magritte.setup module

class magritte.setup.LamdaFileReader(fileName)

Bases: object

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

magritte.setup.check_if_1D(model)

Check if the point positions are 1D for Magritte, i.e only have a non-zero x-coordinate, raises a ValueError if not.

Parameters

model (Magritte model object) – Magritte model object of which to check the dimension.

magritte.setup.check_if_ordered(arr)

Check if an array is ordered, raise a ValueError if not.

Parameters

arr (array_like) – 1D array to check for ordering.

magritte.setup.convertTempToColumnNameAstroquery(temp)
magritte.setup.create_rotation_matrix(n)

Helper function to create rotation matrices. Returns a 3x3 orthonormal matrix around n.

magritte.setup.extractCollisionPartner(fileName, line, species, elem)

Returns collision partner and whether it is ortho or para (for H2)

magritte.setup.extractCollisionPartnerAstroquery(partner, species)
magritte.setup.getProperName(name)

Return the standard name for the species.

magritte.setup.getSpeciesNumber(species, name)

Returns number of species given by ‘name’

Parameters
  • species (Magritte 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:

magritte.setup.load_balance_directions(directions, comm_size)

Basic attempt to imporved load balancing between different MPI processes by reordering the rays such that each process gets a similar set of direcitons.

magritte.setup.set_Delaunay_boundary(model)

Setter for the boundary, assuming all points are the cell centers of a Voronoi tesselation.

Parameters

model (Magritte model object) – Magritte model object to set.

Returns

out – Updated Magritte object.

Return type

Magritte model object

magritte.setup.set_Delaunay_neighbor_lists(model)

Setter for the neighbor lists for each point, assuming they are the cell centers of a Voronoi tesselation.

Parameters

model (Magritte model object) – Magritte model object to set.

Returns

out – Updated Magritte object.

Return type

Magritte model object

magritte.setup.set_boundary_condition_1D(model, T_in=2.72548, T_out=2.72548)

Setter for incoming black body radiation boundary condition at each boundary point.

Parameters
  • model (Magritte model object) – Magritte 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 Magritte object.

Return type

Magritte model object

magritte.setup.set_boundary_condition_CMB(model)

Setter for incoming CMB boundary condition at each boundary point.

Parameters

model (Magritte model object) – Magritte model object to set.

Returns

out – Updated Magritte object.

Return type

Magritte model object

magritte.setup.set_boundary_condition_zero(model)

Setter for incoming zero boundary condition at each boundary point.

Parameters

model (Magritte model object) – Magritte model object to set.

Returns

out – Updated Magritte object.

Return type

Magritte model object

magritte.setup.set_linedata_from_LAMDA_file(model, fileNames, config={})

Set line data by reading it from a data file in LAMDA format.

Parameters
  • model (Magritte model object) – Magritte 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 Magritte object.

Return type

Magritte model object

Note

Do not use the Magritte objects linedata etc. this will kill performance. Hence, the copies.

magritte.setup.set_quadrature(model)

Setter for the quadrature roots and weights for the Gauss-Hermite quadrature, used for integrating over (Gaussian) line profiles.

Parameters

model (Magritte model object) – Magritte model object to set.

Returns

out – Updated Magritte object.

Return type

Magritte model object

magritte.setup.set_rays_spherical_symmetry(model, uniform=True, nextra=0, step=1)

Setter for rays in a 1D spherically symmetric model.

Parameters
  • model (Magritte model object) – Magritte model object to set.

  • 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 Magritte object.

Return type

Magritte model object

magritte.setup.set_uniform_rays(model, randomize=False, first_ray=array([1., 0., 0.]))

Setter for rays to uniformly distributed directions.

Parameters
  • model (Magritte model object) – Magritte model object to set.

  • randomized (bool) – Whether or not to randomize the directions of the rays.

  • first_ray (array-like) – Direction vector of the first ray in the ray list.

Returns

out – Updated Magritte object.

Return type

Magritte model object