SciPy

Halo radius and mass definitions

This unit handles definitions of halo extent, boundary, and mass. Most importantly, it converts a uniquely defined string-based format for definitions to a machine-readable format, and vice versa. Halo definitions are encapsulated by an object with the following main properties:

  • quantity: Indicates the actual quantity described, e.g., radius, mass, peak height, of circular velocity. Perhaps counter-intuitively, this field can be unknown, in which case a general type of definition is described.

  • type: The main type of definition, e.g. friends-of-friends, overdensity, or splashback.

  • subtype: A refinement of type. For example, there are SO defintions wrt critical or mean density, and many types of splashback definitions.

The string format is then generated as <quantity><type><subtype>_<other-properties>. The user can generate a HaloDefinition object from a string using strToDef() and convert the object back using HaloDefinition.toStr().

There are also a number of less important, optional descriptors for which a default is set so that they do not need to be explicitly spelled out in the string format. This unit determines which definitions can be requested in SPARTA or MORIA configuration files, as long as they can be computed by the code.

The implementation exactly shadows the C implementation contained in SPARTA, so that the numerical values of all settings are the same in both languages:

Property

Value

String

Explanation

Quantity

HDEF_Q_UNKNOWN

Default

Could describe any, general type

HDEF_Q_RADIUS

R

Halo radius

HDEF_Q_MASS

M

Halo mass

HDEF_Q_PEAKHEIGHT

nu

Peak height

HDEF_Q_VCIRC

V

Cirular velocity

Type

HDEF_TYPE_SO

m/c/vir

Spherical overdensity

HDEF_TYPE_SPLASHBACK

sp

Splashback

HDEF_TYPE_FOF

fof

Friends-of-friends

HDEF_TYPE_VMAX

max

Maximum circular velocity

HDEF_TYPE_ORBITING

orb

Orbiting particles

Subtype

HDEF_SUBTYPE_SO_MATTER

<int>m

Matter-based SO (e.g., 200m)

HDEF_SUBTYPE_SO_CRITICAL

<int>c

Critical-based SO (e.g., 200c)

HDEF_SUBTYPE_SO_VIRIAL

vir

Virial-based SO (varying overdensity)

HDEF_SUBTYPE_SP_SLOPE_PROFILE

slp-prf

Radius where slope is steepest

HDEF_SUBTYPE_SP_SLOPE_MEDIAN

slp-med

Steepest slope radius in median of angular bins

HDEF_SUBTYPE_SP_SLOPE_SHELL

slp-shl

Non-isotropic steepest slope (e.g. SHELLFISH)

HDEF_SUBTYPE_SP_APOCENTER_RADIUS_MEAN

apr-mn

Mean of first apocenter radii of halo particles

HDEF_SUBTYPE_SP_APOCENTER_RADIUS_PERCENTILE

apr-p<int>

Percentile of first apocenter radii of ptl.

HDEF_SUBTYPE_SP_APOCENTER_SHELL_MEAN

aps-mn

Non-isotropic apocenter mean

HDEF_SUBTYPE_SP_APOCENTER_SHELL_PERCENTILE

aps-p<int>

Non-isotropic apocenter percentile

HDEF_SUBTYPE_ORB_ALL

all

All orbiting particles that ever entered the halo

HDEF_SUBTYPE_ORB_PERCENTILE

p<int>

Percentile of orbiting ptl (within some radius)

Time

HDEF_TIME_NOW

Default

Current state of halo

HDEF_TIME_ACC

acc

State of subhalo at last accretion

HDEF_TIME_PEAK

peak

State of halo at peak of this property

Particle selection

HDEF_PTLSEL_DEFAULT

Default

Not specified

HDEF_PTLSEL_ALL

all

Definition includes all halo particles

HDEF_PTLSEL_BOUND

bnd

Definition includes only grav. bound particles

HDEF_PTLSEL_TRACER

tcr

Definition includes only traced ptl (for subhalos)

HDEF_PTLSEL_ORBITING

orb

Definition includes only orbiting particles

