Keck-DataReductionPipelines / KPF-Pipeline

KPF-Pipeline
https://kpf-pipeline.readthedocs.io/en/latest/
Other
11 stars 2 forks source link

Reduce number of to_fits() and from_fits() calls in main recipe #739

Open awhoward opened 9 months ago

awhoward commented 9 months ago

The main recipe currently has many to_fits() and from_fits() calls. These were put in to handle different conditions, but this is undesirable for two reasons. First, it makes it hard to put quality control into the main recipe because the QC calls have to be put in for every to_fits() call. Second, it makes it really hard to test the full recipe using the /testdata/ directory. The problem is that intermediate files are written to the output directory (set to a subdir of /testdata/ during testing), and then the files are quickly read back in from the input directory (usually a subdir of /data/). In production, the input and output directories are the same, but in testing they are not.

One solution is to declare a variable called save_2D (for example) that can be set in many places in the recipe. Then to_fits() for the 2D file is done only once (save_2D == True), just before the L1 part of the recipe starts.