add command line interface for AstroPhot for simple setups#310
add command line interface for AstroPhot for simple setups#310ConnorStoneAstro wants to merge 19 commits into
Conversation
|
@copilot the output for the CLI script is currently an hdf5 file generated by the caskade interface. I think a simple yaml file that collects the parameters from the main model and the sky model would be better. It should also include the total flux/magnitude |
There was a problem hiding this comment.
Pull request overview
Adds a lightweight command-line script to run a “single object + sky” AstroPhot fit from FITS inputs, aimed at simplifying common workflows without requiring a full custom model configuration.
Changes:
- Introduces
single_model_cli.pyto fit a selected AstroPhot model type (plus sky) to a target FITS image viaargparse. - Supports optional PSF/variance/mask FITS inputs and forwards additional unknown
--key valueargs intoap.Model(...)as initial parameters. - Writes fitted parameter state plus optional model/residual images and covariance matrix outputs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Implemented in 9ddd313. The CLI now writes |
|
@copilot can you please make sure an Astropy WCS object is passed to the the target image creation so that the relevant coordinates are all correct? |
|
@copilot can you add unit tests that grab the CLI script and run it on the target data fits file stored in the docs source? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #310 +/- ##
=======================================
Coverage 91.53% 91.53%
=======================================
Files 113 113
Lines 6072 6072
=======================================
Hits 5558 5558
Misses 514 514
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot Could you please create a unit test for the cli script. Like with the notebooks, you'll need to copy it into the unit testing directory and copy the target image then run the command. |
|
@copilot Could you please create a unit test for the cli script. Like with the notebooks, you'll need to copy it into the unit testing directory and copy the target image then run the command. |
|
@copilot can you move the CLI script into the main AstroPhot directory and make it so that users can call the CLI script with an "astrophot" command rather than calling python and the path to the script |
while AstroPhot allowsfor arbitrary complexity in the models it creates, there are a lot of standard setups that can be handled by a simple command line interface. This will hopefully make for quick one line solutions to typical workflows.
The CLI output has also been simplified: fitted results are now written to a YAML file that collects parameters from both the main model and sky model, and includes total flux and total magnitude summaries (with uncertainties when available).