Process Module
This module contains the utilities to parse
descriptor file, load
image data,
process
image data to generate
results
according to the EMVA1288 standart.
Results can then be plotted
according
to the standart.
data
Transform image data into data
This class takes a dictionary with image data
(product of emva1288.process.loader.LoadImageData
)
and transforms it into data that can be used for the EMVA1288 computations.
It is important to note, that this is separate from LoadImageData because this
step, produces float values that are not easily transportable (db, json,
etc…) without loosing accuracy.
- class emva1288.process.data.Data1288(data, pixels=None, loglevel=20)[source]
Bases:
object
Take data from parsed images (descriptor file) and expose it as temporal and spatial dicts This dicts have the appropriate form for the processing
- __init__(data, pixels=None, loglevel=20)[source]
Data processing object init method.
It sets the logging configuration and creates a
python:logging.Logger
object usingpython:logging.getLogger()
and sets the loglevel. Creates the data dictionaries with the call of_get_temporal()
for temporal data and_get_spatial()
for spatial data.- Parameters:
data (The data descriptor file.) –
loglevel (int, optional) – The loglevel for the Logger object.
- _get_spatial(data)[source]
Fill the spatial dictionary.
The images (sum and pvar) are preserved, they are needed for processing.
- Parameters:
data (The data dictionary to take data from.) –
- Returns:
dict – The keys are the following:
’texp’: the array of exposure times for spatial tests,
’u_p’: the array of photon count average for each exposure times.
’sum’: the array of the image sum for each photon count and exposure time,
’pvar’: the array of the pvar image for each photon count and exposure time,
’L’: the number of image taken to make the sum and pvar images for each photon count and each exposure time,
’avg’: the average computed from the sum image for each photon count and each exposure time,
’var’: the variance computed from the pvar image for each photon count and each exposure time,
’sum_dark’: the sum image in the dark for each exposure time,
’pvar_dark’: the pvar image in the dark for each exposure time,
’L_dark’: the number of image taken in the dark to compose the sum and pvar images for each exposure time,
’avg_dark’: the average computed from the dark sum image for each exposure time,
’var_dark’: the variance computed from the dark pvar image for each exposure time.
- Return type:
A dict containing all spatial test data.
- Raises:
ValueError – If the there is no exactly one dark and one bright point
- _get_spatial_data(d, postfix='')[source]
Add the mean and variance to the spatial image data.
The mean is the sum of the images divided by L, which is the number of images for the spatial test.
The variance is the pseudovariance divided by (L^2 * (L-1)).
- Parameters:
d (dict) – The data dictionary containing the sum and pvar of the images.
postfix (str, optional) – String to add in the resulting dictionary keys
- Returns:
dict (A data dictionary processed from the input. The keys (+ postfix))
are –
‘sum’: the sum image preserved from input,
’L’: the number of image summed,
’M’: the number of rows for one image
’N’: the number of columns for one image
’avg_var’: variance of the the average image
’avg_mean’: mean of the the average image
’var_mean’: the variance of the variance image
’avg_var_cav’: residual column spatial variance
’avg_var_rav’: residual row spatial variance
- _get_temporal(data)[source]
Fill the temporal dict, with the stuff that we need. Compute the averages and variances from the sums (sum and pvar)
If there is only one exposure time, the arrays in the returned dict will all have the same length as the photon count array. For this case, the exposure times and the dark value data array elements will all be the same.
- Parameters:
data (The data dictionary containing the temporal data sets.) –
- Returns:
dict – The keys are the following: ‘texp’: the array of the exposure times used for the test, ‘u_p’: the array of photon count in a pixel for each exposure time and photon count, ‘u_y’: the array of the mean digital value for each exposure time and photon count, ‘s2_y’: the array of the digital value variance for each exposure time and photon count, ‘u_ydark’: the array of the mean digital dark value for each exposure time and ‘s2_ydark’: the array of the digital dark value variance for each exposure time.
- Return type:
A dict containing all temporal test data.
- Raises:
ValueError – If there is no one 0.0 photon count entry for each exposure time and at least one bright point
- _get_temporal_data(d)[source]
Convert temporal image data to mean and variance
The mean is the sum of the pixels of the two images divided by (2 * self.pixels)
The variance is the pseudo variance(integer), divided by (4 * self.pixels)
The difference of mean values is calculated by difference of two images, used for correction for the variance, squared and then divided by 2
- Parameters:
d (dict) – The data dictionary that contains the sum and pvar of the pixels of a sum of two consecutive images with the same photon count and exposure time.
- Returns:
dict – ‘mean’: the mean as described above and ‘var’: the variance as described above. ‘dmean’: the mean difference as described above.
- Return type:
A data dictionary with the following keys:
loader
Load image data This class takes a dictionary (product of parser.ParseEmvaDescriptorFile). Load the related images and reduce it’s data to the minimum possible, preserving all relevant image data in as integers
- class emva1288.process.loader.LoadImageData(images, path='', loglevel=20, fload=<function load_image>, fload_args=[], fload_kwargs={})[source]
Bases:
object
Using an info dictionary, load the images and fill data with the relevant information.
- __init__(images, path='', loglevel=20, fload=<function load_image>, fload_args=[], fload_kwargs={})[source]
Loader init method.
Uses a
python:logging.Logger
object to print infos for the user. In the initialization, itloads
the infos from the images into the data dictionary.- Parameters:
images (dict) – The
images
attribute of aParseEmvaDescriptorFile
object that have parsed the images of a descriptor file.path (str, optional) – The path to the directory containing the images.
loglevel (int, optional) – The information level for the
Logger
.fload (func. optional) – The function that will load the images (one at a time).
fload_args (list, optional) – The list of args for the fload function.
fload_kwargs (dict, optional) – The kwargs dictionary for the fload function.
parser
EMVA 1288 descriptor parser This class takes an EMVA1288 descriptor file and loads its content into a python dictionary.
An EMVA1288 descriptor file is a file that contains the description of an EMVA1288 test including exposure times, photon count and corresponding images
- class emva1288.process.parser.ParseEmvaDescriptorFile(filename, path=None, loglevel=20)[source]
Bases:
object
Take an image descriptor file and transform it into an usable directory
- __init__(filename, path=None, loglevel=20)[source]
Parser init method.
Uses a
python:logging.Logger
object to print infos of the parcing process. This methodloads
the file andgets
the information from it.- Parameters:
filename (str) – The descriptor file’s name or the complete path to it.
path (str, optional) – The path to the descriptor file.
loglevel (int, optional) – The logger level.
plotting
Plot the results This class takes a results.Results1288 object and produces all the plots needed to create a reference datasheet of the EMVA1288 test
- emva1288.process.plotting.EVMA1288plots = [<class 'emva1288.process.plotting.PlotPTC'>, <class 'emva1288.process.plotting.PlotSNR'>, <class 'emva1288.process.plotting.PlotSensitivity'>, <class 'emva1288.process.plotting.PlotUyDark'>, <class 'emva1288.process.plotting.PlotLinearity'>, <class 'emva1288.process.plotting.PlotDeviationLinearity'>, <class 'emva1288.process.plotting.PlotHorizontalSpectrogramPRNU'>, <class 'emva1288.process.plotting.PlotHorizontalSpectrogramDSNU'>, <class 'emva1288.process.plotting.PlotVerticalSpectrogramPRNU'>, <class 'emva1288.process.plotting.PlotVerticalSpectrogramDSNU'>, <class 'emva1288.process.plotting.PlotLogarithmicHistogramDSNU'>, <class 'emva1288.process.plotting.PlotLogarithmicHistogramPRNU'>, <class 'emva1288.process.plotting.PlotAccumulatedLogHistogramDSNU'>, <class 'emva1288.process.plotting.PlotAccumulatedLogHistogramPRNU'>, <class 'emva1288.process.plotting.PlotHorizontalProfile'>, <class 'emva1288.process.plotting.PlotVerticalProfile'>]
This list is quite exhaustive. There are the links to corresponding documentation:
PlotHorizontalProfile
- class emva1288.process.plotting.Emva1288Plot(figure)[source]
Bases:
object
Base class for emva plots.
- name = ''
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- rearrange()[source]
Opportunity to change axis or limits after all the tests have been plotted.
Uses
matplotlib:matplotlib.figure.Figure.tight_layout()
method.
- reduce_ticks(ax, axis, n=4)[source]
Reduce the number of ticks in ax.axis
Uses the
matplotlib:matplotlib.axes.Axes.locator_params()
method.- Parameters:
ax (The
matplotlib:matplotlib.axes.Axes
object to which) – the number of ticks will be changed.axis (str, {'x', 'y', 'both'}) – Axis on which to operate.
n (int, optional) – Number of bins between ticks to be left.
- set_legend(ax)[source]
Shortcut to add legend.
- Parameters:
ax (The
matplotlib:matplotlib.axes.Axes
object to which) – the legend will be added.
- setup_figure()[source]
Simple wrapper for one plot per figure
Takes the name, xlabel, ylabel, xscale and yscale for one plot case.
If more than one plot, just overwrite as you wish.
- title = None
The figure’s title.
- xlabel = None
The x axis label.
- xscale = None
The x axis scale.
- ylabel = None
The y axis label.
- yscale = None
The y axis scale.
- class emva1288.process.plotting.PlotAccumulatedLogHistogramDSNU(figure)[source]
Bases:
Emva1288Plot
Create Accumulated log histogram DSNU plot
- name = 'Accumulated log histogram DSNU'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- xlabel = 'Minimal deviation from the mean [DN]'
The x axis label.
- ylabel = 'Number of pixels'
The y axis label.
- yscale = 'log'
The y axis scale.
- class emva1288.process.plotting.PlotAccumulatedLogHistogramPRNU(figure)[source]
Bases:
Emva1288Plot
Create Accumulated log histogram PRNU plot
- name = 'Accumulated log histogram PRNU'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- xlabel = 'Minimal deviation from the mean [%]'
The x axis label.
- ylabel = 'Number of pixels'
The y axis label.
- yscale = 'log'
The y axis scale.
- class emva1288.process.plotting.PlotDeviationLinearity(figure)[source]
Bases:
Emva1288Plot
Create Deviation Linearity plot
- name = 'Deviation linearity'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- xlabel = '$\\mu_{p}$ [mean number of photons/pixel]'
The x axis label.
- ylabel = 'Linearity error LE [%]'
The y axis label.
- class emva1288.process.plotting.PlotHorizontalProfile(*args, **kwargs)[source]
Bases:
ProfileBase
Create Horizontal profile plot Profile is done with spatial images.
- name = 'Horizontal profile'
The figure’s name (used as title if title is none).
- rearrange()[source]
Opportunity to change axis or limits after all the tests have been plotted.
Uses
matplotlib:matplotlib.figure.Figure.tight_layout()
method.
- setup_figure()[source]
Simple wrapper for one plot per figure
Takes the name, xlabel, ylabel, xscale and yscale for one plot case.
If more than one plot, just overwrite as you wish.
- vertical = False
- class emva1288.process.plotting.PlotHorizontalSpectrogramDSNU(figure)[source]
Bases:
Emva1288Plot
Create Horizontal spectrogram DSNU plot
- name = 'Horizontal spectrogram DSNU'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- xlabel = 'cycles [periods/pixel]'
The x axis label.
- ylabel = 'Standard deviation and\nrelative presence of each cycle [DN]'
The y axis label.
- yscale = 'log'
The y axis scale.
- class emva1288.process.plotting.PlotHorizontalSpectrogramPRNU(figure)[source]
Bases:
Emva1288Plot
Create Horizontal spectrogram PRNU plot
- name = 'Horizontal spectrogram PRNU'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- xlabel = 'cycles [periods/pixel]'
The x axis label.
- ylabel = 'Standard deviation and\nrelative presence of each cycle [%]'
The y axis label.
- yscale = 'log'
The y axis scale.
- class emva1288.process.plotting.PlotLinearity(figure)[source]
Bases:
Emva1288Plot
Create Linearity plot
- name = 'Linearity'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- xlabel = '$\\mu_{p}$ [mean number of photons/pixel]'
The x axis label.
- ylabel = '$\\mu_y - \\mu_{y.dark}$ [DN]'
The y axis label.
- class emva1288.process.plotting.PlotLogarithmicHistogramDSNU(figure)[source]
Bases:
Emva1288Plot
Create Logarithmic histogram DSNU plot
- name = 'Logarithmic histogram DSNU'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- xlabel = 'Dark value [DN]'
The x axis label.
- ylabel = 'Number of pixels'
The y axis label.
- yscale = 'log'
The y axis scale.
- class emva1288.process.plotting.PlotLogarithmicHistogramPRNU(figure)[source]
Bases:
Emva1288Plot
Create Logarithmic histogram PRNU plot
- name = 'Logarithmic histogram PRNU'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- xlabel = 'Deviation from the mean [DN]'
The x axis label.
- ylabel = 'Number of pixels'
The y axis label.
- yscale = 'log'
The y axis scale.
- class emva1288.process.plotting.PlotPTC(figure)[source]
Bases:
Emva1288Plot
Create Photon Transfer plot
- name = 'Photon Transfer'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- xlabel = '$\\mu_y - \\mu_{y.dark}$ [DN]'
The x axis label.
- ylabel = '$\\sigma^2_y - \\sigma^2_{y.dark}$ [DN$^2$]'
The y axis label.
- class emva1288.process.plotting.PlotSNR(figure)[source]
Bases:
Emva1288Plot
Create SNR plot
- name = 'Signal to Noise Ratio'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- setup_figure()[source]
Simple wrapper for one plot per figure
Takes the name, xlabel, ylabel, xscale and yscale for one plot case.
If more than one plot, just overwrite as you wish.
- xlabel = '$\\mu_{p}$ [mean number of photons/pixel]'
The x axis label.
- ylabel = 'SNR'
The y axis label.
- class emva1288.process.plotting.PlotSensitivity(figure)[source]
Bases:
Emva1288Plot
- name = 'Sensitivity'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- rearrange()[source]
Opportunity to change axis or limits after all the tests have been plotted.
Uses
matplotlib:matplotlib.figure.Figure.tight_layout()
method.
- xlabel = '$\\mu_p$ [mean number of photons/pixel]'
The x axis label.
- ylabel = '$\\mu_y - \\mu_{y.dark}$ [DN]'
The y axis label.
- class emva1288.process.plotting.PlotUyDark(figure)[source]
Bases:
Emva1288Plot
Create $mu_{y.dark}$ plot
- name = 'Mean gray value in dark'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- title = '$\\mu_{y.dark}$'
The figure’s title.
- xlabel = 'exposure time [ns]'
The x axis label.
- ylabel = '$\\mu_{y.dark}$ [DN]'
The y axis label.
- class emva1288.process.plotting.PlotVerticalProfile(*args, **kwargs)[source]
Bases:
ProfileBase
Create Vertical profile plot. Profile is done with spatial images.
- name = 'Vertical profile'
The figure’s name (used as title if title is none).
- rearrange()[source]
Opportunity to change axis or limits after all the tests have been plotted.
Uses
matplotlib:matplotlib.figure.Figure.tight_layout()
method.
- setup_figure()[source]
Simple wrapper for one plot per figure
Takes the name, xlabel, ylabel, xscale and yscale for one plot case.
If more than one plot, just overwrite as you wish.
- vertical = True
- class emva1288.process.plotting.PlotVerticalSpectrogramDSNU(figure)[source]
Bases:
Emva1288Plot
Create Vertical spectrogram DSNU plot
- name = 'Vertical spectrogram DSNU'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- xlabel = 'Cycles [periods/pixel]'
The x axis label.
- ylabel = 'Standard deviation and\nrelative presence of each cycle [DN]'
The y axis label.
- yscale = 'log'
The y axis scale.
- class emva1288.process.plotting.PlotVerticalSpectrogramPRNU(figure)[source]
Bases:
Emva1288Plot
Create Vertical spectrogram PRNU plot
- name = 'Vertical spectrogram PRNU'
The figure’s name (used as title if title is none).
- plot(test)[source]
Method to show the figures.
- Parameters:
test (Do nothing for this method but can be) – used for the subclass method.
- Raises:
NotImplementedError – If this method is not overridden.
Notes
Must be overridden in subclasses.
- xlabel = 'cycles [periods/pixel]'
The x axis label.
- ylabel = 'Standard deviation and\nrelative presence of each cycle [%]'
The y axis label.
- yscale = 'log'
The y axis scale.
- class emva1288.process.plotting.Plotting1288(*tests)[source]
Bases:
object
EMVA1288 plots
Creates and shows all plots necessary to prepare a camera or sensor descriptive report compliant with EMVA Standard 1288.
- class emva1288.process.plotting.ProfileBase(*args, **kwargs)[source]
Bases:
Emva1288Plot
results
Compute EMVA1288 values from data This class takes the data from data.Data1288 and compute the actual EMVA1288 values.
- class emva1288.process.results.Results1288(data, pixel_area=None, index_u_ysat=None, loglevel=10)[source]
Bases:
object
Class used to process data and to generate pdf report using LaTeX.
When properties from this class are computed, their docstring are also parsed using the
cls_1288_info()
function to retrieve more data informations (like units or full name).- property DR
Dynamic Range.
Defined as the saturation capacity divided by the absolute sensitivity threshold. The greater this number is, the greater the operational range of a camera (between the dark noise level and the saturation level).
Emva1288
- section: sensitivity
- short: Dynamic Range
- symbol: DR
- latexname: DR
- DR_dB()[source]
Dynamic Range in deciBels.
It is defined as 20 * log_10 ( Dynamic Range ).
Emva1288
- section: sensitivity
- short: Dynamic Range
- symbol: $DR_{dB}$
- unit: dB
- latexname: DRDB
- property DSNU1288
DSNU overall.
Dark Signal NonUniformity (in e^-) is defined as the standard deviation of the dark signal divided by the overall system gain. If the variance is negative, it will return NaN instead of an imaginary number.
Emva1288
- section: spatial
- short: DSNU
- symbol: $DSNU_{1288}$
- unit: $e^-$
- latexname: DSNU
- DSNU1288_DN()[source]
DSNU in DN.
Defined as the DSNU in e^- multiplied by the overall system gain. Returns NaN if the dark signal variance is negative.
- Returns:
float
- Return type:
The DSNU in DN.
Emva1288
- section: spatial
- short: DSNU in DN
- symbol: $DSNU_{1288.DN}$
- unit: DN
- latexname: DSNUDN
- property DSNU1288_col
DSNU in columns.
Dark Signal NonUniformity (in e^-) is defined as the standard deviation of the dark signal divided by the overall system gain. If the variance is negative, it will return NaN instead of an imaginary number.
Emva1288
- section: spatial
- short: DSNUcol
- symbol: $DSNU_{1288.col}$
- unit: $e^-$
- latexname: DSNUcol
- property DSNU1288_pixel
DSNU in pixel.
Dark Signal NonUniformity (in e^-) is defined as the standard deviation of the dark signal divided by the overall system gain. If the variance is negative, it will return NaN instead of an imaginary number.
Emva1288
- section: spatial
- short: DSNUpixel
- symbol: $DSNU_{1288.pixel}$
- unit: $e^-$
- latexname: DSNUpixel
- property DSNU1288_row
DSNU in rows.
Dark Signal NonUniformity (in e^-) is defined as the standard deviation of the dark signal divided by the overall system gain. If the variance is negative, it will return NaN instead of an imaginary number.
Emva1288
- section: spatial
- short: DSNUrow
- symbol: $DSNU_{1288.row}$
- unit: $e^-$
- latexname: DSNUrow
- property K
Overall system gain.
Slope of (s2_y - s2_y_dark) Vs (u_y - u_y_dark). Fit with offset = 0. Uses the
LinearB0()
to make the fit.Emva1288
- section: sensitivity
- short: System gain
- symbol: K
- unit: $DN/e^-$
- latexname: K
- property LE_max
Max Linearity error.
Emva1288
- section: linearity
- short: Max Linearity error
- symbol: $LE_{max}$
- unit: \%
- latexname: LEMax
- property LE_min
Min Linearity error.
Emva1288
- section: linearity
- short: Min Linearity error
- symbol: $LE_{min}$
- unit: \%
- latexname: LEMin
- property PRNU1288
PRNU overall.
Photo Response NonUniformity (in %) is defined as the square root of the difference between the spatial variance of a bright image (or from an average of bright images to remove temporal difformities) and the spatial variance of dark signal, divided by the difference between the mean of a bright image and the mean of a dark image.
Emva1288
- section: spatial
- short: PRNU
- symbol: $PRNU_{1288}$
- unit: \%
- latexname: PRNU
- property PRNU1288_col
PRNU in column.
Photo Response NonUniformity (in %) is defined as the square root of the difference between the spatial variance of a bright image (or from an average of bright images to remove temporal difformities) and the spatial variance of dark signal, divided by the difference between the mean of a bright image and the mean of a dark image.
Emva1288
- section: spatial
- short: PRNUcol
- symbol: $PRNU_{1288.col}$
- unit: \%
- latexname: PRNUcol
- property PRNU1288_pixel
PRNU in pixel.
Photo Response NonUniformity (in %) is defined as the square root of the difference between the spatial variance of a bright image (or from an average of bright images to remove temporal difformities) and the spatial variance of dark signal, divided by the difference between the mean of a bright image and the mean of a dark image.
Emva1288
- section: spatial
- short: PRNUpixel
- symbol: $PRNU_{1288.pixel}$
- unit: \%
- latexname: PRNUpixel
- property PRNU1288_row
PRNU in row.
Photo Response NonUniformity (in %) is defined as the square root of the difference between the spatial variance of a bright image (or from an average of bright images to remove temporal difformities) and the spatial variance of dark signal, divided by the difference between the mean of a bright image and the mean of a dark image.
Emva1288
- section: spatial
- short: PRNUrow
- symbol: $PRNU_{1288.row}$
- unit: \%
- latexname: PRNUrow
- property QE
Quantum efficiency.
It is retrieved as the ratio of the responsivity to the overall system gain.
Emva1288
- section: sensitivity
- short: Quantum efficiency
- symbol: $\eta$
- unit: \%
- latexname: QE
- property R
Responsivity.
Slope of the (u_y - u_y_dark) Vs u_p. Fit with offset = 0 Uses the
LinearB0()
function to make the fit.Emva1288
- section: sensitivity
- short: Responsivity
- symbol: R
- unit: DN/p
- property SNR_max
Maximum Signal-to-Noise Ratio.
Emva1288
- section: sensitivity
- short: Signal-to-Noise Ratio
- symbol: $SNR_{max}$
- latexname: SNRMax
- SNR_max_bit()[source]
Maximum Signal to Noise Ratio in Bits.
Emva1288
- section: sensitivity
- short: Maximum Signal to Noise Ratio in Bits
- symbol: $SNR_{max.bit}$
- unit: bit
- latexname: SNRMaxBit
- SNR_max_dB()[source]
Maximum Signal to Noise Ratio in Db.
Emva1288
- section: sensitivity
- short: Maximum Signal to Noise Ratio in Db
- symbol: $SNR_{max.dB}$
- unit: dB
- latexname: SNRMaxDB
- __init__(data, pixel_area=None, index_u_ysat=None, loglevel=10)[source]
Results computation init method.
This class uses a
python:logging.Logger
object to display informations for users.- Parameters:
data (dict) – The data dictionary to compute the results from.
pixel_area (float, optional) – The area of one pixel in um^2.
index_u_ysat (int, optional) – The index of the u_y array at which we consider that the camera saturates. This is used if forcing the saturation point is necessary.
loglevel (int, optional) – The level for the
python:logging.Logger
object.
- property histogram_DSNU
DSNU histogram.
Uses the
Histogram1288()
function to make the histogram.Emva1288
- section: defect_pixel
- short: DSNU histogram
- property histogram_DSNU_accumulated
Accumulated DSNU histogram.
Uses the
Histogram1288()
function to make the histogram.Emva1288
- section: defect_pixel
- short: accumulated DSNU histogram
- property histogram_PRNU
PRNU histogram.
Uses the
high_pass_filter()
function to filter the image and then uses theHistogram1288()
function to make the histogram.Emva1288
- section: defect_pixel
- short: PRNU histogram
- property histogram_PRNU_accumulated
Accumulated PRNU histogram.
Uses the
high_pass_filter()
function to filter the image and then uses theHistogram1288()
function to make the histogram.Emva1288
- section: defect_pixel
- short: accumulated PRNU histogram
- property index_linearity_max
Linearity fit maximum index.
Maximum index for linear fit (95% of saturation).
Emva1288
- section: linearity
- short: Linearity fit maximum index
- property index_linearity_min
Linearity fit minimun index.
Minimum index for linear fit (5% of saturation).
Emva1288
- section: linearity
- short: Linearity fit minimun index
- property index_sensitivity_max
Index for linear fits in sensitivity part of the standard (70% of saturation).
Emva1288
- section: sensitivity
- short: Sensitivity fit maximum index
- property index_sensitivity_min
Sensitivity minimum index.
Index for linear fits in sensitivity part of the standard (70% of saturation)
Emva1288
- section: sensitivity
- short: Sensitivity fit minimum index
- property index_start
The array’s starting index.
Emva1288
- section: info
- short: Start array index
- property index_u_ysat
Index of saturation.
Emva1288
- section: sensitivity
- short: Saturation index
- inverse_K()[source]
Inverse of overall system gain.
Emva1288
- section: sensitivity
- short: Inverse of overall system gain
- symbol: 1/K
- unit: $e^-/DN$
- latexname: InvK
- inverse_SNR_max()[source]
Inverse Maximum Signal to Noise Ratio.
Emva1288
- section: sensitivity
- short: Inverse Maximum Signal to Noise Ratio
- symbol: $SNR_{max}^{-1}$
- unit: \%
- latexname: InvSNRMax
- linearity()[source]
Returns a dictionary containing linearity information.
It fits the mean digital signal in function of the mean photon count (Linear fit) using the EMVA1288 standard for linear fit.
- Returns:
dict – The keys are:
’fit_slope’ : The slope of the linear fit.
’fit_offset’ : The offset of the fit.
’relative_deviation’ : The relative deviation of the real data from the fit (in %) for the whole array.
’linearity_error_min’ : The minimal value of the relative deviation.
’linearity_error_max’ : The maximal value of the relative deviation.
- Return type:
Linearity dictionary.
- property results
Dictionnary with all the values and metadata for EMVA1288 values.
It uses the
obj_to_dict()
to compute all the results at once.
- property results_by_section
Results ordered by section.
- property s2q
Quantification noise.
- property s_2_y
Spatial variance from image.
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y}$
- unit: DN2
- property s_2_y_cav
Average of column spatial variance from image.
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y.cav}$
- unit: DN2
- property s_2_y_cav_dark
Average of column spatial variance from image.
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y.cav.dark}$
- unit: DN2
- property s_2_y_col
Column spatial variance from image.
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y.col}$
- unit: DN2
- property s_2_y_col_dark
Column spatial variance from dark image.
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y.col.dark}$
- unit: DN2
- property s_2_y_dark
Spatial variance from image,
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y}$
- unit: DN2
- property s_2_y_measured
Spatial variance measure.
Variance value of the bright variance image.
Emva1288
- section: spatial
- short: Spatial variance measure
- symbol: $s^2_{y.measured}$
- unit: DN2
- property s_2_y_measured_dark
Spatial variance measured dark.
Variance value of the dark variance image.
Emva1288
- section: spatial
- short: Spatial variance measured dark
- symbol: $s^2_{y.measured.dark}$
- unit: DN2
- property s_2_y_pixel
Pixel spatial variance from image.
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y.pixel}$
- unit: DN2
- property s_2_y_pixel_dark
Pixel spatial variance from dark image.
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y.pixel.dark}$
- unit: DN2
- property s_2_y_rav
Average of row spatial variance from image.
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y.rav}$
- unit: DN2
- property s_2_y_rav_dark
Average of row spatial variance from image.
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y.rav.dark}$
- unit: DN2
- property s_2_y_row
Row spatial variance from image.
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y.row}$
- unit: DN2
- property s_2_y_row_dark
Row spatial variance from dark image.
Emva1288
- section: spatial
- short: Spatial variance from image
- symbol: $s^2_{y.row.dark}$
- unit: DN2
- property sigma_2_y_stack
Temporal variance stack.
Mean value of the bright variance image.
Emva1288
- section: spatial
- short: Temporal variance stack
- symbol: $\sigma^2_{y.stack}$
- unit: DN2
- property sigma_2_y_stack_dark
Temporal variance stack dark.
Mean value of the dark variance image.
Emva1288
- section: spatial
- short: Temporal variance stack dark
- symbol: $\sigma^2_{y.stack.dark}$
- unit: DN2
- property sigma_d
Temporal Dark Noise.
Emva1288
- section: sensitivity
- short: Temporal Dark Noise
- symbol: $\sigma_d$
- unit: $e^-$
- latexname: SigmaDark
- property sigma_y_dark
Temporal Dark Noise.
Uses
LinearB()
to make the fit.Emva1288
- section: sensitivity
- short: Temporal Dark Noise
- symbol: $\sigma_{y.dark}$
- unit: DN
- latexname: SigmaYDark
- property u_I_mean
Dark Current from mean.
The dark current from mean is the slope of the dark signal mean in function of the exposure times divided by the overall system gain. Returns NaN if the number of different exposure times is less than 3.
Emva1288
- section: dark_current
- short: Dark Current from mean
- symbol: $\mu_{I.mean}$
- unit: $e^-/s$
- property u_I_mean_DN
Dark Current from mean.
The dark current from mean is the slope of the dark signal mean in function of the exposure time. Returns NaN if the number of different exposure times is less than 3.
Emva1288
- section: dark_current
- short: Dark Current from mean
- symbol: $\mu_{I.mean.DN}$
- unit: $DN/s$
- property u_I_var
Dark Current from variance.
The dark current from variance (in e-/s) is the dark current from variance (in DN/s) divided by the system gain. Returns NaN if the fit slope is negative.
Emva1288
- section: dark_current
- short: Dark Current from variance
- symbol: $\mu_{I.var}$
- unit: $e^-/s$
- latexname: UIVar
- property u_I_var_DN
Dark Current from variance.
The dark current from variance (in DN/s) is the slope of the dark signal variance as a function of the exposure time divided by the system gain. Returns NaN if the slope is negative.
Emva1288
- section: dark_current
- short: Dark Current from variance
- symbol: $\mu_{I.var.DN}$
- unit: $DN/s$
- latexname: UIVar
- property u_e_min
Sensitivity threshold.
Emva1288
- section: sensitivity
- short: Sensitivity threshold
- symbol: $\mu_{e.min}$
- unit: $e^-$
- latexname: UEMin
- property u_e_min_area
Sensitivity threshold per pixel area.
Returns None if the pixel area is not defined or 0.
Emva1288
- section: sensitivity
- short: Sensitivity threshold
- symbol: $\mu_{e.min.area}$
- unit: $e^-/\mu m^2$
- latexname: UEMin
- property u_e_sat
Saturation Capacity.
Number of electrons at saturation.
Emva1288
- section: sensitivity
- short: Saturation Capacity
- symbol: $\mu_{e.sat}$
- unit: $e^-$
- latexname: UESat
- property u_e_sat_area
Saturation Capacity per pixel area.
Returns None if pixel area is not defined or 0.
Emva1288
- section: sensitivity
- short: Saturation Capacity
- symbol: $\mu_{e.sat.area}$
- unit: $e^-/\mu m^2$
- latexname: UESat
- property u_p_min
Absolute sensitivity threshold.
Emva1288
- section: sensitivity
- short: Absolute sensitivity threshold
- symbol: $\mu_{p.min}$
- unit: $p$
- latexname: UPMin
- property u_p_min_area
Sensitivity threshold per pixel area.
Returns None if pixel area is not defined or 0.
Emva1288
- section: sensitivity
- short: Sensitivity threshold
- symbol: $\mu_{p.min.area}$
- unit: $p/\mu m^2$
- latexname: UPMin
- property u_p_sat
Saturation Capacity.
Emva1288
- section: sensitivity
- short: Saturation Capacity
- symbol: $\mu_{p.sat}$
- unit: $p$
- latexname: UPSat
- property u_p_sat_area
Saturation Capacity per pixel area.
Returns None if pixel area is not defined or 0.
Emva1288
- section: sensitivity
- short: Saturation Capacity
- symbol: $\mu_{p.sat.area}$
- unit: $p/\mu m^2$
- latexname: UPSat
- xml(filename=None)[source]
Method that writes the results in xml format to a file.
- Parameters:
filename (str, optional) – The file to write the results. If None, the xml string won’t be written but will be returned instead.
- Returns:
str
- Return type:
If the xml string is not written into a file, it is returned.
routines
Utils functions
- emva1288.process.routines.FFT1288(img, rotate=False, n=1)[source]
Compute the FFT emva1288 style
Compute an FFT per line and average the resulting ffts
If img is a masked array then remove the masked data line by line and calculate the FFT on the minimum number of valid columns.
- Parameters:
img (array) – Input image
rotate (bool (optional)) – Rotate the image before performing the FFT
n (int (optional)) – If the image is the sum of several images use this value to produce the fft of the average image
- Returns:
array
- Return type:
One dimension FFT power spectrum
- emva1288.process.routines.cls_1288_info(cls)[source]
Dictionnary that represents results.
- Parameters:
cls (Class from wich to extract the information.) –
- Returns:
Dictionnary extracted using the format defined by a custom sphinx directive with the following format:
{attribute1: {'section': section name, 'units': attribute units, 'short': attribute short description, 'latexname': latex name for the attribute, 'symbol': symbol to represent the value}}
- Return type:
dict
- emva1288.process.routines.dict_to_xml(d, root='results', filename=None)[source]
Takes a dict and return a well formed xml string
- emva1288.process.routines.get_int_imgs(imgs)[source]
Returns the sum, pseudo-variance, mean difference from list of images sum is just the image resulting on the addition of all the images pvar is the pseudo-variance, this is defined by: pvar = SUM((L(i)^2 - (SUM(i))^2) to get variance from pseudo-variance var = (1/(L^2) * 1/(L - 1)) * pvar dmean is the mean difference between the images, obtained by: SUM(mean(i) - mean(i-1)), when i>0 this is used to remove mu_y^2 from the total variance important value to get sigma_y (temporal variance).
- keys & value in output dict:
L : number of images for computation–> int sum : total summed image [M x N] –> array. int64 pvar : summed variance image [M x N] –> array. int64 dmean: summed mean differences –> float
- emva1288.process.routines.high_pass_filter(img, dim)[source]
High pass filtering on image
Computes the highpass filtering as defined by the emva standart keeping the result as an int image. The computation preserves the image as ints and doesn’t perform the final division, but returns the dividing factor
- Parameters:
img (np.array) – the image to filter
dim (int) – The size of the highpass filter
- Returns:
d – The data dictionary of the result. The keys are: ‘img’ : The filtered image ‘multiplicator’ : Factor from the convolution to be considered in the computation of the histogram
- Return type:
dict
- emva1288.process.routines.obj_to_dict(obj)[source]
Get the info dict from the object class Add the values or Data to this dict
for each method if the return value is a dict, it is inserted as d[SectionName][MethodName][Data] = ReturnValue if not d[SectionName][MethodName][Value] = ReturnValue