playNano.cli package¶
Submodules¶
playNano.cli.actions module¶
playNano.cli.entrypoint module¶
playNano.cli.handlers module¶
playNano.cli.utils module¶
Utility functions for the playNano CLI.
- playNano.cli.utils.ask_for_analysis_params(module_name: str) dict[str, Any] [source]¶
Introspect module_name.run signature and interactively ask for param values.
Returns kwargs dict.
- playNano.cli.utils.ask_for_processing_params(step_name: str) dict[str, Any] [source]¶
Introspect a processing callable’s parameters and ask interactively.
Skips the first positional arguments (data, mask).
- playNano.cli.utils.get_processing_step_type(step_name: str) str [source]¶
Return the type of a processing step.
- playNano.cli.utils.is_valid_analysis_step(name: str) bool [source]¶
Return True if name is a built-in analysis, plugin or the ‘clear’ step.
- playNano.cli.utils.is_valid_step(name: str) bool [source]¶
Return True if name is a built-in filter, mask, plugin or the ‘clear’ step.
- playNano.cli.utils.parse_analysis_file(path: str) list[tuple[str, dict[str, object]]] [source]¶
Parse a YAML or JSON analysis file into a list of (name, parameters) tuples.
This reads a saved analysis pipeline definition, validates its structure, and normalizes any complex types (e.g., tuples) into YAML/JSON-safe forms.
- Parameters:
path (str) – Path to the YAML or JSON file containing the analysis definition.
- Returns:
A list where each element is
(analysis_step_name, kwargs_dict)
. Thekwargs_dict
contains parameters for that analysis step.- Return type:
list of tuple
- Raises:
FileNotFoundError – If the file does not exist.
ValueError – If the file cannot be parsed as YAML or JSON, or if the top-level key
analysis
is missing.
Examples
Example YAML format:
analysis: - name: count_nonzero - name: feature_detection mask_fn: mask_threshold min_size: 10 remove_edge: true - name: particle_tracking coord_columns: [centroid_x, centroid_y] coord_key: features_per_frame detection_module: feature_detection max_distance: 5.0
This would be parsed as:
[ ("count_nonzero", {}), ("feature_detection", { "mask_fn": "mask_threshold", "min_size": 10, "remove_edge": True }), ("particle_tracking", { "coord_columns": ["centroid_x", "centroid_y"], "coord_key": "features_per_frame", "detection_module": "feature_detection", "max_distance": 5.0 }) ]
- playNano.cli.utils.parse_analysis_string(analysis_str: str) list[tuple[str, dict[str, object]]] [source]¶
Parse ; delimited analysis strings into a list (analysis_step_name, kwargs) tuples.
- Each segment in analysis_str is of the form:
analysis_module_name analysis_module_name:param=value analysis_module_name:param1=value1,param2=value2
Example
“log_blob_detection:min_sigma=1.0,max_sigma=5.0;x_means_clustering:time_weight=0.2”
- Returns a list in the order encountered, e.g.:
- [(“log_blob_detection”, {“min_sigma”:1.0,”max_sigma”:5.0}),
(“x_means_clustering”, {“time_weight”: 0.2})]
- playNano.cli.utils.parse_processing_file(path: str) list[tuple[str, dict[str, object]]] [source]¶
Parse a YAML (or JSON) processing file into a list of (step_name, kwargs) tuples.
- Expected YAML schema:
- filters:
name: remove_plane
name: gaussian_filter sigma: 2.0
name: threshold_mask threshold: 2
name: polynomial_flatten order: 2
Returns a list in the order listed under filters.
- playNano.cli.utils.parse_processing_string(processing_str: str) list[tuple[str, dict[str, object]]] [source]¶
Parse a semicolon-delimited string of processing steps into a structured list.
The list consists of (step_name, parameters) tuples. Each step in the string can optionally include parameters, separated by commas. Parameters are specified as key=value pairs.
- Format examples:
“remove_plane”
“gaussian_filter:sigma=2.0”
“threshold_mask:threshold=2,mode=soft”
- Full example:
“remove_plane; gaussian_filter:sigma=2.0; threshold_mask:threshold=2”
- Returns:
step_name (str): the name of the processing step
kwargs (dict[str, object]): a dictionary of parameters for the step
- Return type:
A list of tuples, each containing
- Example output:
- [
(“remove_plane”, {}), (“gaussian_filter”, {“sigma”: 2.0, “truncate”: 4.0}), (“threshold_mask”, {“threshold”: 2})
]
Module contents¶
Public package initialization.