Repository navigation
Conversation
Extend the tangent-plane report with: - flat vs gnomonic projection explainer, forward and inverse equations - exact proper-motion and parallax transformations (Jacobians), current behavior vs proposed, covariance propagation - error maps figure (position, PM, parallax) for a simulated GC field - primary-source references - decisions: gnomonic default, 'flat' and temporary 'flat_legacy' modes, sky_to_plane/plane_to_sky offset conventions, barycentric parallax reference point, optional bright-star PM correction, aberration and DAR assessment make_figures.py now ignores personal matplotlibrc settings and also computes the aberration and spherical-offset numbers quoted in the text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te_on_sky New shared module for the tangent-plane plan (docs/plans/tangent_plane, Section 11): gnomonic (default), flat and flat_legacy (temporary) projections in arcsec east/north standard coordinates, the inverse with astropy-style spherical offsets, the proper-motion Jacobians J_g and J_f, propagation on the sky (Eq. prop) and the parallax shift vector. correct_bright_pm is a stub until the bright-star step. Tests: gnomonic vs astropy.wcs TAN, round trips < 1 uas, Jacobian vs numerical derivatives, Eq. pmout vs J^-1, propagation vs SkyCoord.apply_space_motion, offsets vs spherical_offsets_to, at dec0 = -29 and +60 deg for fields up to 30'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
projection='gnomonic' (default), 'flat' or 'flat_legacy' (temporary, removed before release), per Section 11 of the tangent-plane plan: - Positions from projection.sky_to_plane; proper motions as (vx, vy) = F J mu; errors as C' = F J C J^T F, using Gaia's correlation columns when present. This fixes the x0_err = ra_error * cos(dec0) bug for 'gnomonic' and 'flat'. - project_gaia moves stars on the sky and then projects (Eq. prop), propagates errors with the full Gaia covariance, and with include_parallax=True adds the barycentric parallax shift at the epoch. - Both keep ra/dec columns and write meta: projection, proj_ra0, proj_dec0 (deg), frame='icrs', parallax_ref='ssb', data_release, ref_epoch, bright_pm_corrected (project_gaia also epoch and include_parallax). - Both accept the center as a SkyCoord, a Quantity, degrees, or the old hourangle strings. Plain numbers are now degrees in both functions (prepare_gaia_for_flystar used to read them as hours). - 'flat_legacy' runs the old code bit for bit. The snapshot test_data/gaia_legacy_outputs.npz was captured from the unmodified functions (generate_gaia_legacy_fixture.py, synthetic masked Gaia table in gaia_synthetic.py) and is compared byte for byte. - correct_bright_pm keyword added (implemented in a later commit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
parallax_in_direction now displaces a star along -r_obs (the observer's barycentric position) instead of r_sun - r_obs, i.e. Eq. (pfac) of the tangent-plane plan with r_ref = 0, as Gaia and Hipparcos do. The x0, y0 of Parallax fits are therefore barycentric, like Gaia's ra, dec. Docstrings updated (ICRS instead of J2000). The Parallax model still uses the center's ra/dec/pa for every star. Size of the change: the parallax vectors move by the Sun's barycentric offset, at most 0.0091 au (rms 0.0032 au) over 2000-2031 for three test directions (dec -29, +41, +60), relative to vectors of up to 1.0 au; i.e. <~9 uas per mas of parallax. No test had hard-coded parallax vectors, so none needed updating; all existing Parallax tests pass unchanged. New tests (test_parallax.py): the parallax factors match -r_earth from astropy's JPL barycentric position (with pa rotation) to 1e-12 au, and a Parallax fit to data simulated with the barycentric astrometric model (Eq. prop + gnomonic projection) recovers x0, y0 to < 1 uas. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
projection.correct_bright_pm applies Eq. (brightpm) of the tangent-plane plan with the spin table omega(G) of Cantat-Gaudin & Brandt 2021, A&A 649, A124, Table 1 (values copied from the arXiv source of 2103.07432; they match the table in the paper's Appendix A code). Only Gaia EDR3/DR3 is accepted; other releases raise ValueError. Only 5/6-parameter solutions are corrected when astrometric_params_solved is given. Bins are G_min <= G < G_max as in the paper's code, so the correction applies for G < 13 (G = 13.0 exactly is unchanged). prepare_gaia_for_flystar and project_gaia apply it with correct_bright_pm=True (data release from gaia.meta or ref_epoch) and record bright_pm_corrected in meta. Tests: three hand-computed cases from the table, G >= 13 and NaN G unchanged, non-5/6-parameter solutions unchanged, DR2 refused, and the effect through both Gaia functions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Converts a StarTable's fitted x0, y0, vx, vy, pi (and errors) back to ICRS ra, dec, pmra, pmdec, parallax with Gaia's column names and units (Section 11 of the tangent-plane plan): positions by the inverse projection, proper motions and errors by J^-1 F, at each star. - Projection and center default to tab.meta from prepare_gaia_for_flystar. - If (x_ref, y_ref) != (0, 0), the tangent point (frame origin) is solved for by Newton iteration so that (x_ref, y_ref) maps to (ra_ref, dec_ref). - scale and pa handle frames in other units or not north-up. - epoch propagates positions on the sky to a common epoch. - Also outputs dlon, dlat (astropy spherical offsets from the reference) and keeps x0, y0; parallax is reported as fitted. - 'flat_legacy' tables are inverted with J = I, as that mode built them. Tests: Gaia -> prepare_gaia_for_flystar -> startable_to_radec recovers ra, dec (< 1 uas), pmra, pmdec, parallax and errors for 'gnomonic' and 'flat' at dec0 = -29 and +60 deg, fields up to 30', and feeds back into prepare_gaia_for_flystar; plus the reference-point solve, a rotated pixel frame, epoch propagation and the legacy mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
query_gaia, prepare_gaia_for_flystar and project_gaia now share one center parser: a SkyCoord, numbers or Quantities in degrees, or sexagesimal strings (RA in hours), with dec optional for a SkyCoord. project_gaia also no longer needs the parallax columns when the parallax is not used. Adds tests for the center forms and the no-parallax case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion - Introduced EPHEMERIS constant for consistent barycentric position calculations. - Updated parallax-related functions to utilize the new DE440s ephemeris. - Modified test cases to reflect changes in ephemeris usage for improved accuracy.
project_gaia now adds the barycentric parallax shift by default. A Gaia table without a parallax column raises a ValueError pointing to include_parallax=False, and the temporary 'flat_legacy' mode ignores the flag so it still reproduces the old outputs bit for bit. The plan report moves its three open questions to decisions made: BAGLE already uses the barycenter (BAGLE 6cbb7b4), include_parallax defaults to True, and no warning is added for wide fields aligned at first order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the plan in
docs/plans/tangent_plane/tangent_plane_report.pdf, which is included as the first commit. The report has the equations, the size of each effect, and the decisions below.What changes
New
flystar.projectionmodule. The math is now in one place, so ingestion and the reverse conversion can't drift apart. It hassky_to_plane,plane_to_sky(which also returns spherical offsets),jacobian,propagate_on_skyandcorrect_bright_pm.Gaia ingestion (
prepare_gaia_for_flystar,project_gaia)projectionkeyword. The default,'gnomonic', is a true tangent plane.'flat'is a self-consistent flat frame.'flat_legacy'reproduces the old code bit for bit and exists only for regression testing (see below).project_gaiamoves each star on the sky first and projects it afterwards, so the result doesn't depend on the order of the two steps. It now includes the barycentric parallax shift by default (include_parallax=True). PassFalsefor tables without parallax columns.correct_bright_pm. It's off by default and supports DR3 only.raanddecare kept as columns. Frame metadata goes intometa:projection,proj_ra0/proj_dec0,frame='icrs',parallax_ref='ssb',data_release,ref_epochandbright_pm_corrected.query_gaia,prepare_gaia_for_flystarandproject_gaiaall accept the field center in the same forms: aSkyCoord, degrees, or sexagesimal strings.New
analysis.startable_to_radec. It converts fitted positions, proper motions, parallaxes and their errors back to Gaia-style ICRS columns. It reads the frame frommeta, and also supports a reference point other than the center and frames given in pixels or rotated (scale,pa).Parallax
6cbb7b4). Fittedx0,y0shift by up to about 10 µas per mas of parallax. The fitted parallax itself is essentially unchanged.get_observer_barycentricfor spacecraft such as JWST. It used to query Horizons at the median epoch spacing (months) and interpolate linearly across the orbit. It also used Horizons' defaults, which are Sun-centred and in the ecliptic plane. JWST positions were off by up to 0.57 au, and parallax factors by up to about 2×. It now asks Horizons for barycentric, ICRF-equatorial vectors on a 1-day grid and fits a cubic spline. The result matches exact Horizons positions to 5e-9 au.'jpl'default (DE430). DE440s shares its barycenter with the DE441 ephemeris behind Horizons, while DE430 is offset by about 116 km. The function also no longer changes astropy's global ephemeris setting.Testing
pytest flystar/tests. The new tests are intest_projection.py,test_gaia_projection.pyandtest_parallax.py, and they cover everything in the plan's test list:propagate_on_skyagainstSkyCoord.apply_space_motionflat_legacyreproducing the old outputs bit for bittest_observer_barycentric_horizons_matches_astropyneeds network access to JPL Horizons. It skips when the network is unavailable.Follow-ups before release
'flat_legacy',generate_gaia_legacy_fixture.pyandtest_data/gaia_legacy_outputs.npz.🤖 Generated with Claude Code