Module model
source code
Interface to stellar spectra library and functions to manipulate
them.
Make a plot of the domains of all spectral grids. First collect all
the grid names
>>> grids = get_gridnames()
Prepare the plot
>>> p = pl.figure()
>>> color_cycle = [pl.cm.spectral(j) for j in np.linspace(0, 1.0, len(grids))]
>>> p = pl.gca().set_color_cycle(color_cycle)
And plot all the grid points. We have to set some custom default
values for some grids.
>>> for grid in grids:
... vturb = 'ostar' in grid and 10 or 2
... t = 0.
... if 'marcs' in grid: t = 1.
... teffs,loggs = get_grid_dimensions(grid=grid,vturb=vturb,t=t)
... p = pl.plot(np.log10(teffs),loggs,'o',ms=7,label=grid)
Now take care of the plot details
>>> p = pl.xlim(pl.xlim()[::-1])
>>> p = pl.ylim(pl.ylim()[::-1])
>>> p = pl.xlabel('Effective temperature [K]')
>>> p = pl.ylabel('log( Surface gravity [cm s$^{-1}$]) [dex]')
>>> xticks = [3000,5000,7000,10000,15000,25000,35000,50000,65000]
>>> p = pl.xticks([np.log10(i) for i in xticks],['%d'%(i) for i in xticks])
>>> p = pl.legend(loc='upper left',prop=dict(size='small'))
>>> p = pl.grid()
]include figure]]ivs_spectra_model_grid.png]
|
|
list of str
|
|
|
|
|
|
(ndarray,ndarray)
|
|
(1Darray,1Darray,1Darray,3Darray,InterpolatingFunction)
|
get_grid_mesh(wave=None,
teffrange=None,
loggrange=None,
**kwargs)
Return InterpolatingFunction spanning the available grid of spectrum
models. |
source code
|
|
|
logger = logging.getLogger("SPEC.MODEL")
|
|
defaults = dict(grid= 'atlas', z=+ 0.0, vturb= 2, band= 'vis',...
|
|
basedir = 'spectables'
|
Set defaults of this module.
If you give no keyword arguments, the default values will be
reset.
|
Return a list of available grid names.
- Returns: list of str
- list of grid names
|
Retrieve the filename containing the specified SED grid.
Available grids and example keywords:
-
grid='fastwind': no options
-
grid='cmfgen': no options
-
grid='marcs': options c, atm (p or s)
-
grid='ostar2002': options z,v
-
grid='bstar2006a': options z,v
-
grid='bstar2006b': options z,v
-
grid='bstar2006': options z,v,a
-
grid='atlas': options z
-
grid='heberb': no options
-
grid='hebersdb': no options
-
grid='tmapsdb': no options
Details for grid 'bstar2006':
-
metallicity in Z/Z0 with Z0 solar.
z=0,0.001,0.01,0.033,0.1,0.2,0.5,1.,2
-
microturbulent velocity: v=2 or v=10 km/s
-
abundance: a='' or a='CN'. In the latter, the Helium abundance is
increased to He/H=0.2, the nitrogen abundance is increased by a
factor of 5, and the carbon abundance is halved (CNO cycle processed
material brought to the stellar surface)
Details for grid 'heberb': LTE Grid computed for B-type stars by Uli
Heber, reff: Heber et al. 2000
Details for grid 'hebersdb': LTE Grid computed for sdB stars by Uli
Heber, reff: Heber et al. 2000
Details for grid 'tmapsdb': NLTE Grid computed for sdB stars using the
TMAP (TUEBINGEN NLTE MODEL ATMOSPHERE PACKAGE) code. reff: Werner K., et
al. 2003 and Rauch T., Deetjen J.L. 2003
- Parameters:
grid (string) - gridname, or path to grid.
|
get_table(teff=None,
logg=None,
vrad=0,
vrot=0,
**kwargs)
| source code
|
Retrieve synthetic spectrum.
Wavelengths in angstrom, fluxes in eddington flux: erg/s/cm2/A.
It is possible to rotationally broaden the spectrum by supplying at
least 'vrot' and optionally also other arguments for the rotation.rotin
function. Supply vrot in km/s
It is possibility to include a radial velocity shift in the spectrum.
Supply 'vrad' in km/s. (+vrad means redshift). Uses
spectra.tools.doppler_shift
|
Retrieve possible effective temperatures and gravities from a
grid.
- Returns: (ndarray,ndarray)
- effective temperatures, gravities
|
get_grid_mesh(wave=None,
teffrange=None,
loggrange=None,
**kwargs)
| source code
|
Return InterpolatingFunction spanning the available grid of spectrum
models.
WARNING: the grid must be entirely defined on a mesh grid, but it does
not need to be equidistant.
It is thus the user's responsibility to know whether the grid is
evenly spaced in logg and teff
You can supply your own wavelength range, since the grid models'
resolution are not necessarily homogeneous. If not, the first wavelength
array found in the grid will be used as a template.
It might take a long a time and cost a lot of memory if you load the
entire grid. Therefore, you can also set range of temperature and
gravity.
- Parameters:
wave (ndarray) - wavelength to define the grid on
teffrange (tuple of floats) - starting and ending of the grid in teff
loggrange (tuple of floats) - starting and ending of the grid in logg
- Returns: (1Darray,1Darray,1Darray,3Darray,InterpolatingFunction)
- wavelengths, teffs, loggs and fluxes of grid, and the
interpolating function
|
defaults
- Value:
dict(grid= 'atlas', z=+ 0.0, vturb= 2, band= 'vis', t= 0.0, a= 0.0, c=
0.5, atm= 'p')
|
|