meraxes

meraxes.galaxy_history

Generate the full (first progenitor line) history of a galaxy.

dragons.meraxes.galaxy_history.galaxy_history(fname, gal_id, last_snapshot, pandas=False, props=None)[source]

Read in the full first progenitor history of a galaxy at a given final snapshot.

Args:
fname : str
Full path to input hdf5 master file.
gal_id : int
Unique ID of the target galaxy.
last_snapshot : int
Last snapshot (lowest redshift) at which the history is to be traced from.
props : list
A list of galaxy properties requested. (default: All properties)
Kwargs:
pandas : bool
Return panads dataframe. (default = False)
Returns:
history : ndarray or DataFrame
The requested first progenitor history.

meraxes.io

Routines for reading Meraxes output files.

dragons.meraxes.io.check_for_redshift(fname, redshift, tol=0.1)[source]

Check a Meraxes output file for the presence of a particular redshift.

Args:
fname : str
Full path to input hdf5 master file
redshift : float
Redshift value
Kwargs:
tol : float
+- tolerance on redshift value present. An error will be thrown of no redshift within this tollerance is found.
Returns:
snapshot : int
Closest snapshot
redshift : float
Closest corresponding redshift
dragons.meraxes.io.grab_redshift(fname, snapshot)[source]

Quickly grab the redshift value of a single snapshot from a Meraxes HDF5 file.

Args:
fname : str
Full path to input hdf5 master file
snapshot : int
Snapshot for which the redshift is to grabbed
Returns:
redshift : float
Corresponding redshift value
dragons.meraxes.io.grab_unsampled_snapshot(fname, snapshot)[source]

Quickly grab the unsampled snapshot value of a single snapshot from a Meraxes HDF5 file.

Args:
fname : str
Full path to input hdf5 master file
snapshot : int
Snapshot for which the unsampled value is to be grabbed
Returns:
redshift : float
Corresponding unsampled snapshot value
dragons.meraxes.io.list_grids(fname, snapshot)[source]

List the available grids from a Meraxes HDF5 output file.

Args:
fname : str
Full path to input hdf5 master file
snapshot : int
Snapshot for which the grids are to be listed.
Returns:
grids : list
A list of the available grids
dragons.meraxes.io.read_descendant_indices(fname, snapshot, pandas=False)[source]

Read the Descendant indices from the Meraxes HDF5 file.

Args:
fname : str
Full path to input hdf5 master file
snapshot : int
Snapshot from which the descendant dataset is to be read from.
pandas : bool
Return a pandas series instead of a numpy array. (default = False)
Returns:
desc_ind : array
NextProgenitor indices
dragons.meraxes.io.read_firstprogenitor_indices(fname, snapshot, pandas=False)[source]

Read the FirstProgenitor indices from the Meraxes HDF5 file.

Args:
fname : str
Full path to input hdf5 master file
snapshot : int
Snapshot from which the progenitors dataset is to be read from.
pandas : bool
Return a pandas series instead of a numpy array. (default = False)
Returns:
fp_ind : array or series
FirstProgenitor indices
dragons.meraxes.io.read_gals(fname, snapshot=None, props=None, quiet=False, sim_props=False, pandas=False, h=None, indices=None)[source]

Read in a Meraxes hdf5 output file.

Reads in the default type of HDF5 file generated by the code.

Args:
fname : str
Full path to input hdf5 master file.
Kwargs:
snapshot : int
The snapshot to read in. (default: last present snapshot - usually z=0)
props : list
A list of galaxy properties requested. (default: All properties)
quiet : bool
Suppress output info and status messages. (default: False)
sim_props : bool
Output some simulation properties as well. (default = False)
pandas : bool
Ouput a pandas dataframe instead of an astropy table. (default = False)
h : float
Hubble constant (/100) to scale the galaxy properties to. If None then no scaling is made unless set_little_h was previously called. (default = None)
indices : list or array
Indices of galaxies to be read. If None then read all galaxies. (default = None)
Returns:

An astropy table with the requested galaxies and properties.

If sim_props==True then output is a tuple of form (galaxies, sim_props)

dragons.meraxes.io.read_git_info(fname)[source]

Read the git diff and ref saved in the master file.

Args:
fname : str
Full path to input hdf5 master file.
Returns:
ref : str
git ref of the model
diff : str
git diff of the model
dragons.meraxes.io.read_global_xH(fname, snapshot, quiet=False)[source]

