enpt.model package



enpt.model.srf module

EnPT module for handling spectral response functions.

class enpt.model.srf.SRF(wvl_unit: str = 'nanometers', wvl_min: float = 400, wvl_max: float = 2500, specres_nm: float = 1, format_bandnames: bool = False, v: bool = False)[source]

Bases: object

SRF instance provides SRF functions, wavelength positions, etc..

  • wvl_unit – the wavelengths unit to be used within SRF instance (‘nanometers’ or ‘micrometers)

  • wvl_min

  • wvl_max

  • specres_nm – output spectral resolution of SRFs in nanometers

  • format_bandnames – whether to format default strings from LayerBandsAssignment as ‘B01’, ‘B02’ etc..

  • v – verbose mode

static compute_gaussian_srf(cwl: float, fwhm: float, wvl_min: float, wvl_max: float, wvl_res: float, normalize: bool = True) ndarray[source]

Compute a spectral response function based on center wavelength and band width using on a gaussian curve.

  • cwl – target center wavelength position

  • fwhm – target band width (full width half maximum)

  • wvl_min – minimum wavelength to compute spectral response for

  • wvl_max – maximum wavelength to compute spectral response for

  • wvl_res – spectral resolution at which spectral response is to be computed

  • normalize – whether to normalize the output spectral response to values between 0 and 1


2D numpy.ndarray: rows: response per wavelength; columns: wavelength/response


Convert the wavelength unit to nanometers if they are in micrometers or vice versa.

classmethod from_cwl_fwhm(cwls: Union[list, ndarray], fwhms: Union[list, ndarray], **kwargs: dict) SRF[source]

Create an instance of SRF based on center wavelength positions and band widths (using gaussian responses).

  • cwls – center wavelength positions

  • fwhms – band widths

  • kwargs – Keyword arguments to be passed to SRF.__init__().


SRF instance

plot_srfs(figsize: tuple = (15, 5), band: Optional[Union[str, List[str]]] = None, normalize: bool = True)[source]

Show a plot of all spectral response functions.

  • figsize – figure size of the plot

  • band – band key to plot a single band instead of all bands

  • normalize – normalize SRFs to 0-1 (default: True)

Module contents

EnPT module ‘model’, containing all kinds of data models.