crm_divide

This script is specifically designed for only one particular example contained in data/crm_divide/0001/. Therefore it will not work with any other dataset provided. It is used to estimate the parameters of our model and provide profiles for them. More specifically, it estimates the parameters under division of agents.

Usage of the crm_amir script
usage: crm_divide [-h] [-i ITERATION] [--output-dir OUTPUT_DIR] [--skip-profiles]
                [--skip-time-evolution] [--skip-snapshots] [--skip-timings]
                [--skip-mask-adjustment] [--only-mask-adjustment]
                [--skip-distribution] [-w WORKERS]
                [--profiles-maxiter PROFILES_MAXITER]
                [--profiles-samples PROFILES_SAMPLES]
                [--profiles-optim-method PROFILES_OPTIM_METHOD]
                [--profiles-lhs-sample-size PROFILES_LHS_SAMPLE_SIZE]
                [--profiles-lhs-maxiter PROFILES_LHS_MAXITER] [--data-dir DATA_DIR]
                {DE,LHS} ...

Fits the Bacterial Rods model to a system of cells.

positional arguments:
{DE,LHS}
    DE                  Use the differential_evolution algorithm for optimization
    LHS                 Use the Latin-Hypercube Sampling with some local minimization
                        for optimization

options:
-h, --help            show this help message and exit
-i, --iteration ITERATION
                        Use existing output folder instead of creating new one
--output-dir OUTPUT_DIR
                        Directory where to store results
--skip-profiles       Skip plotting of profiles
--skip-time-evolution
                        Skip plotting of the time evolution of costs
--skip-snapshots      Skip plotting of snapshots and masks
--skip-timings        Skip plotting of the timings
--skip-mask-adjustment
                        Skip plotting of the adjusted masks
--only-mask-adjustment
                        Only plot adjusted masks
--skip-distribution   Skip plotting of the distribution of growth rates
-w, --workers WORKERS
                        Number of threads to utilize
--profiles-maxiter PROFILES_MAXITER
--profiles-samples PROFILES_SAMPLES
--profiles-optim-method PROFILES_OPTIM_METHOD
--profiles-lhs-sample-size PROFILES_LHS_SAMPLE_SIZE
--profiles-lhs-maxiter PROFILES_LHS_MAXITER
--data-dir DATA_DIR
default_parameters() tuple[list[float], list[tuple[float, float]]]
Returns:

Initial values and corresponding bounds for optimization

Return type:

tuple[list[float], list[tuple[float, float]]]

plot_growth_rate_distribution(final_parameters, output_dir)

Plots the distribution of growth_rates obtained from the optimization routine

plot_mask_adjustment(output_dir, masks_data, positions_all, settings, iterations_data)

This function is mainly used for debugging. It plots snapshots of how a given image is adjusted such that segmentation masks from data and numerically generated results can be compared directly. To do this, the tree of the numerical simulation needs to be matched to the tree of the data.

plot_profiles(parameters: ndarray, bounds, labels: list, final_costs: tuple[float, float, float], args, output_dir, pyargs)

Calculates or loads profiles and plots them split by different cost contributions.

plot_snapshots(iterations_data, masks_predicted, masks_adjusted, output_dir, color_to_cell, parent_map)

Plots snapshots and differences of the optimized system to the provided data

plot_time_evolution(masks_predicted, new_masks, color_to_cell, parent_map, iterations_simulation, iterations_data, settings, output_dir)
plot_timings(parameters, positions_all, settings, masks_data, iterations_data, output_dir, n_samples: int = 3)

Calculates and plots timings of individual steps utilized within the cost function

preprocessing(data_dir, n_masks=None)

Performs preprocessing steps such as extract positions, load configuration files and sets parameters accordingly.

run_optimizer(params, bounds, output_dir, iteration, args, pyargs)

Wrapper method to call :function:`.minimize_lhs` or :function:`.minimize_de`.

calculate_profiles(parameters, bounds, n_samples, args, pyargs)

Calculates profiles for every optimized parameter given the specified optimization bounds.

minimize_de(params, bounds, args, callback, pyargs)

Uses the differential_evolution algorithm to perform parameter estimation.

minimize_lhs(params, bounds, args, callback, pyargs)

Performs parameter optimization with a Latin-Hypercube sampling