clustertools.io.load module

Read in cluster from Nbody simulations or generate an Nbody cluster

clustertools.io.load.advance_cluster(cluster, load_function=None, ofile=None, orbit=None, filename=None, **kwargs)[source]

Advance a loaded StarCluster snapshot to the next timestep

  • ofile or orbit need to be provded again, same as load_cluster.

  • Be sure that advance is set to True so next line of orbit file is read in

  • if last snapshot has been reached, returns an empty StarCluster

Parameters:
cluster - class

StarCluster to be advanced

load_functionfunction

use a custom function to load data (default : None)

ofilefile

an already opened file containing orbit information (default: None)

orbitclass

a galpy orbit to be used for the StarCluster’s orbital information (default: None)

filename :str

name of file to be opened (optional - necessary if no defaults assigned to ctype) (default: None)

Returns:
clusterclass

StarCluster

Other Parameters:
Same as load_cluster except for:
dtoutinteger

number of nbody timesteps forward to advance to next Nbody6++ timestep (default = 1)

clustertools.io.load.load_cluster(ctype='snapshot', units=None, origin=None, ofile=None, orbit=None, filename=None, particles=None, load_function=None, **kwargs)[source]

Load a StarCluster snapshot from a generic code output

Parameters

ctypestr

Type of file being loaded Currently supports:

  • amuse

  • astropy_table

  • limepy

  • nbody6

  • nbody6se

  • nbody6pp or nbody6++

  • nemo or gyrfalcon

  • snapshot

unitsstr

units of input data (default: None)

originstr

origin of input data (default: None)

ofilefile

an already opened file containing orbit information (default: None)

orbitclass

a galpy orbit to be used for the StarCluster’s orbital information (default: None)

filenamestr

name of file to be opened (optional - necessary if no defaults assigned to ctype) (default: None)

particlesparticles

AMUSE particle dataset (default: None) or ~astropy.table.Table instance if ctype is “astropy_table” or galpy orbits instance if ‘ctype’ is ‘galpy’

load_functionfunction

use a custom function to load data (default : None)

Returns:
clusterclass

StarCluster

Other Parameters:
ofilenamestr

orbit filename if ofile or orbit is not given

ounitsstr

units of orbital information (else assumed equal to StarCluster.units)

nsnapint

if a specific snapshot is to be read in instead of starting from zero

nzfillint

value for zfill when reading and writing snapshots (Default: 5)

delimiterstr

choice of delimiter when reading ascii/csv files (Default: ‘,’)

wdirstr

working directory of simulation if not current directory (Default: ‘’)

snapdirstr

directory of snapshot if not wdir (Default: ‘’)

snapbasestr

base for snapshot filename (Default: ‘’)

snapendstr

end for snapshot filename (Default: ‘’)

skiprowsint

number of rows to skip when reading in snapshot (Default: 0)

initializebool

initialize a galpy orbit after reading in orbital information (default: False)

projectedbool

calculate projected values as well as 3D values (Default: True)

sortstarsbool

sort stars in order from closes to the origin to the farthest (default: True)

column_mapperdict

see _get_astropy_table

verbosebool

print additional information to screen while loading (default : False)

givestr

set what parameters are read in from nemo/gyrfalcon (default: ‘mxv’) Currently only accepts ‘mxvpqael’ as an alternative.

dtoutinteger

number of nbody timesteps forward to advance to next Nbody6++ timestep (default = 1)

History
_______
2018 - Written - Webb (UofT)