Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add median value quality checks when reading flats #284

Open
3 tasks done
bberkeyU opened this issue Jun 27, 2024 · 6 comments
Open
3 tasks done

Add median value quality checks when reading flats #284

bberkeyU opened this issue Jun 27, 2024 · 6 comments
Assignees
Labels
data-changing issue will change data values enhancement new feature needs testing needs more testing/verification
Milestone

Comments

@bberkeyU
Copy link
Contributor

bberkeyU commented Jun 27, 2024

Currently, we do not perform image data quality checks on the flats, which has allowed some marginal or deficient flats to be used in the image correction.

Between spot-checking good and bad flats and looking at metrics across the UCoMP mission, I find that for a given epoch, good flats have a range of meidan values vary by wave region, epoch, camera, and onband tuning.

I have computed a table of high and low flat values for each of the 637,706,1074, and 1079 regions. I also looked at 530, but all flats were equally good (or bad?), so the pipeline should pass all the 530 data. If the pipeline needs values for 530 and the other wavelengths, we should start with min=0 and max =4095 and allow everything to pass.

For the analysis, the median value of the raw L0 flat pixels within an annulus centered in the middle of the detector with an inner radius of 375 and an outer radius of 600 pixels was computed; the computation also excluded post values between x=550 ->700 in the raw detector coordinate systems. These median values were then divided by NUMSUM, and the mean was computed across the 4 modulation states.

The table below contains the high and low flat limits for the following states:

  • CAM0 with ONBAND=RCAM
  • CAM0 with ONBAND=TCAM
  • CAM1 with ONBAND=TCAM
  • CAM1 with ONBAND=RCAM

Date-beg and date-end define the start and stop of the epochs.

@mgalloy Please let me know if this table should be in a different format; I can easily transform and recreate it.

               date-beg                date-end  waveRegion  cam0-on-low  cam0-on-high  cam0-off-low  cam0-off-high  cam1-on-low  cam1-on-high  cam1-off-low  cam1-off-high
