fpipy¶
Top-level package for Fabry-Perot Imaging in Python.
-
fpipy.read_ENVI_cfa(filepath, raw_unit='dn', **kwargs)[source]¶ Read ENVI format CFA data and metadata to an xarray Dataset.
For the VTT format raw ENVI files the ENVI metadata is superfluous and is discarded, with the actual metadata read from the separate VTT header file. Wavelength and fwhm data will be replaced with information from metadata and number of layers etc. are omitted as redundant. Gain and bayer pattern are assumed to be constant within each file.
- Parameters
- Returns
dataset – Dataset derived from the raw image data and accompanying metadata. If the ENVI data had an included dark layer, it is separated into its own data variable in the dataset.
- Return type
-
fpipy.raw_to_radiance(raw, **kwargs)[source]¶ Performs demosaicing and computes radiance from RGB values.
- Parameters
raw (xarray.Dataset) – A dataset containing the following variables: c.sinv_data, c.wavelength_data´, `c.fwhm_data c.camera_exposure c.cfa_data, c.dark_reference_data,
dm_method (str, optional) – {‘bilinear’, ‘DDFAPD’, ‘Malvar2004’, ‘Menon2007’} Demosaicing method. Default is ‘bilinear’. See the colour_demosaicing package for more info on the different methods.
keep_variables (list-like, optional) – List of variables to keep in the result, default None. If you wish to keep the intermediate data, pass the relevant names from fpipy.conventions.
- Returns
radiances – Includes computed radiance sorted by wavelength along with original metadata.
- Return type
-
fpipy.raw_to_reflectance(raw, whiteraw, keep_variables=None)[source]¶ Performs demosaicing and computes radiance from RGB values.
- Parameters
raw (xarray.Dataset) – A dataset containing the following variables: c.cfa_data, c.dark_reference_data, c.sinv_data, c.wavelength_data´, `c.fwhm_data c.camera_exposure
white (xarray.Dataset) – Same as raw but for a cube that describes a white reference target.
keep_variables (list-like, optional) – List of variables to keep in the result, default None. If you wish to keep the intermediate data, pass the relevant names from fpipy.conventions.
- Returns
reflectance – Includes computed radiance and reflectance as data variables sorted by wavelength or just the reflectance DataArray.
- Return type
-
fpipy.radiance_to_reflectance(radiance, white, keep_variables=None)[source]¶ Computes reflectance from radiance and a white reference cube.
- Parameters
radiance (xarray.Dataset) – Dataset containing the image(s) to divide by the references.
white (xarray.Dataset) – White reference image(s).
keep_variables (list-like, optional) – List of variables to keep in the result, default None. If you wish to keep the intermediate data, pass the relevant names from fpipy.conventions.
- Returns
reflectance – Dataset containing the reflectance and the original metadata for both datasets indexed by measurement type.
- Return type
-
fpipy.demosaic(cfa, pattern, dm_method)[source]¶ Perform demosaicing on a DataArray.
- Parameters
cfa (xarray.DataArray) – Array containing a stack of CFA images.
pattern (BayerPattern or str) – Bayer pattern used to demosaic the CFA.
dm_method (str) –
- Returns
- Return type
-
fpipy.subtract_dark(ds, keep_variables=None)[source]¶ Subtracts dark current reference from image data.
Subtracts a dark reference frame from all the layers in the given raw data and clamps any negative values in the result to zero. The result is stored in the dataset as the variable c.dark_corrected_cfa_data which is overwritten if it exists.
- Parameters
ds (xarray.DataSet) – Dataset containing the raw images in fpipy.conventions.cfa_data and the dark current reference measurement as fpipy.conventions.dark_reference_data.
keep_variables (list-like, optional) – List of variables to keep in the result, default None. If you wish to keep the dark reference data and/or the original raw images, pass a list including the variable names.
- Returns
Dataset with the dark corrected data as fpipy.conventions.dark_corrected_cfa_data
- Return type