Sensors
To convert the photon intensity to a signal, sensors are required.
Sensor
Purpose
This class is a template for all sensors. It is not meant to be used directly, as it is an abstract class.
Properties
- num_bins
(
double) The number of energy bins the sensor has.
- bin_width
(
double) The width of each energy bin in the sensor.
- nrj_range
(
1x2 double) The range of energies the sensor can detect.
- nrj_bins
(
1xN double) A 1xnum_bins array of the energy bins the sensor has.
- num_samples
(
double) The number of energy samples to take in each energy bin of the sensor.
Functions
- sensor(nrj_range, num_bins, num_samples=1)
This function returns a sensor object. The parameters are as follows:
- Parameters:
nrj_range (
2x1 double) – An array representing the range of energies the sensor can detect.num_bins (
double) – The number of energy bins the sensor has.num_samples (
double) – The number of energy samples to take in each energy bin of the sensor. (default = 1)
- Returns:
sensor – An instance of the sensor class.
- Return type:
sensor
Abstract Methods
- detector_response(obj, nrj_bin, count_array)
This method is meant to be overridden by the child class. It should take in an index referring to the energy bin and an array of photon counts in that energy bin. It should then return the signal from the sensor in response to the counts in the energy bin.
- Parameters:
nrj_bin (
double) – A single value representing the index of the energy bin.count_array (
MxNxP double) – An array of dimensions [ny_pix, nz_pix, nrotation] representing the number of photons in each pixel and rotation in the energy bin.
- Returns:
signal – should be of the same shape as
count_array, and should represent the signal from the sensor in response to the counts in the energy bin.- Return type:
MxNxP double
Methods
- get_range(obj)
This method returns an array representing the range of energies the sensor can detect. This may be converted to an attribute in the future.
- Returns:
range – an array representing the range of energies the sensor can detect.
- Return type:
Nx2 double
- get_nrj_bin(obj, nrj)
This method takes in an energy and returns the index of the energy bin that the energy falls into.
- Parameters:
nrj (
double) – A single value representing the energy.- Returns:
ebin – is a single value representing the index of the energy bin that the energy falls into.
- Return type:
double
- get_signal(obj, photon_counts)
This method takes in an array of dimensions [nrj_bins, ny_pix, nz_pix, nrotation] representing the number of photons in each pixel and rotation in each nrj bin, and returns the signal from the sensor using the
detector_response()method.- Parameters:
photon_counts (
MxNxPxQ double) – An array of dimensions [nrj_bins, ny_pix, nz_pix, nrotation] representing the number of photons in each pixel and rotation in each energy bin.- Returns:
signal – the signal from the sensor in response to the photon counts. It should essentially be the sum of the signals from each energy bin, with weights based on the energy of the bin, calculated using the
detector_response()method.- Return type:
NxPxQ double
- get_image(~, signal, I0)
This method takes in the final signal and the air scan and returns \(-\ln{\frac{S}{I0}}\), where
signalis the signal from primary and scatter rays andI0is the air scan. It is expected that other sensors can override this method, for example, to add noise to the signal.- Parameters:
signal (
MxNxP double) – An array of dimensions [ny_pix, nz_pix, nrotation] representing the signal from the sensor.- Returns:
image – should be of the same shape as
signal, and should represent the image from the sensor in response to the signal.- Return type:
MxNxP double
Potential Changes
The current implementation of get_image does not add noise to the signal. This may be added in the future.
get_range() may be converted to an attribute in the future.
Ideal Sensor
Purpose
This class is a subclass of sensor and represents a sensor that reacts equally to all energies.
Methods
- ideal_sensor.detector_response(obj, nrj_bin, count_array)
This method takes in an index referring to the energy bin and an array of photon counts in that energy bin, and returns the count_array multiplied by the average energy of the energy bin. See the parameters and return values from
detector_response().- Parameters:
nrj_bin (
double) – A single value representing the index of the energy bin.count_array (
MxNxP double) – An array of dimensions [ny_pix, nz_pix, nrotation] representing the number of photons in each pixel and rotation in the energy bin.
- Returns:
signal –
count_arraymultiplied by the average energy of the energy bin.- Return type:
MxNxP double