gala.dynamics.estimate_dt_n_steps(w0, hamiltonian, n_periods, n_steps_per_period, dE_threshold=1e-09, func=<function nanmax>, **integrate_kwargs)[source]

Estimate the timestep and number of steps to integrate an orbit for given its initial conditions and a potential object.

w0 : PhaseSpacePosition, array_like

Initial conditions.

potential : PotentialBase

The potential to integrate the orbit in.

n_periods : int

Number of (max) orbital periods to integrate for.

n_steps_per_period : int

Number of steps to take per (max) orbital period.

dE_threshold : numeric (optional)

Maximum fractional energy difference – used to determine initial timestep. Set to None to ignore this.

func : callable (optional)

Determines which period to use. By default, this takes the maximum period using nanmax(). Other options could be nanmin(), nanmean(), nanmedian().

dt : float

The timestep.

n_steps : int

The number of timesteps to integrate for.