Closed jbkalmbach closed 10 months ago
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.
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?
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)
Thanks! Yeah, that did the trick.
@jmeyers314 I think this is ready for a review if you have a chance.
Thanks! Unfortunately I don't have write access on the repo so if you could merge it that would be great!
I primarily wanted to get the
PROGRAM
header into the amp files to specify ascience_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.