Feature/astrometry for testing (v2.1.0 for my own sanity) - #9
Merged
mtpenny merged 49 commits intoJan 30, 2026
Conversation
Adds individual source magnifications to the lightcurve output
- Implemented astrometric error calculations based on photometric precision in `photometry.cpp`. - Updated `lightcurveGenerator.cpp` and `pllxLightcurveGeneratorMultiple.cpp` to handle centroid information for multiple sources. - Introduced new parameters for astrometry in `readParamfile.cpp` and `structures.h` to control astrometric features. - Added documentation for new astrometric functionalities and parameter configurations.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: AmberLee2427 <26697369+AmberLee2427@users.noreply.github.com>
Co-authored-by: AmberLee2427 <26697369+AmberLee2427@users.noreply.github.com>
Co-authored-by: AmberLee2427 <26697369+AmberLee2427@users.noreply.github.com>
Co-authored-by: AmberLee2427 <26697369+AmberLee2427@users.noreply.github.com>
Guard against division by zero in astrometry calculations
…flux ratio calculation
Co-authored-by: AmberLee2427 <26697369+AmberLee2427@users.noreply.github.com>
Add v2.1.0 release documentation for astrometry feature
…tion build process
…ml for reproducible CI builds; add .gitkeep to documentation static directory.
- Extract gulls version from executable output - v2.1.0 validates minimal lens-frame columns (x_centroid, y_centroid, etc.) - v2.2.0+ validates full sky-frame columns (true_N_centroid_mas, etc.) - Skip astrometry plotting for v2.1.0 (lens-frame only) Co-authored-by: AmberLee2427 <26697369+AmberLee2427@users.noreply.github.com>
Co-authored-by: AmberLee2427 <26697369+AmberLee2427@users.noreply.github.com>
Make smoke test astrometry validation version-aware for v2.1.0 vs v2.2.0+
…culation Co-authored-by: AmberLee2427 <26697369+AmberLee2427@users.noreply.github.com>
…ed; normalize base paths in parameter file reading
Fix segfault from incorrect loop bound in photometry companion flux calculation
Co-authored-by: AmberLee2427 <26697369+AmberLee2427@users.noreply.github.com>
mtpenny
approved these changes
Jan 30, 2026
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.
Minimal Astrometry Implementation Notes (Gulls v2.1.0 Release)
Date: December 27, 2025
Feature - Basic Astrometry Support
This PR adds basic astrometric capabilities to Gulls, enabling the simulation of centroid motion for microlensing events. This feature allows users to model and predict the astrometric signatures of lensed sources, which is critical for follow-up observations and event characterization.
What's New
🎯 Astrometry Implementation
📊 "New" Output Columns
The following columns are added to lightcurve outputs when astrometry is enabled:
true_x_centroid- True centroid position (x-axis, Einstein radii)true_y_centroid- True centroid position (y-axis, Einstein radii)x_centroid- Observed centroid with noise (x-axis, Einstein radii)y_centroid- Observed centroid with noise (y-axis, Einstein radii)x_centroid_err- Uncertainty on x centroid (Einstein radii)y_centroid_err- Uncertainty on y centroid (Einstein radii)⚙️ New Configuration Parameters
ASTROMETRY_ON (default: 0)
ASTROMETRIC_SYS_FLOOR (default: 0.1 mas)
📚 Documentation
documentation/source/astrometry.rst)Technical Details
Coordinate System
Astrometric outputs are currently provided in the lens frame (VBM coordinate system):
Future PRs will add sky-frame (North/East), absolute RA/Dec outputs and values in mas.
Noise Model
The astrometric uncertainty follows Gould & Yee (2014):
σ_phot = A_err / max(A_obs, 1e-12)FWHM_er = (FWHM_arcsec * 1000) / θ_E_masσ_astro = FWHM_er * σ_phot / sqrt(ln(256))σ_total = sqrt(σ_astro² + (sys_floor / θ_E_mas)²)Random Gaussian noise is added to true centroids based on these uncertainties.
Blending
For events with blended light:
Code Changes
Modified Files
src/structures.h- Added astrometry parameters to Paramfile structuresrc/readParamfile.cpp- Parse new astrometry configuration parameterssrc/pllxLightcurveGenerator.cpp- Compute centroids for single-source eventssrc/pllxLightcurveGeneratorMultiple.cpp- Compute centroids for multi-source eventssrc/photometry.cpp- Apply noise model and compute observed valuesdocumentation/source/astrometry.rst- New comprehensive documentationREADME.md- Added feature descriptionBug Fixes
Asrc→musrcfor magnification)Usage Example
To enable astrometry in your parameter file:
Output files will then include the six new centroid columns alongside existing photometric data.
Limitations and Future Work
Current Limitations
Planned for Future Featuress
Breaking Changes
None. This is a feature addition with backward compatibility. Existing parameter files will work unchanged with
ASTROMETRY_ONdefaulting to 0.Migration Guide
For Existing Users
ASTROMETRY_ON 1ASTROMETRIC_SYS_FLOOR 0.1(or your preferred systematic floor)documentation/source/astrometry.rstFor Developers
BinaryMag2()andMultiMag2()Performance Impact
Minimal performance impact when astrometry is disabled (default). When enabled:
Known Issues
Testing
This PR has undergone basic validation:
A large test set would be a good next step for further validation an sanity checks.
Scientific References
Gould, A. & Yee, J. C. (2014) - "MICROLENS MASSES FROM ASTROMETRY AND PARALLAX IN SPACE-BASED SURVEYS: FROM PLANETS TO BLACK HOLES"
Penny et al. (2013, 2014, 2019) - Original Gulls papers
Acknowledgments
This PR adds an important capability for astrometric microlensing studies. The implementation leverages the VBMicrolensing library's low-level functions for efficient centroid calculations and Gulls-compatible parameterization.
Getting Started
documentation/source/astrometry.rst.prmfileWhat's Included
Full Changelog
See CHANGELOG.md for the complete list of changes.
Previous version: v2.0.0 (October 2025) - Release automation, CMake, validation, binary sources, and CI smoke tests
Next Planned Release: v2.2.0 (Sky-frame and mutli-lens astrometry support)
Smoke Test Results
This PR was validated with automated smoke tests. The plots below show sample lightcurves generated by the different Gulls executables:
smoke_croin_0_0_0.all_astrometry_plot.png
smoke_croin_0_0_0.all_plot.png
smoke_croin_binary_0_0_0.det_astrometry_plot.png
smoke_croin_binary_0_0_0.det_plot.png
smoke_fish_0_0_0.all_astrometry_plot.png
smoke_fish_0_0_0.all_plot.png
smoke_fish_binary_0_0_0.det_astrometry_plot.png
smoke_fish_binary_0_0_0.det_plot.png
smoke_std_0_0_0.all_astrometry_plot.png
smoke_std_0_0_0.all_plot.png
smoke_std_binary_0_0_0.det_astrometry_plot.png
smoke_std_binary_0_0_0.det_plot.png