models.voxel.Voxel#

class Voxel(index=0, debugging=False)[source]#

Bases: object

A class to compute the emission from a voxel in kosmatau3d. It contains ensembles of spherical PDR simulations (to mimic the fractal structure of PDRs), a FUV field element, and element absorption, separated for dust and transitions. It has been tested to contain two ensembles: one for the dense clumpy medium and one for the diffuse interclump medium. This is to account for dense clumps embedded in a diffuse environment.

Methods

calculate_emission

Calculate voxel-averaged absorption and emmisivity.

gaussian

Return Gaussian.

get_abundances

Return species abundances.

get_clump_velocity

Return a tuple of the velocity bins used in the calculation and the indeces.

get_column_density

Return column densities.

get_density

Return the ensemble-averaged density.

get_dust_absorption

Return the dust continuum absorption.

get_dust_emissivity

Return the dust continuum emissivity.

get_dust_intensity

Return the dust continuum intensity.

get_dust_optical_depth

Return the dust continuum optical depth.

get_dust_temperature

Return ensemble-averaged dust temperature.

get_ensemble_mass

Return the ensemble mass.

get_fuv

Return the voxel-averaged far-UV density.

get_gas_temperature

Return ensemble-averaged gas temperature.

get_h2_mass

Return the \(\mathrm{H}_2\) mass represented in the model.

get_hi_mass

Return the \(\mathrm{HI}\) mass represented in the model.

get_index

Return the voxel index.

get_model_mass

Return the mass represented by the model.

get_position

Return voxel position.

get_species_absorption

Return line emission absorption.

get_species_emissivity

Return line emission emissivity.

get_species_intensity

Return line emission intensity.

get_species_number

Return the either the total number of species or fractional abundance in each ensemble.

get_species_optical_depth

Return line emission optical depth.

get_taufuv

return the voxel-averaged far-UV optical depth.

get_velocity

Return a tuple of the voxel velocity and ensemble-averaged dispersion.

get_volume_filling_factor

Return the volume-filling factor.

get_voxel_filling_factor

Return the voxel-filling factor (the fraction of the voxel filled by gas).

plot_clump_number

Plot the number of clumpy used as a function of velocity bin.

plot_spectrum

Plot the either the intesity or optical depth spectrum at the voxel velocity (the velocity with the largest ensemble).

plot_transition

Plot the transition emission with respect to the voxel velocity structure.

printVoxel

Coming soon...

set_index

Change the index.

set_position

Change the voxel location.

set_properties

This method initialises all of the voxel parameters and, if not already evaluated, also initialises the KOSMA-\(\tau\) grid and prepares interpolation routines.

two_gaussians

Return two Gaussians stacked horizontally.

calculate_emission(taufuv=0, test_calc=False, test_opacity=False, test_pexp=False, test_fv=False, verbose=False, timed=False)[source]#

Calculate voxel-averaged absorption and emmisivity.

gaussian(x, a, sigma)[source]#

Return Gaussian.

get_abundances(*args, **kwargs)[source]#

Return species abundances.

get_clump_velocity()[source]#

Return a tuple of the velocity bins used in the calculation and the indeces.

get_column_density(*args, **kwargs)[source]#

Return column densities.

get_density()[source]#

Return the ensemble-averaged density.

get_dust_absorption(fit=True, total=True, minimal=False)[source]#

Return the dust continuum absorption.

get_dust_emissivity(fit=True, total=True, minimal=False)[source]#

Return the dust continuum emissivity.

get_dust_intensity(fit=True, total=True, minimal=False)[source]#

Return the dust continuum intensity. This integrates the radiative transfer equation over the length of the voxel.

get_dust_optical_depth(fit=True, total=True, minimal=False)[source]#

Return the dust continuum optical depth.

get_dust_temperature(total=True)[source]#

Return ensemble-averaged dust temperature.

get_ensemble_mass(total=False)[source]#

Return the ensemble mass.

get_fuv()[source]#

Return the voxel-averaged far-UV density.

get_gas_temperature(total=True)[source]#

Return ensemble-averaged gas temperature.

get_h2_mass(total=False)[source]#

