sot / proseco

Probabilistic star evaluation and catalog optimization
https://sot.github.io/proseco
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Make ACA penalty limit optional #384

Closed taldcroft closed 1 year ago

taldcroft commented 1 year ago

Description

Make the ACA penalty limit from the chandra_models aca_spec.json file be optional. This also makes the ACA planning limit optional for proseco, though it is still needed in other tools.

If not provided there is no penalty limit and the effective CCD temperature is the same as the actual (predicted) temperature. In this case the t_ccd_penalty_limit attribute of an ACA catalog is None.

This PR also transitions to using ska_helpers.chandra_models to get the chandra_models data. This is helpful to enable testing using the CHANDRA_MODELS_REPO_DIR and CHANDRA_MODELS_DEFAULT_VERSION env vars.

Interface impacts

CHANDRA_MODELS_REPO_DIR and CHANDRA_MODELS_DEFAULT_VERSION env vars now work with proseco for selection of the aca thermal model for limits. Those vars already worked to define the acquisition model used within proseco via chandra_aca.

Testing

Unit tests

Independent check of unit tests by Jean

Functional tests

chandra_models update

Starting from chandra_models version 3.49, I made a new branch no-penalty-limit and edited chandra_models/xija/aca/aca_spec.json to remove the penalty limit.

➜  chandra_models git:(no-penalty-limit) git diff 3.49                         
diff --git a/chandra_models/xija/aca/aca_spec.json b/chandra_models/xija/aca/aca_spec.json
index 87665ca..7912ffe 100644
--- a/chandra_models/xija/aca/aca_spec.json
+++ b/chandra_models/xija/aca/aca_spec.json
@@ -273,7 +273,6 @@
     },
     "limits": {
         "aacccdpt": {
-            "planning.penalty.high": -4.0,
             "planning.warning.high": -4.5,
             "unit": "degC"
         }

Simple test

$ export CHANDRA_MODELS_REPO_DIR=/Users/aldcroft/tmp/chandra_models
$ export CHANDRA_MODELS_DEFAULT_VERSION=no-penalty-limit    
$ ipython
In [1]: from proseco.tests.test_common import mod_std_info
In [2]: from proseco import get_aca_catalog
In [3]: aca = get_aca_catalog(**mod_std_info(t_ccd=-2.0))
In [4]: aca.t_ccd_acq
Out[4]: -2.0

In [5]: aca.t_ccd_eff_acq
Out[5]: -2.0

In [6]: print(aca.t_ccd_penalty_limit)
None

In [7]: import proseco.characteristics as ACA

In [8]: ACA.chandra_models_version
Out[8]: 'no-penalty-limit'

In [9]: ACA.aca_t_ccd_planning_limit
Out[9]: -4.5

In [10]: print(ACA.aca_t_ccd_penalty_limit)
None