temet.tracer
Monte Carlo tracer particles.
temet.tracer.evolution
Analysis for evolution of tracer quantities in time (for cosmo boxes/zooms).
- zoomDataDriver(sP, fields, snapStep=1)
Run and save data files for tracer evolution in several quantities of interest.
- boxTracerDataCutout(snap=None)
Extract cutout tracer data for individual subhalos from a full box.
- tracersTimeEvo(sP, fieldName, snapStep=None, all=True, pSplit=None)
Wrapper to handle zoom vs. box load.
- tracersMetaOffsets(sP, all=None, parIDs=None, trIDs=None, getPath=False)
Get offsets needed to load a halo/subhalo-restricted part of any of the tracer_tracks data.
For a fullbox sP and either sP.haloInd or sP.subhaloInd specified. If all == ‘Halo’ or ‘Subhalo’, then return all respective offsets and lengths. If parIDs or trIDs is not None, then a ptName to load and return these IDs for directly.
- loadAllOrRestricted(sP, saveFilename, datasetName=None, indRange=None)
Load a dataset from a tracer_tracks file, either full or for a halo/subhalo subset.
- accTime(sP, snapStep=1, rVirFac=1.0, pSplit=None, indRangeLoad=None)
Calculate ‘halo accretion time’ for each tracer, as the earliest (highest redshift) rvir crossing.
Uses the ‘rad_rvir’ field. Argument: rVirFac = what fraction of the virial radius denotes the accretion time?
- redshiftsToClosestSnaps(data, redshifts, indsNotSnaps=False)
Return the nearest snapshot number to each redshift.
Uses the data[‘redshifts’] and data[‘snaps’] mapping. By default, return simulation snapshot number, unless indsNotSnaps==True, in which case return the indices into the first dimension of data[field] for each tracer of the second dimension.
- accMode(sP, snapStep=1, pSplit=None, indRangeLoad=None)
Calculate an ‘accretion mode’ categorization for each tracer based on its group membership history.
Specifically, separate all tracers into one of [smooth/merger/stripped] defined as: * smooth: child of MPB or no subhalo at all z>=z_acc * merger: child of subhalo other than the MPB at z=z_acc * stripped: child of MPB or no subhalo at z=z_acc, but child of non-MPB subhalo at any z>z_acc Where z_acc is the accretion redshift defined as the first (highest z) crossing of the virial radius.
- valReduction(sP, fieldName, snapStep=1, op='max')
Calculate a reduction operation (e.g. min, max, mean) for every tracer for a given property (e.g. temp).
For [gas] values affected by the modified Utherm of the star-forming eEOS (temp, entr) we exclude times when SFR>0. This is then also consistent with what is done in the code for tracer_max* recorded values.
- trValsAtRedshifts(sP, valName, redshifts, snapStep=1)
Return some property from the tracer evolution tracks (e.g. rad_rvir, temp) at specific redshifts.
Given by valName at the times in the simulation given by redshifts. Extracted from closest snapshot, no interpolation of property value.
- trValsAtReductionTimes(sP, valName, redName, op='max', snapStep=1)
Wrap trValsAtRedshifts() to give trVals at the redshifts of these extremum (i.e. max) times.
- trValsAtAccTimes(sP, valName, rVirFac=1.0, snapStep=1)
Wrap trValsAtRedshifts() to give trVals at the redshifts of the tracer halo accretion times.
- mpbValsAtRedshifts(sP, valName, redshifts, snapStep=1)
Return some halo property, per tracer, from the main progenitor branch (MPB) (e.g. tvir, spin).
Given by valName at the times in the simulation given by redshifts.
- mpbValsAtExtremumTimes(sP, valName, extName, op='max', snapStep=1)
Wrap mpbValsAtRedshifts() to give mpbVals at the redshifts of these extremum (i.e. max) times.
- mpbValsAtAccTimes(sP, valName, rVirFac=1.0, snapStep=1)
Wrap mpbValsAtRedshifts() to give mpbVals at the redshifts of the tracer halo accretion times.
temet.tracer.montecarlo
Helper functions to efficiently work with the Monte Carlo tracers.
- getTracerChildren(sP, parentSearchIDs, inds=False, ParentID=None, ParentIDSortInds=None)
Return the list of all child tracers belonging to a set of parents, specified by IDs.
For an input list of parent IDs (a UNIQUE list of an unknown mixture of gas/star/BH IDs), return the complete list of child MC tracers belonging to those parents (either their IDs or their global indices in the snap).
- mapParentIDsToIndsByType(sP, parentIDs)
Return the global snapshot indices for a set of parent IDs, an unknown possibly non-unique mix of types.
(one per tracer, and so then possibly containing duplicates).
- concatTracersByType(trIDsByParType, parPartTypes)
Collapse trIDsByParType dictionary into 1D tracer ID/index list.
Ordering preserved according to the order of parPartTypes.
- subhaloTracerChildren(sP, inds=False, haloID=None, subhaloID=None, parPartTypes=['gas', 'stars', 'bhs'], concatTypes=True, ParentID=None, ParentIDSortInds=None, doCache=True)
For a given haloID or subhaloID, return all the child tracers of parents in that object.
Either their IDs or their global indices in the snap, by default for parents of all particle types, optionally restricted to input particle type(s).
- globalTracerChildren(sP, inds=False, halos=False, subhalos=False, parPartTypes=['gas', 'stars', 'bhs'], concatTypes=True, ParentID=None, ParentIDSortInds=None)
For all subhalos or halos in a snapshot, return all the child tracers of parents in those objects.
Either their IDs or their global indices in the snap, by default for parents of all particle types, optionally restricted to input particle type(s).
- getEvoSnapList(sP, toRedshift=None, snapStep=1, reqFluidQuants=False)
Helper for below.
- tracersTimeEvo(sP, tracerSearchIDs, trFields, parFields, toRedshift=None, snapStep=1, mpb=None, saveFilename=None, onlySnap=None, exitAfterOneSnap=False)
Follow a set of tracers through time, recording their properties as well as those of their parents.
For a given set of tracerIDs at sP.redshift, walk through snapshots either forwards or backwards until reaching toRedshift. At each snapshot, re-locate the tracers and record trFields as a time sequence (from fluid_properties). Then, locate their parents at each snapshot and record parFields (from valid snapshot fields). For gas fields (e.g. temp), if the tracer is in a parent of a different type at that snapshot, record NaN. If the tracer is in a BH, set Velocity=0 as a flag. If saveFilename specified, then we save inside this function one snapshot at a time (avoid large memory allocation, and can be restarted). Otherwise, return for external save. If exitAfterOneSnap, then process only one snapshot and return, mostly for memory efficiency.
- subhalosTracersTimeEvo(sP, subhaloIDs, toRedshift, trFields, parFields, parPartTypes, outPath, onlySnap=None)
For a set of subhaloIDs, determine all their child tracers, and then record their properties back in time.
- subhaloTracersTimeEvo(sP, subhaloID, fields, snapStep=1, toRedshift=10.0, fullHaloTracers=True)
For a single subhalo, determine all its child tracers and then record their properties back in time.
Continue until the beginning of the simulation (‘tracks’).
Note: Nearly identical to subhaloTracersTimeEvo() and can be merged in the future. Currently, here we do a separate snapshot loop for each quantity and save each quantity in a separate file. Memory load is smaller, run time is longer, parallelized to multiple quantities easily, and only one subhaloID supported at a time.
- globalTracerLength(sP, halos=False, subhalos=False, haloTracerOffsets=None)
Return a 1D array of the number of tracers per halo or subhalo.
Note: in direct analogy to LenType in the group catalogs. Compute the offsets as well.
- globalTracerMPBMap(sP, halos=False, subhalos=False, trIDs=None, retMPBs=False, extraFields=None, indRange=None)
Load all MPBs of a global tracer set and create a mapping between unique MPBs and tracers.
If indRange is not None (only so far when calling from accMode()), attempt to get halo_id’s using already computed parent_indextype tracer_tracks (for speed and efficiency only).
- globalAllTracersTimeEvo(sP, field, halos=True, subhalos=False, indRange=None, toRedshift=None)
For all tracers in all FoFs, record time evolution tracks of one field for all snapshots.
- checkTracerMeta(sP)
Verify globalAllTracersTimeEvo() ordering.
- concat_tracer_parent_cats()
Combine individual tracer_parent_indextype, tracer_subhalo_id, etc catalogs into single file.
temet.tracer.plot
Plotting for evolution of tracer quantities in time (for cosmo boxes/zooms).
- addRedshiftAgeImageAxes(ax, sP, snaps)
Add a redshift (bottom) and age (top) pair of axes for imshow plots.
Top axis does not work when a colorbar is also added to the plot.
- plotConfig(fieldName, extType='')
Store some common plot configuration parameters.
- getEvo2D(sP, field, trIndRange=None, accTime=None, accMode=None)
Create and cache various permutations of the full 2D evolution tracks for all tracers.
- plotEvo2D()
Plot various full 2D blocks showing evolution of ‘all’ tracer tracks vs redshift/radius.
- plotEvo1D()
Plot various 1D views showing evolution of tracer tracks vs redshift/radius.
- getValHistos(sP, field, extType, accMode=None)
Calculate and cache 1D histograms of field/extType combinations from the full tracer tracks.
- plotValHistos()
Plot (1D) histograms of extremum values, values at t_acc, or values at the extremum time of another value.
- plotPosTempVsRedshift()
Plot trMC position (projected) and temperature evolution vs redshift.
- plotStarFracVsRedshift()
Plot the fraction of tracers in stars vs. gas parents vs redshift.