def get_parameter_from_files(files, parameters=None, unique=False, sort=True):
logging.debug('<STR_LIT>' + str(parameters) + '<STR_LIT>' + str(len(files)) + '<STR_LIT>')<EOL>files_dict = collections.OrderedDict()<EOL>if isinstance(files, str):<EOL><INDENT>files = (files, )<EOL><DEDENT>if isinstance(parameters, str):<EOL><INDENT>parameters = (parameters, )<EOL><DEDENT>parameter_values_from_file_names_dict = get_parameter_value_from_file_names(files, parameters, unique=unique, sort=sort)  <EOL>for file_name in files:<EOL><INDENT>with tb.open_file(file_name, mode="<STR_LIT:r>") as in_file_h5:  <EOL><INDENT>scan_parameter_values = collections.OrderedDict()<EOL>try:<EOL><INDENT>scan_parameters = in_file_h5.root.scan_parameters[:]  <EOL>if parameters is None:<EOL><INDENT>parameters = get_scan_parameter_names(scan_parameters)<EOL><DEDENT>for parameter in parameters:<EOL><INDENT>try:<EOL><INDENT>scan_parameter_values[parameter] = np.unique(scan_parameters[parameter]).tolist()  <EOL><DEDENT>except ValueError:  <EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>except tb.NoSuchNodeError:  <EOL><INDENT>try:<EOL><INDENT>scan_parameters = get_scan_parameter(in_file_h5.root.meta_data[:])  <EOL>if scan_parameters:<EOL><INDENT>try:<EOL><INDENT>scan_parameter_values = np.unique(scan_parameters[parameters]).tolist()  <EOL><DEDENT>except ValueError:  <EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>except tb.NoSuchNodeError:  <EOL><INDENT>pass<EOL><DEDENT><DEDENT>if not scan_parameter_values:  <EOL><INDENT>try:<EOL><INDENT>scan_parameter_values = parameter_values_from_file_names_dict[file_name]<EOL><DEDENT>except KeyError:  <EOL><INDENT>scan_parameter_values = None<EOL><DEDENT><DEDENT>else:  <EOL><INDENT>try:<EOL><INDENT>for key, value in list(scan_parameter_values.items()):<EOL><INDENT>if value and value[<NUM_LIT:0>] != parameter_values_from_file_names_dict[file_name][key][<NUM_LIT:0>]:  <EOL><INDENT>logging.warning('<STR_LIT>' + str(key) + '<STR_LIT>' + str(value) + '<STR_LIT>', file_name)<EOL><DEDENT><DEDENT><DEDENT>except KeyError:  <EOL><INDENT>pass<EOL><DEDENT>except IndexError:<EOL><INDENT>raise IncompleteInputError('<STR_LIT>')<EOL><DEDENT><DEDENT>if unique and scan_parameter_values is not None:<EOL><INDENT>existing = False<EOL>for parameter in scan_parameter_values:  <EOL><INDENT>all_par_values = [values[parameter] for values in list(files_dict.values())]<EOL>if any(x in [scan_parameter_values[parameter]] for x in all_par_values):<EOL><INDENT>existing = True<EOL>break<EOL><DEDENT><DEDENT>if not existing:<EOL><INDENT>files_dict[file_name] = scan_parameter_values<EOL><DEDENT>else:<EOL><INDENT>logging.warning('<STR_LIT>', file_name)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>files_dict[file_name] = scan_parameter_values<EOL><DEDENT><DEDENT><DEDENT>return collections.OrderedDict(sorted(iter(files_dict.items()), key=itemgetter(<NUM_LIT:1>)) if sort else files_dict)<EOL>
Takes a list of files, searches for the parameter name in the file name and in the file.
    Returns a ordered dict with the file name in the first dimension and the corresponding parameter values in the second.
    If a scan parameter appears in the file name and in the file the first parameter setting has to be in the file name, otherwise a warning is shown.
    The file names can be sorted by the first parameter value of each file.

    Parameters
    ----------
    files : string, list of strings
    parameters : string, list of strings
    unique : boolean
        If set only one file per scan parameter value is used.
    sort : boolean

    Returns
    -------
    collections.OrderedDict