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 specifying grid acquisition probability model with wildcards #146

Closed taldcroft closed 1 year ago

taldcroft commented 1 year ago

The grid probability models are named grid-<name>-<date>. Currently the default model is hardcoded with the full name:

DEFAULT_MODEL = "grid-floor-2020-02"

In order to update the model without a new release of chandra_aca and a new FOT MATLAB tools release, enable wildcards and select the most recent date of matching models. Then use:

DEFAULT_MODEL = "grid-*"
jeanconn commented 1 year ago

Great idea to take steps now to make this more agile. Though could we just chuck DEFAULT_MODEL altogether?

taldcroft commented 1 year ago

DEFAULT_MODEL is very useful in testing because you can change it and then re-run proseco star selection. In other words, anywhere that star probs are used then you can globally override the model without any API changes.

taldcroft commented 1 year ago

With a more modern mindset we could change that module global into an astropy configuration parameter. That's an option which would probably break something but not anything that can't be easily fixed.

jeanconn commented 1 year ago

I was thinking that if you wanted to change the model in testing you'd just control what was in chandra_models or the chandra_models environment variable without API changes.

taldcroft commented 1 year ago

That's quite cumbersome and difficult for the simple case of comparing e.g. the current flight model to a new one. For example:

ef reselect_catalog(aca):
    kwargs = aca.call_args.copy()
    kwargs["include_ids_acq"] = list(aca.acqs['id'])
    kwargs["include_halfws_acq"] = list(aca.acqs['halfw'])
    kwargs["dark_date"] = aca.dark_date
    kwargs["n_acq"] = len(aca.acqs)

    star_probs.DEFAULT_MODEL = 'grid-floor-2020-02'
    aca_orig = get_aca_catalog(**kwargs)
    p2_orig = -aca_orig.acqs.get_log_p_2_or_fewer()

    star_probs.DEFAULT_MODEL = 'grid-local-quadratic-2023-05'
    aca_new = get_aca_catalog(**kwargs)
    p2_new = -aca_new.acqs.get_log_p_2_or_fewer()

    return p2_orig, p2_new
jeanconn commented 1 year ago

Gotcha. I figured that there was already something handy for doing that same thing when comparing different thermal models, but I haven't don't those comparisons myself.