This class describes a sensor. It is responsible for determining the size of the camera field of view and also for recording particles.
The particle recording behavior is similar to the one described by Lecordier and Westerweel in their synthetic image generator .
Some features can be easily implemented such as:
receives the wavelength as a parameter)
more data)
But were not implemented until now.
Methods
Background noise mean level (in A/D converter counts)
Standard deviation of background level (gaussian noise assumed) in sensor counts
The quantity of bits in the A/D converter
Initializes sensor with gaussian noise, the distribution parameters are given by:
To handle negative values, only the absolute value is taken into account
Sensor color in RGB
Creates a dead/hot pixel mapping for the sensor reading simulation
Stores the position of dead pixels
Determines the dimension of the sensor in the axes \(x,y,z\), (\(x=0\))
This function displays what is currently recorded in the camera sensor.
Determines the ratio between light sensitive and “dark” areas for pixels in the \(y,z\) directions, respectively
The maximum number of electrons that can be stored in a pixel
The number of electrons needed to raise the value of the A/D converter by one count (in the A/D converter)
Stores the position of hot pixels
Transforms (normalized) parametric coordinates into pixel position on the sensor.
There is an inversion of the \(u,v\) columns because of the unfortunate parametric coordinate system that maps:
\(u \mapsto z(sensor)\)
\(v \mapsto y(sensor)\)
Parameters : | coords : numpy.ndarray \((N,3)\)
|
---|---|
Returns : | pixels : numpy.ndarray \((N,2)\)
DOES NOT CHECK IF OUTSIDE SENSOR BOUNDARIES!!! : |
From the parametric coordinates \(\\overline{U,V}\), which range is \([-1..1]\), calculates the sensor coordinates in meters, so the algorithm is basically multiplying by the sensor size.
Parameters : | param_coords : numpy.ndarray \((N,2)\)
|
---|---|
Returns : | sensor_coords : numpy.ndarray \((N,2)\)
|
Transforms world coordinates into a position in the sensor, given in pixels
Parameters : | coords : numpy.ndarray \((N,3)\)
|
---|---|
Returns : | pixels : numpy.ndarray \((N,2)\)
DOES NOT CHECK IF OUTSIDE SENSOR BOUNDARIES!!! : |
The size of each pixel (in meters) in the \(y,z\) directions
The amount of electrons generated for each incoming photon
This field stores data that is obtained directly from light intensity measurements. This is converted to electrons, but allows fractional values and is noiseless
Returns the sensor reading in counts, creating quantization noise and saturating the signal where appropriate. This also simulates dead pixels, if there is a dead pixel mapping
The readout noise, however, should be included in the background noise property of the class
coords - [u,v] sensor coordinates of the recorded point energy - J - energy which is captured by the lenses wavelength - m - illumination wavelength diameter - m - particle image diameter
This is the front-end of the _recordParticle method, its main input is an array of sensor coordinates, representing the particle image centers.
The other inputs can be either arrays (e.g. for particle with varying diameters) or scalars (e.g. for all particles with same diameter). It is more or less obvious that the arrays must have the same length as the coordinate arrays.
Another issue is that the recording is much less efficient when particle image sizes varying size (the source of this issue is at the _recordParticles documentation). So some tricks (such as sorting by particle size) are used to reduce this effect. This procedure is made when the standard deviation exceeds 1/10th of the particle diameter (ajustable by the STD_PARAM constant at the beginning of the module).
Finally, as the recording itself is vectorized, but uses too much memory, it is made in steps. If you find problems too often, adjust the following constants at the header of this module:
MEMSIZE - maximum acceptable number of elements in a numpy.ndarray
MEM_SAFETY - factor of safety
Determines the number of pixels in the \(y,z\) directions, respectively.
Stores sensor data that is lost due to saturation (may be used to check images without regenerating them)
Writes the sensor data in a 16-bit TIFF file (which is compatible with some mainstream PIV software)
Parameters : | filename : string
|
---|
Transform sensor coordinates \((U,V)\) in meters to parametric coordinates, \((\\overline{U},\\overline{V})\).
Parameters : | param_coords : numpy.ndarray \((N,2)\)
|
---|---|
Returns : | sensor_coords : numpy.ndarray \((N,2)\)
|
Transform sensor coordinates \((U,V)\) in meters to world coordinates
Parameters : | param_coords : numpy.ndarray \((N,2)\)
|
---|---|
Returns : | sensor_coords : numpy.ndarray \((N,3)\)
|
Transforms (normalized) parametric coordinates into pixel position on the sensor.
There is an inversion of the UV columns because of the unfortunate parametric coordinate system that maps:
\(u \mapsto z(sensor)\)
\(v \mapsto y(sensor)\)
Parameters : | coords : numpy.ndarray \((N,3)\)
|
---|---|
Returns : | pixels : numpy.ndarray \((N,2)\)
DOES NOT CHECK IF OUTSIDE SENSOR BOUNDARIES!!! : |
This field can be used by future-implemented functions for storing relevant data for the simulation (colors, light vector direction)