Pipelines#

class pyxel.pipelines.DetectionPipeline(scene_generation=None, photon_collection=None, phasing=None, charge_generation=None, charge_collection=None, charge_transfer=None, charge_measurement=None, signal_transfer=None, readout_electronics=None, data_processing=None)[source]#

Bases: object

Represent a pipeline of detection models organized into different groups.

MODEL_GROUPS = ('scene_generation', 'photon_collection', 'phasing', 'charge_generation', 'charge_collection', 'charge_transfer', 'charge_measurement', 'signal_transfer', 'readout_electronics', 'data_processing')#
property scene_generation#

Get group ‘scene generation’.

property photon_collection#

Get group ‘photon collection’.

property phasing#

Get group ‘phasing’.

property charge_generation#

Get group ‘charge generation’.

property charge_collection#

Get group ‘charge collection’.

property charge_transfer#

Get group ‘charge transfer’.

property charge_measurement#

Get group ‘charge measurement’.

property signal_transfer#

Get group ‘signal transfer’.

property readout_electronics#

Get group ‘readout electronics’.

property data_processing#

Get group ‘data processing’.

property model_group_names#

Get all model groups.

get_model(name)[source]#

Return a ModelFunction object for the specified model name.

Parameters:

name (str) – Name of the model.

Returns:

ModelFunction

Raises:

AttributeError – If model with the specified name is not found.

describe()[source]#
class pyxel.pipelines.Processor(detector, pipeline, observation_mode=None)[source]#

Bases: object

Represent a processor that execute pipeline.

It manages the execution of models in the pipeline.

Parameters:
  • detector (Detector) – The detector object associated with the processor.

  • pipeline (DetectionPipeline) – The detection pipeline object defining the sequence of model groups.

has(key)[source]#

Check if a parameter is available in this Processor.

Examples

>>> processor = Processor(...)
>>> processor.has("pipeline.photon_collection.illumination.arguments.level")
True
get(key, default=<pyxel.pipelines.processor._MISSING_TYPE object>)[source]#

Get the current value from a Parameter.

Examples

>>> processor = Processor()
>>> processor.get("pipeline.photon_collection.illumination.arguments.level")
array(0.)
>>> processor.get("pipeline.characteristics.quantum_efficiency")
array(0.1)
set(key, value, convert_value=True)[source]#

Set the value of a parameter in the Processor.

Parameters:
  • key (str)

  • value

  • convert_value (bool)

run_pipeline(debug)[source]#

Run a pipeline with all its models in the right order.

Parameters:

debug (bool)

Notes

The Processor instance with method ‘.run_pipeline’ is modified.

property result#

Return exposure pipeline final result in a dictionary.

result_to_dataset(y, x, times, result_type)[source]#

Return the result in a xarray dataset.

property numbytes#

Recursively calculates object size in bytes using Pympler library.

Returns:

int – Size of the object in bytes.

replace(changes)[source]#
class pyxel.pipelines.ModelGroup(models, name)[source]#

Bases: object

Manage a collection of model functions.

Parameters:
  • models (sequence of ModelFunction) – Sequence of model functions belonging to the group.

  • name (str) – Name of this group.

run(detector, debug)[source]#

Execute each enabled model in this group.

Parameters:
  • detector (Detector)

  • debug (bool)

class pyxel.pipelines.ModelFunction(func, name, arguments=None, enabled=True)[source]#

Bases: object

Create a wrapper function around a Model function.

Parameters:
  • func (str) – Full name of the model to use with this ModelFunction.

  • name (str) – A unique name for this ModelFunction.

  • arguments (dict (optional). Default: None) – Parameters that will be passed to ‘func’.

  • enabled (bool. Default: True) – A flag indicating whether this ModelFunction is enabled or disabled.

Examples

>>> model_func = ModelFunction(
...     func="pyxel.models.photon_collection.illumination",
...     name="illumination",
...     arguments={"level": 1, "option": "foo"},
... )

Access basic parameters

>>> model_func.name
'illumination'
>>> model_func.enabled
True
>>> model_func.arguments
Arguments({'level': 1, 'option': 'foo'})

Access the arguments with a dict interface

>>> list(model_func.arguments)
['level', 'option']
>>> model_func.arguments["level"]
1
>>> model_func.arguments["level"] = 2
TypeError: 'Arguments' object does not support item assignment

Access the arguments with an attribute interface

>>> model_func.arguments.level
1

Execute this ModelFunction >>> from pyxel.detectors import CCD >>> detector = CCD(…) >>> model_func(detector=detector) >>> detector # Modified detector

property name#

Name for this ModelFunction.

property arguments#

TBW.

property func#

TBW.