Skip to content

Commit

Permalink
Merge pull request #209 from roman-corgi/kgain_guess
Browse files Browse the repository at this point in the history
the walker can't currently correctly guess the Kgain recipe
  • Loading branch information
maxwellmb authored Sep 23, 2024
2 parents d43e942 + 29abdc2 commit 638cfa2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions corgidrp/walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ def guess_template(dataset):
recipe_filename = "l1_flat_and_bp.json"
elif image.pri_hdr['OBSTYPE'] == "NONLIN":
recipe_filename = "l1_to_l2a_nonlin.json"
elif image.pri_hdr['OBSTYPE'] == "KGAIN":
recipe_filename = "l1_to_kgain.json"
elif image.pri_hdr['OBSTYPE'] == "MNFRAME":
# Disambiguate between NONLIN and KGAIN
for data in dataset:
Expand Down
8 changes: 7 additions & 1 deletion tests/e2e_tests/kgain_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def test_l1_to_kgain(tvacdata_path, e2eoutput_path):
l1_data_filelist_range_exp = [os.path.join(l1_datadir, "CGI_EXCAM_L1_00000{0}.fits".format(i)) for i in np.arange(51731, 51841)]#[51731, 51761]]

####### Run the walker on some test_data
for file in l1_data_filelist_range_exp:
image = data.Image(file)
# This should not be necessary anymore after the updates of the OBSTYPE keyword, up to now it is only "SCI"
if image.pri_hdr['OBSTYPE'] != 'KGAIN':
image.pri_hdr['OBSTYPE'] = 'KGAIN'
image.save(filename = file)

for file in l1_data_filelist_same_exp:
image = data.Image(file)
Expand All @@ -40,7 +46,7 @@ def test_l1_to_kgain(tvacdata_path, e2eoutput_path):
image.save(filename = file)
l1_data_filelist_range_exp.append(file)

walker.walk_corgidrp(l1_data_filelist_range_exp, "", kgain_outputdir, template="l1_to_kgain.json")
walker.walk_corgidrp(l1_data_filelist_range_exp, "", kgain_outputdir)
kgain_file = os.path.join(kgain_outputdir, "CGI_EXCAM_L1_0000051731_kgain.fits")
kgain = data.KGain(kgain_file)

Expand Down

0 comments on commit 638cfa2

Please sign in to comment.