class gala.dynamics.mockstream.MockStreamGenerator(df, hamiltonian, progenitor_potential=None)[source]#

Bases: object

Generate a mock stellar stream in the specified external potential.

By default, you must pass in a specification of the stream distribution function (df), and the external gravitational potential and reference frame (via a Hamiltonian object passed in through the hamiltonian argument).

Also by default, the stream generation does not include the self-gravity of the progenitor system: star particles are generated using the df object, and released into the external potential specified by the hamiltonian. If you would like the star particles to feel the gravitational field of the progenitor system, you may pass in a potential object to represent the progenitor via the progenitor_potential argument. This can be any valid gala potential instance.

dfBaseStreamDF subclass instance

The stream distribution function (DF) object that specifies how to generate stream star particle initial conditions.


The external potential and reference frame to numerically integrate orbits in.

progenitor_potentialPotentialBase (optional)

If specified, the self-gravity of the progenitor system is included in the force calculation and orbit integration. If not specified, self-gravity is not accounted for. Default: None

Methods Summary

run(prog_w0, prog_mass[, nbody, ...])

Run the mock stream generator with the specified progenitor initial conditions.

Methods Documentation

run(prog_w0, prog_mass, nbody=None, release_every=1, n_particles=1, output_every=None, output_filename=None, check_filesize=True, overwrite=False, progress=False, **time_spec)[source]#

Run the mock stream generator with the specified progenitor initial conditions.

This method generates the mock stellar stream for the specified progenitor system properties. The progenitor orbit is specified by passing in the initial or final conditions prog_w0 and by specifying time-stepping information via the **time_spec keyword arguments. If the time-stepping specification proceeds forward in time, prog_w0 is interpreted as initial conditions and the mock stream is generated forwards from this position. If the time-stepping proceeds backwards in time, the progenitor orbit is first numerically integrated backwards given the time-stepping information, then the stream is generated forward from the past such that prog_w0 becomes the final position of the progenitor.

Note that the stream generation also supports including other massive perturbers that can gravitationally influence the stream stars. These other massive bodies must be passed in as a DirectNBody instance through the nbody argument. The phase-space coordinates of the bodies, nbody.w0, are interpreted as initial or final conditions with the same logic as above.


The initial or final phase-space position of the progenitor system (see note above).

prog_massQuantity [mass]

The mass of the progenitor system, passed in to the stream distribution function (df) .sample() method. This quantity sets the scale mass of the particle release df, but not the mass of the progenitor potential used to compute the self-gravity on the stream particles.

nbodyDirectNBody (optional)

This allows specifying other massive perturbers (N-bodies) that can gravitationally influence the stream star orbits.

release_everyint (optional)

Controls how often to release stream particles from each tail. Default: 1, meaning release particles at each timestep.

n_particlesint, array_like (optional)

If an integer, this controls the number of particles to release in each tail at each release timestep. Alternatively, you can pass in an array with the same shape as the number of timesteps to release bursts of particles at certain times (e.g., pericenter).

output_everyint (optional)

Controls whether to output snapshots of the stream particle orbits. This is relative to the global time array.

output_filenamestr (optional)

The path to the HDF5 file to be generated by the snapshotting.

check_filesizebool (optional)

If True (the default value), this controls whether to check the estimated size of the output file, and emits a warning if the file is >8GB in size.

overwritebool (optional)

Overwrite the output file if it exists.

progressbool (optional)

Print a very basic progress bar while computing the stream.


Specification of how long to integrate. Most commonly, this is a timestep dt and number of steps n_steps, or a timestep dt, initial time t1, and final time t2. You may also pass in a time array with t. See documentation for parse_time_specification for more information.