Driver

class driver.Snapshot(snapdir, snapname, snapnum, extension)[source]

Bases: object

Class for tracking paths and data for simulation snapshots.

Parameters
  • snapdir (str) – Path to snapshot

  • snapname (str) – Name of snapshot minus number and extension

  • snapnum (int) – Snapshot number

  • extension (str, optional) – File extension of your snapshot, ‘hdf5’ by default.

Notes

This class attempts to concat strings to form a full path to your simulation snapshot in the following manner:

>>> '%s/%s%03d.%s' % (snapdir, snapname, snapnum, extension)
_make_output_dir()[source]

If output directory is not present, create it.

Perform the member_search() method on this snapshot.

set_output_information(ds, prefix='caesar_', suffix='hdf5')[source]

Set the name of the CAESAR output file.

driver.drive(snapdirs, snapname, snapnums, progen=False, skipran=False, member_search=True, extension='hdf5', caesar_prefix='caesar_', **kwargs)[source]

Driver function for running CAESAR on multiple snapshots.

Can utilize mpi4py to run analysis in parallel given that MPI and mpi4py is correctly installed. To do this you must create a script similar to the example below, then execute it via:

>>> mpirun -np 8 python my_script.py
Parameters
  • snapdirs (str or list) – A path to your snapshot directory, or a list of paths to your snapshot directories.

  • snapname (str) – Formatting of your snapshot name disregarding any integer numbers or file extensions; for example: snap_N256L16_

  • snapnums (int or list or array) – A single integer, a list of integers, or an array of integers. These are the snapshot numbers you would like to run CAESAR on.

  • progen (boolean, optional) – Perform most massive progenitor search. Defaults to False.

  • skipran (boolean, optional) – Skip running member_search() if CAESAR outputs are already present. Defaults to False.

  • member_search (boolean, optional) – Perform the member_search() method on each snapshot. Defaults to True. This is useful to set to False if you want to just perform progen for instance.

  • extension (str, optional) – Specify your snapshot file extension. Defaults to hdf5

  • prefix (str, optional) – Specify prefix for caesar filename (replaces ‘snap_’)

  • unbind_halos (boolean, optional) – Unbind halos? Defaults to False

  • unbind_galaxies (boolean, optional) – Unbind galaxies? Defaults to False

  • b_halo (float, optional) – Quantity used in the linking length (LL) for halos. LL = mean_interparticle_separation * b_halo. Defaults to b_halo = 0.2.

  • b_galaxy (float, optional) – Quantity used in the linking length (LL) for galaxies. LL = mean_interparticle_separation * b_galaxy. Defaults to b_galaxy = b_halo * 0.2.

  • ll_cloud (float, optional) – Linking length in comoving kpc (kpccm_ for clouds. Defaults to same linking length as used for galaxies.

  • fofclouds (boolean, optional) – Sets whether or not we run 3D FOF for clouds. Default is that this is not run as this isn’t the typical use case for Caesar, and slows things down a bit

  • fof6d (boolean, optional) – Sets whether or not we do 6D FOF for galaxies. if not set, the default is to do normal 3D FOF for galaxies.

  • fof6d_LL_factor (float, optional) – Sets linking length for fof6d

  • fof6d_mingrp (float, optional) – Sets minimum group size for fof6d

  • fof6d_velLL (float, optional) – Sets linking length for velocity in fof6d

  • nproc (int, optional) – Sets number of processors for fof6d

  • blackholes (boolean, optional) – Indicate if blackholes are present in your simulation. This must be toggled on manually as there is no clear cut way to determine if PartType5 is a low-res particle, or a black hole.

  • lowres (list, optional) – If you are running CAESAR on a Gadget/GIZMO zoom simulation in HDF5 format, you may want to check each halo for low-resolution contamination. By passing in a list of particle types (ex. [2,3,5]) we will check ALL objects for contamination and add the contamination attribute to all objects. Search distance defaults to 2.5x radii[‘total’].

Examples

>>> import numpy as np
>>> snapdir  = '/Users/bob/Research/N256L16/some_sim'
>>> snapname = 'snap_N256L16_'
>>> snapnums = np.arange(0,86)
>>>
>>> import caesar
>>> caesar.drive(snapdir, snapname, snapnums, skipran=False, progen=True)
driver.print_art()[source]

Print some ascii art.