[PIPE2D-509] How much do we need to defocus in order to measure change of effective frd Created: 27/Jan/20  Updated: 13/Jan/22

Status: Open
Project: DRP 2-D Pipeline
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Normal
Reporter: ncaplar Assignee: Brent Belland
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File FRD_Change_Detect_Corner.png     PNG File image-2020-03-16-06-34-09-667.png     PNG File image-2020-03-16-06-41-39-796.png     PNG File image-2020-03-16-10-53-22-346.png     PNG File Residuals_Analysis_Corner.png     PNG File Residuals_Analysis.png    
Issue Links:
Relates
relates to PIPE2D-508 Find out translation from real frd to... Done
relates to PIPE2D-574 Increasing defocus effect on FRD anal... Done
relates to PIPE2D-285 Quantify the effect of FRD variations... Done
relates to PIPE2D-452 Develop methods to quickly estimate e... Won't Fix
Story Points: 8
Sprint: 2DDRP-2021 A

 Description   

The task is to analyze and find how much defocus is needed in order to measure the realistic change of frd, in realistic conditions. This is to be done with our current knowledge about the system and with the 2d psf modeling code. 

The task includes (we might break this into finer additional tickets):

  1. determining what values of frd change we expect and what level do we need to measure (we might need to solicit some input from Jim on this)
  2. Determine defocus values that allow to measure these changes as a function of signal-noise and position on the detector (center, edges...)

This is rehashing of PIPE2D-452 updated to signify updated constraints and the transfer of this work to Caltech



 Comments   
Comment by ncaplar [ 27/Jan/20 ]

