pynbody.test_utils.gadget4_subfind_reader.Halos#

class pynbody.test_utils.gadget4_subfind_reader.Halos(basePath, snapNum)[source]#

Bases: object

This class extracts halo/subhalo information directly from the group catalog HDF5 file. It is used here to test that the group catalogue properties match those obtained via the pynbody interface.

It can load all halo/subhalo information from the entire group catalog for one snapshot or return group catalog information for one halo/subhalo.

Methods

gcPath(basePath, snapNum)

Return absolute path to a group catalog HDF5 file.

getNumPart(file)

Calculate number of particles of all types given a snapshot header.

getSnapOffsets(searchID, type)

Compute offsets within snapshot for a particular group/subgroup.

load([fields])

Load complete group catalog all at once.

loadHalo(haloid, partType[, fields])

Load all particles/cells of one type for a specific halo (optionally restricted to a subset fields).

loadHalos([fields])

Load all halo information from the entire group catalog for one snapshot (optionally restrict to a subset given by fields).

loadHeader()

Load the group catalog header.

loadObjects(gName, nName, fields)

Load either halo or subhalo information from the group catalog.

loadParams()

Load the group catalog header.

loadSingle([haloID, subhaloID])

Return complete group catalog information for one halo or subhalo.

loadSubhalo(haloid, partType[, fields])

Load all particles/cells of one type for a specific subhalo (optionally restricted to a subset fields).

loadSubhalos([fields])

Load all subhalo information from the entire group catalog for one snapshot (optionally restrict to a subset given by fields).

loadSubset([partType, fields, subset, float32])

Load a subset of fields for all particles/cells of a given partType. If offset and length specified, load only that subset of the partType. If mdi is specified, must be a list of integers of the same length as fields, giving for each field the multi-dimensional index (on the second dimension) to load. For example, fields=['Coordinates', 'Masses'] and mdi=[1, None] returns a 1D array of y-Coordinates only, together with Masses. If sq is True, return a numpy array instead of a dict if len(fields)==1. If float32 is True, load any float64 datatype arrays directly as float32 (save memory).

partTypeNum(partType)

Mapping between common names and numeric particle types.

snapPath(basePath, snapNum)

Return absolute path to a snapshot HDF5 file.

__init__(basePath, snapNum)[source]#
gcPath(basePath, snapNum)[source]#

Return absolute path to a group catalog HDF5 file.

getNumPart(file)[source]#

Calculate number of particles of all types given a snapshot header.

getSnapOffsets(searchID, type)[source]#

Compute offsets within snapshot for a particular group/subgroup.

load(fields=None)[source]#

Load complete group catalog all at once.

loadHalo(haloid, partType, fields=None)[source]#

Load all particles/cells of one type for a specific halo (optionally restricted to a subset fields).

loadHalos(fields=None)[source]#

Load all halo information from the entire group catalog for one snapshot (optionally restrict to a subset given by fields).

loadHeader()[source]#

Load the group catalog header.

loadObjects(gName, nName, fields)[source]#

Load either halo or subhalo information from the group catalog.

loadParams()[source]#

Load the group catalog header.

loadSingle(haloID=-1, subhaloID=-1)[source]#

Return complete group catalog information for one halo or subhalo.

loadSubhalo(haloid, partType, fields=None)[source]#

Load all particles/cells of one type for a specific subhalo (optionally restricted to a subset fields).

loadSubhalos(fields=None)[source]#

Load all subhalo information from the entire group catalog for one snapshot (optionally restrict to a subset given by fields).

loadSubset(partType='dm', fields=None, subset=None, float32=False)[source]#

Load a subset of fields for all particles/cells of a given partType. If offset and length specified, load only that subset of the partType. If mdi is specified, must be a list of integers of the same length as fields, giving for each field the multi-dimensional index (on the second dimension) to load.

For example, fields=[‘Coordinates’, ‘Masses’] and mdi=[1, None] returns a 1D array of y-Coordinates only, together with Masses.

If sq is True, return a numpy array instead of a dict if len(fields)==1. If float32 is True, load any float64 datatype arrays directly as float32 (save memory).

partTypeNum(partType)[source]#

Mapping between common names and numeric particle types.

snapPath(basePath, snapNum)[source]#

Return absolute path to a snapshot HDF5 file.