Keck-DataReductionPipelines / KPF-Pipeline

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

Added QLP features for service mission #801

Closed awhoward closed 5 months ago

awhoward commented 5 months ago

In the L1 flux ratio plot, I added a row for SCI1/SCI3. This pair of slices the most diagnostic.

I also added the ability to plot states instead of just floats in the standard time series plots in AnalyzeTimeSeries. An example is below.

The pull request also includes small improvements to the documentation.

DRP_version_time_series

awhoward commented 5 months ago

I addressed Issue https://github.com/Keck-DataReductionPipelines/KPF-Pipeline/issues/803 so that Analyze2D can make plots of 2D images with order trace overlaid. An example is below.

Currently, the code selects an order trace file based on the date of observation. We talked about putting the order trace file into the header (https://github.com/Keck-DataReductionPipelines/KPF-Pipeline/issues/802) and using it in the QLP. This will be complicated because the order trace file isn't known until the L1 file is made and it's needed for the 2D QLP. Perhaps a way around this is to trigger the creation of the 2D order trace plot in the QLP when the L1 files is made, extracting the header keyword then and adding an argument to Analyze2D.plot_2D_order_trace2x2() for the order trace file. This is a little untidy, but it will get the job done.

This code is currently running in the production QLP instance on shrek.

(The title of the plot is cut off for reasons that I can't figure out right now. I'll look into it later.)

order_trace_red

awhoward commented 5 months ago

If you want to run the code in a Jupyter Notebook, here's how:

from kpfpipe.models.level0 import KPF0
from modules.Utils.kpf_parse import get_datecode
from modules.quicklook.src.analyze_2d import Analyze2D
%matplotlib inline

ObsID = 'KP.20240131.01126.61' # flat
D2_file = '/data/2D/' + get_datecode(ObsID) + '/' + ObsID + '_2D.fits'
D2 = KPF0.from_fits(D2_file)
myD2 = Analyze2D(D2)
myD2.plot_2D_order_trace2x2(chip='green', show_plot=True)
#myD2.plot_2D_order_trace2x2(chip='green', fig_path='order_trace_green.png')
myD2.plot_2D_order_trace2x2(chip='red', show_plot=True)
#myD2.plot_2D_order_trace2x2(chip='red', fig_path='order_trace_red.png')