sot / chandra_aca

Chandra Aspect Camera Tools
https://sot.github.io/chandra_aca
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Allow for glob specification of acq prob model + documentation overhaul #149

Closed taldcroft closed 1 year ago

taldcroft commented 1 year ago

Description

This adds the capability to specify an acquisition probability model with a glob specification. Matching files are sorted by the model date and the most recent one is selected. The practical upshot is that the default model is now "grid-*", which will choose the latest grid model that is available in the chandra_models repo.

This requires that model spec files be named grid-<something>-YYYY-MM.fits.gz where YYYY is the year and MM is the month.

The previous version used an anti-pattern of defining a module global DEFAULT_MODEL with the intent that application code or test code would update that global. Instead the default model is now defined as an astropy configuration variable conf.default_model within the star_probs module. Application code can use the config functionality to either set the default going forward or temporarily within a context manager.

This also updates the drift model code to use ska_helpers.chandra_models.get_data() to get the drift model data. In updating the test I saw that it was using a packaged version of the current (as of chandra_models 3.48) version of the drift model JSON file. Instead the regression test now just checks against chandra_models version 3.48.

Finally, in the process of making relevant documentation updates I found that the docs were just a complete mess and almost unusable. I reorganized the docs to be one RST file per module. This makes things pretty tidy.

Fixes #146

Interface impacts

The DEFAULT_MODEL global has been removed. My search of the sot org found one notebook (validating the grid-local model in aca_stats) that uses this. If we try to re-run this notebook then it will break and we will fix it.

Testing

Unit tests

Independent check of unit tests by Jean

Functional tests

Built documentation and confirmed no warnings and that it looks reasonable.

With this git branch in the PYTHONPATH, ran unit tests for sparkles and proseco with no errors.

jeanconn commented 1 year ago

I'm not sure which of this and https://github.com/sot/chandra_models/pull/106 would probably need to be retested for the record.