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

Creates a profile object that returns the requested quantiles for a given array in a given bin. The quantiles may be mass weighted.

Input:

sim: snapshot to make a profile from

q (default: (0.16,0.5,0.84)):

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 (default:None):

What should be used to weight the quantile. You will usually want to use particle mass: sim[‘mass’]. The default is to not weight by anything, weights=None.

Optional Keywords:

ndim: if ndim=2, an edge-on projected profile is produced,

i.e. density is in units of mass/pc^2. If ndim=3 a volume profile is made, i.e. density is in units of mass/pc^3.

Methods

create_particle_array(profile_name[, ...])

Create a particle array with the results of the profile calculation.

derivable_keys()

Returns a list of possible profiles

families()

Returns the family of particles used

keys()

Returns a listing of available profile types

write()

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

profile_property

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

Create a particle array with the results of the profile calculation.

After calling this function, sim[particle_name][i] == profile[profile_name][bin_in_which_particle_i_sits]

If particle_name is not specified, it defaults to the same as profile_name.

derivable_keys()#

Returns a list of possible profiles

families()#

Returns the family of particles used

keys()#

Returns a listing of available profile types

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.