ExtData¶
- class measure_extinction.extdata.ExtData(filename=None)[source]¶
Bases:
object
Extinction for a single line-of-sight
Atributes:
- typestring
extinction curve type (e.g., elx or alax)
- type_rel_bandstring
band name for relative extinction measurement (x in elx)
- red_filestring
reddened star filename
- comp_filestring
comparison star filename
- columnsdict of tuples of column measurements
measurements are A(V), R(V), N(HI), etc. tuples are measurement, uncertainty
- wavesdict of key:wavelengths
key is BAND, IUE, IRS, etc.
ext : dict of key:E(lambda-X) or A(lambda)/A(X) measurements
uncs : dict of key:E(lambda-X) or A(lambda)/A(X) measurement uncertainties
stds : dict of key:A(lambda)/A(X) standard deviations (only defined if the curve is an average of a set of curves, in which case the standard deviation is the spread of the sample around the population mean)
npts : dict of key:number of measurements at each wavelength
names : dict of key:names of names of each wavelength (if photometric bands)
- fm90list of FM90 parameters tuples
tuples are measurement, uncertainty
- modeldict of key:value with model fitting results, including
waves: np.ndarray with the wavelengths used in the fitting
exts: np.ndarray with the fitted powerlaw model to the extinction curve
residuals: np.ndarray with the fractional residuals, i.e. (data-fit)/fit
params: tuple with the parameters (amplitude, alpha) if data in A(lambda)/A(V) or (amplitude, alpha, A(V)) if data in E(lambda-V)
- Parameters:
- filenamestring, optional [default=None]
Full filename to a saved extinction curve
Methods Summary
calc_AV
([akav])Calculate A(V) from the observed extinction curve:
Calculate A(V) from the observed extinction curve:
calc_EBV
()Calculate E(B-V) from the observed extinction curve
calc_RV
()Calculate R(V) from the observed extinction curve
calc_elx
(redstar, compstar[, rel_band])Calculate the E(lambda-X) basic extinction measurement
calc_elx_bands
(red, comp[, rel_band])Calculate the E(lambda-X) for the photometric band data
calc_elx_spectra
(red, comp, src[, rel_band])Calculate the E(lambda-X) for the spectroscopic data
Fit the observed NIR extinction curve with a powerlaw model, based on the band data between 1 and 40 micron
fit_spex_ext
([amp_bounds, index_bounds, ...])Fit the observed NIR extinction curve with a powerlaw model, based on the SpeX spectra
get_fitdata
(req_datasources[, ...])Get the data to use in fitting the extinction curve
plot
(pltax[, color, alpha, alax, wavenum, ...])Plot an extinction curve
read
(ext_filename)Read in a saved extinction curve from a FITS file
rebin_constres
(source, waverange, resolution)Rebin the source extinction curve to a fixed spectral resolution and min/max wavelength range.
save
(ext_filename[, column_info, ...])Save the extinction curve to a FITS file
trans_elv_alav
([av, akav])Transform E(lambda-V) to A(lambda)/A(V) by normalizing to A(V) and adding 1.
trans_elv_elvebv
([ebv])Transform E(lambda-V) to E(lambda -V)/E(B-V) by normalizing by E(B-V)).
Methods Documentation
- calc_AV(akav=0.112)[source]¶
- Calculate A(V) from the observed extinction curve:
fit a powerlaw to the SpeX extinction curve, if available
otherwise: extrapolate the K-band extinction
- Parameters:
- akavfloat [default = 0.112]
Value of A(K)/A(V) default is from Rieke & Lebofsky (1985) van de Hulst No. 15 curve has A(K)/A(V) = 0.0885
- Returns:
- Updates self.columns[“AV”]
- calc_AV_JHK()[source]¶
- Calculate A(V) from the observed extinction curve:
extrapolate from J, H, & K photometry
assumes functional form from Rieke, Rieke, & Paul (1989)
- Returns:
- Updates self.columns[“AV”]
- calc_EBV()[source]¶
Calculate E(B-V) from the observed extinction curve
- Returns:
- Updates self.columns[“EBV”]
- calc_RV()[source]¶
Calculate R(V) from the observed extinction curve
- Returns:
- Updates self.columns[“RV”]
- calc_elx(redstar, compstar, rel_band='V')[source]¶
Calculate the E(lambda-X) basic extinction measurement
- Parameters:
- redstar:class:StarData
Observed data for the reddened star
- compstar:class:StarData
Observed data for the comparison star
- rel_bandstring
Band to use for relative extinction measurement default = “V”
- Returns:
- updates self.(waves, exts, uncs, npts, names)
- calc_elx_bands(red, comp, rel_band='V')[source]¶
Calculate the E(lambda-X) for the photometric band data
Separate from the spectral case as the bands in common must be found. In addition, some of the photometric observations are reported as colors (e.g., B-V) with uncertainties on those colors. As colors are what is needed for the extinction curve, we want to work in those colors to preserve the inheritly lower uncertainties.
- Parameters:
- red:class:StarData
Observed data for the reddened star
- comp:class:StarData
Observed data for the comparison star
- rel_bandstring
Band to use for relative extinction measurement default = “V”
- Returns:
- updates self.(waves, exts, uncs, npts, names)[‘BAND’]
- calc_elx_spectra(red, comp, src, rel_band='V')[source]¶
Calculate the E(lambda-X) for the spectroscopic data
- Parameters:
- red:class:StarData
Observed data for the reddened star
- star:class:StarData
Observed data for the comparison star
- srcstring
data source (see global _poss_datasources)
- rel_bandstring
Band to use for relative extinction measurement default = “V”
- Returns:
- updates self.(waves, exts, uncs, npts)[src]
- fit_band_ext()[source]¶
Fit the observed NIR extinction curve with a powerlaw model, based on the band data between 1 and 40 micron
- Returns:
- Updates self.model[“waves”, “exts”, “residuals”, “params”] and self.columns[“AV”] with the fitting results:
waves: np.ndarray with the wavelengths used in the fitting
exts: np.ndarray with the fitted powerlaw model to the extinction curve
residuals: np.ndarray with the fractional residuals, i.e. (data-fit)/fit
params: tuple with the parameters (amplitude, alpha) if data in A(lambda)/A(V) or (amplitude, alpha, A(V)) if data in E(lambda-V)
- fit_spex_ext(amp_bounds=(-1.5, 1.5), index_bounds=(0.0, 5.0), AV_bounds=(0.0, 6.0))[source]¶
Fit the observed NIR extinction curve with a powerlaw model, based on the SpeX spectra
- Parameters:
- amp_boundstuple [default=(-1.5,1.5)]
Model amplitude bounds to be used in the fitting
- index_boundstuple [default=(0.0,5.0)]
Powerlaw index bounds to be used in the fitting
- AV_boundstuple [default=(0.0,6.0)]
A(V) bounds to be used in the fitting
- Returns:
- Updates self.model[“waves”, “exts”, “residuals”, “params”] and self.columns[“AV”] with the fitting results:
waves: np.ndarray with the wavelengths used in the fitting
exts: np.ndarray with the fitted powerlaw model to the extinction curve
residuals: np.ndarray with the fractional residuals, i.e. (data-fit)/fit
params: tuple with the parameters (amplitude, alpha) if data in A(lambda)/A(V) or (amplitude, alpha, A(V)) if data in E(lambda-V)
- get_fitdata(req_datasources, remove_uvwind_region=False, remove_lya_region=False, remove_irsblue=False)[source]¶
Get the data to use in fitting the extinction curve
- Parameters:
- req_datasourceslist of str
list of data sources (e.g., [‘IUE’, ‘BAND’])
- remove_uvwind_regionboolean, optional (default=False)
remove the UV wind regions from the returned data
- remove_lya_regionboolean, optional (default=False)
remove the Ly-alpha regions from the returned data
- remove_irsblueboolean, optional (default=False)
remove the IRS blue photometry from the returned data
- Returns:
- (wave, y, y_unc)tuple of arrays
wave is wavelength in microns y is extinction (no units) y_unc is uncertainty on y (no units)
- plot(pltax, color=None, alpha=None, alax=False, wavenum=False, exclude=[], normval=1.0, yoffset=0.0, rebin_fac=None, annotate_key=None, annotate_wave_range=None, annotate_text=None, annotate_rotation=0.0, annotate_yoffset=0.0, annotate_color='k', legend_key=None, legend_label=None, fontsize=None, model=False)[source]¶
Plot an extinction curve
- Parameters:
- pltaxmatplotlib plot object
- colormatplotlib color [default=None]
color to use for all the data
- alphafloat [default=None]
transparency value (0=transparent, 1=opaque)
- alaxboolean [default=False]
convert from E(lambda-X) using A(X), if necessary plot A(lambda)/A(X)
- wavenumboolean [default=False]
plot x axis as 1/wavelength as is standard for UV extinction curves
- excludelist of strings [default=[]]
List of data type(s) to exclude from the plot (e.g., “IRS”, “IRAC1”,…)
- normvalfloat [default=1.0]
Normalization value
- yoffsetfloat [default=0.0]
additive offset for the data
- rebin_facint [default=None]
factor by which to rebin the extinction curve
- annotate_keystring [default=None]
type of data for which to annotate text (e.g., SpeX_LXD)
- annotate_wave_rangelist of 2 floats [default=None]
min/max wavelength range for the annotation of the text
- annotate_textstring [default=None]
text to annotate
- annotate_rotationfloat [default=0.0]
annotation angle
- annotate_yoffsetfloat [default=0.0]
y-offset for the annotated text
- annotate_colorstring [default=”k”]
color of the annotated text
- legend_keystring [default=None]
legend the spectrum using the given data key
- legend_labelstring [default=None]
label to use for legend
- fontsizeint [default=None]
fontsize for plot
- modelboolean
if set and the model exists, plot it
- read(ext_filename)[source]¶
Read in a saved extinction curve from a FITS file
- Parameters:
- filenamestring
Full filename of the saved extinction curve
- rebin_constres(source, waverange, resolution)[source]¶
Rebin the source extinction curve to a fixed spectral resolution and min/max wavelength range.
- Parameters:
- sourcestr
source of extinction (i.e. “IUE”, “IRS”)
- waverange2 element array of astropy Quantities
Min/max of wavelength range with units
- resolutionfloat
Spectral resolution of rebinned extinction curve
- Returns:
- measure_extinction ExtData
Object with source extinction curve rebinned
- save(ext_filename, column_info=None, save_params=None, fm90_best_params=None, fm90_per_params=None, p92_best_params=None, p92_per_params=None)[source]¶
Save the extinction curve to a FITS file
- Parameters:
- filenamestring
Full filename to save extinction curve
- column_infodict
dictionary with information about the dust column for example: {‘ebv’: 0.1, ‘rv’: 4.2, ‘av’: 0.42}
- save_paramsdict
“type” - type of parameters (e.g., FM90, P92) “best” - best fit parameters as tuple (names, values) “per” - percentile parameters as tuple (names, p50s, puncs, muncs)
- fm90_best_paramstuple of 2 float vectors
parameter names and best fit values for the FM90 fit (legacy, use save_params instead)
- fm90_per_paramstuple of 2 float vectors
parameter names and (p50, +unc, -unc) values for the FM90 fit (legacy, use save_params instead)
- p92_best_paramstuple of 2 float vectors
parameter names and best fit values for the P92 fit (legacy, use save_params instead)
- p92_per_paramstuple of 2 float vectors
parameter names and (p50, +unc, -unc) values for the P92 fit (legacy, use save_params instead)
- trans_elv_alav(av=None, akav=0.112)[source]¶
Transform E(lambda-V) to A(lambda)/A(V) by normalizing to A(V) and adding 1. If A(V) is in the columns of the extdata object, use that value. If A(V) is passed explicitly, use that value instead. If no A(V) is available, calculate A(V) from the input elx curve.
- Parameters:
- avfloat [default = None]
value of A(V) to use - otherwise take it from the columns of the object or calculate it
- akavfloat [default = 0.112]
Value of A(K)/A(V), only needed if A(V) has to be calculated from the K-band extinction default is from Rieke & Lebofsky (1985) van de Hulst No. 15 curve has A(K)/A(V) = 0.0885
- Returns:
- Updates self.(exts, uncs)