2022-11-18 12:00:00.000 2022-12-06 12:00:00.000      1074.0        340.0         360.0         300.0          330.0        320.0         340.0         285.0          315.0
2022-06-16 19:12:00.000 2022-11-17 12:00:00.000      1074.0        335.0         365.0         300.0          325.0        335.0         364.0         295.0          325.0
2022-03-19 12:00:00.000 2022-06-16 19:12:00.000      1074.0        355.0         380.0         310.0          340.0        350.0         375.0         310.0          335.0
2022-02-23 19:12:00.000 2022-03-19 12:00:00.000      1074.0        370.0         385.0         320.0          340.0        365.0         378.0         320.0          342.0
2022-02-02 12:00:00.000 2022-02-23 19:12:00.000      1074.0        860.0         880.0         815.0          840.0        850.0         865.0         800.0          820.0
2022-01-14 12:00:00.000 2022-02-02 12:00:00.000      1074.0        740.0         765.0         720.0          740.0        735.0         760.0         705.0          730.0
2021-11-11 12:00:00.000 2022-01-14 12:00:00.000      1074.0        750.0         785.0         730.0          755.0        740.0         775.0         720.0          750.0
2021-10-08 00:00:00.000 2021-11-11 12:00:00.000      1074.0        805.0         830.0         775.0          790.0        795.0         815.0         760.0          780.0
2021-08-11 12:00:00.000 2021-10-08 00:00:00.000      1074.0        770.0         795.0         740.0          760.0        760.0         780.0         730.0          750.0
2021-07-29 12:00:00.000 2021-08-11 12:00:00.000      1074.0        800.0         860.0         765.0          820.0        800.0         860.0         750.0          820.0
2022-11-18 12:00:00.000 2022-12-06 12:00:00.000      1079.0        371.0         410.0         285.0          336.0        353.0         390.0         273.0          321.0
2022-06-16 19:12:00.000 2022-11-17 12:00:00.000      1079.0        330.0         436.0         270.0          340.0        330.0         441.0         270.0          350.0
2022-03-19 12:00:00.000 2022-06-16 19:12:00.000      1079.0        340.0         460.0         280.0          379.0        340.0         466.0         280.0          371.0
2022-02-23 19:12:00.000 2022-03-19 12:00:00.000      1079.0        380.0         460.0         290.0          380.0        370.0         460.0         280.0          380.0
2022-02-02 12:00:00.000 2022-02-23 19:12:00.000      1079.0        860.0         946.0         740.0          887.0        860.0         919.0         740.0          875.0
2022-01-14 12:00:00.000 2022-02-02 12:00:00.000      1079.0        760.0         815.0         680.0          772.0        760.0         804.0         680.0          761.0
2021-11-11 12:00:00.000 2022-01-14 12:00:00.000      1079.0        750.0         830.0         684.0          770.0        733.0         820.0         650.0          760.0
2021-10-08 00:00:00.000 2021-11-11 12:00:00.000      1079.0        800.0         879.0         740.0          805.0        800.0         868.0         740.0          794.0
2021-08-11 12:00:00.000 2021-10-08 00:00:00.000      1079.0        770.0         839.0         710.0          775.0        770.0         829.0         701.0          764.0
2021-07-29 12:00:00.000 2021-08-11 12:00:00.000      1079.0        840.0         905.0         758.0          832.0        818.0         910.0         730.0          840.0
2022-11-18 12:00:00.000 2022-12-06 12:00:00.000       789.0        121.0         134.0         103.0          118.0        115.0         129.0          96.0          112.0
2022-06-16 19:12:00.000 2022-11-17 12:00:00.000       789.0        100.0         136.0         100.0          121.0        100.0         138.0         100.0          124.0
2022-03-19 12:00:00.000 2022-06-16 19:12:00.000       789.0        110.0         139.0          95.0          120.0        105.0         138.0          95.0          120.0
2022-02-23 19:12:00.000 2022-03-19 12:00:00.000       789.0        115.0         140.0         100.0          130.0        115.0         140.0         100.0          125.0
2022-02-02 12:00:00.000 2022-02-23 19:12:00.000       789.0        610.0         640.0         600.0          620.0        610.0         630.0         590.0          610.0
2022-01-14 12:00:00.000 2022-02-02 12:00:00.000       789.0        582.0         604.0         574.0          591.0        580.0         596.0         559.0          583.0
2021-11-11 12:00:00.000 2022-01-14 12:00:00.000       789.0        580.0         617.0         573.0          600.0        584.0         610.0         550.0          592.0
2021-10-08 00:00:00.000 2021-11-11 12:00:00.000       789.0        575.0         650.0         570.0          620.0        580.0         620.0         550.0          600.0
2021-08-11 12:00:00.000 2021-10-08 00:00:00.000       789.0        580.0         612.0         570.0          598.0        580.0         605.0         555.0          591.0
2022-11-18 12:00:00.000 2022-12-06 12:00:00.000       706.0         87.0         100.0          74.0           84.0         84.0          98.0          70.0           81.0
2022-06-16 19:12:00.000 2022-11-17 12:00:00.000       706.0         85.0         110.0          60.0           90.0         85.0         110.0          70.0           90.0
2022-03-19 12:00:00.000 2022-06-16 19:12:00.000       706.0         85.0         103.0          70.0           85.0         80.0         100.0          65.0           85.0
2022-02-23 19:12:00.000 2022-03-19 12:00:00.000       706.0         80.0         110.0          80.0          100.0         80.0         110.0          80.0          100.0
2021-10-08 00:00:00.000 2021-11-11 12:00:00.000       706.0        587.0         588.0         581.0          582.0        578.0         578.0         572.0          572.0
2021-08-11 12:00:00.000 2021-10-08 00:00:00.000       706.0        542.0         591.0         542.0          583.0        533.0         583.0         533.0          575.0
2021-07-29 12:00:00.000 2021-08-11 12:00:00.000       706.0        564.0         645.0         578.0          636.0        580.0         778.0         566.0          768.0
2022-02-02 12:00:00.000 2022-02-23 19:12:00.000       706.0        555.0         604.0         554.0          596.0        546.0         595.0         545.0          587.0
2022-11-18 12:00:00.000 2022-12-06 12:00:00.000       637.0         81.0          93.0          72.0           90.0         79.0          92.0          70.0           90.0
2022-06-16 19:12:00.000 2022-11-17 12:00:00.000       637.0         60.0          98.0          60.0           95.0         60.0          99.0          60.0           97.0
2022-03-19 12:00:00.000 2022-06-16 19:12:00.000       637.0         74.0          95.0          70.0           91.0         70.0          94.0          70.0           92.0
2022-02-23 19:12:00.000 2022-03-19 12:00:00.000       637.0         70.0         100.0          70.0          100.0         70.0         100.0          70.0          100.0
2022-02-02 12:00:00.000 2022-02-23 19:12:00.000       637.0        546.0         591.0         546.0          588.0        538.0         582.0         538.0          579.0
2022-01-14 12:00:00.000 2022-02-02 12:00:00.000       637.0        552.0         576.0         557.0          573.0        552.0         567.0         544.0          564.0
2021-11-11 12:00:00.000 2022-01-14 12:00:00.000       637.0        542.0         590.0         552.0          576.0        541.0         571.0         533.0          593.0
2021-10-08 00:00:00.000 2021-11-11 12:00:00.000       637.0        550.0         585.0         550.0          585.0        545.0         580.0         545.0          580.0
2021-08-11 12:00:00.000 2021-10-08 00:00:00.000       637.0        550.0         582.0         550.0          578.0        540.0         573.0         540.0          570.0
2021-07-29 12:00:00.000 2021-08-11 12:00:00.000       637.0        568.0         634.0         577.0          631.0        569.0         779.0         564.0          775.0

