atomcloud.process_fits.format module
- class atomcloud.process_fits.format.FitDictRowFormat[source]
Bases:
IterateFitDictFormat a fit dictionary into a single row dictionary for any type of fit dictionary.
see IterateFitDict for more details and documentation.
- process_fitdict1d(fit_dict, *args, **kwargs)[source]
Process a single 1d fit dictionary. It’s important to deepcopy the dictionary before processing it to avoid changing the original dictionary.
- Parameters:
fit_dict (dict) –
- Return type:
dict
- process_fitdict2d(fit_dict, *args, **kwargs)[source]
Process a single 2d fit dictionary. It’s important to deepcopy the dictionary before processing it to avoid changing the original dictionary.
- Parameters:
fit_dict (dict) –
- Return type:
dict
- row_fitdict(fit_dicts, dict_type=None, total_flatten=False, *args, **kwargs)[source]
Format a fit dictionary into a single row dictionary for any type of fit dictionary. Only the fit dict needs to be passed in if the fit dict type is not given, the type will be inferred from the fit dict.
Lastly, if it’s a mixedl level fit dictionary, the total_flatten argument can be used to flatten the fit dictionary into a single row dictionary where the levels are appended to the keys. Otherwise, the fit dictionary will be returned as a dictionary of flatted dictionaries. One flattened dictionary for each level (e.g. multi-function fit).
- Parameters:
fit_dicts (dict) – fit dictionary to be flattened
dict_type (str | None) – type of fit dictionary. If not given, the type will be inferred from the fit dict.
total_flatten (bool) – if True, the a multi-level fit dictionary will be
dictionary. (completely flattened into a single row) –
- Returns:
flattened dictionary or dictionary of flattened dictionaries depending on the fit dictionary type and the total_flatten argument.
- Return type:
dict
- sum_fit(fit_dict, *args, **kwargs)[source]
Process a single sum fit dictionary. The sum fit dictionary is composed of sub-dictionaries of 1d fits to the summed data on the x and y axes (along with a dictionary of 2d fits calculated from the 1d fits). These are already deepcopied in their respective processing functions.
- Parameters:
fit_dict (dict) –
- Return type:
dict
- atomcloud.process_fits.format.flatten_dicts(fit_dicts)[source]
Flatten a dictionary of dictionaries into a single dictionary with each key being the key of the original dictionary plus the key of the nested dictionary.
- Parameters:
fit_dicts (dict) – dictionary of dictionaries
- Returns:
flattened dictionary
- Return type:
dict
- atomcloud.process_fits.format.format_1d_fit(fit_dict)[source]
Takes a single 1d fit dictionary and returns a dictionary where each value is a single value in the dictionary.
- Parameters:
fit_dict (dict) – fit dictionary of a single 1d multi-function fit
- Returns:
dictionary with single values for each key
- Return type:
dict
- atomcloud.process_fits.format.format_2d_fit(fit_dict)[source]
Takes a single 2d fit dictionary and returns a dictionary where each value is a single value in the dictionary.
- Parameters:
fit_dict (dict) – fit dictionary of a single 2d multi-function fit
- Returns:
dictionary with single values for each key
- Return type:
dict
- atomcloud.process_fits.format.format_sumfit(fit_dict)[source]
Takes a single sum fit dictionary which is composed of sub-dictionaries of 1d fits to the summed data on the x and y axes (along with a dictionary of 2d fits calculated from the 1d fits) and returns a dictionary where these sub-dictionaries are themselves flattened into a single dictionary and then these flattened dictionaries added together into a single dictionary.
- Parameters:
fit_dict (dict) – fit dictionary of a single sum fit
- Returns:
flatted dictionary with single values for each key
- Return type:
dict
- atomcloud.process_fits.format.make_equation_dict(fit_dict, func_registry)[source]
Takes a single multi-function fit dictionary which has lists of fit parameters, analysis parameters, fit metrics and data sums and returns a dictionary where each value is a single value in the dictionary. Those values unique to the individual functions of the multi-function fit have the equaiton name appended to the key.
- Parameters:
fit_dict (dict) – fit dictionary of a single multi-function fit
func_registry (object) – 1d or 2d function registry objects corresponding to the either 1d or 2d fit performed.
- Returns:
dictionary with single values for each key
- Return type:
dict
- atomcloud.process_fits.format.row_fitdict(fit_dicts, dict_type=None, total_flatten=False, *args, **kwargs)[source]
Initialize the FitDictRowFormat class and call the row_fitdict method. This allows any fit dict to be analyzed without having to initialize the class.
- Parameters:
fit_dicts (dict) –
dict_type (str | None) –
total_flatten (bool) –
- Return type:
dict
- atomcloud.process_fits.format.unique_equation_names(equations)[source]
Get the names of the equations in a list of equations. If two equations are the same, append a number to the names. :param equations: list of equations
- Returns:
list of unique equation names
- Parameters:
equations (list[str]) –
- Return type:
list[str]