pynbody.analysis.profile.QuantileProfile#

class pynbody.analysis.profile.QuantileProfile(sim, q=(0.16, 0.5, 0.84), weights=None, load_from_file=False, ndim=3, type='lin', **kwargs)[source]#

Bases: Profile

A profile object that returns requested quantiles instead of means in each bin.

Methods

derivable_keys()

Returns a list of possible profiles

families()

Returns the family of particles used

keys()

Returns a listing of available profile types

profile_property(fn)

Function decorator to define a new profile property.

write()

Writes all the vital information of the profile to a file.

__init__(sim, q=(0.16, 0.5, 0.84), weights=None, load_from_file=False, ndim=3, type='lin', **kwargs)[source]#

Creates a profile object that returns the requested quantiles for a given array in a given bin.

Parameters:
  • sim (pynbody.snapshot.simsnap.SimSnap) – The snapshot to make a profile from.

  • q (list of floats, optional) – The quantiles that will be returned. Default is median with 1-sigma on either side. q can be of arbitrary length allowing the user to select any quantiles they desire.

  • weights (pynbody.array.SimArray, optional) – What should be used to weight the quantile. A likely possibility is to use particle mass: sim['mass']. The default is to weight by particle number, weights=None.

  • **kwargs – Additional keyword arguments are passed onto the underlying Profile constructor.

derivable_keys()#

Returns a list of possible profiles

families()#

Returns the family of particles used

keys()#

Returns a listing of available profile types

static profile_property(fn)#

Function decorator to define a new profile property.

For example,

@Profile.profile_property
def x_squared(pro):
    return pro['x']**2

would define a new profile property ‘x_squared’ which is the square of the ‘x’ profile. This can then be accessed as pro['x_squared'] for any profile object pro.

write()#

Writes all the vital information of the profile to a file.

To recover the profile, initialize a profile with the load_from_file=True keyword to automatically load a previously saved profile. The filename is chosen automatically and corresponds to a hash generated from the positions of the particles used in the profile. This is to ensure that you are always looking at the same set of particles, centered in the same way. It also means you must use the same centering method if you want to reuse a saved profile.