spacetelescope / stdatamodels

https://stdatamodels.readthedocs.io
Other
5 stars 25 forks source link

NRMModel updates #359

Open rcooper295 opened 6 days ago

rcooper295 commented 6 days ago

Discussion originating on https://github.com/spacetelescope/stdatamodels/issues/342) with @braingram :

I'm working on changing the AMI code to use values from the header of the NRM reference file rather than the hardcoded ones currently in mask_definitions.py. When I load the reference file as an NRMModel, the keywords I need are in the extra_fits part of the tree, but instead of being accessed like this they seem to be stored in nested lists and have to be accessed by their index [...] This whole issue may be irrelevant anyways; since these values will be important to the AMI code I was thinking it might make sense to have them be defined/required in the schema.

The reference file keywords aren't listed in the keyword dictionary and are in different schemas in this package. Adding them to the schema is required to get them out of "extra_fits". Adding them will require picking an attribute name so feel free to suggest one (or we can just use the current variable names) in that issue.

We concluded the values we need should be added to the NRMModel schema and therefore the keyword dictionary. I will confirm with other AMI team members what we want to call the attribute names (if different from the current FITS keyword names).

rcooper295 commented 6 days ago

I think we'd like the following FITS keywords to be defined in the NRMModel schema:

I've just copied these as they appear in the header currently. I think for the schema since we don't have the same character limits we could expand "f2f" to be "flat_to_flat". I'll also change the FITS comment for each keyword to match the 1-indexing in the names (apertures 1-7 instead of 0-6), but I think the other keyword names are ok as-is.

I can open a JWSTKD project JIRA ticket to get these added to the keyword dictionary as well, and I'll look at adding them to the NRMModel schema. Do I just need to add a block like:

- type: object
  properties:
    meta:
      type: object
      properties:
        flat_to_flat:
          type: object
          required: [f2f]
        nrm_x_a1:
          type: object
          required: [nrm_x_a1]
        [...]
        required: [flat_to_flat, nrm_x_a1, ...]
  required: [meta]
braingram commented 6 days ago

Thanks!

Are these only for the NRMModel reference file? If so, there's no need for a keyword dictionary ticket (as that resource doesn't list reference file keywords).

braingram commented 6 days ago

As far as the schema update, if it works for you I'll open a PR with proposed changes and ping you for review/testing.

The example changes are on the right track but are missing fits_keyword entries, etc.

braingram commented 6 days ago

@rcooper295 How does https://github.com/spacetelescope/stdatamodels/pull/361 look?

rcooper295 commented 5 days ago

Are these only for the NRMModel reference file? If so, there's no need for a keyword dictionary ticket (as that resource doesn't list reference file keywords).

Yes, these are only for this reference file. Ok, I think I get it -- so the keyword dictionary only needs to have keywords that are in data products, but there are datamodel schemas for reference files as well as data products, and some individual keywords as well?

braingram commented 5 days ago

Exactly! The reference files datamodels use different schemas than the science product datamodels. The latter are the only ones that contain fits keywords that are also covered by the keyword dictionary.

I just merged a PR with docs updates that are relevant here: https://stdatamodels.readthedocs.io/en/latest/jwst/datamodels/schemas.html