beatlas: module of BeAtlas tools

PyHdust beatlas module: BeAtlas specific variables and functions.

Module contains: - BAstar class - BAmod class

license:GNU GPL v3.0
class pyhdust.beatlas.BAmod(f0)[source]

BeAtlas disk model filename structure.

It could be f0.split(‘_’), but the f0.find(‘_X’) way was chosen.

See that the parameters sequence is not important for this reading (this may not be the case of other routines). And, by definition, the source star has a specific name added at the end of disk model name, starting with ‘Be_’.

build(ctrlarr, listpars)[source]

Set full list of parameters.


Find index of current model in minfo array.

class pyhdust.beatlas.BAstar(f0)[source]

BeAtlas source star filename structure.

The filename must follow this structure (the sequence in filename is not importante): - keys: [‘M’, ‘ob’, ‘H’, ‘Z’, ‘b’] - last-key (no identifier): ‘Ell’

See BAmod, phc.keys_values.

pyhdust.beatlas.check_xdr_limits(xdrminfo, todel=[])[source]

Check if the XDR file contains models for all parameters within their maximum interval.

todel: list for dimensions to be skipped in the test. -1 is usually the cossine of the observer’s inclination angle. If dim=-1 has values from 0 to 1, it is automatically skipped.

pyhdust.beatlas.createBAsed(fsedlist, xdrpath, lbdarr, param=True, savetxt=False, ignorelum=False, pol=False, saveextra=None)[source]

Create the BeAtlas SED XDR release.

WARNING: The file names must be in this format: mod01_PLn3.5_sig0.00_h072_Rd000.0_Be_M14.60_ob1.45_H0.77_Z0.014_bE_Ell

The file structure:
-n_quantities, n_lbd, n_models,
-n_qt_vals1, n_qt_vals2, .. n_qt_valsn
-quantities values = M, ob(W), Z, H, sig, Rd, h, n, cos(i).
-(Unique) lbd array
*model values
*model SED
-photospheric models: sig0 = 0.00
-Parametric disk model default (param == True)
-VDD-ST models: n excluded (alpha and R0 fixed. Confirm?)
-The flux will be given in ergs/s/um2/um. If ignorelum==True, the usual
F_lbda/F_bol unit will be given.

Since the grid is not symmetric, there is no index to jump directly to the desired model. So the suggestion is to use the index matrix, or read the file line by line until find the model (if exists).

def genxdr(xdrname=’PL.xdr’, param=True, pol=False):

fs2l = glob(‘fullsed/*.sed2’) print(‘# Using {0} as reference!’.format(fs2l[0])) lbdarr = hdt.readfullsed2(fs2l[0]) lbdarr = lbdarr[0, :, 2] nm, listpar = bat.fsedList(fs2l) bat.createBAsed(fs2l, xdrname, lbdarr, param=param, savetxt=False,

pol=pol, saveextra=xdrname.replace(‘xdr’, ‘txt’))



pyhdust.beatlas.createXDRmap(maplist, xdrpath, refclass, lbdlim=None, npix=128)[source]

Is this possible?

lbdlim: discard images that are out of this limits (None keeps all; units of microns).

Criteria: - all the images are converted the same size in pixels (npix). - only images with zoom = renv are used (checked by *.log file) - the pixel values are converted to flux units (erg/s/Ang) - the pixel scale is converted to length unit (at d = 10 pc)

Example: maspp = maspp * 10/5 # transform the pixel scale for d = 5 pc

pyhdust.beatlas.createXDRsed(fsedlist, xdrpath, refclass, lbdarr, ignorelum=False, pol=False)[source]

Create the generic SED XDR release.

nob = (individual) number of observers listpar = parameters of each model nq = number of parameters nmod = number of models

output units: 10**-4 erg/s/Ang/cm2

pyhdust.beatlas.create_custom_sed(xdrpath, listpar, lbdarr, minfo, models)[source]

Create the generic SED XDR release.

nob = (individual) number of observers listpar = parameters of each model nq = number of parameters nmod = number of models

output units: 10**-4 erg/s/Ang/cm2

pyhdust.beatlas.densBAnorm(r01, M, issig0=True)[source]

Converts density in normalized range [0-1], and vice-versa for the BeAtlas.

If issig0, treats r01 as \(\Sigma_0\); otherwise, use it as [0-1] value.

pyhdust.beatlas.fsedList(fsedlist, param=True)[source]

Return the total of models and the parameters values in the fullsed list.

The len of fsedlist is 9 (param=True) for the parametric case and 8 to the VDD-ST one.

The sequence is: M, ob(W), Z, H, sig, Rd, h, n, cos(i).

It is assumed that all models have the same observers configuration.

pyhdust.beatlas.griddataBA(minfo, models, params, isig, silent=True)[source]

Interpolates model grid

Usage: model_interp = griddata(minfo, models, params, isig, silent=True)

where minfo = grid of parameters models = grid of models params = parameters, isig = (normalized) sigma0 index

Ex: # read grid xdrpath = ‘beatlas/disk_flx.xdr’ listpar, lbdarr, minfo, models = bat.readBAsed(xdrpath, quiet=True) # find isig dims = [‘M’, ‘ob’, ‘sig0’, ‘nr’, ‘cosi’] dims = dict(zip(dims, range(len(dims)))) isig = dims[“sig0”] # interpolation params = [12.4, 1.44, 0.9, 4.4, 0.1] model_interp = np.exp(griddataBA(minfo, np.log(models), params, isig))

If photospheric models are interpolated, let isig=None. For spectra, it is recommended to enter the log of the grid of spectra as input, as shown in the example above.

pyhdust.beatlas.hfrac2tms(Hfrac, inverse=False)[source]

Converts nuclear hydrogen fraction into fractional time in the main-sequence, (and vice-versa) based on the polynomial fit of the average of this relation for all B spectral types and rotational velocities.

Usage: t = hfrac2tms(Hfrac, inverse=False) or Hfrac = hfrac2tms(t, inverse=True)

pyhdust.beatlas.interpolBA(params, ctrlarr, lparams, minfo, models, param=True)[source]

Interpola os modelos para os parametros params

-params = from emcee minimization
-ctrlarr = the fixed value of M, ob(W), Z, H, sig, Rd, h, n, cos(i).
If it is not fixed, use np.NaN.
-Parametric disk model default (param == True).

This function always returns a valid result (i.e., extrapolations from the nearest values are always on).

If it is a ‘Non-squared grid’ (asymmetric), it will return a zero array if a given model is not found.

pyhdust.beatlas.parnorm(dvals, vmax, vmin_non0, issig0=True, s_non0=0)[source]

Converts density in normalized range [0-1], and vice-versa.

If issig0, treats r01 as \(\Sigma_0\); otherwise, use it as [0-1] value.

s_non0 forces vmin_non0 to be lower limit of the density scale interval. Example: s_non0 = 0.25 forces the density scale to be between [0.25-1.00].

pyhdust.beatlas.readBAsed(xdrpath, quiet=False)[source]

Read only the BeAtlas SED release.

-photospheric models: sig0 (and other quantities) == 0.00
-Parametric disk model default (param == True)
-VDD-ST models: n excluded (alpha and R0 fixed. Confirm?)
-The models flux are given in ergs/s/cm2/um. If ignorelum==True in the
XDR creation, F_lbda/F_bol unit will be given.

INPUT: xdrpath

OUTPUT: listpar, lbdarr, minfo, models
(list of mods parameters, lambda array (um), mods index, mods flux)
pyhdust.beatlas.readXDRsed(xdrpath, quiet=False)[source]

Read a XDR with a set of models.

The models’ parameters (as well as their units) are defined at XDR creation.

INPUT: xdrpath

OUTPUT: ninfo, intervals, lbdarr, minfo, models

(xdr dimensions, params limits, lambda array (um), mods params, mods flux)

pyhdust.beatlas.rmMods(modn, Ms, clusters=['job'])[source]

Remove the *.inp models of models modn according to the list structure below.

Masses list ans sig0 POSITION do be excluded
Ms = [
[‘14.6’, [0]],
[‘12.5’, [0,-1]],
[‘10.8’, [0,-1]],
[‘09.6’, [0,-2,-1]],
[‘08.6’, [0,-2,-1]],
[‘07.7’, [0,-2,-1]],
[‘06.4’, [0,-3,-2,-1]],
[‘05.5’, [0,-3,-2,-1]],
[‘04.8’, [-4,-3,-2,-1]],
[‘04.2’, [-4,-3,-2,-1]],
[‘03.8’, [-4,-3,-2,-1]],
[‘03.4’, [-4,-3,-2,-1]],]

INPUT: string, structured list

OUTPUT: *files removed