pwspy.dataTypes.CameraCorrection

class pwspy.dataTypes.CameraCorrection(darkCounts, linearityPolynomial=None)[source]

Bases: object

This class represents all the information needed to correct camera related hardware defects in our data. This includes a dark count value (The counts registered when no light is incident on the camera. It also includes a polynomial that is used to linearize the counts. E.G. if you image something over a range of exposure times you would expect the measured counts to be proportional to the exposure time. However on some cameras this is not the case.

darkCounts

Dark count for a single pixel of the camera. This will be subtracted from the data in pre-processing. When binning is used the dark counts are summed together, so if you measure a dark count of 400 with 2x2 binning then the single pixel dark count is 100.

Type

float

linearityPolynomial

Sequence of polynomial coefficients [a,b,c,etc…] in the order a*x + b*x^2 + c*x^3 + etc… Used to linearize the counts from the camera so that they are linearly proportional to the image brightness. This can generally be left as None for sCMOS cameras but it is often required for CCD type cameras.

Type

t_.Sequence[float, …]

classmethod fromJsonFile(filePath)[source]

Load the camera correction from a json text file.

Parameters

filePath (str) – The file path of the JSON file to load from.

Return type

CameraCorrection

Returns

A new instance of CameraCorrection.

Examples

corr = CameraCorrection.fromJsonFile(‘~/Desktop/camera.json’)

toJsonFile(filePath)[source]

Save the camera correction to a JSON formatted text file.

Parameters

filePath (str) – The file path for the new JSON file.