OrbitGenerator Class

class galport.OrbitGenerator(potential, Omega=0.0)[source]

Bases: object


A class for generating initial conditions for various orbit families in barred galactic potentials.

Parameters:
  • potential (agama.Potential) – Galactic potential model (can be non-axisymmetric, e.g., with bar).

  • Omega (float, optional) – Pattern speed of the non-axisymmetric perturbation. Default: 0.0

Orbital Types

The generator supports the following orbit types:

Planar Resonant Orbits

  • x1 — x1 bar orbits, align along the major axis of the bar in xy-plane

  • uha / 4:1 — ultraharmonic resonant orbits

  • cor — corotation resonance orbits

Sets of Orbits

  • bar_2d — sample of bar and near-bar orbits in xy-plane

  • x1v — bar orbits aligned with major axis, varying z-amplitude

Resonant 3D Orbits

  • ban_up — banana orbits with tips pointing upward (+z)

  • ban_down — banana orbits with tips pointing downward (-z)

Additional Methods

HJ(xv)

Compute Jacobi integrals for given phase-space coordinates.

find_bar_boundaries(x0=0.1)

Find bar boundaries by locating L1 Lagrange points. The maximum HJ corresponds to the L1 point.

HJ(xv)[source]

HJ the Jacobi integral

Parameters:

xv ((N, 6) numpy array) – array of coordinates and velocities

Returns:

HJ – array of Jacobi integrals

Return type:

(N, ) numpy array

ORBITAL_TYPES = ['x1', 'x1v', 'ban_up', 'ban_down', 'bar_2d', 'uha', '4:1', 'cor']
__call__(H=None, y=None, otype=None, Tint=200.0, Norb=10, onlyposz=False, coef_xmax=0.6, z_min=0.001, coef_ymin=0.02, coef_ymax=0.95, Ngrid=100, napo=None, y0=0.1)[source]
Parameters:
  • otype ('str', optional) –

    type of orbit, which we want to find List of types:

    ’x1’ : x1 bar orbits, align along the major axis of the bar in xy-plane ‘uha’ : ultraharmonic resonant orbits ‘cor’ : orbit on corotation resonant ‘bar_2d’ : the bar and near-bar orbits in xy-plane ‘x1v’ : bar orbits, align along the major axis with different z-max ‘ban_up’ : resonant banana orbits, the tips of which point upwards ‘ban_down’ : resonant banana orbits, the tips of which point downwards

  • H (float or (N, ) numpy array, optional) – the Jacobi integral or array of integrals, by default None

  • y (float or (N, ) numpy array, optional) – the initial y for ‘x1’, ‘uha’ and ‘cor’

  • Tint (float, optional) – the time of the integration, by default 200.

  • Norb (int, optional) – number of orbits for ‘x1v’ and ‘bar_2d’, by default 10

  • onlyposz (bool, optional) – for ‘x1v’, by default False

  • coef_xmax (float, optional) – for ‘x1v’, by default 0.6

  • z_min (float, optional) – for ‘x1v’, by default 0.001

  • napo (None or int, optional) – for ‘ban_up’ or ‘ban_down’, number of apocenters for discrepancy vector, if None sequentially obtained from 2 to 10 ones, by default None

  • Ngrid (int, optional) – for ‘x1v’ and flat resonants. Size of grid for the optimizer, by default 100

  • y0 (float, optional) – for flat resonants. If H os not None, initial y for ‘newton’ method, by default 0.1

Returns:

  • xv ((N, 6) numpy array) – array of initial conditions

  • delta ((N, ) numpy array, optional) – array of residuals. Always except ‘bar_2d’

__init__(potential, Omega=0.0)[source]
Parameters:
  • potential (agama.Potential) – potential of model

  • Omega (float) – Angular velocity of non-axisymmetric pattern (a bar or spirals), by default 0

find_ban(H=-2.0, Tint=50, bantype='up', napo=None)[source]

Find initial condition for banana orbits return xv = [x, 0, z, 0, vy(H, x, z), 0]

Parameters:
  • H ((N, ) numpy array, optional) – array of Jacobi integrals, by default -2.

  • Tint (float, optional) – the time of the integration, by default 100

  • bantype (str, optional) – ‘up’ or ‘down’, by default ‘up’

  • napo (None or int, optional) – number of apocenters for discrepancy vector, if None sequentially obtained from 2 to 10 ones, by default None

Returns:

  • xv ((N, 6) numpy array) – array of initial conditions

  • delta ((N, ) numpy array) – array of residuals

find_bar_2d(H=-2.0, Norb=20, coef_ymin=0.02, coef_ymax=0.95)[source]

Find sample of bar and near bar orbits (0, y, 0, vx(y, H), 0, 0)

Parameters:
  • H (float, optional) – the Jacobi integral or array of integrals, by default -2.0

  • Norb (int, optional) – number of orbits, by default 20

  • coef_ymin (float, optional) – ymin = coef_ymin*y(H, vx=0, vy=0, x=0), by default 0.02

  • coef_ymax (float, optional) – ymax = coef_ymax*y(H, vx=0, vy=0, x=0), by default 0.95

Returns:

xv – array of initial conditions

Return type:

(N, 6) numpy array

find_bar_boundaries(x0=0.1)[source]

Find x coordinate of L1 point, max and min Jacobi integrals

find_res_orb_2d(H=None, y=None, otype='x1', Tint=100, Ngrid=100, y0=0.1)[source]

Find resonant orbits in xy plane, by the Jacobi integral or initial y return xv = [[0, y, 0, vx, 0, 0],…]

Parameters:
  • H ((N, ) numpy array, optional) – array of Jacobi integrals, by default None

  • y ((N, ) numpy array, optional) – array of initial y, by default None

  • otype (str, optional) – orbital types ‘x1’ - x1 - orbits ‘uha’ or ‘4:1’ - ultraharmonic resonant orbits ‘cor - corotation orbits by default ‘x1’

  • Ngrid (int, optional) – size of grid for the optimizer, by default 100

  • Tint (float, optional) – the time of the integration, by default 100

  • y0 (float, optional) – if initial y for ‘newton’ method, by default 0.1

Returns:

  • xv ((N, 6) numpy array) – array of initial conditions

  • delta ((N, ) numpy array) – array of residuals

find_x1v(H=-2.0, Norb=20, onlyposz=False, coef_xmax=0.6, Tint=50, z_min=0.001, Ngrid=100)[source]

Find initial condition for orbits align the major axis of the bar return initial condition of Norb xv = [[x, 0, z, 0, vy(H, x, z), 0], …]

Parameters:
  • H ((N, ) numpy array, optional) – array of Jacobi integrals, by default -2.

  • Norb (int, optional) – number of orbits, by default 20

  • Tint (float, optional) – the time of the integration, by default 50

  • onlyposz (bool, optional) – initial z > 0, by default False

  • coef_xmax (float, optional) – z_max correspond to equipotential with x = x_max*coef_xmax, x_max is maximal x with this H in disk plane , by default 0.6

  • z_min (float, optional) – minimal z if onlyposz=True, by default 0.001

  • Ngrid (int, optional) – size of grid for the optimizer, by default 100

Returns:

  • xv ((N, Norb, 6) numpy array) – array of initial conditions

  • delta ((N, Norb) numpy array) – array of residuals