Read global xH from the Meraxes HDF5 file.

Args:
fname : str
Full path to input hdf5 master file
snapshot : int or list
Snapshot(s) from which the global xH is to be read from.
Returns:
global_xH : float or ndarray
Global xH value(s)
dragons.meraxes.io.read_grid(fname, snapshot, name, h=None, h_scaling={}, quiet=False)[source]

Read a grid from the Meraxes HDF5 file.

Args:
fname : str
Full path to input hdf5 master file
snapshot : int
Snapshot from which the grid is to be read from.
name : str
Name of the requested grid
h : float
Hubble constant (/100) to scale the galaxy properties to. If None then no scaling is made unless set_little_h was previously called. (default = None)
h_scaling : dict
Dictionary of grid names (keys) and associated Hubble constant scalings (values) as lambda functions. e.g. | h_scaling = {“MassLikeGrid” : lambda x, h: x/h,}
Returns:
grid : array
The requested grid
dragons.meraxes.io.read_input_params(fname, h=None, quiet=False, raw=False)[source]

Read in the input parameters from a Meraxes hdf5 output file.

Args:
fname : str
Full path to input hdf5 master file.
h : float
Hubble constant (/100) to scale the galaxy properties to. If None then no scaling is made unless set_little_h was previously called. (default = None)
raw : bool
Don’t augment with extra useful quantities. (default = False)
Returns:
A dict containing all run properties.
dragons.meraxes.io.read_nextprogenitor_indices(fname, snapshot, pandas=False)[source]

Read the NextProgenitor indices from the Meraxes HDF5 file.

Args:
fname : str
Full path to input hdf5 master file
snapshot : int
Snapshot from which the progenitors dataset is to be read from.
pandas : bool
Return a pandas series instead of a numpy array. (default = False)
Returns:
np_ind : array
NextProgenitor indices
dragons.meraxes.io.read_ps(fname, snapshot)[source]

Read 21cm power spectrum from the Meraxes HDF5 file.

Args:
fname : str
Full path to input hdf5 master file
snapshot : int
Snapshot from which the power spectrum is to be read from.
Returns:
kval : array
k value (Mpc^-1)
ps : array
power value (should be dimensionless but actually might be power density i.e. with units [Mpc^-3])
pserr : array
error
dragons.meraxes.io.read_size_dist(fname, snapshot)[source]

Read region size distribution from the Meraxes HDF5 file.

Args:
fname : str
Full path to input hdf5 master file
snapshot : int
Snapshot from which the region size distribution is to be read from.
Returns:
Rval : array
R value
RdpdR : array
RdpdR value
dragons.meraxes.io.read_snaplist(fname, h=None)[source]

Read in the list of available snapshots from the Meraxes hdf5 file.

Args:
fname : str
Full path to input hdf5 master file.
Kwargs:
h : float
Hubble constant (/100) to scale the galaxy properties to. If None then no scaling is made unless set_little_h was previously called. (default = None)
Returns:
snaps : array
snapshots
redshifts : array
redshifts
lt_times : array
light travel times (Myr)
dragons.meraxes.io.read_units(fname, quiet=False)[source]

Read in the units and hubble conversion information from a Meraxes hdf5 output file.

Args:
fname : str
Full path to input hdf5 master file.
Returns:
units : dict
A dict containing all units (Hubble conversions are stored with key HubbleConversions).
dragons.meraxes.io.set_little_h(h)[source]

Set the value of little h to be used by all future meraxes.io calls where applicable.

Args:
h : float
Little h value

meraxes.reion

Routines for reionisation related calculations.

dragons.meraxes.reion.electron_optical_depth(fname, volume_weighted=False)[source]

Calculate the electron Thomson scattering optical depth from a Meraxes + 21cmFAST run. Note that this implementation assumes that the simulation volume is fully ionised before the final snapshot stored in the input file.

Args:
fname : str
Full path to input hdf5 master file
volume_weighted : bool
This option is just for testing purposes as it can take a long time to mass weight the neutral fraction depending on the grid size. The optical depth obtained is often very similar to the correctly mass weighted value, however, this should not be used to final results.
Returns:
z_list : ndarray
Redshifts of each snapshot read in the input simulation.
scattering_depth : ndarray
Thomson scattering depth integrated between z=0 and each snapshot of the input simulation.