# chama.sensors module¶

The sensor module contains classes to define point or camera sensors that can either be stationary and mobile.

Contents

 Sensor([position, detector]) Defines a sensor object and methods to calculate detection. Position([location]) Defines a sensor’s position. Stationary([location]) Defines a stationary sensor’s position. Mobile([locations, speed, start_time, repeat]) Defines a mobile sensor’s position. Detector([threshold, sample_times]) Defines a sensor’s detector. Point([threshold, sample_times]) Defines a point sensor. Camera([threshold, sample_times, direction]) Defines a camera sensor.
class chama.sensors.Sensor(position=None, detector=None)[source]

Bases: object

Defines a sensor object and methods to calculate detection.

Parameters
• position (chama Position) – Sensor position

• detector (chama Detector) – Sensor detector, determines the method used to calculate detection

get_detected_signal(signal, interp_method=None, min_distance=10.0)[source]

Returns the detected signal.

class chama.sensors.Position(location=None)[source]

Bases: object

Defines a sensor’s position.

Parameters

location ((x,y,z) tuple or index) – The location of the Position object defined as an (x,y,z) tuple or location index, which can be a string or integer

class chama.sensors.Stationary(location=None)[source]

Defines a stationary sensor’s position.

Defines a sensor’s position.

Parameters

location ((x,y,z) tuple or index) – The location of the Position object defined as an (x,y,z) tuple or location index, which can be a string or integer

class chama.sensors.Mobile(locations=None, speed=1, start_time=0, repeat=False)[source]

Defines a mobile sensor’s position. A mobile position moves according to defined waypoints and speed. The mobile position is assumed to move in a straight line between waypoints and will repeat its path if needed.

Parameters
• locations (list of (x,y,z) tuples) – List of (x,y,z) tuples defining the waypoints of the mobile sensor’s path.

• speed (int or float) – The speed of the mobile sensor in units consistent with the waypoints and sensor sample_times

• repeat (bool) – Boolean indicating if the path should repeat

Defines a sensor’s position.

Parameters

location ((x,y,z) tuple or index) – The location of the Position object defined as an (x,y,z) tuple or location index, which can be a string or integer

class chama.sensors.Detector(threshold=None, sample_times=None)[source]

Bases: object

Defines a sensor’s detector.

Parameters
• threshold (int) – The minimum signal that can be detected by the sensor

• sample_times (list of ints or floats) – List of the sensor’s sample/measurement times

get_sample_points(position)[source]

Returns the sensor sample points in the form (t,x,y,z) or (t,j)

Parameters

position (chama Position) – The position of the sensor

Returns

A list of sample points in the form (t,x,y,z) or (t,j)

get_detected_signal(signal, position, interp_method, min_distance)[source]

Returns the signal detected by the sensor.

Parameters
• signal (pandas DataFrame) – DataFrame with the multi-index (T, X, Y, Z) or (T,J) and columns containing the concentrations for different scenarios

• position (chama Position) – The position of the sensor

• interp_method ('linear', 'nearest', or None) – Method used to interpolate the signal if needed. A value of ‘linear’ will use griddata to interpolate missing sample points. A value of ‘nearest’ will set the sample point to the nearest signal point within a minimum distance of min_distance. If there are no signal points within this distance then the signal will be set to zero at the sample point.

• min_distance (float) – The minimum distance when using the ‘nearest’ interp_method

Returns

• A pandas Series with multi-index (T, Scenario) and signal values above

• the sensor threshold.

class chama.sensors.Point(threshold=None, sample_times=None)[source]

Defines a point sensor.

class chama.sensors.Camera(threshold=None, sample_times=None, direction=1, 1, 1, **kwds)[source]

Defines a camera sensor.

Parameters
• threshold (int) – The minimum number of pixels that must detect something in order for the camera to detect.

• sample_times (list of ints or floats) – List of the sensor’s sample/measurement times

• direction ((x, y, z) tuple) – Tuple representing the direction that the camera is pointing in (x, y, z) coordinates relative to the origin

• **kwds (dictionary) – Keyword arguments for setting parameter values in the camera model