sot / chandra_aca

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

Improve caching even more #155

Closed taldcroft closed 1 year ago

taldcroft commented 1 year ago

Description

Follow-on to #154. See the monster thread but mostly https://github.com/sot/chandra_aca/pull/153#issuecomment-1684113154 and https://github.com/sot/chandra_aca/pull/153#issuecomment-1684118781.

Interface impacts

None

Testing

Unit tests

Independent check of unit tests by Javier

Functional tests

In [1]: from chandra_aca import star_probs

In [2]: %time model = star_probs.get_grid_func_model()
CPU times: user 22.3 ms, sys: 21.3 ms, total: 43.7 ms
Wall time: 84.9 ms

In [3]: %time model = star_probs.get_grid_func_model(None)
CPU times: user 60 µs, sys: 12 µs, total: 72 µs
Wall time: 74.9 µs

In [4]: %time model = star_probs.get_grid_func_model("grid-*")
CPU times: user 28 µs, sys: 1e+03 ns, total: 29 µs
Wall time: 31 µs

And with PYTHONPATH pointing to this PR and a patched ska_helpers with a print statement in chandra_models.get_data:

In [1]: from proseco import get_aca_catalog

In [2]: aca = get_aca_catalog(23456)
{'call_args': {'file_path': 'chandra_models/aca_acq_prob',
               'read_func': '<function _read_grid_func_model at 0x121afeef0>',
               'read_func_kwargs': {'model_name': 'grid-*'},
               'repo_path': 'None',
               'require_latest_version': False,
               'timeout': 5,
               'version': None}}

In [3]:
taldcroft commented 1 year ago

Now I just don't know off hand why I'm not seeing a get_data call for the ACA spec file to get the penalty limit.