axon_synthesis.synthesis.main_trunk.post_process

Post-process the Steiner solutions.

Functions

check_next_target(intermediate_pts, ...)

Check if a next target can be selected and return it.

closest_seg_pt(pt, seg)

Compute the closest point on a line from a given point.

compute_direction(start_pt, end_pt)

Compute the direction and distance between 2 points.

compute_step_direction(intermediate_pts, ...)

Compute the direction for one step.

export(morph, initial_morph, output_path, ...)

Export morphology and figure.

gather_sections(root_section, tuft_barcodes)

Gather the sections with unifurcations.

get_random_vector([distance, norm, std, ...])

Return 3-d coordinates of a new random point.

history(latest_lengths, latest_directions, ...)

Returns a combination of the segments history.

plot(morph, initial_morph, figure_path)

Plot the morphology after post-processing.

post_process_trunk(morph, trunk_section_id, ...)

Post-process a trunk of the given morphology.

random_walk(starting_pt, intermediate_pts, ...)

Perform a random walk guided by intermediate points.

resample_diameters(pts, resampled_pts, diams)

Resample the diameters on the new points.

weights(lengths, history_path_length)

Compute the weights depending on the lengths.

Classes

PostProcessConfig([skip, ...])

Class to store the parameters needed for long-range trunk post-processing.

class axon_synthesis.synthesis.main_trunk.post_process.PostProcessConfig(skip: bool = False, history_path_length: float | None = None, default_history_path_length_coeff: float = 5, global_target_coeff: float = 0, global_target_sigma_coeff: float = 10, target_coeff: float = 2, target_sigma_coeff: float = 2, random_coeff: float = 2, history_coeff: float = 2, history_sigma_coeff: float = 2, length_coeff: float = 1, max_random_direction_picks: int = 10)

Bases: object

Class to store the parameters needed for long-range trunk post-processing.

skip

Skip the post-processing step if set to True.

Type:

bool

history_path_length

The length used to compute the random walk history.

Type:

float | None

default_history_path_length_coeff

The coefficient used to compute the history path length when it is not provided.

Type:

float

global_target_coeff

The coefficient applied to the global target term.

Type:

float

global_target_sigma_coeff

The sigma coefficient applied to the global target term.

Type:

float

target_coeff

The coefficient applied to the next target term.

Type:

float

target_sigma_coeff

The sigma coefficient applied to the next target term.

Type:

float

random_coeff

The coefficient applied to the random term.

Type:

float

history_coeff

The coefficient applied to the history term.

Type:

float

history_sigma_coeff

The sigma coefficient applied to the history term.

Type:

float

length_coeff

The coefficient applied to step length.

Type:

float

max_random_direction_picks

The maximum number of random direction picks (random directions are picked again when they are not facing the target)

Type:

int

axon_synthesis.synthesis.main_trunk.post_process.check_next_target(intermediate_pts, nb_intermediate_pts, target_index, target, target_dist, next_target_index, next_target, min_target_dist, length_norm, default_min_target_dist, logger)

Check if a next target can be selected and return it.

axon_synthesis.synthesis.main_trunk.post_process.closest_seg_pt(pt, seg)

Compute the closest point on a line from a given point.

axon_synthesis.synthesis.main_trunk.post_process.compute_direction(start_pt, end_pt)

Compute the direction and distance between 2 points.

axon_synthesis.synthesis.main_trunk.post_process.compute_step_direction(intermediate_pts, current_pt, target, target_index, next_target, next_target_index, step_length, total_length, config, history_direction, latest_directions, rng=<module 'numpy.random' from '/home/docs/checkouts/readthedocs.org/user_builds/axon-synthesis/conda/stable/lib/python3.12/site-packages/numpy/random/__init__.py'>, logger=None)

Compute the direction for one step.

axon_synthesis.synthesis.main_trunk.post_process.export(morph, initial_morph, output_path, figure_path, logger)

Export morphology and figure.

axon_synthesis.synthesis.main_trunk.post_process.gather_sections(root_section, tuft_barcodes)

Gather the sections with unifurcations.

axon_synthesis.synthesis.main_trunk.post_process.get_random_vector(distance: float = 1.0, norm: float | None = None, std: float | None = None, initial_theta: float | None = None, initial_phi: float | None = None, rng=<module 'numpy.random' from '/home/docs/checkouts/readthedocs.org/user_builds/axon-synthesis/conda/stable/lib/python3.12/site-packages/numpy/random/__init__.py'>) ndarray[Any, dtype[floating]]

Return 3-d coordinates of a new random point.

The distance between the produced point and (0,0,0) is given by the ‘distance’ argument.

axon_synthesis.synthesis.main_trunk.post_process.history(latest_lengths, latest_directions, history_path_length)

Returns a combination of the segments history.

axon_synthesis.synthesis.main_trunk.post_process.plot(morph, initial_morph, figure_path)

Plot the morphology after post-processing.

axon_synthesis.synthesis.main_trunk.post_process.post_process_trunk(morph: Morphology, trunk_section_id: int, trunk_properties: DataFrame, tuft_barcodes: DataFrame, config: PostProcessConfig, *, rng: None | int | Sequence[int] | SeedSequence | BitGenerator | Generator = None, output_path: str | PathLike | None = None, figure_path: str | PathLike | None = None, logger: Logger | LoggerAdapter | None = None)

Post-process a trunk of the given morphology.

axon_synthesis.synthesis.main_trunk.post_process.random_walk(starting_pt: ~collections.abc.Sequence[float] | ~numpy.ndarray[~typing.Any, ~numpy.dtype[~numpy.floating]], intermediate_pts: ~collections.abc.Sequence[~collections.abc.Sequence[float]] | ~numpy.ndarray[~typing.Any, ~numpy.dtype[~numpy.floating]], length_stats: dict[str, float], config: ~axon_synthesis.synthesis.main_trunk.post_process.PostProcessConfig, previous_history: tuple[list[float], list[list[float] | ~numpy.ndarray[~typing.Any, ~numpy.dtype[~numpy.floating]]]] | None = None, *, rng=<module 'numpy.random' from '/home/docs/checkouts/readthedocs.org/user_builds/axon-synthesis/conda/stable/lib/python3.12/site-packages/numpy/random/__init__.py'>, logger: ~logging.Logger | ~logging.LoggerAdapter | None = None) tuple[ndarray[Any, dtype[floating]], tuple[list[float], list[list[float] | ndarray[Any, dtype[floating]]]]]

Perform a random walk guided by intermediate points.

axon_synthesis.synthesis.main_trunk.post_process.resample_diameters(pts, resampled_pts, diams)

Resample the diameters on the new points.

axon_synthesis.synthesis.main_trunk.post_process.weights(lengths, history_path_length)

Compute the weights depending on the lengths.