diskpy.clumps.simclumps package

Module contents

Created on Sat Jul 18 15:36:26 2015

@author: ibackus

diskpy.clumps.simclumps.newSimgroup(simlist)[source]

Generates a new simgroup object from a list of clumplists.

diskpy.clumps.simclumps.newSim(clumplist)[source]

Generates a sim object from a list of clump dictionaries for an entire simulation.

diskpy.clumps.simclumps.newClump(clumpDict)[source]

Generates a new clump object from a clump dictionary (see clumps.blank_clump and clumps.build_clumps).

diskpy.clumps.simclumps.clump(nt)[source]

Generates a clump object, which is basically just a pynbody SimSnap where time steps are represented by particles.

ARGUMENTS

nt : int
Number of time steps in the simulation
class diskpy.clumps.simclumps.sim[source]

Bases: numpy.ndarray

The sim class. sims are basically just numpy arrays containing clump objects. It stores data for all the clumps in a given simulation (for all available time steps). Additionally, slicing can be done in different ways (see below)

To initialize a blank sim object:

>>> s = sim(nClumps)

To generate a sim object from a list of clumpDicts for a simulation (ie the output of clumps.clump_tracker())

>>> s = newSim(clumplist)

Where nClumps is the number of clumps in the simulation

Accessing different quantites:

>>> s = newSim(clumplist) # create sim object from clumplist
>>> x = s('x', t=slice(None)) # get x for all clumps at all times
# Get the mass for the first time step at which the clumps exist
>>> m0 = s('mass',t=0,clumpexist=True)
# Get velocity for the final timestep at which a clump exists
>>> vf = s('vel', t=-1, clumpexist=True)
# Get masses of all clumps at end of simulation
>>> all_masses = s('mass', t=-1)
>>> mask = ~np.isnan(all_masses)
>>> mf = all_masses[mask]

Print available keys:

>>> s.keys()

Select a sub-group of clumps by normal array slicing:

>>> s1 = s[0:10]

CALL FUNCTION ARGUMENTS s(key, t=None, clumpexist=False, clump=None)

key : str
Clump key to access
t : slicer
Anything that can be used to slice a numpy array, eg [1,2,4] or slice(0,-1). Slices according to the simulation time
clumpexist : bool
Filter out all quantities by whether the clump exists at that time. e.g., this makes it easy to select the first timestep when a clump exists
clump : slicer
Anything that can be used to slice a numpy array, eg [1,2,4] or slice(0,-1). Slices by clump number
keys()[source]

Return keys present in all clumps

nClumps()[source]

Returns the number of clumps in the simulation

nt()[source]

Returns the number of timesteps in the simulation

class diskpy.clumps.simclumps.simgroup[source]

Bases: numpy.ndarray

The simgroup class. Basically just an array containing a bunch of sim objects. Meant to contain information for clumps in a suite of simulations

To initialize a blank sim group:

>>> sgrp = simgroup(nSims)

To initialize from a list of simulations (ie a list of the outputs from clumps.clumptracker()):

>>> sgrp = newSimgroup(simlist)

Accessing different quantites:

>>> s = newSimgroup(simlist) # create sim object from simlist
>>> x = s('x', t=slice(None)) # get x for all clumps at all times
# Get the mass for the first time step at which the clumps exist
>>> m0 = s('mass',t=0,clumpexist=True)
# Get velocity for the final timestep at which a clump exists
>>> vf = s('vel', t=-1, clumpexist=True)
# Get masses of all clumps at end of simulation
>>> all_masses = s('mass', t=-1)
>>> mask = ~np.isnan(all_masses)
>>> mf = all_masses[mask]

Print available keys:

>>> s.keys()

Select a sub-group of simulations by normal array slicing:

>>> s1 = s[0:10]

CALL FUNCTION ARGUMENTS s(key, t=None, clumpexist=False, clump=None, sims=None)

key : str
Clump key to access
t : slicer
Anything that can be used to slice a numpy array, eg [1,2,4] or slice(0,-1). Slices according to the simulation time
clumpexist : bool
Filter out all quantities by whether the clump exists at that time. e.g., this makes it easy to select the first timestep when a clump exists
clump : slicer
Anything that can be used to slice a numpy array, eg [1,2,4] or slice(0,-1). Slices by clump number
sims : slicer
Anything that can be used to slice a numpy array, eg [1,2,4] or slice(0,-1). Slices by simulation number
keys()[source]

Return keys present in all clumps

nClumps()[source]
nsim()[source]

Return the number of simulations present here

diskpy.clumps.simclumps.exists(sim)[source]

Defines a pynbody derived array which determines the time steps a clump exists at

diskpy.clumps.simclumps.len2(x)[source]

A modified version of len() to work with numbers. Numbers have a length of 1

diskpy.clumps.simclumps.arraylistcat(arraylist)[source]

Concatenate a list of like arrays (or SimArrays) into a single array. Concatenates along the first dimension Returns None for an empty list