def gen_filename(experiment_number, file_number):
    """
    generates NICOS data file names for TAS .dat and MIEZE .tof files
    --------------------------------------------------
    
    Arguments:
    ----------
    experiment_number   : int   : usually a 5 digit number of an neutron scattering experiment (same as proposal)
                                  if 0 is given, the file is deterimend to be a .tof file by CASCADE
    file_number         : int   : up to 8 digit number describing a certain file of an experiment
    
    Return:
    ----------
    fname               : str   : filename constructed from input
    """
    
    if experiment_number != 0:
        return '{:05d}_{:08d}.dat'.format(experiment_number, file_number)
    else:
        return '{:08d}.tof'.format(experiment_number, file_number)