topostats.processing#
Functions for procesing data.
Attributes#
Functions#
|
Process a single image, filtering, finding grains and calculating their statistics. |
|
Check options for running steps (Filter, Grain, Grainstats and DNA tracing) are logically consistent. |
|
Print a completion message summarising images processed. |
Module Contents#
- topostats.processing.LOGGER#
- topostats.processing.process_scan(img_path_px2nm: Dict[str, numpy.ndarray | pathlib.Path | float], base_dir: str | pathlib.Path, filter_config: dict, grains_config: dict, grainstats_config: dict, dnatracing_config: dict, plotting_config: dict, output_dir: str | pathlib.Path = 'output') None #
Process a single image, filtering, finding grains and calculating their statistics.
- Parameters:
img_path_px2nm (Dict[str, Union[np.ndarray, Path, float]]) – A dictionary with keys ‘image’, ‘img_path’ and ‘px_2_nm’ containing a file or frames’ image, it’s path and it’s pixel to namometre scaling value.
base_dir (Union[str, Path]) – Directory to recursively search for files, if not specified the current directory is scanned.
filter_config (dict) – Dictionary of configuration options for running the Filter stage.
grains_config (dict) – Dictionary of configuration options for running the Grain detection stage.
grainstats_config (dict) – Dictionary of configuration options for running the Grain Statistics stage.
dnatracing_config (dict) – Dictionary of configuration options for running the DNA Tracing stage.
plotting_config (dict) – Dictionary of configuration options for plotting figures.
output_dir (Union[str, Path]) – Directory to save output to, it will be created if it does not exist. If it already exists then it is possible that output will be over-written.
- topostats.processing.check_run_steps(filter_run: bool, grains_run: bool, grainstats_run: bool, dnatracing_run: bool) None #
Check options for running steps (Filter, Grain, Grainstats and DNA tracing) are logically consistent.
This checks that earlier steps required are enabled.
- Parameters:
filter_run (bool) – Flag for running Filtering.
grains_run (bool) – Flag for running Grains.
grainstats_run (bool) – Flag for running GrainStats.
dnatracing_run (bool) – Flag for running DNA Tracing.
- Return type:
None
- topostats.processing.completion_message(config: Dict, img_files: List, summary_config: Dict, images_processed: int) None #
Print a completion message summarising images processed.
- Parameters:
config (dict) – Configuration dictionary.
img_files (list()) – List of found image paths.
summary_config (dict() – Configuration for plotting summary statistics.
images_processed (int) – Pandas DataFrame of results.
Results
-------
None