Approaches class

Convenience class to get concatenated data for all galaxies. Mainly used when they are in close proximity and can appear on the same plot.

class galaxy.approaches.Approaches(snap=801, datadir=None, usesql=False, stride=1, ptype='lum')[source]

A class to work with all 3 galaxies when in close proximity.

Args:
snap (int):
Snap number, equivalent to time elapsed. Defaults to the last timepoint.
datadir (str):
Directory to search first for the required file. Optional, and a default list of locations will be searched.
usesql (bool):
If True, data will be taken from a PostgreSQL database instead of text files.
stride (int):
Optional. For stride=n, get every nth row in the table. Only valid with usesql=True.
ptype (str):
can be ‘lum’ for disk+bulge, ‘dm’ for halo
Class attributes:
data (np.ndarray):
type, mass, position_xyz, velocity_xyz for each particle
read_db(stride)[source]

Get relevant data from a PostgreSQL database and format it to be identical to that read from test files.

Args:
stride (int):
Optional. For stride=n, get every nth row in the table.
Changes:
self.time, self.particle_count and self.data are set.

Returns: nothing

xyz()[source]

Convenience method to get positions as a np.array of shape (3,N)

vxyz()[source]

Convenience method to get velocities as a np.array of shape (3,N)