Progen

progen.caesar_filename(snap, prefix, extension)[source]

return full Caesar filename including filetype extension for given Snapshot object.

progen.check_if_progen_is_present(caesar_file, index_name)[source]

Check CAESAR file for progen indexes.

Parameters
  • caesar_file (str) – Name (including path) of Caesar file with tree_data

  • index_name (str) – Name of progen index to get redshift for (e.g. ‘progen_galaxy_star’)

progen.collect_group_IDs(obj, data_type, part_type, snap_dir)[source]

Collates list of particle and associated group IDs for all specified objects. Returns particle and group ID lists, and a hash list of indexes for particle IDs corresponding to the starting index of each group.

Parameters
  • obj (main.CAESAR) – Caesar object for which to collect group IDs

  • data_type (str) – ‘halo’, ‘galaxy’, or ‘cloud’

  • part_type (str) – Particle type

  • snap_dir (str) – Path where snapshot files are located; if None, uses obj.simulation.fullpath

progen.find_progens(pid_current, pid_target, gid_current, gid_target, pid_hash, npart_target, n_most=None, min_in_common=0.1, nproc=1, reverse_match=False)[source]

Find most massive and second most massive progenitor/descendants.

Parameters
  • pids_current (np.ndarray) – particle IDs from the current snapshot.

  • pids_target (np.ndarray) – particle IDs from the previous/next snapshot.

  • gids_current (np.ndarray) – group IDs from the current snapshot.

  • gids_target (np.ndarray) – group IDs from the previous/next snapshot.

  • pid_hash (np.ndarray) – indexes for the start of each group in pids_current

  • n_most (int) – Find n_most most massive progenitors/descendants, None for all.

  • min_in_common (float) – Require >this fraction of parts in common between object and progenitor to be a valid progenitor.

  • nproc (int) – Number of cores for multiprocessing. Note that this doesn’t help much since most of the time is spent in sorting.

  • reverse_match (bool) –

progen.get_progen_redshift(caesar_file, index_name)[source]

Returns redshift of progenitors/descendants currently stored in tree_data. Returns -1 (with warning) if no tree_data is found.

Parameters
  • caesar_file (str) – Name (including path) of Caesar file with tree_data

  • index_name (str) – Name of progen index to get redshift for (e.g. ‘progen_galaxy_star’)

progen.progen_finder(obj_current, obj_target, caesar_file, snap_dir=None, data_type='galaxy', part_type='star', recompute=True, save=True, n_most=None, min_in_common=0.1, nproc=1, match_frac=False, reverse_match=False)[source]

Function to find the most massive progenitor of each Caesar object in obj_current in the previous snapshot. Returns list of progenitors in obj_target associated with objects in obj_current

Parameters
  • obj_current (main.CAESAR) – Will search for the progenitors of the objects in this object.

  • obj_target (main.CAESAR) – Looking for progenitors in this object.

  • caesar_file (str) – Name (including path) of Caesar file associated with primary snapshot, where progen info will be written

  • snap_dir (str) – Path where snapshot files are located; if None, uses obj.simulation.fullpath

  • data_type (str) – ‘halo’, ‘galaxy’, or ‘cloud’

  • part_type (str) – Particle type in ptype_ints. Current options: ‘gas’, ‘dm’, ‘dm2’, ‘star’, ‘bh’

  • recompute (bool) – False = see if progen info exists in caesar_file and return, if not then compute True = always (re)compute progens

  • save (bool) – True/False = write/do not write info to caesar_file

  • n_most (int) – Find n_most most massive progenitors/descendants. Stored as a list for each galaxy. Default: None for all progenitors/descendants

  • min_in_common (float) – Require >this fraction of parts in common between object and progenitor to be a valid progenitor.

  • nproc (int) – Number of cores for multiprocessing.

  • match_fracs (bool) – True/False = Return / do _not_ return match fraction for each match

  • reverse_match (bool) – False = match all objects where fraction of _current_ is above min_in_common True = match all objects where fraction of _target_ is above min_in_common if match_fracs=True, returned fraction is the fraction of the current/target (False/True)

progen.run_progen(snapdirs, snapname, snapnums, prefix='caesar_', suffix='hdf5', **kwargs)[source]

Function to run progenitor/descendant finder in specified snapshots (or redshifts) in a given directory.

Parameters
  • snapdirs (str or list of str) – Full path of directory(s) where snapshots are located

  • snapname (str) – Formatting of snapshot name excluding any integer numbers or file extensions; e.g. ‘snap_N256L16_

  • snapnums (int or list of int) – Snapshot numbers over which to run progen. Increasing order -> descendants; Decreasing -> progens.

  • prefix (str) – Prefix for caesar filename; assumes these are in ‘Groups’ subdir

  • suffix (str) – Filetype suffix for caesar filename

  • kwargs (Passed to progen_finder()) –

progen.wipe_progen_info(caesar_file, index_name=None)[source]

Remove all progenitor/descendant info from Caesar file.

Parameters
  • caesar_file (str) – Name (including path) of Caesar file with tree_data

  • index_name (str (optional)) – Name (or substring) of progen index to remove (e.g. ‘progen_galaxy_star’). If not provided, removes all progen/descend info

progen.z_to_snap(redshift, snaplist_file='Simba', mode='closest')[source]

Finds snapshot number and snapshot redshift close to input redshift.

Parameters
  • redshift (float) – Redshift you want to find snapshot for

  • snaplist_file (str) – Name (including path) of Caesar file with a list of expansion factors (in ascending order) at which snapshots are output. This is the same file as used when running a Gizmo/Gadget simulation. ‘Simba’ returns the value for the default Simba simulation snapshot list.

  • mode (str) – ‘closest’ finds closest one in redshift ‘higher’/’upper’/’above’ finds the closest output >= redshift ‘lower’/’below’ finds the closest output <= redshift.