TransmissionCurve

class simcado.spectral.TransmissionCurve(filename=None, lam=None, val=None, **kwargs)[source]

Bases: object

Very basic class to either read in a text file for a transmission curve or take two vectors to make a transmission curve

Parameters
filenamestr, optional

The path to the file containing wavelength and transmission data where the first column is wavelength in [um] and the second is the transmission coefficient between [0,1].

Alternatively this data can be passed directly. If filename is not provided, lam= and val= must be passed

lamarray, optional

[um] Wavelength bins in a 1D numpy array of length n

valarray, optional

[0 .. 1] The transmission coefficients

Returns
TransmissionCurve object

Methods Summary

filter_info(self)

Returns the filter properties as a dictionary

filter_table(self)

Returns the filter properties as a astropy.table

normalize(self[, val, mode])

Normalize the spectral curve

plot(self, \*\*kwargs)

Plot the transmission curve on the current axis

resample(self, bins[, action, use_edges, …])

Resamples both the wavelength and value vectors to an even grid.

Methods Documentation

filter_info(self)[source]

Returns the filter properties as a dictionary

filter_table(self)[source]

Returns the filter properties as a astropy.table

Notes

ONLY works if filter files have the SimCADO header format

The following keywords should be in the header:

author
source
date_created
date_modified
status 
type
center
width
blue_cutoff
red_cutoff
normalize(self, val=1.0, mode='integral')[source]

Normalize the spectral curve

Parameters
valfloat, optional

The value to normalise to. Default is 1.

modestr, optional
  • “integral” normalizes the integral over the defined

    wavelength range to val (default: 1.)

  • “maximum” normalizes the maximum over the defined

    wavelength range to val (default: 1.)

plot(self, **kwargs)[source]

Plot the transmission curve on the current axis

The method accepts matplotlib.pyplot keywords.

resample(self, bins, action='average', use_edges=False, min_step=None, use_default_lam=False)[source]

Resamples both the wavelength and value vectors to an even grid. In order to avoid losing spectral information, the TransmissionCurve resamples down to a resolution of ‘min_step’ (default: 0.01nm) before resampling again up to the given sampling vector defined by ‘bins’.

Parameters
binsfloat or array of floats
[um]: float - taken to mean the width of bins on an even grid
array - the centres of the spectral bins
  • the edges of the spectral bins if use_edges = True

actionstr, optional

[‘average’,’sum’] How to rebin the spectral curve. If ‘sum’, then the curve is normalised against the integrated value of the original curve. If ‘average’, the average value per bin becomes the value for each bin.

use_edgesbool, optional

[False, True] True if the array passed in ‘bins’ describes the edges of the wavelength bins. Default is False

min_stepfloat, optional

[um] default=1E-4, the step size for the down-sample

use_default_lambool, optional

Default is False. If True, bins is ignored and the default wavelength range is used as the resampling grid.