# Storing an instrument model

**URL:** <https://www.rubin.community/t/storing-an-instrument-model/679>\
**Category:** Data Management\
**Created:** [April 12, 2016, 4:13pm UTC](https://www.rubin.community/t/storing-an-instrument-model/679 "2016-04-12T16:13:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![boutigny](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/boutigny/32/26_2.png) [@boutigny](https://www.rubin.community/u/boutigny)\
**Post date:** [April 12, 2016, 4:13pm UTC](https://www.rubin.community/t/storing-an-instrument-model/679/1 "2016-04-12T16:13:50Z")

</div>

In order to fit the astrometry on full exposures (all CCD) we need to use an instrument model which will be itself the result of a simultaneous fit on multiple images.  
The question is : what is the best way to store this model, assuming that it will be encoded in a set of files (probably fits) associated to a given instrument. The file to be used may depend on the filter and on the observing date ?  
I am thinking of the mechanism used to store and retrieve Megacam defects, but I am wondering if there is a better way to do it ?

---

<div class="post-metadata">

**Author:** ![jbosch](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/jbosch/32/12_2.png) [@jbosch](https://www.rubin.community/u/jbosch)\
**Post date:** [April 12, 2016, 5:53pm UTC](https://www.rubin.community/t/storing-an-instrument-model/679/2 "2016-04-12T17:53:02Z")

</div>

I don’t know how the Megacam defect system works, but I know I’ve always been vaguely dissatisfied with the HSC one, just from a software engineering perspective (it puts the data in obs\_subaru, which confuses software versions with instrument versions). I think we eventually want to store this sort of information in a Butlerized repository that’s associated with main data repository in a way that’s similar to the way we store calibration frames. I think @KSK and @npease may have thought about this some; there were some early discussions at the JTM but I don’t know if they’ve gone anywhere since.

---

<div class="post-metadata">

**Author:** ![ktl](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/ktl/32/1373_2.png) [@ktl](https://www.rubin.community/u/ktl)\
**Post date:** [April 12, 2016, 9:19pm UTC](https://www.rubin.community/t/storing-an-instrument-model/679/3 "2016-04-12T21:19:24Z")

</div>

The repo-of-repos model that @npease is working on is intended to handle this use case. We need to change cameras from being a special thing loaded in the `CameraMapper` constructor to something that is loaded from a dataset and that can use the validity interval mechanisms in the Butler. The problem we have right now (being discussed a little in [DM-5738](https://jira.lsstcorp.org/browse/DM-5738)) is that we have no good general mechanism for grabbing parts of objects (e.g. Exposures) from different places (although there are attempts to permit this in the Butler code, they’ve never been used). The other big worry I have once that is solved is performance, but we might be able to defer that for future optimization. (Oh, and whether the repositories describing a camera live in the `obs_*` package or somewhere else is up to you; it would depend on whether these are quite stable or highly variable/experimental.)

---

<div class="post-metadata">

**Author:** ![hsinfang](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/hsinfang/32/1986_2.png) [@hsinfang](https://www.rubin.community/u/hsinfang)\
**Post date:** [April 12, 2016, 10:27pm UTC](https://www.rubin.community/t/storing-an-instrument-model/679/4 "2016-04-12T22:27:50Z")

</div>

> [@jbosch](#):
>
> I think we eventually want to store this sort of information in a Butlerized repository that’s associated with main data repository in a way that’s similar to the way we store calibration frames

FWIW (and slightly off-topic), that sounds like how obs\_decam handles defect currently. Defect is a Butler calibration dataset type in DecamMapper and resides outside obs\_decam like other calibration data. There have been requests to move it into obs\_decam though. What is preferred?

---

<div class="post-metadata">

**Author:** ![RHL](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/rhl/32/25_2.png) [@RHL](https://www.rubin.community/u/RHL)\
**Post date:** [April 18, 2016, 4:28am UTC](https://www.rubin.community/t/storing-an-instrument-model/679/5 "2016-04-18T04:28:51Z")

</div>

This sounds like the information that is currently in the cameraGeom model of the object. It used to be a .paf file, but I think @KSK changed (== fixed that).

The rest of the answers, how to version this object, are on topic of course.

---

<div class="post-metadata">

**Author:** ![KSK](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/ksk/32/393_2.png) [@KSK](https://www.rubin.community/u/KSK)\
**Post date:** [April 18, 2016, 4:21pm UTC](https://www.rubin.community/t/storing-an-instrument-model/679/6 "2016-04-18T16:21:53Z")

</div>

> [@RHL](#):
>
> This sounds like the information that is currently in the cameraGeom model of the object.

This is exactly the think the CameraGeom is supposed to take care of. If there are things that make that difficult (or non-performant), I’d hope we could fix that rather than inventing a new thing.
