galpy.df.streamspraydf.streamTrack¶
- streamspraydf.streamTrack(n=5000, particles=None, tail=None, track_time_range=None, ntp=None, smoothing=None, smoothing_factor=1.0, niter=0, order=2, velocity_weight='auto', custom_sky_transform=None)[source]¶
Construct a smooth phase-space track through the stream by sampling particles and projecting them onto a finely-integrated progenitor orbit.
The track is parameterized by the progenitor’s time coordinate
tp:tp=0is the progenitor today,tp<0are past positions (matched by the trailing arm) andtp>0are future positions (matched by the leading arm). Because stream particles have small velocity offsets from the progenitor, they lie spatially close to a short arc of the progenitor’s orbit — the relevanttprange is much smaller thantdisrupt.- Parameters:
n (int, optional) – Total number of particles to draw. When
tail='both',nis split equally between leading and trailing (matchingself.sample(n, ...)’s convention). Ignored ifparticlesis provided. Default is 5000.particles (array, shape (6, N), optional) – Pre-computed present-day
(R, vR, vT, z, vz, phi)of stream particles. Useself.sample(returndt=False, return_orbit=False, integrate=True)to draw, or pass an externally-generated sample (e.g. from an N-body run). Whentail='both', the array must follow the sample ordering (leading first, then trailing) and is split atN // 2. Default is None (sample freshly).tail (str, optional) – One of
'leading','trailing', or'both'. Defaults to the value set at initialization.track_time_range (float or Quantity, optional) – Half-range (symmetric about tp=0) of the finely-integrated progenitor orbit used for closest-point matching. Default is data-driven:
8 * d_max / |v_prog|clamped to[1, tdisrupt], whered_maxis the farthest particle’s distance from the progenitor.ntp (int, optional) – Number of binning nodes. Default
sqrt(N)with a floor of 21 and a ceiling that scales with the arc span (at least 201; larger for long streams).smoothing (None, float, or array-like, optional) – Smoothing parameter(s).
None(default) uses GCV auto-tuning. A float sets a singlesfor all coords. An array-like of length 6 (mean only) or 27 (mean + covariance) sets per-splinesvalues — pass a previous call’strack.smoothing_sto reproduce the same smoothness without re-running GCV.smoothing_factor (float, optional) – Multiplier applied to every spline’s effective
safter GCV (or explicit-s) selection. Values > 1 force a smoother fit, values < 1 a rougher one. Useful when GCV undersmooths in finite samples (a common failure mode ofmake_smoothing_splineon noisy binned means). Default 1.0. For an interactive smoothing sweep, savetrack.particlesfrom the first call and pass it back asparticles=— only the cheap re-fit step runs, the orbit-integration sample is reused.niter (int, optional) – Iterations beyond the initial fit. Each iteration reassigns particles to the closest point on the current track.
order (int, optional) – 1 = mean only, 2 = mean + covariance (default).
velocity_weight (float or
'auto', optional) – Multiplicative weight applied to velocity components when computing 6D distances during the closest-point projection. Default'auto'learns the weight from the inner-half particle dispersion (σ_pos / σ_vel, clipped to[0.1, 10]); typically lands at ~2–3 for both clean and perturbed streams. Values > 1 make velocity matches more important than position matches — useful when the progenitor orbit revisits regions of phase space (e.g., in strongly-perturbed potentials with a massive LMC). Pass1.0for the legacy unweighted natural-units metric.
- Returns:
A single-arm track object, or a pair with
.leadingand.trailingtracks whentail='both'.- Return type:
Notes
2026-04-14 - Written - Bovy (UofT)