StreamTrack

class galpy.df.StreamTrack(tp_grid, track_xyz, track_vxvyvz, cov_xyz=None, custom_sky_transform=None, parameter_kind='time', ro=None, vo=None, zo=None, solarmotion=None)[source]

Smooth phase-space track for a single arm of a stream.

A StreamTrack holds a smooth mean curve (and optional covariance) in galactocentric Cartesian phase space, parameterized by an affine curve parameter tp. The class is a pure precomputed-track container — accessors evaluate the stored splines and cov(basis=...) transforms the stored covariance into other bases via analytical Jacobians. The fitting pipeline (closest-point + offset smoothing) is provided by the from_particles() classmethod.

The semantics of tp are set at construction via parameter_kind:

  • "time" (default): astropy Quantity inputs to accessors are parsed via conversion.parse_time. Used by the streamspraydf pipeline, where tp=0 is the progenitor today, tp>0 is future (leading arm), tp<0 is past (trailing arm).

  • "angle": parsed via conversion.parse_angle. The natural choice for streamdf-style tracks indexed by an angle along the stream.

  • None: pass-through; useful for any other custom curve parameter.

Accessors and cov() return NaN for tp values outside the track’s valid range (rather than silent cubic-spline extrapolation). For an array tp, only the offending entries are NaN.

particles

Present-day phase space (R, vR, vT, z, vz, phi) of the particles the track was fit to, in the layout that from_particles() accepts and streamspraydf.streamTrack returns from its particles= knob. Available only on tracks built via from_particles() (the streamspraydf.streamTrack path); absent on tracks constructed directly from precomputed splines via __init__(). Useful for re-fitting at different smoothing / iteration settings without re-sampling the spray DF.

Type:

ndarray of shape (6, N), or absent

__init__(tp_grid, track_xyz, track_vxvyvz, cov_xyz=None, custom_sky_transform=None, parameter_kind='time', ro=None, vo=None, zo=None, solarmotion=None)[source]

Build a StreamTrack from a precomputed smooth track.

Parameters:
  • tp_grid (array, shape (N,)) – Affine curve parameter samples. Must be strictly monotonic.

  • track_xyz (array, shape (N, 3)) – Galactocentric Cartesian positions (x, y, z) on tp_grid, in galpy internal length units.

  • track_vxvyvz (array, shape (N, 3)) – Galactocentric Cartesian velocities (vx, vy, vz) on tp_grid, in galpy internal velocity units.

  • cov_xyz (array, shape (N, 6, 6), optional) – Galactocentric Cartesian covariance (x, y, z, vx, vy, vz) on tp_grid (internal units). Required for cov() and for the spread band in plot(). None (default) ⇒ no covariance support.

  • custom_sky_transform (array, shape (3, 3), optional) – Rotation from equatorial to a custom (phi1, phi2) sky frame. Enables the phi1/phi2/pmphi1/pmphi2 accessors and cov(basis="customsky").

  • parameter_kind ({"time", "angle", None}, optional) – How astropy Quantity inputs to accessors are interpreted (see class docstring). Default "time".

  • ro (float or Quantity, optional) – Distance scale (kpc). When omitted, falls back to the normalization.ro config value and physical-units output is off by default (_roSet=False); when set explicitly, physical-units output is on by default. Mirrors Orbit.

  • vo (float or Quantity, optional) – Circular velocity scale (km/s). Same semantics as ro.

  • zo (float or Quantity, optional) – Sun’s height above the midplane (kpc). Default None.

  • solarmotion (str, numpy.ndarray or Quantity, optional) – 'hogg', 'dehnen', 'schoenrich', or [-U, V, W] in km/s. Default None.