Skip to content

Conversation

@mcara
Copy link
Member

@mcara mcara commented Oct 6, 2023

Resolves JP-3438
Closes #7996

This PR adds support for custom group ID so that users can conveniently modify how input models are grouped for the tweakreg and skymatch steps.

Checklist for maintainers

  • added entry in CHANGES.rst within the relevant release section
  • updated or added relevant tests
  • updated relevant documentation
  • added relevant milestone
  • added relevant label(s)
  • ran regression tests, post a link to the Jenkins job below.
    How to run regression tests on a PR
  • Make sure the JIRA ticket is resolved properly

@mcara mcara added this to the Build 10.1 milestone Oct 6, 2023
@mcara mcara requested review from hbushouse and nden October 6, 2023 05:56
@mcara mcara self-assigned this Oct 6, 2023
@mcara mcara requested a review from a team as a code owner October 6, 2023 05:56
@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified lines are covered by tests ✅

Files Coverage Δ
jwst/datamodels/container.py 82.56% <100.00%> (+0.84%) ⬆️

📢 Thoughts on this report? Let us know!.

Copy link
Collaborator

@nden nden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test?
If I understand this correctly I should be able to edit an association file and add a custom group_id. This does not work. Is group_id even saved to an association_file?

Copy link
Collaborator

@hbushouse hbushouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need updates to RTD somewhere (wherever appropriate) to explain this new capability.

@mcara mcara force-pushed the custom-grouping branch 3 times, most recently from 21f4d4e to e26eb4a Compare October 8, 2023 06:46
@mcara
Copy link
Member Author

mcara commented Oct 8, 2023

Can you add a test? If I understand this correctly I should be able to edit an association file and add a custom group_id. This does not work. Is group_id even saved to an association_file?

It does work. Can you explain what is not working as expected?

I added a unit test. I had to modify the headers.fits file to add the following meta info:

meta.observation.sequence_id = '2'
meta.observation.visit_group = '02'
meta.observation.activity_id = '01'

Without sequence_id , visit_group, and activity_id defined, ModelContainer.models_grouped would not work.

@nden
Copy link
Collaborator

nden commented Oct 11, 2023

Can you explain what is not working as expected?

I was trying to generate an association file with a custom group_id . As described somewhere above I opened the files, assigned model.meta.goup_id and saved them. Then I ran asn_from_list to generate the association file. The new association is missing goup_id. This may be a user error or an association enhancement.
However, it looks like the only way to use a custom group_id or not group observations is to edit an association. Does it make sense to have a parameter to calweb_image3, tweakreg or sky_match which disables grouping?

@mcara
Copy link
Member Author

mcara commented Oct 11, 2023

I was trying to generate an association file with a custom group_id . As described somewhere above I opened the files, assigned model.meta.goup_id and saved them. Then I ran asn_from_list to generate the association file.

asn_from_list would need to be updated in order to be able to do this. Currently, this is not supported and I am not sure there is need for this: If you edited the files and set model.group_id (NOT model.meta.goup_id) then ModelContainer will pick this up. This PR is similar to #7022 in how it handles stuff. In fact, most machinery to support reading extra members from ASN and setting corresponding model attributes was done in that PR.

However, it looks like the only way to use a custom group_id or not group observations is to edit an association.

If you set model.group_id and save the model, it should work.

Does it make sense to have a parameter to calweb_image3, tweakreg or sky_match which disables grouping?

In principle yes, but it is harder to achieve that, I think... And it makes it easier to have confusing situations like what takes precedence. I need to investigate this a little.

@nden
Copy link
Collaborator

nden commented Oct 11, 2023

This looks good to me. The other enhancements can be done in a different PR. Need to rebase this one.

@mcara mcara force-pushed the custom-grouping branch 2 times, most recently from c2f2135 to 54d0e92 Compare October 14, 2023 23:55
@mcara mcara merged commit 6902a68 into spacetelescope:master Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow users to specify custom grouping of models for tweakreg and skymatch

3 participants