Possible epoch value definitions, which are all 2-element arrays of min/max values:

rcam_onband_flat_range  : type=float, extract=YES
rcam_offband_flat_range : type=float, extract=YES
tcam_onband_flat_range  : type=float, extract=YES
tcam_offband_flat_range : type=float, extract=YES

Tasks

  • create epoch spec file definitions
  • update epochs
  • create cal quality test
@mgalloy mgalloy added enhancement new feature data-changing issue will change data values labels Jun 27, 2024
@mgalloy mgalloy added this to the UCoMP 1.0.11 milestone Jun 27, 2024
@mgalloy mgalloy changed the title Add median value quality checks when reading flats. Add median value quality checks when reading flats Jun 27, 2024
@mgalloy
Copy link
Member

mgalloy commented Jul 5, 2024

@bberkeyU Are the times listed in Julian date? Why is 12:00:00 so frequent? i.e. is the "2022-11-18 12:00:00.000" listed actually "2022-11-18T12:00:00Z"?

@mgalloy
Copy link
Member

mgalloy commented Jul 5, 2024

I think there is a missing epoch for 706. I think that the next epoch after:

2021-10-08 00:00:00.000 2021-11-11 12:00:00.000

is:

2022-02-23 19:12:00.000 2022-03-19 12:00:00.000

So 2021-11-11 12:00:00.000 to 2022-02-23 19:12:00.000 is missing.

@mgalloy
Copy link
Member

mgalloy commented Jul 5, 2024

@bberkeyU Are there example files that you know will fail the quality check? I would like some good days to test on.

@bberkeyU
Copy link
Contributor Author

bberkeyU commented Jul 5, 2024

@mgalloy I think they are in Julian Dates:

To get the epochs, I pulled the DATE-BEG from all of the header files and converted it to Julian data with the astropy.time import Time with the following command: Time(ext.header['DATE-BEG']).jd,fit[0]

I then plotted the flat medians vs this Julien data and tweaked my X and Y limits until I found good start/stop times and intensity limits. (Note: when doing the start/stop finding, I subtracted 2459000 from all of the Julien dates so I could think about smaller numbers.

I converted the values back from Julien date to date time strings with the following command flatRanges["date-beg"] = Time(flatRanges["jdstart"]+2459000,format="jd").iso

This process gave a 12:00 reference instead of a 00:00 reference time. In most but not all cases, the epochs change at the beginning or end of an observing day, so the exact timestamp isn't going to be important.

@bberkeyU
Copy link
Contributor Author

bberkeyU commented Jul 6, 2024

@mgalloy I am looking into finding bad days that are both clearly and marginally bad.

@bberkeyU
Copy link
Contributor Author

I created a workbook with Flat epoch plots. It is a fairly long document with the interesting part most of the way down.

In this example plot from the 637 section
image we can see an epoch for 2022-03-19 to 2022-06-16 There are four plots in this images separated by camera and onband. Orange dots represent the median flat values in the "coronal" region. Most points fall within the yellow bars representing high and low limit values, but a handful is clearly below the low-intensity limit.

There is a similar plot for each of the six wave regions (530, 637, 706, 789, 1074,1079) for each epoch region I identified. The upper and lower limits were empirically selected; and others might pick different values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data-changing issue will change data values enhancement new feature needs testing needs more testing/verification
Projects
None yet
Development

No branches or pull requests

2 participants