Source

HDEF_SOURCE_ANY

Default

Unknown source, unspecified

HDEF_SOURCE_CATALOG

cat

Taken from halo catalog

HDEF_SOURCE_SPARTA

spa

Computed by SPARTA

HDEF_SOURCE_SHELLFISH

sfish

Computed by SHELLFISH

Value or error

HDEF_ERR_NO

Default

This is the indicated quantity

HDEF_ERR_1SIGMA

err

This is the 1-sigma uncertainty on the quantity

HDEF_ERR_2SIGMA

err2s

This is the 2-sigma uncertainty on the quantity

Other flags

HDEF_FLAG_INTERNAL

internal

Flag for internally used values

Depending on the choices, a number of numerical values can become active, in particular:

  • overdensity: if type is HDEF_TYPE_SO and subtype is HDEF_SUBTYPE_SO_MATTER or HDEF_SUBTYPE_SO_CRITICAL.

  • linking_length: if type is HDEF_TYPE_FOF.

  • percentile: if type is HDEF_TYPE_SPLASHBACK and subtype is HDEF_SUBTYPE_SP_APOCENTER_RADIUS_PERCENTILE or HDEF_SUBTYPE_SP_APOCENTER_SHELL_PERCENTILE.

Examples

Valid examples of mass definitions would include:

  • 200m, vir

  • R200m, M200m, nu200m

  • Vmax

  • Mfof-b0.2, Rfof-b0.15

  • Rsp-slp-prf, Msp-slp-prf

  • Rsp-apr-p75

Not strictly correct, but also accepted when converting from a string are different capitalizations of the quantity (but only the quantity), e.g.:

  • r200m, m200m, mfof-b0.2

  • NU200m, Nu200m

  • vmax

While those strings will be converted into a halo definition without an error, converting the definition back to a string will result in the standard capitalization. Thus, it is recommended to stick with R, M and so on whenever possible.

All additional properties are separated by underscores and can be ordered at will. Defaults are used if no value is specified. Valid definitions thus include:

  • R200m

  • R200m_peak, R200m_acc

  • R200m_all, R200m_bnd

  • R200m_cat, R200m_spa

  • R200m_err, R200m_err2s

The best way to test whether a definition is valid is to try converting it with strToDef(), which will throw an error if the string is not a correct definition.

Module reference

class sparta_tools.halodef.HaloDefinition

Object that encapsulates a halo definition.

Methods

overdensityStr()

Convert an SO halo definition to a short overdensity identifier, such as "200m" or "500c".

toLabel([add_dollars, add_units, ...])

Convert halo definition to a latex label.

toStr()

Convert halo definition to string.

toStr()

Convert halo definition to string.

Returns
defstr: str

A string that uniquely describes the halo definition, and that can be converted back into the same definition.

toLabel(add_dollars=True, add_units=False, suppress_source=False, suppress_time=False, suppress_bound=False, suppress_flags=False)

Convert halo definition to a latex label.

Parameters
add_dollars: bool

Whether or not to add $ signs at the beginning and end of the string.

add_units: bool

Add units in brackets behind the label.

suppress_source: bool

Do not output source identifiers (e.g., _cat).

suppress_time: bool

Do not output time identifiers (e.g., _peak or _acc).

suppress_bound: bool

Do not output all-particle and bound-only identifiers (e.g., _all and _bnd).

suppress_flags: bool

Do not output additional flag info (e.g., _internal).

Returns
label: str

A string that can be fed to latex, e.g. for figure labels.

overdensityStr()

Convert an SO halo definition to a short overdensity identifier, such as “200m” or “500c”.

This function fails if the definition is not an SO definition, and ignores any additional properties of the definition.

Returns
so_str: str

A string that identifies the overdensity of an SO definition.

sparta_tools.halodef.strToDef(defstr)

Convert a halo definition string to a halo definition object.

Parameters
defstr: str

A string that uniquely describes the halo definition in the correct format.

Returns
hdef: HaloDefinition

A halo definition object that can be converted back into the same string.