Return the \(\mathrm{H}_2\) mass represented in the model.

get_hi_mass(total=False)[source]#

Return the \(\mathrm{HI}\) mass represented in the model.

get_index()[source]#

Return the voxel index.

get_model_mass(total=False)[source]#

Return the mass represented by the model.

get_position()[source]#

Return voxel position.

get_species_absorption(kind='linear', include_dust=False, fit=True, total=True, hi=False)[source]#

Return line emission absorption.

get_species_emissivity(kind='linear', include_dust=False, fit=True, total=True, hi=False)[source]#

Return line emission emissivity.

get_species_intensity(integrated=False, kind='linear', include_dust=False, fit=True, total=True, hi=False)[source]#

Return line emission intensity. This integrated the radiative transfer equation over the length of the voxel.

get_species_number(species=None, abun=False, nref=[('H', 1), ('H2', 2)], total=True)[source]#

Return the either the total number of species or fractional abundance in each ensemble. The default functionality is to express the fractional in terms of total hydrogen (\(N_\mathrm{H} = N_\mathrm{H}^0 + 2N_\mathrm{H}_2\)).

get_species_optical_depth(kind='linear', include_dust=False, fit=True, total=True, hi=False)[source]#

Return line emission optical depth.

get_taufuv()[source]#

return the voxel-averaged far-UV optical depth.

get_velocity()[source]#

Return a tuple of the voxel velocity and ensemble-averaged dispersion.

get_volume_filling_factor()[source]#

Return the volume-filling factor.

get_voxel_filling_factor()[source]#

Return the voxel-filling factor (the fraction of the voxel filled by gas).

plot_clump_number(effective=False, mass=False)[source]#

Plot the number of clumpy used as a function of velocity bin.

This requires further testing…

plot_spectrum(quantity='intensity', kind='linear', integrated=False, total=False, vel=None, title='')[source]#

Plot the either the intesity or optical depth spectrum at the voxel velocity (the velocity with the largest ensemble).

plot_transition(transition='', quantity='intensity', kind='linear', include_dust=False, total=False, label='', title='', logscale=False)[source]#

Plot the transition emission with respect to the voxel velocity structure.

printVoxel()[source]#

Coming soon…

set_index(index)[source]#

Change the index.

set_position(x, y, z, r, phi)[source]#

Change the voxel location.

set_properties(voxel_size=1, transitions='all', abundances=['ELECTR', 'H', 'H2', 'H+'], dust='PAH', alpha=1.84, gamma=2.31, clump_tau_grid_file='clump_tau_LineCenter.dat', clump_tb_grid_file='clump_Tmb_LineCenter.dat', clump_taufuv_grid_file='RhoMassAFUV.dat', clump_column_density_file='clumpMeanCols.dat', clump_temperature_file='clumpTemperatures_filled.dat', interclump_tau_grid_file='interclumpTauLineCenter.dat', interclump_dust_tau_grid_file='interclumpDustTau.dat', interclump_tb_grid_file='interclumpTmbLineCenter.dat', interclump_dust_tb_grid_file='interclumpDustSED.dat', interclump_taufuv_grid_file='interclumpTauFUV.dat', interclump_column_density_file='interclumpMeanCols.dat', interclump_temperature_file='interclumpTemperatures_filled.dat', clump_mass_number=(3, 1), clump_mass_range=([0, 2], [-3]), clump_n_max=(1, 100), interclump_idx=[False, True], interclump_wnm_idx=[False, False], velocity_range=(-10, 10), velocity_number=201, velocity=0.0, velocity_resolution=10, ensemble_mass=(100, 40), ensemble_dispersion=2, ensemble_density=(100000.0, 1911), volume_factor=None, voxel_factor=1, fuv=200, crir=2e-16, suggested_calc=True, from_grid=False, new_grid=False, change_interpolation=False, dilled=False, timed=False, verbose=False, debug=False)[source]#

This method initialises all of the voxel parameters and, if not already evaluated, also initialises the KOSMA-\(\tau\) grid and prepares interpolation routines.

There are quite a few kwargs that can be used to initialise a Voxel instance:

