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

Add ability to add keywords for the DM Butler directly into primary amp headers. #443

Conversation

jbkalmbach
Copy link
Member

I primarily wanted to get the PROGRAM header into the amp files to specify a science_program in the butler repository for the data but I think it was cleaner to make something that can accommodate any other optional headers that might be useful in the future.

@jmeyers314
Copy link
Member

I can't remember, does GetAllParams apply config processing within the dict? For example, can you do?:

output:
  readout:
    added_keywords:
      some_math: $1+2

If so, that'd be a nice test.

@jbkalmbach
Copy link
Member Author

I can't remember, does GetAllParams apply config processing within the dict? For example, can you do?:

output:
  readout:
    added_keywords:
      some_math: $1+2

If so, that'd be a nice test.

No, it doesn't look like the way I did it processes the math. Is there a better function to use?

@jmeyers314
Copy link
Member

I think something like the following should work:

        # Parse parameters from the config dict.
        opt = {
            'camera': str,
            'readout_time': float,
            'dark_current': float,
            'bias_level': float,
            'scti': float,
            'pcti': float,
            'full_well': float,
            'read_noise': float,
            'bias_levels_file': str,
            }
        ignore = ['file_name', 'dir', 'hdu', 'filter', 'added_keywords']
        kwargs = GetAllParams(config, base, opt=opt, ignore=ignore)[0]

        if 'added_keywords' in config:
            kwargs['added_keywords'] = {}
            for k in (added_keywords := config.get('added_keywords', {})):
                kwargs['added_keywords'][k], safe = ParseValue(added_keywords, k, base, str)

@jbkalmbach
Copy link
Member Author

Thanks! Yeah, that did the trick.

@jbkalmbach
Copy link
Member Author

@jmeyers314 I think this is ready for a review if you have a chance.

Copy link
Member

@jmeyers314 jmeyers314 left a comment

Choose a reason for hiding this comment

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

Yep. Looks good to me. Thanks!

@jbkalmbach
Copy link
Member Author

Thanks! Unfortunately I don't have write access on the repo so if you could merge it that would be great!

@jmeyers314 jmeyers314 merged commit e6124cf into LSSTDESC:main Jan 20, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants