Read routines for a model

This module provides several routines to read the output of a ProDiMo model. All the data belonging to a ProDiMo model is put into an hierachical data structure (Data_ProDiMo).

The module provides a routine to read “all” the data of a ProDiMo model and spezialized routines to read only distinct model data (e.g. only the SED of a model).

Usage example

The following example reads the output files of a ProDiMo model from the current working directory. The read_prodimo() function tries to read (nearly)all ProDiMo output data which can found. There are also more spezialed read routines (see prodimopy.read).

import prodimopy.read as pread

model=pread.read_prodimo()

print(model)

Source documentation

class prodimopy.read.Data_ProDiMo(name)[source]

Data container for most of the output produced by ProDiMo.

The class also includes some convenience functions and also derives/calculates some addtionialy quantities not directly included in the ProDiMo output.

Parameters:

name (string) – The name of the model (can be empty).

name

string: The name of the model (can be empty)

directory

string: The directory from which the model was read. Is e.g. set by read_prodimo() Can be a relative path.

params

prodimopy.read.ModelParameters Dictionary that allows to acces the models Parameters from Parameter.out.

nx

int: The number of spatial grid points in the x (radial) direction

nz

int: The number of spatial grid points in the z (vertical) direction

nspec

int: The number of chemical species included in the model.

nheat

int: The number of heating processes included in the model.

ncool

int: The number of cooling processes included in the model.

p_dust_to_gas

float: The global dust to gass mass ratio (single value, given Parameter)

p_v_turb

float: The global turbulent velocity (single value) UNIT: km s-1

p_rho_grain

float: The global grain mass density (the density of one dust grain) UNIT: g cm-3

mstar

float: The stellar mass in solar units. is taken from ProDiMo.out

x

array_like(float,ndim=2): The x coordinates (radial direction). UNIT: au, DIMS: (nx,nz)

z

array_like(float,ndim=2): The z coordinates (vertical direction). UNIT: au, DIMS: (nx,nz)

rhog

array_like(float,ndim=2): The gas density. UNIT: g cm-3, DIMS: (nx,nz)

rhod

array_like(float,ndim=2): The dust density. UNIT: g cm-3, DIMS: (nx,nz)

d2g

array_like(float,ndim=2): The dust to gas mass ratio form ProDiMo UNIT: , DIMS: (nx,nz)

nHtot

array_like(float,ndim=2): The total hydrogen number density. UNIT: cm-3, DIMS: (nx,nz)

muH

float: The conversion constant from nHtot to rhog It is assume that this is constant throught the disk. It is given by by rhog/nHtot UNIT: g

NHver

array_like(float,ndim=2): Vertical total hydrogen column density. nHtot is integrated from the disk surface to the midplane at each radial grid point. The intermediate results are stored at each grid point. For example NHver[:,0] gives the total column density as a function of radius. UNIT: cm-2, DIMS: (nx,nz)

NHrad

array_like(float,ndim=2): Radial total hydrogen column density. Integrated along radial rays, starting from the star. Otherwise same behaviour as NHver. UNIT: cm-2, DIMS: (nx,nz)

nd

array_like(float,ndim=2): The dust number density. UNIT: cm-3, DIMS: (nx,nz)

tg

array_like(float,ndim=2): The gas temperature. UNIT: K, DIMS: (nx,nz)

td

array_like(float,ndim=2): The dust temperature. UNIT: K, DIMS: (nx,nz)

pressure

array_like(float,ndim=2): The gas pressure UNIT: erg cm-3, DIMS: (nx,nz)

soundspeed

array_like(float,ndim=2): The isothermal sound speed. UNIT: km s-1, DIMS: (nx,nz)

velocity

array_like(float,ndim=2): The velocity field (vector) given as vx,vy,vz UNIT: km s-1, DIMS: (nx,nz,2)

damean

array_like(float,ndim=2): The mean dust particle radius. Is defined as <a3>**(1/3) UNIT: micron, DIMS: (nx,nz)

da2mean

array_like(float,ndim=2): The surface weighted mean dust particle radius. UNIT: micron, DIMS: (nx,nz)

dNlayers

array_like(int,ndim=2): The number of ice layers on the dust grains. UNIT: dimensionless, DIMS: (nx,nz)

Hx

array_like(float,ndim=2): The X-ray energy deposition rate per hydrogen nuclei UNIT: erg <H>-1, DIMS: (nx,nz)

zetaX

array_like(float,ndim=2): X-ray ionisation rate per hydrogen nuclei. UNIT: s-1, DIMS: (nx,nz)

zetaCR

array_like(float,ndim=2): Cosmic-ray ionisation rate per molecular hydrogen (H2) UNIT: s-1, DIMS: (nx,nz)

zetaSTCR

array_like(float,ndim=2): Stellar energetic particle ionisation rate per H2 UNIT: s-1, DIMS: (nx,nz)

tauX1

array_like(float,ndim=2): Radial optical depth at 1 keV (for X-rays). UNIT: , DIMS: (nx,nz)

tauX5

array_like(float,ndim=2): Radial optical depth at 5 keV (for X-rays). UNIT: , DIMS: (nx,nz)

tauX10

array_like(float,ndim=2): Radial optical depth at 10 keV (for X-rays). UNIT: , DIMS: (nx,nz)

AVrad

array_like(float,ndim=2): Radial visual extinction (measerd from the star outwards). UNIT: , DIMS: (nx,nz)

AVver

array_like(float,ndim=2): Vertical visual extinction (measured from the disk surface to the midplane). UNIT:, DIMS: (nx,nz)

AV

array_like(float,ndim=2): Given by min([AVver[ix,iz],AVrad[ix,iz],AVrad[nx-1,iz]-AVrad[ix,iz]]) Gives the lowest visiual extinction at a certain point. Where it is assumed radiation can escape either vertically upwards, radially inwards or radially outwards. UNIT: , DIMS: (nx,nz)

nlam

int: The number of wavelength bands used in the continuum radiative transfer.

lams
array_like(float,ndim=1):

The band wavelengths considered in the radiative transfer.

UNIT: microns, DIMS: (nlam)

chi

array_like(float,ndim=2): Geometrial UV radiation field in units of the Drain field. UNIT: Draine field, DIMS: (nx,nz)

chiRT

array_like(float,ndim=2): UV radiation field as properly calculated in the radiative transfer, in units of the Drain field. UNIT: Draine field, DIMS: (nx,nz)

kappaRos

array_like(float,ndim=2): Rosseland mean opacity. In case of gas radiative transfer for the dust plus the gas. UNIT: cm-1, DIMS: (nx,nz)

tauchem

array_like(float,ndim=2): Chemical timescale (steady-state) UNIT: yr, DIMS: (nx,nz)

taucool

array_like(float,ndim=2): Cooling timescale. UNIT: yr, DIMS: (nx,nz)

taudiff

array_like(float,ndim=2): Vertical radiative diffussion timescale (using the Rosseland mean opacities). UNIT: yr, DIMS: (nx,nz)

spnames

dictionary: Dictionary providing the index of a particular species (e.g. spnames[“CO”]). This index can than be used for arrays having an species dimension (like nmol). The electron is included. UNIT: , DIMS: (nspec)

solved_chem

