Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_association fails to identify an association #209

Open
izkgao opened this issue Sep 14, 2023 · 0 comments
Open

is_association fails to identify an association #209

izkgao opened this issue Sep 14, 2023 · 0 comments

Comments

@izkgao
Copy link

izkgao commented Sep 14, 2023

I found that the is_association function of stdatamodels.jwst.datamodels.util checks if an object is an association based on the fact that it is a dict. However, the association created by jwst.associations.asn_from_list.asn_from_list by default is not a dict but jwst.associations.lib.rules_level3_base.DMS_Level3_Base. This would cause a problem when creating a ModelContainer from a DMS_Level3_Base association.

def is_association(asn_data):

Here is the code to reproduce this problem.

from jwst.associations.asn_from_list import asn_from_list
from jwst.datamodels import ModelContainer
import glob
files = glob.glob('*.fits')
asn = asn_from_list(files, product_name='test')
images = ModelContainer(asn)

But it works if bypassing the is_association check.

from jwst.associations.asn_from_list import asn_from_list
from jwst.datamodels import ModelContainer
import glob
files = glob.glob('*.fits')
asn = asn_from_list(files, product_name='test')
images = ModelContainer()
images.from_asn(asn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant