pogona.SensorCounting

class pogona.SensorCounting[source]

Bases: pogona.sensor.Sensor

Attributes

component_name

Unique name of this component, unless it is "Generic component".

log_folder

The file sensor[<component name>].csv will be created in here.

rotation

scale

shape

Shape of this sensor.

transformation

translation

__init__()[source]

Methods

__init__()

finalize(simulation_kernel)

initialize(simulation_kernel, init_stage)

Use InitStages to initialize this Component instance.

is_inside_sensor_zone(position_global)

process_molecule_moving_after(...)

Override this method for your sensing algorithm.

process_molecule_moving_before(...)

Called before updating the position of a particle within a time step.

process_new_time_step(simulation_kernel, ...)

set_arguments(**kwargs)

Read arguments as key value pairs and set this component's member variables accordingly.

__init__()[source]
finalize(simulation_kernel: pogona.simulation_kernel.SimulationKernel)[source]
initialize(simulation_kernel: pogona.simulation_kernel.SimulationKernel, init_stage: pogona.component.InitStages)[source]

Use InitStages to initialize this Component instance.

is_inside_sensor_zone(position_global: numpy.ndarray)
process_molecule_moving_after(simulation_kernel: pogona.simulation_kernel.SimulationKernel, molecule: pogona.molecule.Molecule)[source]

Override this method for your sensing algorithm. The sensor manager will use this method to notify you of all molecule movement inside of the sensor zone. However, it may also notify you of molecule movement outside of your sensor zone! So make sure you additionally check the molecule position yourself. See SensorCounting for a simple reference implementation.

Parameters
  • simulation_kernel – The single simulation kernel

  • molecule – Which molecule has moved, with the new position

process_molecule_moving_before(simulation_kernel: pogona.simulation_kernel.SimulationKernel, molecule: pogona.molecule.Molecule)

Called before updating the position of a particle within a time step. Useful for SensorTeleporting, for example, which should consider the position of particles right after they have been spawned.

Parameters
  • simulation_kernel

  • molecule

Returns

process_new_time_step(simulation_kernel: pogona.simulation_kernel.SimulationKernel, notification_stage: pogona.component.NotificationStages)[source]
set_arguments(**kwargs)

Read arguments as key value pairs and set this component’s member variables accordingly. Validity of the argument values will be checked in initialize().

component_name = 'Generic component'

Unique name of this component, unless it is “Generic component”.

id

Unique integer component ID

log_folder = 'sensor_data'

The file sensor[<component name>].csv will be created in here.

rotation = [0, 0, 0]
scale = [1, 1, 1]
sensor_id: int

Unique integer sensor ID. Set by the sensor manager.

shape = 'NONE'

Shape of this sensor. Valid shapes are defined in the pogona.Shapes enum.

property transformation: pogona.transformation.Transformation
translation = [0, 0, 0]