array_like(int,ndim=2): Flag for chemistry solver (values, 0,1,2) (see ProDiMo code) 1 means everything okay, 0 failure, 2 time-dependent step needed DIMS:` (nx,nz)

rateH2form

array_like(float,ndim=3): The H2 formation ratio UNIT: s-1, DIMS: (nx,nz)

rateH2diss

array_like(float,ndim=3): The different H2 dissociation rates. UNIT: s-1, DIMS: (nx,nz,3)

heat_names

list (string) All the names of the cooling processes.

cool_names

list (string) All the names of the cooling processes.

heat_mainidx

array_like(float,ndim=3): Index of the main heating process at the given grid point. UNIT: , DIMS: (nx,nz)

cool_mainidx

array_like(float,ndim=3): Index of the main cooling process at the given grid point. UNIT: , DIMS: (nx,nz)

lineEstimates

list(prodimopy.read.DataLineEstimate): All the line estimates from FlineEstimates.out. Each spectral line in FlineEstimates corresponds to one prodimopy.read.DataLineEstimate object.

lines

array_like(prodimopy.read.DataLine): Alle the spectral lines from line_flux.out (proper Linetransfer). Each spectral line in line_flux.out corresponds to one prodimopy.read.DataLine object

contImages

prodimopy.read.DataContinuumImages: Reads the continuum images data (image.out) if available. The full images are only read if requested for a particular wavelength see prodimopy.read.DataContinuumImages for details.

starSpec

prodimopy.read.DataStarSpec: The (unattenuated) stellar input spectrum. see prodimopy.read.DataStarSpec for details.

gas

prodimopy.read.DataGas: Holds various properties of the gas component (e.g. opacities). see prodimopy.read.DataGas

dust

prodimopy.read.DataDust: Holds various properties of the dust component (e.g. opacities). see prodimopy.read.DataDust

env_dust

prodimopy.read.DataDust: Holds various properties of the dust component (e.g. opacities) of the envelope. Only relevant if ProDiMo is used in the envelope mode. see prodimopy.read.DataDust

elements

prodimopy.read.DataElements: Holds the initial gas phase element abundances

species

prodimopy.read.DataSpecies: Holds the initial species data

sedObs

prodimopy.read.DataContinuumObs: Holds the provided SED observations (photometry, spectra, extinction etc.) TODO: maybe put all the observations into one object (e.g. also the lines)

lineObs

prodimopy.read.DataLineObs: Holds the provide line observations (e.g. LINEObs.dat and line profiles) TODO: maybe put all the observations into one object (e.g. also the lines)

FLiTsSpec

prodimopy.read.DataFLiTsSpec: Holds the FLiTs spectrum if it exists.

sedinc(iinc=0)[source]

Get the sed for a certain inclination

property sed

not sure if this is the best solution, but need a getter it seems return the current one with inclination

property nmol

array_like(float,ndim=3): Number densities of all chemical species (mainly molecules) UNIT: cm-3, DIMS: (nx,nz,nspec)

property cdnmol

array_like(float,ndim=3): Vertical column number densities for each chemical species at each point in the disk. Integrated from the surface to the midplane at each radial grid point. UNIT: cm-2, DIMS: (nx,nz,nspec)

property rcdnmol

array_like(float,ndim=3): Radial column number densities for each species at each point in the disk. Integrated from the star outwards along fixed radial rays given by the vertical grid. UNIT: cm-2, DIMS: (nx,nz,nspec)

property sdg

array_like(float,ndim=2): The gas vertical surface density. This is for only one half of the disk (i.e. from z=0 to z+), like in ProDiMo. For the total surface density multiply by two. UNIT: g cm-2, DIMS: (nx,nz)

property sdd

array_like(float,ndim=2): The dust vertical surface density. This is for only one half of the disk (i.e. from z=0 to z+), like in ProDiMo. For the total surface density multiply by two. UNIT: g cm-2, DIMS: (nx,nz)

property cool

array_like(float,ndim=3): Cooling rates for the various coling. UNIT: erg cm-3 s-1 DIMS: (nx,nz,ncool)

property heat

array_like(float,ndim=3): Heating rates for the various heating processes. UNIT: erg cm-3 s-1 DIMS: (nx,nz,nheat)

property radFields

array_like(float,ndim=3): Radiation field (mean intensity) for each wavelength band. UNIT: erg s-1 cm-2 sr-1 Hz-1, DIMS: (nx,nz,nlam)

property vol

array_like(float,ndim=2): The volume for each grid point UNIT: cm3, DIMS: (nx,nz)

property chemnet

prodimopy.chemistry.network.ReactionNetworkPout: Holds the used chemical network of the model from Reactions.out. Is only read on demand.

getLine(wl, ident=None, incidx=0)[source]

Returns the spectral line closest to the given wavelentgh.

Parameters:
  • wl (float) – the wavelength which is used for the search. UNIT: micron.

  • ident (string, optional) – A line identification string which should also be considered for the search. (default: None)

  • incidx (int) – select the inclination for the line. (default: 0) . 0 means the first one. If only one inclination exists always this one will be used (i.e. the vaue of incidx is ignored).

Returns:

Returns None if no lines are included in the model.

Return type:

prodimopy.read.DataLine

gen_specFromLineEstimates(wlrange=[10, 15], ident=None, specR=3000, unit='W', contOnly=False, noCont=False)[source]

Generates a “Spectrum” from the line estimates results of ProDiMo and convolves it to the given spectral resolution. If the SED was also calculated the line fluxes will be added to the continuum, if not a continuum of zero flux is assumed.

This routine can become very slow, depending on the number of lines within a given wavelenght range. It can be more efficient to produce smaller chuncks with not so many lines.

Parameters:
  • wlrange (array_like) – Generate the spectrum in the wavelength range [start,end] Default: [10,15] Units: micron

  • ident (str) – only the lines with this ident (like given in the line estimates) are considered. Default: None (all lines in the given wlrange are considered)

  • specR (int) – the desired spectral resolution. If None a spectrum with simple the line fluxes added (i.e. as “delta function”) is returned. Default: 3000

  • unit (str) – desired unit for the output. Current choices W (W/m^2/Hz) or ‘Jy’ (Jansky. W is the default option.

  • contOnly (boolean) – only do it for the continuum (do not add any other lines). Default: False

  • noCont (boolean) – assume zero continuum Default: False

Returns:

tuple containing: wls(array_like): array of wavelenght points in micron, flux(array_like): flux values for each wavelenght point in W m-2 Hz-1 or Jy (depending on the unit parameter)

Return type:

(tuple)

getLineEstimate(ident, wl)[source]

Finds and returns the line estimate for the given ident which is closest to the given wavelength. If the ident is unknown None is returned. If the ident exist the routine always returns an line estimate object.

Parameters:
  • ident (string) – The line identification string. Note that the ident is not necessarely equal to the corresponding chemical species.

  • wl (float) – the wavelength which is used for the search. UNIT: micron.

Returns:

Returns None if the line estimate is not found.

Return type:

prodimopy.read.DataLineEstimate

Notes

The parameters of this method are not consistent with getLine(). This might be confusing. However, there is a reasong for this. The number of included line estimates in a ProDiMo model can be huge and just searching with the wavelenght might become slow. However, this probably can be improved.

To speed up the reading of FlineEstimate.out the extra radial info (see DataLineEstimateRInfo of all the line estimates is not read. However, in this routine it is read for the single line estimate found. One should use this routine to access the radial info for a single line estimate.

selectLineEstimates(ident, wlrange=None)[source]

Returns a list of all line estimates (i.e. all transitions) for the given line ident and/or in the given wavelength range.

Parameters:
  • ident (string) – The line identification (species name) as defined in ProDiMo. The ident is not necessarely equal to the underlying chemial species name (e.g. isotopologues, ortho-para, or cases like N2H+ and HN2+). If wlrange is set ident can be None in that case all lines in the given wlrange are returned.

  • wlrange (array_like) – All lines in the given wavelength range [start,end] and the given ident are returned. if the ident is None all lines are returned. Default: None Units: micron

Returns:

List of prodimopy.read.DataLineEstimate objects, or empty list if nothing was found.

Return type:

list(prodimopy.read.DataLineEstimate)

Notes

In this routine the additional radial information of the line esitmate (see DataLineEstimateRInfo) is not read.

Examples

# select all line estimates for CO
lests=model.selectLineEstimates("CO")

# select only the 1300 micron CO line
lests=model.selectLineEstimates("CO",wlrange=[1300,1310])

# select all linest in the given wavelength range
lests=model.selectLineEstimates(None,wlrange=[1200,1400])

# print all of them to see what we got
for lest in lests:
  print(lest)
selectLines(ident)[source]

Returns a list of all line fluxes included in the line tranfer, for the given line ident.

Parameters:

ident (string) – The line identification (species name) as defined in ProDiMo. The ident is not necessarely equal to the underlying chemial species name (e.g. isotopologues, ortho-para, or cases like N2H+ and HN2+)

Returns:

List of prodimopy.read.DataLine objects, or empty list if nothing was found.

Return type:

list(prodimopy.read.DataLine)

getAbun(spname)[source]

Returns the abundance for a given species.

Parameters:

spname (string) – The name of the chemical species as define in ProDiMo.

Returns:

an array of dimension [nx,nz] with species abundance or None if the species was not found.

Return type:

array_like(float,ndim=2)

Notes

The abundance is given relative to the total hydrogen nuclei density (i.e. nmol(spname)/nHtot)

A warning is printed in case the species was not found in spnames.

get_toomreQ(mstar=None)[source]

Returns the Toomre Q parameter as a function of radius. (for the midplane).

Q is given by

Q(r)=k(r)*cs(r)/(pi * G * sigma(r))

for k we use the keplerian frequency, cs is the soundspeed (from the mdoel) and sigma is the total gas surface density (both halfs of the disk).

Parameters:

mstar (float) – The stellar mass in solar units (optional). If None the value from the model is taken.

Returns:

an array of dimension [nx] with the Q param

Return type:

array_like(float,ndim=1)

getSEDAnaMask(lam)[source]

Returns a numpy mask where only the grid points outside the emission origin area for the given wavelength (continuum) are marked as invalid.

This mask can be used in e.g. avg_quantity()

Warning

in case of optically thin emission only the points of one half of the disk are considered. In that case an average quantity of this box(mask) will not be completely correct.

Parameters:

lam (float) – the wavelength for which the emission origin region should be determined: UNITS: micron

Returns:

Numpy mask with DIMS: (nx,nz)

Return type:

array_like(float,ndim=2)

getLineOriginMask(lineEstimate)[source]

Returns a numpy mask where the grid points outside the emission origin area for the given lineEstimate are marked as invalid.

This mask can be used in e.g. avg_quantity()

Parameters:

lineEstimate (prodimopy.read.DataLineEstimate) – a line Estimate object for which the operation should be done

Returns:

Numpy mask with DIMS: (nx,nz)

Return type:

array_like(float,ndim=2)

get_VKep(mstar=None, type=2)[source]

Returns the Keplerian rotation velocity [km/s] as a function of radius and height (same as in ProDiMo)

Type 1: vkep=sqrt((G* mstar) / r) Type 2: vkep=sqrt((G* mstar * x**2) / r**3) Type 3: with pressure gradient (see Rosenfeld+ 2013)

Parameters:

mstar (float) – The stellar mass in solar units (optional). If None the value from the model is taken.

Returns:

Rotation velocity [km/s]

Return type:

array_like(float,ndim=1)

get_KeplerOmega(mstar=None)[source]

Returns the Keplerian orbital frequency [1/s] (for the midplane).

omega=sqrt(G*mstar/r**3)

Parameters:

mstar (float) – The stellar mass in solar units (optional). If None the value from the model is taken.

Returns:

Keplerian orbital frequency as function of radius [1/s]

Return type:

array_like(float,ndim=1)

int_ring(quantity, r1=None, r2=None)[source]

Integrates the given quantitiy (needs to be a function of r) from rin to rout.

No interpolation is done. Simply the nearest neighbour for rin and rout are taken.

The integration is done in cgs units and also the return value is in cgs units.

For example if the total gas surfacedensity is passed this routine gives the disk mass. (if r1=rin and r2=rout).

Parameters:
  • quantity (array_like(float,ndim=1)) – the quantity to average. DIMS: (nx).

  • r1 (float) – inner radius [au]. optional DEFAULT: inner disk radius

  • r2 (float) – inner radius [au]. optional DEFAULT: outer disk radius

avg_quantity(quantity, weight='gmass', weightArray=None, mask=None)[source]

Calculates the weighted mean value for the given field (e.g. td). Different weights can be used (see weight parameter)

Parameters:
  • quantity (array_like(float,ndim=2)) – the quantity to average. DIMS: (nx,nz).

  • weight (str) – option for the weight. Values: gmass (gass mass) dmass (dust mass) or vol (Volume). DEFAULT: gmass

  • weightArray (array_like(float,ndim=2)) – Same dimension as quantity. If weightArray is not None it is used as the weight for calculating the mean value.

  • mask (array_like(boolean,ndim=2)) – A mask with the same dimension as quantity. All elements with True are masked, i.e. not considered in the average (see numpy masked_array). For example one can pass the result of getLineOriginMask() to calculate average quantities over the emitting region of a line.

Examples

Here is an example for making a mass weighted average for the gas temperature in the main line emitting region for the CO 1.3 mm line. model is the model data read with read_prodimo().

avgtg=model.avg_quantity(model.tg,weight="gmass",
                   mask=model.getLineOriginMask(model.getLineEstimate("CO",1300.)))
class prodimopy.read.ModelParameters(filename='Parameter.out', directory='.')[source]

Access to the Parameters of a model. Reads Parameter.out and provides some utiliy functions fo access a Parameters

Todo

  • Currently all Parameters are strings. make type conversions.

  • provide utility functions to access special Parameters

  • maybe inherit from Dictionary class and mat custom getters

Opens the file and fills a dictrionary with all Parameters. This dictionary cannot be changed anymore. One can only read the parameters. The get routine has some special treatment for certain parameters, but does not do any type converting. Except that list separated with “,” will be returned a lists.

Todo

things like SPNOERASE= 30*” “ not interpreted yet

Parameters:
  • filename (string) – The Filename of the Parameter file.

  • directory (string) – The directory the contains the ProDiMo model output.

clear() None.  Remove all items from D.
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
class prodimopy.read.DataLineProfile(nvelo, restfrequency=None)[source]

Data container for a spectral line profile for a single spectral line.

nvelo

int: number of velocity points of the profile.

restfrequency

float: the restfrequency of the line. Usefull for conversoins. Optional. UNIT: GHz

velo

array_like(float,ndim=1): The velocity grid of the line profile. UNIT: kms/s, DIMS: (nvelo)

property flux
property flux_dust
property flux_conv
property frequency

The frequencies according to the velocity grid. Is relative to the restfrequency. UNIT: GHz

FIXME: restfreq can be None … FIXME: There is some risk that this is slow, but should not be use very often

property fluxErgAng

The fluxes in units of erg/s/cm^2/Angstrom.

FIXME: Deprecated

FIXME: needs frequency which breaks if restfrequency is None FIXME: There is some risk that this is slow, but should not be used very often FIXME: now just takes the restfrequency for conversion which is not correct however for the continuum we also take the restfrequency as we have only one value Usually this does not introduce a signficant error.

property flux_unit
convolve(R)[source]

Convolves the given profile to the spectrayl resolution R. The profile is convolved with a Gaussian where R determines the FWHM of that Gaussian.

The results are stored in flux_conv

Parameters:

R (float) – the spectral resolution.

Returns:

The FWHM of the Gaussian in units of km/s i.e. the spectral resolution.

Return type:

float

class prodimopy.read.DataLine[source]

Data container for a single spectral line read from line_flux.out.

wl

float: Restwavelenght of the line. UNIT: micron

frequency

float: Restfrequency of the line. UNIT: GHz

prodimoInf

string: Some information String from PRoDiMo (i.e. transition)

species

string: The chemical species of the line. Identical to ident.

ident

string: The identification of the line (i.e. as given in LineTransferList.in)

distance

float: The distance use for the line calculations. UNIT: pc

property flux
property fcont
property profile
property inclination
property flux_Jy

The flux of the line in Jansky km s-1.

property fcontErgAng

The flux of the continuum in erg/s/cm^2/Angstrom

property luminosityErgs

Returns the luminosity in erg/s

property luminosityWatt

Returns the line luminosity in Watt

convolve(R)[source]

Convolves all the profiles (for each inclination) for this lines.

simply calls convovle()

class prodimopy.read.DataLineObs(flux, flux_err, fwhm, fwhm_err, flag)[source]

Holds the observational data for one line.

Differently to DataLine DataLineObs does not care about multiple inclinations. So simply some setter and getters are used to fill the list quantities (first entry).

property flux
property profile
convolve(R)

Convolves all the profiles (for each inclination) for this lines.

simply calls convovle()

property fcont
property fcontErgAng

The flux of the continuum in erg/s/cm^2/Angstrom

property flux_Jy

The flux of the line in Jansky km s-1.

property inclination
property luminosityErgs

Returns the luminosity in erg/s

property luminosityWatt

Returns the line luminosity in Watt

wl

float: Restwavelenght of the line. UNIT: micron

frequency

float: Restfrequency of the line. UNIT: GHz

prodimoInf

string: Some information String from PRoDiMo (i.e. transition)

species

string: The chemical species of the line. Identical to ident.

ident

string: The identification of the line (i.e. as given in LineTransferList.in)

distance

float: The distance use for the line calculations. UNIT: pc

class prodimopy.read.DataFLiTsSpec[source]

Data container for a FLiTs spectrum. Currently provides only the wavelength grid and the flux in Jy, as produced by FLiTs.

wl

array_like: Wavelength grid in micron.

flux

array_like: Flux of the spectrum in Jy.

convolve(specR, sample=1)[source]

Returns a convolved version of the Spectrum. Does not change the original FLiTs spectrum.

Parameters:

specR (int) – The desired spectral resolution.

Returns:

tuple containing: wls(array_like): array of wavelenght points in micron, flux(array_like): flux values for each wavelenght point in Jansky.

Return type:

(tuple)

Todo

allow for different units.

class prodimopy.read.DataLineEstimate(ident, wl, jup, jlow, flux)[source]

Data container for a single line estimate.

Parameters:
  • ident (string) –

  • wl (float) –

  • jup (int) –

  • jlow (int) –

  • flux (float) –

ident

string: The line identifications (species)

wl

float: The wavelength of the line. UNIT: micron

jup

int: Upper level as defined in ProDiMo ((not the real one!)

jlow

int: Lower level as defined in ProDiMo (not the real one!).

rInfo

list(prodimopy.read.DataLineEstimateRInfo): The extra radial information of the line.

property frequency

Frequency of the line in [GHz].

property flux_Jy

The flux of the line Jansky km s-1

class prodimopy.read.DataLineEstimateRInfo(ix, iz, Fcolumn, tauLine, tauDust, z15, z85, ztauD1, Ncol)[source]

Data container for the extra radial information for a single line estimate. The data is read from FlineEstimates.out. This object corresponds to one line of the radial information in FlineEstimates.out

Parameters:
  • ix (int) –

  • iz (int) –

  • Fcolumn (float) –

  • tauLine (float) –

  • tauDust (float) –

  • z15 (float) –

  • z85 (float) –

  • ztauD1 (float) –

  • Ncol (float) –

ix

int: The x-coordinate index.

iz

int: The z-coordinate index.

Fcolumn

float: the line flux in the particular column (check again, i guess the iz coordinate is irrelevant for that)

tauLine

float: the total vertical optical depth of the line measured from tauDust=1 upwards f(r)

tauDust

float: the total vertical optical depth of the dust at the wl of the line as f(r)

z15

float: z-level where the line flux reaches 15% of the total flux as f(r) (integrated from top to bottom of the disk); UNIT: au

z85

float: z-level where the line flux reaches 85% as f(r) (integrated from top to bottom of the disk); UNIT: au

ztauD1

float: z-level where taudust_ver(lambda_line)=1; UNIT: au Is None for FlineEstimates version < 3

Ncol

float: The column density of the species as f(r) measured from ztauD1 upwards; UNIT: cm-2

It considers both halfs of the disks (i.e. for the case of tauDust <1 ) so the values can be different to cdnmol where only one half of the disk is considered. Is None for FlineEstimates version < 3

class prodimopy.read.DataGas(nlam)[source]

Holds the data for the gas (mainly from dust_opac.out) TODO: currently only the init cs is read, not the x,y data

class prodimopy.read.DataDust(amin, amax, apow, nsize, nlam)[source]

Holds the data for the dust (mainly from dust_opac.out) TODO: dust composition is not yet read

amin

float: The minimum grain size of the size distribution. UNIT: micron

amax

float: The maximum grain size of the size distribution. UNIT: micron

apow

float: The powerlaw exponent of the grain size distribution.

nsize

int: The number for grain size bins

lam

array_like(float,ndim=1): The wavelength grid for the dust opacities. UNIT: micron

energy

array_like(float,ndim=1): The energy grid for the dust opacities. UNIT: eV For convinience (i.e. for the X-ray regime) TODO: check the unit

kext

array_like(float,ndim=1): The dust extinction coefficient for each wavelength per g of dust. UNIT: |cm^2g^-1|

kabs

array_like(float,ndim=1): The dust absorption coefficient for each wavelength per g of dust. UNIT: |cm^2g^-1|

ksca

array_like(float,ndim=1): The dust scattering coefficient for each wavelength per g of dust. UNIT: `|cm^2g^-1|

