# estimate_dt_n_steps¶

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.

Parameters
w0PhaseSpacePosition, array_like

Initial conditions.

potentialPotentialBase

The potential to integrate the orbit in.

n_periodsint

Number of (max) orbital periods to integrate for.

n_steps_per_periodint

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

dE_thresholdnumeric (optional)

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

funccallable (optional)

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

Returns
dtfloat

The timestep.

n_stepsint

The number of timesteps to integrate for.