Simple Sensor

template<IsSpectral TSpectral>
class SimpleSensor : public huira::SensorModel<TSpectral>

Simple sensor model with basic noise and ADC simulation.

Implements a basic sensor readout model, including shot noise, read noise, and quantization.

Template Parameters:

TSpectral – The spectral representation type.

Public Functions

inline SimpleSensor(SimpleSensorConfig<TSpectral> config = SimpleSensorConfig<TSpectral>{})
~SimpleSensor() override = default
virtual void readout(FrameBuffer<TSpectral> &fb, float exposure_time) const override

Simulates the sensor readout process, including noise and quantization.

Converts received power to electrons, applies quantum efficiency, adds noise, and quantizes the result.

Parameters:
  • fb – The frame buffer containing received power and where the sensor response will be written.

  • exposure_time – The exposure time in seconds.

void set_resolution(Resolution resolution)

Sets the sensor resolution.

Parameters:

resolution – The new sensor resolution (width x height).

Throws:

std::runtime_error – if the resolution is invalid.

inline Resolution resolution() const
void set_pixel_pitch(units::Micrometer pitch_x, units::Micrometer pitch_y)

Sets the pixel pitch of the sensor.

Parameters:
  • pitch_x – The horizontal pixel pitch in micrometers.

  • pitch_y – The vertical pixel pitch in micrometers.

Throws:

std::runtime_error – if either pitch is invalid.

Vec2<float> pixel_pitch() const

Returns the pixel pitch of the sensor.

Returns:

The pixel pitch as a 2D vector (x, y) in meters.

void set_sensor_size(units::Millimeter width, units::Millimeter height)

Sets the sensor size in millimeters.

Computes and sets the pixel pitch based on the given sensor size and current resolution.

Parameters:
  • width – The sensor width in millimeters.

  • height – The sensor height in millimeters.

Throws:

std::runtime_error – if either dimension is invalid.

Vec2<float> sensor_size() const

Returns the sensor size in meters.

Returns:

The sensor size as a 2D vector (width, height) in meters.

void set_quantum_efficiency(const TSpectral &qe)

Sets the quantum efficiency of the sensor.

Parameters:

qe – The quantum efficiency spectrum (values between 0 and 1).

Throws:

std::runtime_error – if the values are invalid.

inline TSpectral quantum_efficiency() const
void set_full_well_capacity(float fwc)

Sets the full well capacity of the sensor.

Parameters:

fwc – The full well capacity in electrons.

Throws:

std::runtime_error – if the value is invalid.

inline float full_well_capacity() const
void set_read_noise(float read_noise)

Sets the read noise of the sensor.

Parameters:

read_noise – The read noise in electrons RMS.

Throws:

std::runtime_error – if the value is invalid.

inline float read_noise() const
void set_dark_current(float dark_current)

Sets the dark current of the sensor.

Parameters:

dark_current – The dark current in electrons per second.

Throws:

std::runtime_error – if the value is invalid.

inline float dark_current() const
void set_bias_level_dn(float bias_level_dn)

Sets the bias level of the sensor in ADU.

Parameters:

bias_level_dn – The bias level in ADU.

Throws:

std::runtime_error – if the value is invalid.

inline float bias_level_dn() const
void set_bit_depth(int bit_depth)

Sets the bit depth of the sensor.

Parameters:

bit_depth – The bit depth (number of bits per pixel).

Throws:

std::runtime_error – if the value is invalid.

inline int bit_depth() const
void set_gain_adu(float gain)

Sets the gain of the sensor in e-/ADU.

Parameters:

gain – The gain in electrons per ADU.

Throws:

std::runtime_error – if the value is invalid.

inline float gain_adu() const
void set_unity_db(float unity_db)

Sets the unity dB reference level for gain.

Parameters:

unity_db – The unity dB reference level.

Throws:

std::runtime_error – if the value is invalid.

inline float unity_db() const
void set_gain_db(float gain_db)

Sets the gain in dB for the sensor.

Parameters:

gain_db – The gain in decibels.

inline float gain_db() const
inline void set_rotation(units::Radian angle)
inline units::Radian rotation() const

Protected Attributes

SensorConfig<TSpectral> config_