Simulation class

A set of initial and output files that belong to a single simulation can be handled using the following class and its methods:

class arepy.files.simulation(dirSim='.', name='', sid=None, **opt)

Simulation class

Parameters
  • dirSim (str) – Path to a simulation directory

  • name (str) – Name of a simulation

  • sid (int) – Simulation ID

  • fileNameParam (str) – Name of a parameter file

  • fileNameConfig (str) – Name of a configuration file

  • fileNameIcs' (str) – Name of a file with initial conditions

  • comoving (bool) – Indicates whether simulation is comoving or not.

  • nsub (int) – Number of subfiles

Example of use:

>>> import arepy as apy
>>> sim = apy.files.simulation(
>>>     '/path/to/simulation/directory/', 'simulationName',
>>>     initUnitsNew={'length': apy.const.kpc, 'time': apy.const.kyr}
>>> )
>>> snap = sim.getSnapshot(10)
>>> snap.getProperty('Masses')

[234.234, 33.34, 234.34,...]
dirSnap(snap, init=False)

Compose a snapshot directory path

Parameters
  • snap (int) – Number of a snapshot

  • init (bool) – Switches between normal or initial output directory

Return str

Path of the simulation output directory

fileSink(snap=None)

Compose a sink file name

Parameters

snap (int) – Snapshot number

Return str

Path to the sink snapshot file

fileSnap(snap=None, init=False)

Compose a snapshot file name

Parameters
  • snap (int) – Snapshot number

  • init (bool) – Switches between snapshots in normal or initial output directory

Return str

Path to the snapshot file

getImage(isnap, iprop, itype)

Get an object of a specific image

Parameters
  • isnap (int) – Number of the snapshot

  • iprop (str) – Image property

  • itype (str) – Image type (slice/proj)

Returns

Image object

Return type

arepy.files.image

getSnapshot(snap, **opt)

Get a snapshot object

Parameters

snap (int) – Snapshot number

Returns

Snapshot object

Return type

arepy.files.snap

getSink(snap, **opt)

Get a sink snapshot object

Parameters

snap (int) – Snapshot number

Returns

Sink snapshot object

Return type

arepy.files.sink

getSources()

Get an object with radiation sources

Returns

Radiation sources object

Return type

arepy.files.sources

getParameters()

Get a parameter file object

Returns

Parameter file object

Return type

arepy.files.param

getConfig()

Get a configuration file object

Returns

Configuration file object

Return type

arepy.files.config

getSnapNums()

Get all snapshot numbers

Returns

List of snapshot numbers

Return type

list(int)

hasSnapshot(snap)

Checks whether a snapshot exist

Parameters

snap (int) – Snapshot number

Returns

Status of a snapshot

Return type

bool

getSnapAtTimes(times)

Search a closest snap number to a specific simulation times

Parameters

times (float or list(float)) – Searched times in code unites

Returns

Closest snapshot numbers

Return type

int or list(int)

getSnapAfterFirstSink(times)

Search for a closest snap number to a time after creation of a first sink particle

Parameters

times (float or list(float)) – Searched times in code units

Returns

Cloasest snapshot numbers

Return type

int or list(int)