def get_data_file_names_from_scan_base(scan_base, filter_str=['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'], sort_by_time=True, meta_data_v2=True):
data_files = []<EOL>if scan_base is None:<EOL><INDENT>return data_files<EOL><DEDENT>if isinstance(scan_base, str):<EOL><INDENT>scan_base = [scan_base]<EOL><DEDENT>for scan_base_str in scan_base:<EOL><INDENT>if '<STR_LIT>' == os.path.splitext(scan_base_str)[<NUM_LIT:1>]:<EOL><INDENT>data_files.append(scan_base_str)<EOL><DEDENT>else:<EOL><INDENT>data_files.extend(glob.glob(scan_base_str + '<STR_LIT>'))<EOL><DEDENT><DEDENT>if filter_str:<EOL><INDENT>if isinstance(filter_str, str):<EOL><INDENT>filter_str = [filter_str]<EOL><DEDENT>data_files = [data_file for data_file in data_files if not any([(True if x in data_file else False) for x in filter_str])]<EOL><DEDENT>if sort_by_time and len(data_files) > <NUM_LIT:1>:<EOL><INDENT>f_list = {}<EOL>for data_file in data_files:<EOL><INDENT>with tb.open_file(data_file, mode="<STR_LIT:r>") as h5_file:<EOL><INDENT>try:<EOL><INDENT>meta_data = h5_file.root.meta_data<EOL><DEDENT>except tb.NoSuchNodeError:<EOL><INDENT>logging.warning("<STR_LIT>" % h5_file.filename)<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>if meta_data_v2:<EOL><INDENT>timestamp = meta_data[<NUM_LIT:0>]["<STR_LIT>"]<EOL><DEDENT>else:<EOL><INDENT>timestamp = meta_data[<NUM_LIT:0>]["<STR_LIT>"]<EOL><DEDENT><DEDENT>except IndexError:<EOL><INDENT>logging.info("<STR_LIT>" % h5_file.filename)<EOL><DEDENT>else:<EOL><INDENT>f_list[data_file] = timestamp<EOL><DEDENT><DEDENT><DEDENT><DEDENT>data_files = list(sorted(f_list, key=f_list.__getitem__, reverse=False))<EOL><DEDENT>return data_files<EOL>
Generate a list of .h5 files which have a similar file name.

Parameters
----------
scan_base : list, string
    List of string or string of the scan base names. The scan_base will be used to search for files containing the string. The .h5 file extension will be added automatically.
filter : list, string
    List of string or string which are used to filter the returned filenames. File names containing filter_str in the file name will not be returned. Use None to disable filter.
sort_by_time : bool
    If True, return file name list sorted from oldest to newest. The time from meta table will be used to sort the files.
meta_data_v2 : bool
    True for new (v2) meta data format, False for the old (v1) format.

Returns
-------
data_files : list
    List of file names matching the obove conditions.