4.1.1.1.1.6. lib.data_handling.data_postprocessing
#
Module that provides functionality in order to postprocess data.
@author: Thomas Arne Hensel, 2023
4.1.1.1.1.6.1. Module Contents#
4.1.1.1.1.6.1.1. Classes#
Class to post-process data. |
|
Class to post-process data. |
|
4.1.1.1.1.6.1.2. Functions#
Post process fitting results from an experiment. |
|
Process a group by calculating the normalized distance ‘d_norm’. |
4.1.1.1.1.6.1.3. API#
- lib.data_handling.data_postprocessing.postprocess_single_file(full_file_path)#
Post process fitting results from an experiment.
- Parameters:
full_file_path (str) – Full path to the fitting results file.
- Returns:
Dictionary containing processed results.
- Return type:
dict
- lib.data_handling.data_postprocessing.process_group(group)#
Process a group by calculating the normalized distance ‘d_norm’.
- Parameters:
group (pandas.DataFrame) – Pandas DataFrame group.
- Returns:
Processed group.
- Return type:
pandas.DataFrame
- class lib.data_handling.data_postprocessing.PostProcessorFacade(collect_artefacts=True)#
Class to post-process data.
Operates only on results of a study, no reference to the experiment object.
Initialization
Initialize the PostProcessorFacade.
- Parameters:
collect_artefacts (bool) – Whether to collect artefacts during postprocessing.
- postprocess_data(input_dir, output_dir, max_files=10**4)#
Multi-threaded postprocessing of the data.
- Parameters:
input_dir (str) – Root directory of the input data.
output_dir (str) – Root directory of the output data.
max_files (int) – Maximum number of files to process.
- _convert_results_to_df(result_dict)#
Convert post-processed results dictionary to a DataFrame.
- Parameters:
result_dict (dict) – Post-processed results dictionary.
- Returns:
DataFrame containing post-processed results.
- Return type:
pandas.DataFrame
- class lib.data_handling.data_postprocessing.PostProcessor#
Class to post-process data.
Operates only on results of a study, no reference to the experiment object.
Initialization
- process_results(dir, result_dict)#
Method to post-process results from a study. 1. Cluster positions and retrieve means. 2. Compare result to ground truth if available. 3. Calculate CRB either for true or for estimated position.
- Parameters:
dir (str) – Directory of results file. Look here for source to calculate CRB.
result_dict (dict) – Dictionary containing results from the study.
- Returns:
Processed results and success status.
- Return type:
tuple(dict, bool)
- get_even_clusters(pos, anchor=None)#
Method for K-means clustering with even cluster-size.
- Parameters:
pos – Positions in shape (K, M, dim) for N estimates of M molecules in dim dimensions.
[ [[x1, y1, …], [x2, y2, …], …, [xM, yM, …]], [], …, [n-th estimate] ] :type pos: numpy.ndarray :param anchor: Anchor point for clustering (default is None). :type anchor: numpy.ndarray, optional :return: Ordered positions in shape (M, K, dim). :rtype: numpy.ndarray