Parameters:
  • voxel_size – The voxel size in parsecs. The default is 1 pc.

  • transitions – The transitions included in the model. This is a list of strings, where each string has the species name (as in the grid) followed by the transition number (which is taken from KOSMA-\(\tau\)) or "all" for all transitions in the grid. It is set to "all" by default.

  • abundances – The species included in the model. Independent of the species specified in transitions, it sets the species for which the fractional abundances are calculated for each ensemble. The default value is ["ELECTR", "H", "H2", "H+"].

  • dust – This is a string to limit how much of the dust continuum is included. The available continuum ranges from 1 nm to 3.1 mm. This can be limited to the range of molecular lines by setting dust="molecular" (22 dust wavelengths), or to the range of PAH dust features by setting dust="PAH" (201 dust wavelengths). All dust wavelengths (333) will be included in the calculation if dust="".

  • alpha – The power law distribution required for initial mass function \(\mathrm{d}N(M) / \mathrm{d}M = M^-\alpha\). The default is 1.84 as determined in Heithausen et al. (1998).

  • gamma – The power law mass-size relation satisfying \(M = C R^\gamma\). The default is 2.31 as determined in Heithausen et al. (1998).

  • velocity_range – The range (list) of the observed radial velocities. By default it is [-10, 10].

  • velocity_number – The number of observed velocities in the specified range (including endpoints). The default is 51.

  • clump_mass_number – The number of clump masses for each set. This should be a list of integers with the same length as clump_mass_range. The default is [3, 1].

  • clump_mass_range – The range (list) of clump masses for each set. This is a list of ranges with the same length as clump_mass_number. The ranges can have length 1, in which case it only evaluates that clump mass. The masses are in units of \(\mathrm{dex}(M_\odot)\). By default it is [[0, 2], [-2]].

  • clump_density – This changes the default clump density in the constants module. This overrides the voxel density kwarg, and is useful for creating interclumps medium that is not scaled according to the clumps. The default is [None, 1911], so the first clump set takes the voxel density. This is in units of \(\mathrm{cm}^{-3}\).

  • clump_fuv – This changes the default clump FUV in the constants module. This overrides the voxel FUV kwarg. It is a list of length of the number of clump sets. Use a value of None to use the voxel FUV field. The default is [None, 1], in units of the Draine field.

  • clump_n_max – The maximum number of the largest clump in the ensemble. This helps to limit the calculation of a large combination of clumps by rescaling the voxel (thus eliminating any change to the brightness temperature). Larger combinations are used if the rescaled voxel is smaller than the largest clump. The default is [1, 100].

  • velocity – The average radial velocity of the observed Voxel instance. This is used with the model velocities to determine the number of clumps seen at a given velocity. The default is 0 \(\mathrm{km\, s^{-1}}\).

  • ensemble_mass – This can be either a float or list of floats, depending on how many ensembles you have. The default is 100 \(M_\odot\).

  • ensemble_dispersion – The velocity dispersion of the ensemble. This is used with the model velocities to determine the number of clumps at a given velocity. The default is 1 \(\mathrm{km, s^{-1}}\).

  • ensemble_density – The observed hydrogen density in the voxel. This is different from and overridden by any default density specified in the constants module. The default is 15000 \(\mathrm{cm^{-3}}\).

  • volume_factor

  • voxel_factor

  • fuv – The far-UV radiation of the voxel. All clumps are isotropically radiated with this radiation. It is different from and overridden by any default far-UV radiation specified in the constants sub-module. The default is 20000 \(\chi_\mathrm{D}\), where \(\chi_\mathrm{D}\) refers to the radiation in the Draine field.

  • crir – The primary cosmic ray ionisation rate with respect to molecular hydrogen (\(\zeta_{H_2}\)). By default, the local rate is used (2e-16 \(s^{-1}\)).

  • suggested_calc – This flag is used to specify the corrected version of the calculation should be used. It is True by default.

  • from_file – This flag can be set to retrieve the voxel properties from a file. It is False by default.

  • verbose – This is mainly used for debugging purposes. It prints various statements as the code is evaluated.

  • debug

  • timed

two_gaussians(x, a1, a2, sigma)[source]#

Return two Gaussians stacked horizontally.