locan.analysis.pipeline.Pipeline#

class locan.analysis.pipeline.Pipeline(computation, meta=None, **kwargs)[source]#

Bases: _Analysis

The base class for a specialized analysis pipeline to be used on LocData objects.

The custom analysis routine has to be added by implementing the method computation(self, **kwargs). Keyword arguments must include the locdata reference and optional parameters.

Results are provided as customized attributes. We suggest abbreviated standard names for the most common procedures such as:

  • lp - Localization Precision

  • lprop - Localization Property

  • lpf - Localizations per Frame

  • rhf - Ripley H function

  • clust - locdata with clustered elements

Parameters:
  • computation (Callable[..., Any]) – A function computation(self, **kwargs) specifying the analysis procedure.

  • meta (locan.analysis.metadata_analysis_pb2.AMetadata) – Metadata about the current analysis routine.

  • kwargs (Any) – Locdata reference and optional parameters passed to computation(self, **kwargs).

Variables:
  • count (int) – A counter for counting instantiations (class attribute).

  • parameter (dict) – A dictionary with all settings for the current computation.

  • meta (locan.analysis.metadata_analysis_pb2.AMetadata | None) – Metadata about the current analysis routine.

  • computation (Callable[..., Any]) – A function computation(self, **kwargs) specifying the analysis procedure.

  • kwargs – All parameters including the locdata reference that are passed to computation(self, **kwargs).

Note

The class variable Pipeline.count is only incremented in a single process. In multiprocessing Pipeline.count and Pipeline.meta.identifier (which is set using count) cannot be used to identify distinct Pipeline objects.

Note

For the Pipeline object to be pickleable attention has to be paid to the computation() method. With multiprocessing it will have to be re-injected for each Pipeline object by pipeline.computation = computation after computation and before pickling.

Methods

__init__(computation[, meta])

computation_as_string()

Return the analysis procedure (i.e. the computation() method) as string.

compute()

Run the analysis procedure.

report(*args, **kwargs)

Show a report about analysis results.

save_computation(path)

Save the analysis procedure (i.e. the computation() method) as human readable text.

Attributes

count

A counter for counting Analysis class instantiations (class attribute).

computation_as_string()[source]#

Return the analysis procedure (i.e. the computation() method) as string.

Return type:

str

compute()[source]#

Run the analysis procedure. All parameters must be given upon Pipeline instantiation.

Return type:

Any

save_computation(path)[source]#

Save the analysis procedure (i.e. the computation() method) as human readable text.

Parameters:

path (str | os.PathLike[Any]) – Path and file name for saving the text file.

Return type:

None