I have placed pandas dataframe describing the spots across the detector at [https://github.com/Subaru-PFS/dev_2ddrp/tree/master/2d_PSF_code/Data/results_of_fit_many_interpolation_HgAr_from_Dec04.pkl|https://github.com/Subaru-PFS/dev_2ddrp/tree/master/2d_PSF_code/Data/[results_of_fit_many_interpolation_HgAr_from_Dec04.pkl]. Brent you can load it by 

import pickle
 DATAFRAMES_FOLDER='/Users/nevencaplar/Documents/PFS/Fit_Results/Dec040119/'
 with open(DATAFRAMES_FOLDER+'results_of_fit_many_interpolation_HgAr_from_Dec04.pkl', 'rb') as f:
     results_of_fit_many_interpolation_HgAr_from_Dec04=pickle.load(f)

where you replace the path in `DATAFRAMES_FOLDER` to where you have placed the file. Then you can access the values for each defocus by specifying in the label e.g., 

results_of_fit_many_interpolation_HgAr_from_Dec04['m1']

would give the values of parameters at minus 1 mm of slit defocus at LAM. Other values are m45,m4,m35,m3,m25,m2,m15,m1,m05,0,p05,p1,p15,p2,p25,p3,p35,p4,p45. I recommend that at the start you use values for spot 1 (spot in the lower left corner of the detector ) and spot 55 (roughly in the center). To get values for these spots at a given defocus one would do something like

results_of_fit_many_interpolation_HgAr_from_Dec04['p35'].loc[1]

to get, for instance, values for spot 1, at plus 3.5 mm defocus of slit at LAM. 

Comment by Brent Belland [ 01/Feb/20 ]

As to work on part 1: Based on a report PFS-PFI-IPM000003-02_SuccessCriteriaCobraModuleFRDandRelativeThroughput I find that cable A has an expected average FRD of 10 mrad and Cable B has an expected average FRD of 17 mrad. Cable C has an average of 10 mrad; two ~10 mrad angular misalignments in connections between cables are introduced. Variations in Cobra angular error and nontelecentricity as well as uncertainties in Cable C FRD (standard deviation of 2 mrad) can be incorporated.

An overall range of FRD in a single fiber with variation in angle. The 

In an very extreme minimum case, FRD^2 ~ 100+289+36+0+100 ~> FRD of 20 mrad (no Cobra angular misalignment + perfect C cable)

Then for the most variation in that fiber, FRD^2 ~ 100+289+36+312.5+100 ~> FRD of 29 mrad (high end of Cobra angular misalignment)

Notably, an extreme maximal case of FRD^2 ~ 100+289+196+312.5+100 ~> FRD of 32 mrad. (max Cobra angular misalignment + high FRD C cable) if a stress were imposed on the cable. 

 

I'll post an image detailing how FRD and angle vary soon.

As to part 2: I had an issue reading the files which was entirely on my end; python incompatibility. Updated my python but completing the upgrade will take a bit of time. I can access all of the data though and am starting to go through it.

 

Comment by Brent Belland [ 16/Mar/20 ]

I've run tests to calculate the change in FRD. To calculate the change in profile, I took the residual of images generated in Neven’s 2D-DRP code at varying FRD values . Zernike coefficients provided by Neven from LAM data in the HgAr lamp on December 4th were used to accurately simulate the profile images.

Variations in FRD were considered over a variety of defocus values (0-4 mm in steps of 0.5 mm) and signal to noise ratio. Noise was modeled as Poisson noise plus a read noise of ~6.5 counts (40 counts in variance), and signal was increased from scaling the brightest pixel in each image to a uniform value.

For uniformity, initial FRD was taken to be the value from the FRD data. The corresponding value of sigma_FRD in the data is 0.0603; converting from this code value to a real value of FRD using the logic in PIPE2D-508 yields an effective FRD of 0.17857*sqrt(2)*0.0603/0.92 ~ 16.5 milliradians, assuming an input f/number of 2.8. Then, FRD was scaled up and down from this value: 0.8 times this FRD (13.2 milliradians) to 1.2 times this FRD (19.9 milliradians).

Chi squared was selected as an appropriate metric to characterize the FRD image residuals as it could be meaningfully applied across images at varying defocus and did not depend on any local features in the pupil images. However, at larger defocus the residuals across FRD have a distinct structure that could be utilized in both distinguishing FRD from competing effects and approximating FRD changes in a linear approximation fashion. Work in this area is ongoing.

Detectability was quantified by measuring the standard deviation of the averaged chi squared metric when just the noise data was considered. Only pixels brighter than a threshold of ~2% maximum brightness plus read noise were considered in the chi squared calculation, since the addition of pixels outside the image decreases the effective The detectability criterion was taken to be three times this standard deviation at every defocus. At smaller defocus, the standard deviation in chi squared is larger due to the lower number of pixels, which matches intuition that changes in the PSF are harder to detect at low defocus.

Variations of Chi squared versus defocus at four signals are shown in FRD_Change_Detect_Center. Note that the Chi squared axis is logarithmic and not the same between plots. Error bars for a given FRD indicate the 16%-84% percentile of Chi squared variation at that combination of defocus, SNR, and FRD over 100 trials.

Even at brightest signal of 60000 counts (~90% of the saturation limit of 65k counts), a defocus of 1mm is required to reasonably confidently detect a change on the order of 1.5 mrad, but at lower signal a larger defocus is required.

Comment by Brent Belland [ 16/Mar/20 ]

To visualize the residual variation with FRD change, Residuals_Analysis was also uploaded. This indicates the FRD images at 16.5 mrad FRD (top left), 31.0 mrad FRD (top right), noise residual (bottom left) and image residual (bottom right). While FRD change is more extreme than would be expected in the PFS, the structure of the residuals is very apparent. Smaller FRD changes have similar residuals at smaller magnitudes and are a promising avenue to speed up the analysis and robustly detect FRD variation.

Comment by Brent Belland [ 16/Mar/20 ]

A basic example of the masking used in the chi squared calculation is shown below in Masking_Simple. An image example spectrograph image is shown above, and the selected pixels for the analysis are shown below in yellow. Pixels on the order of brightness of the background are not considered in the analysis.

Comment by Brent Belland [ 19/Mar/20 ]

Below are plots that correspond to the FRD change detectability at a corner of the spectrograph. It seems like it's actually easier to detect changes near the edges, but I plan on investigating at other locations as well.

 

Comment by Brent Belland [ 31/Mar/20 ]

Changes in FRD (even on the order of 1.5 mrad) are readily detectable at ~60000 counts at defocuses >= 1mm. The amount of defocus needed to measure changes in FRD seems to be quantified to a degree that this purpose of the ticket is answered. 

However, from a conversation with Jim and Neven, the current focus of the investigation should be on FRD-induced variations on the PSF when the instrument is at or near focus (< 1mm). This work relates to PIPE2D-285, but this new work will have its own ticket.

This ticket will be closed with future work added to upcoming tickets.

Comment by rhl [ 31/Mar/20 ]

You should be able to convert "readily detectable" into a quantitative statement about the in-focus PSFs given Neven's optical model, or possibly even a simple pupil model and perfect optics. Do you have any feeling for the size of the effect?

Generated at Sat Feb 10 15:54:14 JST 2024 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.