magrittetorch.tools.setup
Contains the data structure of the images of a model.
- class magrittetorch.tools.setup.LamdaFileReader(fileName)
Reader for LAMDA line data files.
- extractCollisionPartner(line, species, elem)
Returns collision partner and whether it is ortho or para (for H2)
- readColumn(start, nElem, columnNr, type)
Returns a column of data as a list
- magrittetorch.tools.setup.create_rotation_matrix(n: ndarray) ndarray
Helper function to create rotation matrices. Returns a 3x3 orthonormal matrix around n.
- magrittetorch.tools.setup.getSpeciesNumber(species: Species, name: str) int
Returns number of species given by ‘name’
- Parameters:
species (Magrittetorch species object) – Contains the information about the chemical species in the model
name (str) – name of the chemical species
:raises KeyError : if the species name is not found in the list of chemical species:
- magrittetorch.tools.setup.getSpeciesNumberList(species: Species, name: list[str]) list[int]
Returns number of species given by ‘name’
- Parameters:
(Species) (species)
(list[str]) (name)
:raises KeyError : if the species name is not found in the list of chemical species:
- magrittetorch.tools.setup.set_Delaunay_boundary(model: Model) Model
Setter for the boundary, assuming all points are the cell centers of a Voronoi tesselation. Only supported for 1D.
- Parameters:
model (Magrittetorch model object) – Magrittetorch model object to set.
- Returns:
out – Updated Magrittetorch object.
- Return type:
Magrittetorch model object
- magrittetorch.tools.setup.set_Delaunay_neighbor_lists(model: Model) Model
Setter for the neighbor lists for each point, assuming they are the cell centers of a Voronoi tesselation.
- Parameters:
(Model) (model)
- Returns:
out – Updated Magrittetorch object.
- Return type:
Magrittetorch model object
- magrittetorch.tools.setup.set_boundary_condition_1D(model: ~magrittetorch.model.model.Model, T_in: ~astropy.units.quantity.Quantity = <Quantity 2.72548 K>, T_out: ~astropy.units.quantity.Quantity = <Quantity 2.72548 K>)
Setter for incoming black body radiation boundary condition at each boundary point.
- Parameters:
model (Magrittetorch model object) – Magrittetorch model object to set.
T_in (float) – Boundary temperature at the inner boundary.
T_out (float) – Boundary temperature at the outer boundary.
- Returns:
out – Updated Magrittetorch object.
- Return type:
Magrittetorch model object
- magrittetorch.tools.setup.set_boundary_condition_CMB(model: Model) Model
Setter for incoming CMB boundary condition at each boundary point.
- Parameters:
model (Magrittetorch model object) – Magrittetorch model object to set.
- Returns:
out – Updated Magrittetorch object.
- Return type:
Magrittetorch model object
- magrittetorch.tools.setup.set_boundary_condition_zero(model: Model) Model
Setter for incoming zero boundary condition at each boundary point.
- Parameters:
model (Magrittetorch model object) – Magrittetorch model object to set.
- Returns:
out – Updated Magrittetorch object.
- Return type:
Magrittetorch model object
- magrittetorch.tools.setup.set_linedata_from_LAMDA_file(model: Model, fileNames: list[str] | str, config: dict[str, list[int]] = {})
Set line data by reading it from a data file in LAMDA format.
- Parameters:
model (Magrittetorch model object) – Magrittetorch model object to set.
fileNames (list of strings) – List of file names for the LAMDA line data files.
config (dict) – Optionally specify specific radiative transitions to consider.
- Returns:
out – Updated Magrittetorch object.
- Return type:
Magrittetorch model object
- magrittetorch.tools.setup.set_quadrature(model: Model, nquads: int) Model
Setter for the quadrature roots and weights for the Gauss-Hermite quadrature, used for integrating over (Gaussian) line profiles.
- magrittetorch.tools.setup.set_rays_spherical_symmetry(model: Model, nrays: int, uniform: bool = True, nextra: int = 0, step: int = 1) Model
Setter for rays in a 1D spherically symmetric model.
- Parameters:
model (Magrittetorch model object) – Magrittetorch model object to set.
nrays (int) – Number of rays to use
uniform (bool) – Whether or not to use uniformly distributed rays.
nextra (int) – Number of extra rays to add.
step (int) – Step size used to step through the points when shooting rays (step=1 uses all points).
- Returns:
out – Updated Magrittetorch object.
- Return type:
Magrittetorch model object
- magrittetorch.tools.setup.set_uniform_rays(model: Model, nrays: int, randomize: bool = False, first_ray: ndarray = array([1., 0., 0.])) Model
Setter for rays to uniformly distributed directions.
- Parameters:
model (Model) – Magrittetorch model object to set.
nrays (int) – Number of rays to use
randomized (bool) – Whether or not to randomize the directions of the rays.
first_ray (np.ndarray) – Direction vector of the first ray in the ray list. Has dimensions [3]
- Returns:
out – Updated Magrittetorch object.
- Return type:
Magrittetorch model object