4.2. sed.py Documentation
4.2.1. SEDTools class
- class twinkle.sed.SEDTools[source]
Bases:
objectSEDTools has functions to aid in modeling an SED of an astronomical source creates bandpass objects, converts stellar magnitudes to flux in cgs units, convolves flux with said bandpasses and calculates (for now) simple blackbody and stellar photosphere from Grids. Amongst a bunch of other things.
- Jy2cgs(fluxNu, freq, lam=None)[source]
To convert flux in Jansky to \(\mbox{erg}/\mbox{cm}^2/s/A\) It assumes the wavelength is in Angstroms.
- Parameters:
fluxNu (tuple(float/array,float/array)) – flux and uncertainty in Jansky
freq (tuple(float,float)) – frequency and uncertainty in freq in Hz
lam (tuple(float,float), optional) – Wavelength in angstroms and corresponding uncertainty. If freq is None, then this will be used to calculate a frequency.
- Returns:
A tuple with the flux and conversion error (Flux, dFlux) in \(\mbox{erg}/\mbox{cm}^2/s/A\).
- Return type:
(tuple)
- NBlackBody(lambda_, p0, su2ea1=1, bands=None, units='angstrom', bulk=False, **kwargs)[source]
Computes the total emission from multiple blackbody spectra.
This function calculates the combined blackbody radiation spectrum for multiple blackbody components, each defined by its temperature and scaling factor. The input parameters
p0should contain pairs of values representing each blackbody’s temperature and normalization factor.Raises SystemExit if the length of p0 is not even, indicating incomplete blackbody parameter pairs.
- Parameters:
lambda_ (arr) – Wavelength array over which the blackbody radiation is computed.
p0 (list/arr) – A flat list containing pairs of values, where each pair represents [temperature, normalization factor] for one blackbody component. The length of
p0must be even, as each blackbody requires two parameters.su2ea1 (float, optional) – Scaling factor for the unit conversion. Default is 1.
bands (arr, optional) – Spectral bands over which to integrate the blackbody spectrum. Default is None.
units (str, optional) – Wavelength units (‘angstrom’, ‘nm’, etc.). Default is ‘angstrom’.
bulk (bool, optional) – If True, performs bulk processing for efficiency. Default is False.
kwargs (dict) – Additional keyword arguments passed to the
SEDTools.blackbody()function.
- Returns:
Combined blackbody spectrum calculated as the sum of individual blackbody components.
- batch_mag2fluxAB(band_list, abmags, abmagserr)[source]
Tools to convert from AB mags to fluxes. returns a Dictionary of fluxes and flux errors with keys from input list.
- Parameters:
band_list (list) – strings with magnitude names (ex: [‘mv1’,’mv2’,…,’mvn’])
abmags/abmagserr (dict) – dictionary of magnitude/error in AB mag format with keys ‘mvi_AB’ or ‘mvi_ABerr’ for errors
- Returns:
- dictionaries of converted AB mag to fluxes and separate
dict for flux errors \(\mbox{erg}/\mbox{cm}^2/s/Hz\).; keys: ‘mvi_flux’
- Return type:
(dict)
- batch_mag2fluxZPLam(band_list, Vmags, Vmagserr)[source]
Converts mag to flux using mag2fluxZP using zero point fluxs. for multiple bands all at once. Uses mag2fluxZPLam.
- Parameters:
band_list (list) – list of strings with magnitude names (ex:[‘mv1’,’mv2’,…,’mvn’])
Vmags/Vmagserr (dict) – magnitude/error in Vega Mag format with keys ‘mvi’ for both mag and errors.
- Returns:
dictionaries of converted Vega magnitude to fluxes and associated errors in units of \(\mbox{erg}/\mbox{cm}^2/s/A\).
- Return type:
(dict, dict)
- batch_vega2AB(mag_list, vegaMag, vegaMagErr)[source]
Converts all the vega magnitudes in vegaMag and associated errors in vegaMagErr to AB magnitudes.
- Parameters:
mag_list (list) – List of strings with passband name
vegaMag (dict) – Vega magnitudes in mag_list
+Err – Vega magnitudes in mag_list
- blackbody(lambda_, p0, su2ea1=1, bands=None, units='angstrom', bulk=False, **kwargs)[source]
To calculate the blackbody irradiance in units of cgs Flux \(\mbox{erg}/\mbox{cm}^2/s/A\). This module assumes projected emission from a source, so solid angle = pi. All physical constants are in units to facilitate this. Wavelength must be in units of angstrom, microns, cm, or meters. They will be converted to cm to carry out the
calculation.
- Parameters:
lambda_ (arr) – wavelengths
p0 (arr/list) –
Td, Rd
Td - dust temperature in Kelvin
Rd - dust radius in AU
su2ea1 – Partial flux normalization. Incorporates distance to the star, and assumes 1 AU radius: \(R_d[AU]/dist[pc]\) in natural units - \(\mbox{AU2cm}^2/(\mbox{distance}\times\mbox{pc2cm})^2\)
units (str) – input units
angstrom,micron,meters,cmbands
bulk (bool)
- Returns:
returns flux of blackbody at fitted temperature.
- Return type:
(arr)
- calcBBTemp(T0, lamArr, flxArr)[source]
Calculates the temperature of the blackbody flux Assumes Flux in units of \(\mbox{erg}/\mbox{cm}^2/s/A\) and returns temperature in kelvin. To be used in conjunction with Newton-Raphson algorithm
- Parameters:
T0
lamArr
flxArr
Returns:
- calcModTemp(T0, lam0, lamArr, flxArr)[source]
Calculates the temperature of a modified blackbody with a power law assuming the power index has been parametrized and the ratio of two fluxes are taken. The Flux is in \(\mbox{erg}/\mbox{cm}^2/s/A\) and wavelength in cm. This is to be used in conjunction with a Newton-Raphson/Bisecting algorithm to find zeros for the temperature equation.
- Parameters:
T0 (float) – temperature in kelvin
lam0 (float) – target wavelength
lamArr (arr) – wavelength array
flxArr (arr) – flux array
- Returns:
function
- calcRJ_spectrum(xarr, yarr)[source]
Calculate Rayleigh-Jeans extension of the input spectrum array
- Parameters:
xarr (arr) – wavelength array
yarr (arr) – flux array
- Returns:
slope and y-intercept in the log-space of the RJ tail.
- calc_grids(lambda_, p0, su2ea1=1, griddata=None, tempArr=None, mag2use=None, resample=True, **kwargs)[source]
Returns array of flux values at input wavelength array interpolated at T0.
- Parameters:
lambda_ (arr/float) – wavelength values where flux will be calculated
T0 (float) – Temperature in Kelvins to determine best grid flux
su2ea1 (float) – factor that includes the \(\mbox{distance}^2\) to convert from surface to earth flux: :math:`1/mbox{radius}^2 times (mbox{radius}/mbox{dist})^2
griddata (tuple) – wavelength and flux arr in a 2-element tuple created from
DataLogistics.get_[model]Grids(), where model is either ATLAS9 or NextGen.tempArr (arr) – Array of increasing temperature values mapped to those found in
griddata.mag2use (arr) – Array of strings with names of photometric magnitude bands where fluxes are calculated. Required to call passband object.
- Returns:
Array of fluxes calculated at argument wavelengths in units of \(\mbox{erg}/\mbox{cm}^2/s/A\)
- calc_temp(y, yerr, x, temparr, kw_cor)[source]
Calculate the residuals between the input fluxes and predicted fluxes… i think
- Parameters:
y (arr) – fluxes
yerr (arr) – uncertaintiy in fluxes
x (arr) – string array denoting bands
temparr (arr) – arrays of temperatures
kw_cor (dict) – stuff from load_wfcorrection
- Returns:
residuals, flux normalized to blackbody fluxes, and array of chi2 calculations.
- cgs2Jy(flux, dflux, band=None, wave=None, nu=None)[source]
- To convert specific flux from \(\mbox{erg}/\mbox{cm}^2/s/A\) to Jy.
It assumes input wavelength is in Angstroms
- Parameters:
nu (float) – frequency in Hz to convert to Jansky.
wave (float) – wavelength in Angstroms
flux (arr) – flux in \(\mbox{erg}/\mbox{cm}^2/s/A\)
band (passband obj) – any of the
SEDTools.[band_id]pbandwave – wavelength in angstroms(???)
nu – frequency in …(??)
- Returns:
flux density in Janskies.
- Return type:
(tuple)
- create_passbands(RSRFile=None, flat=False, waverange=(None, None), cntr=None)[source]
Returns passband objects (no input) for all bands in this function.
You can serparately enter the RSRFile name along with wavelength units to create your own passband object. Above rules apply. Wavelength is automatically converted to Angstroms.
- Parameters:
RSRFile (str) – File name that contains the RSR information
flat (bool) – When set True, will let you create a flat spectrum
waverange (tuple) – 2 float elements. These need to be initiated to the min and max wave of the flat spectrum
cntr (float) – center or isophotal wavelength of the flat bandpass.
- doubleBB(lambda_, p0, su2ea1=1, bands=None, units='angstrom', bulk=False, **kwargs)[source]
Computes the combined spectrum of two blackbody components.
This function calculates the total emission spectrum resulting from the sum of two blackbody radiation spectra. Each blackbody component is defined by its temperature and scaling factor, provided in the input parameter p0.
Note
This function assumes exactly two blackbody components and requires four parameters in p0.
- Parameters:
lambda_ (arr) – Wavelength array over which the blackbody radiation is computed.
p0 (arr/list) – A list containing four values; [temperature1, normalization1, temperature2, normalization2]. The first pair is for the first blackbody, and the second pair is for the second blackbody.
su2ea1 (float, optional) – Scaling factor for the unit conversion. Default is 1.
bands (arr, optional) – Spectral bands over which to integrate the blackbody spectrum. Default is None.
units (str, optional) – Wavelength units (‘angstrom’, ‘nm’, etc.). Default is ‘angstrom’.
bulk (bool, optional) – If True, performs bulk processing for efficiency. Default is False.
kwargs (dict) – Additional keyword arguments passed to the
SEDTools.blackbody()function.
- Returns:
The combined spectrum of the two blackbody components.
- fit_photosphere(xlam, yfluxdat, p0, su2ea2, modinfo, magfit, func, MegaGridModels)[source]
Find the best fit photospheric model to the photometric data. Fits are done using mpfit (Levenberg-Marquardt algorithm).
- Parameters:
xlam (arr) – Strings of wavelength identifiers of the bands that are going to be used to fit.
yfluxdat (arr) – Flux of the data at wavelengths in xlam to be fit.
p0 (arr) – Initial Args for temperature and stellar radius. Temperature is required, Radius is not.
su2ea2 (float) – Scaling factor \(R_{\mbox{sun}}^2/d_{\mbox{star}}^2\)
modinfo (str) – Which model type to use based on (model name, log(g), metallicity) to be used as keys in MegaGrid.
magfit (dict) – String arrays of band identifiers keyed by
photmags(bands used to fit the model) and ‘scalemags’ (which bands to use to scale the raw stellar flux to observed flux to first order).func (obj) – Function to use to fit the data.
MegaGridModels (dict) – all atmospheric grid models with metallicity, grav, and temperature keys.
- Returns:
Fitted stellar radius, temperature and mpfit object.
- fluxZPLam2mag(band, flux, fluxErr)[source]
Convert input flux which should be in units of \(\mbox{erg}/\mbox{cm}^2/s/A\) to vega magnitudes using the zero point fluxes for each bandpass listed in the RSR file and hence the passband object
- Parameters:
band (obj) – passband object
flux (float) – Flux density in \(\mbox{erg}/\mbox{cm}^2/s/A\)
fluxErr (float) – error assosciated wiht the input flux
- Returns:
mag, magerr in vega magnitudes
- get_eff_wavelengths(mag_list)[source]
Returns dictionary of central wavelength’s listed in mag_list Contingent on passband objects being created in create_passbands. Returns isophotal wavelength in RSR headers or calculates effective/pivot wavelength if isowavelength is unavailable (Tokunanga & Vacca 2005).
- Parameters:
mag_list (list) – list of strings with keys corresponding to band from which to extract wavelength. If mag_list = [‘mv1’,’mv2’,…,’mvN’], then wave[i] =
Star.[mv1]pband.isoWavelength(). Check to see which RSR bands are available.- Returns:
dictionary of keys:val such that keys=mvi & val are the iso/pivot wavelengths (Angstroms).
- Return type:
(dict)
- indSandwhich(t0, arr)[source]
Gives the indices of the array (
arr) surrounding the target temperaturet0to within 3 grid spaces for effective interpolation. I mean, this can be used for any array – not just SED stuff.- Parameters:
t0 (float) – Target temperature in Kelvin
arr (arr) – array that contains the target temperature.
Returns: +/- 3 indexes to the left and right of the target value.
- mag2Jy(band, mag, magerr)[source]
Convert magnitudes to Janskies
- Parameters:
band (str) – any of the band designations in
SEDTools.create_passbands()mag (float) – photometric measurement in vega mags
magerr (float) – associated mag uncertainty
- Returns:
flux and uncertainty in Jansky.
- Return type:
tuple - (arr, arr)
- mag2fluxAB(band, abmags, abmagserr)[source]
Does the same thing as
SEDTools.batch_mag2flux()except only takes one band and can be applied to multiple measurements in the same band to produce a flux- Parameters:
band (obj) – strings with magnitude names (ex: [‘mv1’,’mv2’,…,’mvn’])
abmags/abmagserr (dict) – dictionary of magnitude/error in AB mag format with keys ‘mvi_AB’ or ‘mvi_ABerr’ for errors
- Returns:
dictionaries of converted AB mag to fluxes and separate dict for flux errors \(\mbox{erg}/\mbox{cm}^2/s/A\).; keys:
mvi_flux- Return type:
(dict, dict)
- mag2fluxZPLam(band, Vmag, VmagErr, sysErr=False)[source]
Converts the input vega magnitude to specific flux in \(\mbox{erg}/\mbox{cm}^2/s/A\) using the zero point fluxes obtained from the passband file from literature.
- Parameters:
band (obj) – passband object
Vmag (float) – Vega magnitude
VmagErr (float) – error associated with Vega Magnitude)
sysErr – (bool) Includes the given bandpasses photospheric calibration systematic uncertainty found in the RSR text file. Set to True if this error needs to be added in quadrature to the total integrated flux uncertainty. Default is False
- Returns:
flux, fluxerr in \(\mbox{erg}/\mbox{cm}^2/s/A\)
- mag2fluxZPNu(band, Vmag, VmagErr, sysErr=False)[source]
Converts the input vega magnitude to specific flux in \(\mbox{erg}/\mbox{cm}^2/s/Hz\) using the zero point fluxes obtained from the passband file from literature. For this module, the zero point fluxes in frequency need to be there otherwise this won’t work.
- Parameters:
band (obj) – passband object
Vmag (float) – Vega magnitude
VmagErr (float) – error associated with Vega Magnitude)
sysErr (bool) – Includes the given bandpasses photospheric calibration systematic uncertainty found in the RSR text file. Set to True if this error needs to be added in quadrature to the total integrated flux uncertainty. Default is False
- Returns:
flux, and flux uncertainties in \(\mbox{erg}/\mbox{cm}^2/s/Hz\)
- Return type:
list
- modifiedBB(lambda_, p0, su2ea1=1, bands=None, units='angstrom', **kwargs)[source]
Calculates a modified blackbody function given a powerlaw in conjunction with
SEDTools.blackbody()- Parameters:
peaks. (lam0 = wavelength at which emission)
- Returns:
modified blackbody flux
- photosphere(p0, su2ea2, modelinfo, MegaGridModels, wave=(2000, 10000000.0), gridpts=10000)[source]
Calculates the photospheric emission line from grid models given relevant Args and griddata and temperature array, and range of wavelength to calculate emission for. Usually this should not exceed the limits for the grid models. If limits are exceeded flux is extrapolated linearly in log-log space, following Rayleigh-Jeans law.
- Parameters:
p0 (arr) – Args to be passed to
SEDTools.calc_grids().su2ea2 (float) – Normalization to be passed to
SEDTools.calc_grids().modelinfo (arr) – Multi-dimensional array to be passed to
SEDTools.calc_grids()wave (tuple/arr) – tuple or array of 2 elements; min and max of wavelength for flux to be calculated. Be consistent with units. (angstroms)
gridPts (int) – Integer value for how many grid points you want returned (aka resolution)
MegaGridModels (dict) – all atmospheric grid models with metallicity, grav, and temperature keys.
- Returns:
wavelength and photospheric flux arrays
- Return type:
(tuple)
- rsr_eflux(pband, lambda_, flux, flux_up, flux_down, report_type='avg')[source]
Calculates the integrated flux filtered through a particluar passband, as well as the upper and lower limits of the flux to give a 1 sigma uncertainty based on the fit Args uncertainties
- Parameters:
pband (obj) – passband object for a given photometric band created from Bandpass class
lambda_ (arr) – Wavelengths in Angstroms range of flux to be calculated. Range should be atleast the extent of pband
flux (arr) – Fluxes of main fit
flux_up (arr) – Fluxes of upper limit of fit.
flux_down (arr) – Fluxes of lower limit of fit.
report_type (str) – either
avgto report average of uncertainties orboth
- Returns:
flux at the particular band and uncertainties. If
avg, returns 2 element array (flux, eflux). Ifboth, returns 3 element array (flux, eflux_low, eflux_high)
- rsr_flux(pband, lambda_, flux)[source]
Calculates integreated flux filtered through a passband object
\[F_{full} = \frac{\int F_\lambda\ \mbox{RSR}_\lambda\ \lambda\ \delta\lambda}{\int \mbox{RSR}_\lambda\ \lambda\ \delta\lambda}\]- Parameters:
pband (obj) – passband object for a given photometric band created from Bandpass class
lambda_ (arr) – Wavelengths in Angstroms range of flux to be calculated. Range should be atleast the extent of pband
flux (arr) – Fluxes mapped to lambda_ in \(\mbox{erg}/\mbox{cm}^2/s\)?
- Returns:
Integrated flux over the specified bandpass as float or array. Integration is done using Simpson’s rule for integration such that:
- scaleSED2bands(scbdlist, usebdlist, yphot, fluxm, fluxme, synflux)[source]
Use this to scale the fitted stellar SED to a set of particular bands for whatever reason.
- Parameters:
scbdlist (arr) – strings of band identifiers to scale the fitted photosphere.
usebdlist (arr) – all the bands that are used.
yphot (float) – fitted photospheric flux
fluxm (arr) – broad band photometric data for all bands in usebdlist
fluxme (arr) – uncertainties in fluxm
synflux (arr) – synthetic photospehric flux at each band in usebdlist.
- Returns:
factor calculated to scale the SED yphot : scaled flux array yphot_unsc: pre-scaled flux RJ_On: boolean to tell you whether this was done – not sure why I still have this.
- Return type:
phot_norm_fac
- scale_wavelength(lambda_, units='micron')[source]
Rescales the wavelength lambda_ to cm
- Parameters:
lambda_ (float/arr) – wavelength value(s)
units (str) – units of input lambda_
- Returns:
wavelength in centimeters.
- vega2AB(band, m_vega)[source]
Module to convert photometric magnitudes into AB mag system. AB magnitude is defined such that the monochromatic flux is measured in \(\mbox{erg}/\mbox{cm}^2/s/Hz\). i.e., \(\mbox{AB} = -2.5 \log(f_{cgs}) - 48.6\) , such that for any filter, the zero point mag corresponds to a flux density of 3631 Jy.
Note
2MASS: TAKEN FROM ODENWALD ET AL. 2003 Analysis of the Diffuse Near-Infrared Emission from 2MASS Deep Integration Data: Foregrounds versus the Cosmic Infrared Background
WISE: http://wise2.ipac.caltech.edu/docs/release/allsky/expsup/
- Parameters:
band (str) – Which pass band.
m_vega (float/array) – Vega magnitudes
- Returns:
AB converted magntidues as same format as input
m_vega
- wienTEMP(lambda_, units='micron')[source]
Calculates the maximum temperature of a blackbody at a given wavelength using Wien’s law.
To calculate the blackbody irradiance in units of cgs Flux \(\mbox{erg}/\mbox{cm}^2/s/A\). This module assumes projected emission from a source, so solid angle = pi. All physical constants are in units to facilitate this. Wavelength must be in units of
angstrom,microns,cm, ormeters. They will be converted to cm to carry out the calculation.- Parameters:
lambda_ (float/arr) – reference wavelength(s) to calculate blackbody temperature.
units (str) – describes reference wavelength unit. All values in lambda_ have to be the same. Allowed units are
angstrom,microns,cm,meters. Units will be converted to cm for ease of calculation.
- Returns:
Temperature in Kelvin.
- Return type:
(float)
4.2.2. DataLogistics class
- class twinkle.sed.DataLogistics(jfile=None)[source]
Bases:
objectSet of tools to help with the logistical aspect of loading and managing the user input data, empirical stellar colors, and atmospheric grid files.
- loadAllModels()[source]
Load all the unique stellar photospheric models based on the input star file and all the options that are needed. Everything is sorted in a dictionary with keys of (model, log(g), metallicity) in the :attr:DataLogistics.MegaGrid class variable.
- loadAllStars(starfile, changekeys)[source]
Deprecated since version 1.1: Use
loadAllStarsExcel()instead.Loads all data into a dictionary from starfile. If changekeys is active, it will try to replace the saturated corrected photometry keywords to standard WISE keywords.
Unsaturated WISE photometry can be corrected using procedures found in Patel,+2014.
Need to add in part about self-correcting the photometry instead of relying on input. :param starfile: file name and path :type starfile: str :param changekeys ():
- loadAllStarsExcel(starfile, sheet_name=1, changekeys=True)[source]
Loads all data into a dictionary from starfile. If changekeys is active, it will try to replace the saturated corrected photometry keywords to standard WISE keywords.
Data is stored in the
DataLogistics.StarsDatclass attribute.Unsaturated WISE photometry can be corrected using procedures found in Patel,+2014.
Need to add in part about self-correcting the photometry instead of relying on input.
- Parameters:
starfile (str/pathfile) – file name and path
sheet_name (str) – Which sheet in the file to use. Default is the first one
changekeys (bool) – Whether to replace the WISE saturated corrected photometry keywords to standard WISE keywords.
4.2.3. GridModels class
- class twinkle.sed.GridModels[source]
Bases:
object- static get_ATLAS9Grids(grav, met, model='ATLAS9', ext='.fits')[source]
- Parameters:
grav (str,str) – gravity and metallity values associated with files for given model –> must match format for the models as indicated in their respective readme files.
met (str,str) – gravity and metallity values associated with files for given model –> must match format for the models as indicated in their respective readme files.
model (str) – Model name. Should be same name as the directory all grids are located.
ext (str) – Grid file extensions.
- Returns:
(tuple); (lam_arr_all, flux_arr_all, temparr)
lam_arr_all: (1X N x M)-D numpy array with N wavelength pointsfor
each M temperature in the specified grav and met range.
- flux_arr_all: (1xNxM)-D numpy array with N flux points from grid
model to each wavelength point in lam_arr_all for each M
temperature for the specified met and grav.
- temparr: (1xM) numpy array of sorted temperatures from grid models
with values divided by 1000.
[wavelength]: angstroms
[flux] : \(\mbox{erg}/\mbox{cm}^2/s/A\)
[temperature]: Kelvin/1000.
- static get_NextGenGrids(grav=None, met=0, model='NextGen', ext='.txt')[source]
- Parameters:
grav (str,str) – gravity and metallity values associated with files for given model –> must match format for the models as indicated in their respective readme files.
met (str,str) – gravity and metallity values associated with files for given model –> must match format for the models as indicated in their respective readme files.
model (str) – Model name. Should be same name as the directory all grids are located.
ext (str) – Grid file extensions.
- Returns:
(lam_arr_all, flux_arr_all, temparr)
lam_arr_all: \((1 \times N \times M)\)-D numpy array with
N-wavelength points for each M temperature in the specified grav and met range.
- flux_arr_all (arr): (1xNxM)-D numpy array with N flux points from
grid model to each wavelength point in lam_arr_all for each M temperature for the specified met and grav.
- temparr (arr): (1xM) numpy array of sorted temperatures from grid models
with values divided by 1000.
[wavelength] (arr): angstroms
[flux] (arr): \(\mbox{erg}/\mbox{cm}^2/s/A\)
[temperature] (arr): Kelvin/1000.
The grids are unevenly spaced, so filler ‘nan’s are placed in both the wavelength and flux points to make things run smoothly.
- Return type:
(tuple)
- treat_NextGenSpecModels(met=0, grav='all', ext='.spec')[source]
Use this in order to convert the raw files of the NextGen atmospheric models (i.e. “.spec” files) from France Allard’s page. The raw files are listed as such: low-res: low-resolution (100-25,000A at 2A) spectra (directly from the model iterations) Obtained from: ftp://ftp.hs.uni-hamburg.de/pub/outgoing/phoenix Spectrum files: Wavelengths are in vacuum, fluxes and BB(Teff) are in cgs (erg/s/cm^2/cm) (yes, that is correct. NOT in erg/s/cm^2/A). Also note that the fluxes and BB’s are given directly, NOT as log10 as in previous versions of the model grid.
line1: Teff logg [M/H] of the model Wavelength, flux and bbflux are stacked. This is not a column wise file. This module assumes all files have been unzipped. It does not discriminate with respect to temperature, although selections can be made to transform grids of a given solar metallicity and gravity.
Warning
THERE EXIST POINTS IN THE GRIDS THAT CORRESPOND TO THE SAME DATA POINT IN BOTH LAM AND FLUX SPACE – PROCEED WITH CAUTION IF NAN’S OCCUR
- Parameters:
met (str/float) – “All” will choose files for all metallicities. Input of a number from the models will select files of that metallicity.
grav – Same as met
ext – What the original extension of the raw files are. I suggest to keep them as .’spec’
- Returns:
Individual ascii files of the grids, two column of wavelength and F_lam as in the raw files.
File names: ‘lte_temp_grav_met.txt’ Flam units: \(\mbox{erg}/\mbox{cm}^2/s/A\) Wavelength: Angstrom
4.2.4. Bandpass class
- class twinkle.sed.Bandpass(fileName, normalise=True, inputUnits='angstroms')[source]
Bases:
object- fluxVegaZeroPointLam()[source]
Extracts the zero point fluxes and related uncertainties from the bandpass if it’s there. Otherwise it throws and error and lets you know you are now attached to another object by an inclined plane, wrapped helically around an axis. The information is kept in the header file that looks like # !N1[0,f]/ N2[1,f]/ N3[2,f]/ where N1 is the isophotal wavelength and the N2, N3 are the zero point fluxes respectively.
- isoWavelength()[source]
Extracts the isophotal wavelength from the bandpass file if it’s there. Otherwise it uses the calculated effective wavelength of the bandpass. The isophotal wavelength is kept under # !NNNNN.NN[0,f]/ in the first line of the bandpass file.
- metaPassDat(dfile)[source]
This will extract the first line in the RSR data files that contains the zero point wavelengths, frequencies and fluxes, denoted by the string ‘#!’
- Parameters:
dfile – string that points to the file name of the RSR bandpass.
- Returns:
list of zero point data. Check readme file in RSR file for more information.