ksca_an

array_like(float,ndim=1): The dust anisotropic (approximation) scattering coefficient for each wavelength per g of dust. UNIT: |cm^2g^-1|

asize

array_like(float,ndim=1): The grain size for each size bin. UNIT: micron

sigmaa

array_like(float,ndim=2): The radial surface density (g cm^-2) profiles for each individual grain. size (shape=[nsize,nr]. Might not exit!

class prodimopy.read.DataElements[source]

Data for the Element abundances (the input).

Holds the data from Elements.out.

The data is stored as OrderedDict with the element names as keys.

abun

OrderedDict: Ordered Dictionary holding the element abundaces realtive to hydrogen

abun12

OrderedDict: abundances in the +12 unit

massRatio

OrderedDict: mass ratios

amu

OrderedDict: atomic mass unit

muHamu

float: rho = muH*n<H> with muH/amu = muHamu see the Elements.out file

class prodimopy.read.DataSpecies[source]

Data for the Species (the input).

Holds the data from Species.out.

The data is stored as OrderedDict with the element names as keys.

mass

OrderedDict(float): The mass of the species UNIT: g.

charge

OrderedDict(int): The mass of the species UNIT: g.

chemPot

OrderedDict(float): chemical potential as determined by ProDiMo.

get_spdata(name)[source]

Returns all data of the species with name.

Parameters:

name (str or int) – The name of the species. if int then use it as index

Return type:

(mass,charge,chemPot)

class prodimopy.read.DataContinuumObs(nlam=None)[source]

Holds the observational data for the continuum (the dust).

Holds the photometric data, spectra (experimental) and radial profiles (experimental).

class prodimopy.read.DataSED(nlam, distance)[source]

Holds the data for the Spectral Energy Distribution (SED).

TODO: documentation for the fields.

property fnuErg
property nuFnuW
property fnuJy
property inclination
property Lbol
property Tbol
setLbolTbol()[source]

Calculates the bolometric temperature and lumionsity for the given values of the SED.

quite approximate at the moment.

class prodimopy.read.DataSEDAna(nlam, nx)[source]

Holds the analysis data for the Spectral Energy Distribution (SEDana.out).

class prodimopy.read.DataContinuumImages(nlam, nx, ny, incl=None, filepath='./image.out')[source]

Holds the continuum images (image.out) and provides a method to read one particular image.

The coordinates x,y are the same for all images, and only stored once.

nlam

int: The number of wavelength points (== number of images)

lams

array_like(float,ndim=1): The wavelengths UNIT: micron, DIMS: (nlam)

inclination

float: The inclination used for calculating that image. UNIT: deg

nx

int: The number of x axis points (radial) of the image

ny

int: The number of y axis points (or theta) of the image

x

array_like(float,ndim=2): x coordindates UNIT: au, DIMS: (nx,ny)

y

array_like(float,ndim=2): y coordindates UNIT: au, DIMS: (nx,ny)

getImage(wl)[source]

Reads the intensities at a certain wavelength (image) from the image.out file.

The image with the closest wavelength to the given wavelength (wl) will be returned

Parameters:
  • wl (float) –

  • image (the wavelength in micron of the requested) –

Returns:

  • tuple ((array_like(float,ndim=2),float) :)

  • the image intensitis in units … (dimension nx,ny) and the wavelength

class prodimopy.read.DataBgSpec(nlam)[source]

Backgound field input spectrum

class prodimopy.read.DataStarSpec(nlam, teff, r, logg, luv)[source]

Stellar input spectrum.

lam

array_like(float,ndim=1): wavelength unit : micron

nu

array_like(float,ndim=1): frequency unit : Hz

Inu

array_like(float,ndim=1): Intensitye unit: erg/cm2/s/Hz/sr

class prodimopy.read.Chemistry(name)[source]

Data container for chemistry analysis. Holds the information for one particular molecule.

Parameters:

name (string) – The name of the model (can be empty).

name

string: The name of the model (can be empty)

totfrate

array: Total formation rate at each spatial grid point.

totdrate

array: Total destruction rate at each spatial grid point.

gridf

array: Contains for each individual grid point a sorted list of the formation reactions including the index (0) and the rate (1)

gridd

array: Contains for each individual grid point a sorted list of the destruction reactions including the index (0) and the rate (1)

fridxs

array: List of all formation reaction indices for this species.

dridxs

array: List of all destruction reaction indices for this species.

species

str: name of species for which the chamanalysis should be done

chemnet

prodimopy.chemistry.network.ReactionNetworkPout array with nx,ny,species index, reaction number, and reaction rate for a given species

reac_to_str(reac, idx, rate=None)[source]

Converts a Reaction to the outputformat we want for the chemanalysis.

Parameters:

reac (prodimopy.chemistry.network.Reaction) –

get_reac_grid(level, rtype)[source]

Gets the counting index of the x important Reaction. If it does not exist it is set to 0.

Parameters:
  • level (int) – The level of important 1 meand most important, 2 second most important etc.

  • type (str) – Formation (pass f) or destruction Reaction (pass d)

Returns:

And array of shape (model.nx,model.nz) where the first one containts the index of the Reactions for the list of reactions from chemanalysis (the outputfile) and the second one the rate itself (for this Reaction at each point).

Return type:

tuple

prodimopy.read.read_prodimo(directory='.', name=None, readlineEstimates=True, readObs=True, readImages=True, filename='ProDiMo.out', filenameLineEstimates='FlineEstimates.out', filenameLineFlux='line_flux.out', td_fileIdx=None)[source]

Reads in all (not all yet) the output of a ProDiMo model from the given model directory.

Parameters:
  • directory (str) – the directory of the model (optional).

  • name (str) – an optional name for the model (e.g. can be used in the plotting routines)

  • readlineEstimates (boolean) – read the line estimates file (can be slow, so it is possible to deactivate it)

  • readObs (boolean) – try to read observational data (e.g. SEDobs.dat …)

  • filename (str) – the filename of the main prodimo output

  • filenameLineEstimates (str) – the filename of the line estimates output

  • filenameLineFlux (str) – the filename of the line flux output

  • td_fileIdx (str) – in case of time-dependent model the index of a particular output age can be provided (e.g. “03”)

Returns:

the ProDiMo model data or None in case of errors.

Return type:

prodimopy.read.Data_ProDiMo

prodimopy.read.read_elements(directory, filename='Elements.out', tarfile=None)[source]

Reads the Elements.out file. Also adds the electron “e-” to the Elements.

Parameters:
  • directory (str) – the directory of the model

  • filename (str) – an alternative Filename

Returns:

the Elements model data or None in case of errors.

Return type:

DataElements

prodimopy.read.read_species(directory, filename='Species.out', tarfile=None)[source]

Reads the Species.out file. Also adds the electron “e-” if necessary.

Also sets data.nspec as only here I can know if e- was a real species in ProDiMo or not. If it was a real species I don’t need to add that.

Parameters:
  • directory (str) – the directory of the model

  • pdata (prodimopy.read.Data_ProDiMo) – the ProDiMo Model data structure, where the data is stored

  • filename (str) – an alternative Filename

Returns:

  • DataSpecies – the Species model data or None in case of errors.

  • ..todo

    • stochiometry is still missing

prodimopy.read.read_lineEstimates(directory, pdata, filename='FlineEstimates.out', tarfile=None)[source]

Read FlineEstimates.out Can only be done after ProDiMo.out is read.

Parameters:
  • directory (str) – the directory of the model

  • pdata (prodimopy.read.Data_ProDiMo) – the ProDiMo Model data structure, where the data is stored

  • filename (str) – an alternative Filename

prodimopy.read.read_linefluxes(directory, filename='line_flux.out', tarfile=None)[source]

Reads the line fluxes output. Can deal with multiple inclinations.

Parameters:
  • directory (str) – the model directory.

  • filename (str) – the filename of the output file (optional).

Returns:

List of lines.

Return type:

list(prodimopy.read.DataLine)

prodimopy.read.read_lineObs(directory, nlines, filename='LINEobs.dat', tarfile=None)[source]

Reads the lineobs Data. the number of lines have to be known.

prodimopy.read.read_lineObsProfile(filename, directory='.', tarfile=None)[source]

reads a line profile file which can be used for ProDiMo

prodimopy.read.read_gas(directory, filename='gas_cs.out', tarfile=None)[source]

Reads gas_cs.out

Return type:

DataGas

prodimopy.read.read_continuumImages(directory, filename='image.out')[source]

Reads the image.out file.

To avoid unnecessary memory usage, the Intensities are not read in this routine. For this use get_image()

prodimopy.read.read_continuumObs(directory, filename='SEDobs.dat')[source]

Reads observational continuum data (SED).

Reads the file SEDobs.dat (phtotometric points) and all files ending with *spec.dat (e.g. the Spitzer spectrum)

FIXME: does not work yet with tar files

prodimopy.read.read_FLiTs(directory, filename='specFLiTs.out', tarfile=None)[source]

Reads the FLiTs spectrum.

Returns:

The Spectrum.

Return type:

prodimopy.read.DataFLiTsSpec

prodimopy.read.read_sed(directory, filename='SED.out', filenameAna='SEDana.out', tarfile=None)[source]

Reads the ProDiMo SED output including the analysis data.

prodimopy.read.read_starSpec(directory, filename='StarSpectrum.out', tarfile=None)[source]

Reads StarSpectrum.out

prodimopy.read.read_bgSpec(directory, filename='BgSpectrum.out', tarfile=None)[source]

Reads the BgSpectrum.out file.

Returns:

prodimopy.read.read_dust(directory, filename='dust_opac.out', tarfile=None)[source]

Reads dust_opac.out and if it exists dust_sigmaa.out. Does not read the dust composition yet

FIXME: reading of dust_opac.out should be in separate routine.

Return type:

DataDust

prodimopy.read.read_dust_sigmaa(directory, filename='dust_sigmaa.out', tarfile=None)[source]

Reads the radial surface density profiles for each grain size.

Parameters:
  • directory (str) – The directory where the file is located (the ProDiMo model directory).

  • filename (str) – The filename. Default: “dust_sigmaa.out”

prodimopy.read.calc_NHrad_oi(data)[source]

Calculates the radial column density from out to in (border of model space to star/center)

TODO: move this to utils

prodimopy.read.calc_surfd(data)[source]

Caluclates the gas and dust vertical surface densities at every point in the model.

Only one half of the disk is considered. If one needs the total surface density simply multiply the value from the midplane (zidx=0) by two.

TODO: make it “private” no need to use it directly.

prodimopy.read.analyse_chemistry(species, model, to_txt=True, td_fileIdx=None, filenameReactions='Reactions.out', filenameChemistry='chemanalysis.out', name=None, directory=None)[source]

Function that analyses the chemistry in a similar way to chemanalysis.pro.

Parameters:
  • species (str) – The species name one wants to analyze.

  • model (Data_ProDiMo) – the ProDiMo model data.

  • to_txt (boolean) – Write info about formation and destruction reactions for the selecte molecule to a txt file. Default: True

  • td_fileIdx (str) – For time-dependent chemanalysis. Provide here the idx for the timestep. E.g. “0001” for the first one.

  • todo:: (..) –

    • name and directory are not used anymore (I think) can be removed

Returns:

Object that holds all the required information and can be use for the plotting routines or for reac_rates_ix_iz()

Return type:

prodimopy.read.Chemistry

prodimopy.read.reac_rates_ix_iz(model, chemana, ix=None, iz=None, locau=None)[source]

Function that analyses the chemana manually via a point-by-point analysis for a given species. Shows the most important formation and destruction rates for the given point ix,iz (or in au via Parameter locau).

Parameters:
  • model (Data_ProDiMo) – the model data

  • chemana (Chemistry) – data resulting from analyse_chemistry() on a single species

  • ix (int) – ix corresponding to desired radial location in grid, starting at 0

  • iz (int) – iz corresponding to desired radial location in grid, starting at 0

  • locau (array_like) – the desired coordinates in au [x,z]. The routine then finds the closest grid point for those coordinates.