NCAR / ucomp-pipeline

Data processing pipeline for UCoMP
Other
6 stars 3 forks source link

Check keywords and make sure we are promoting the correct keywords between levels #281

Open bberkeyU opened 5 months ago

bberkeyU commented 5 months ago

Are we doing the right thing by promoting keywords across levels and into averaging?

Questions are based on recent processing of the process.analytic-gaussian data. Tracking is looking at 20220202.213127 and the waves collections.

Copies of the header can (temporarily be found in the wiki)

Questions

Todo

Level 1 files

Level 1 averages

Level 1 average extensions

Level 2 files

Related Issues:

bberkeyU commented 5 months ago

The pipeline computes the mean value for the mean files for the camera and cropico temps. This seems the correct way to handle the value.

I see two options to document how we manage the temperatures. Either change the meta-comment at the start of the temperature section or add Mean to each individual comment.

For the Meta comment change,we could add a couple lines to the end of the COMMENT --- Temperatures --- section like the following.

COMMENT --- Temperatures ---                                                    \
COMMENT Temperatures used in the Lyot filter calibrations are low-pass          \
COMMENT filtered and reported in keywords that start with T_. The raw,          \
COMMENT unfiltered temperature values for recorded temperatures are recorded    \
COMMENT in keywords that begin with TU_.   
COMMENT The values in this section are the mean temperature values values from all 
COMMENT  L1 files included in this Mean file.

If we change the individual comments we could do the following. current T_LCVR1 = 34.387 / [C] Lyot LCVR1 Temp

new T_LCVR1 = 34.387 / [C] Mean Lyot LCVR1 Temp

bberkeyU commented 5 months ago

No statistics are done to DSUN_OBS, SECANT_Z, SID_TIME, and JUL_DATE they are promoted from the first file.

The keywords in the --- Ephemeris info --- section use up most of the 31 characters available to them, so we would not be able to add information to the individual keyword without reworking the keyword language. Therefore, if we add language about how we compute header values for the mean file, it must be in a meta-comment for the whole section.

bberkeyU commented 5 months ago

The --- Quality metrics --- keywords are promoted from the first file.

It seems like we should either drop this section or change it to include the mean and standard deviation to give a sense of the statistics behind these values.

bberkeyU commented 5 months ago

Tracking the number of images used in an L1/L2 mean file. The averaging code computes NUMWAVE and NUMFILES by looking at all the wavelengths and files included in the average. However, the other image tracking numbers are prompted from the first file in the mean. Further, the pipeline doesn't check that all files in a mean have the same NUMSUM and NREPEAT but assumes that by policy, we will not try to average dissimilar files.

If we keep REMFRAME we should change it to the sum of all the REMFRAME values from the input files.

NREPEAT seems confusing in this context. We should either drop it. Or if we keep it, we should edit the comment to be something more like NREPEAT = 1 / number of repeat wavelength scans per L1 file

NFRAME comment should be edited. Perhaps NFRAME = 48 / total number of image frames in an L1 file

New comment for NUMFILES is addressed in #208

Sample from the header.

NFRAME  =                   48 / total number of image frames in file           \
REMFRAME=                    0 / number of bad frames removed                   \
NUMWAVE =                    3 / number of wavelengths                          \
NUMSUM  =                   14 / number of camera reads summed in an image frame\
NREPEAT =                    1 / number of repeats of wavelength scans          \
NUMBEAM =                    2 / number of beams                                \
NUMFILES=                   70 / number of level 1 files averaged               \
COMMENT Total camera reads in this file = NFRAME * NUMSUM where                 \
COMMENT   NFRAME = NUMWAVE * NREPEAT * NUMBEAM * 2(Cameras) * 4(Polarizations)  \
bberkeyU commented 5 months ago

We should expand the --- Occulter centering info --- section to record the mean and standard deviation of each of these values.

It may be hard to find reasonable keyword names for the new keywords.

bberkeyU commented 5 months ago

We should expand the --- Weather info --- section to include the mean and standard deviation for each of these values.

bberkeyU commented 5 months ago

We should drop the RAWEXTS, RAWDARK1, DARKEXT1, RAWDARK2, DARKEXT2, FLTFILE1, FLTEXTS1, MFLTEXT1, FLTFILE2, FLTEXTS2, MFLTEXT2 values from the L1 Mean files.

It will be complicated to keep track of these across the multiple L1 input files.

bberkeyU commented 5 months ago

FLATDN, CAMCORR, CAMDIFF, RCAMMED, TCAMMED, SKYTRAN Should not be prompted from the L1 file into L2 files.

If we want to keep them in the L2 and Mean files, we need to figure out how to average them across all the extensions.

RAWFILE should not be prompted to the Mean files.

mgalloy commented 5 months ago

My notes for changes to make are here.

mgalloy commented 4 months ago

From @bberkeyU, possible keywords and header comments:

COMMENT --- Occulter centering info ---                                         \
COMMENT X/YOFFSET define position w.r.t. distortion corrected L0 images         \
COMMENT Mean standard deviations and Max values were calculated across all      \
COMMENT the header values for the files included in the mean collection.        \
XOFFSET0=                1.154 / [pixels] RCAM occulter x-offset mean           \
XOFF0S=                  1.154 / [pixels] RCAM occulter x-offset std            \
YOFFSET0=               -5.666 / [pixels] RCAM occulter y-offset mean           \
YOFF0S=                  1.154 / [pixels] RCAM occulter y-offset std            \
RADIUS0 =              343.051 / [pixels] RCAM occulter radius mean             \
RADIUS0S=              343.051 / [pixels] RCAM occulter radius std              \
FITCHI0M=            0.022681 / [pixels] MAX chi-squared for RCAM center fit    \
XOFFSET1=                2.611 / [pixels] TCAM occulter x-offset mean           \
XOFF1S=                  1.154 / [pixels] TCAM occulter x-offset std            \
YOFFSET1=               -6.121 / [pixels] TCAM occulter y-offset mean           \
YOFF1S=                  1.154 / [pixels] TCAM occulter y-offset std            \
RADIUS1 =              343.418 / [pixels] TCAM occulter radius mean             \
RADIUS1S=              343.418 / [pixels] TCAM occulter radius std              \
FITCHI1M=             0.021198 / [pixels] MAX chi-squared for TCAM center fit   \
POST_ANG=              193.421 / [deg] post angle CCW from north mean           \
PST_ANGS=              193.421 / [deg] post angle CCW from north std            \
RADIUS  =              343.234 / [pixels] occulter average radius mean          \
RADIUSS  =             343.234 / [pixels] occulter average radius std           \
IMAGESCL=               2.9219 / [arcsec/pixels] image scale mean               \
IMGSCLS=                2.9219 / [arcsec/pixels] image scale std                \
RCAMECCM =              0.0178 / MAX occulter eccentricity in RCAM              \
TCAMECCM =              0.0313 / MAX occulter eccentricity in TCAM              \
bberkeyU commented 4 months ago

@mgalloy In the level1 flat/dark files (ie level1/YYYYMMDD.ucomp.dark.fts) should have the TCAMNUC /RCAMNUC keywords pushed into the extension headers. At least once during the mission we changed the NUC in the middle of an observing day.