[PIPE2D-829] Investigate/fix line intensity measurements Created: 05/May/21 Updated: 26/Aug/21 Resolved: 16/Jun/21 |
|
| Status: | Done |
| Project: | DRP 2-D Pipeline |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Story | Priority: | Normal |
| Reporter: | price | Assignee: | price |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Story Points: | 2 | ||||||||
| Sprint: | 2DDRP-2021 A 4, 2DDRP-2021 A5, 2DDRP-2021 A 6 | ||||||||
| Reviewers: | hassan | ||||||||
| Description |
|
rhl has shown that line intensity measurements (using CentroidLineTask) of the same line in different fibers is inconsistent. This is important to get right, since sky subtraction requires being able to associate intensities of lines in different fibers. Investigate and fix. |
| Comments |
| Comment by price [ 15/May/21 ] |
|
I spent some time this week writing a function to do simultaneous PSF fitting of all lines, and then made improvements to make it run within a reasonable amount of time. Now I have a catalog of aperture (5 pixel radius, summed pixels within aperture and scaled up to appropriate radius) and both unforced (at centroid position) and forced (at detectorMap position) PSF (a DoubleGaussianPsf with FWHM=2.5 pixels) flux measurements. Let's play with it.
import pandas from astropy.table import Table df = Table.read("photometry.fits").to_pandas() avgFlux = df[["wavelength", "psfFlux_forced", "psfFluxErr_forced"]].join(df.groupby("wavelength")["psfFlux_forced"].mean().rename("meanFlux"), "wavelength", "inner") relFlux = avgFlux["psfFlux_forced"]/avgFlux["meanFlux"] relFluxErr = avgFlux["psfFluxErr_forced"]/avgFlux["meanFlux"] pattern = relFlux[df["wavelength"] == 692.51295].to_numpy() import matplotlib.pyplot as plt for wl, col in zip((690.2737, 691.45295, 694.14355, 695.0961), ("rgbc")): select = df["wavelength"] == wl plt.scatter(df["fiberId"][select], relFlux[select]/pattern, color=col, marker="o", alpha=0.2) plt.xlabel("fiberId") plt.ylabel("Flux ratio") plt.show() |
| Comment by price [ 22/May/21 ] |
|
While also attending the MOS workshop this week, I did some eigenvector analysis of the measured line fluxes. In what follows, I use forced simultaneous PSF-fitting fluxes from the continuum-subtracted 2D spectra. The continuum subtraction is decent (not good, not awful): in general it's more over-subtracted than under-subtracted, and there's a slight misalignment that's more noticeable in the blue (maybe that's just where the continuum is bright). That's consistent with the line-subtracted image, where the lines almost all look like a backwards "C". The first normalised eigenvalue is 93%, then 3, 2 and 1%, which is somewhat reassuring. Here are the top six eigenvectors. The zeroth is the average, as usual, and looks reasonable (apart from a few strange values, which I think are from small measurement problems). The next three scale up and down various line combinations (I wonder if we can extract some physics from this when we get a better handle on the measurements?). Not entirely sure what the fourth and fifth are.
Fitting the measurements with the top six eigenvectors yields the following coefficients. Red points are diffuse fibers, while blue are imaging; there's no great difference between those until we get to the third coefficient (bottom-left), where there's a clear discontinuity between the red and blue points. My guess is that this has to do with a connector. I think this is the same phenomenon observed in the flux ratios plot in the previous comment, as the 690.2737 line (which is red in that plot) is close to zero in the third eigenvector while the other lines in that plot have negative values.
I think this shows promise for modeling the sky line fluxes for the 2D sky subtraction module, but we're going to need better line measurements. I need to look at improving the detectorMaps and check that the fiberProfiles are reasonable. |
| Comment by rhl [ 22/May/21 ] |
|
There are/should be (at least) three things going on with the line ratios:
|
| Comment by rhl [ 22/May/21 ] |
|
Next time you make the PCA plots can you scale the eigen vectors by sqrt(eigenvalue)? that way you get an idea of the relative importance of the terms. Also, colour code the way that drp/stella/utils does (red for diffuse, green for imaging)? I assume that "eigenflux" means eigenvector (it could be interpreted to mean the coefficients). Let's stick with the standard names! I don't understand why the diffuse fibres, with c. 72% of the throughput according to the fiberTraces, have roughly the same 0th component. What's going on with component 1 (top middle)? It looks triple-valued to me. The only thing I can think of is something about the pattern of gaps along the slit (usually 2 or 3 but 1 in the large diffuse block), but I don't see how that would work. Component 2 is also weird; small for almost all fibres. Component 3 even more so. If I had to guess, I'd say it was something in the flux estimation, probably the continuum. |
| Comment by rhl [ 22/May/21 ] |
Is this all lines within one spectrum, or all lines in the spectrograph? I assume the former. I wouldn't expect this to be slow, it's no worse than independent measurements followed by a least-squares solver (N_line^2 time, or N_line^3 if you wanted the covariances). |
| Comment by price [ 26/May/21 ] |
|
Here's an image of the residuals after continuum subtraction and subtraction of the PSF fits (with improved detectorMap and fiberProfiles). The green circles indicate the extent of the six fibers x 5 wavelengths originally highlighted in this ticket.
|
| Comment by rhl [ 26/May/21 ] |
|
Are you using a different sky model in each fibre (I suspect that the answer's yes)? I think we need to use the same model for all fibres, and that may be part of the reason for inconsistent line ratios between the fibres. The fiberProfile alignment looks good, but we're oversubtracting sky. |
| Comment by price [ 12/Jun/21 ] |
|
I think this is now in a position to merge and close. I believe the problems were due to a combination of the following: With the above addressed, I believe that we're down in the noise. As a demonstration, I offer photometry from 20 contiguous SuNSS exposures. The following plot shows the flux of the 692.51295 sky line for the same group of fibers RHL chose earlier (24 <= fiberId <= 38) as a function of visit, with the fibers color-coded. Firstly, the pattern of colors differs from visit to visit. Secondly, the error bars greatly overlap, showing that the data is generally consistent within the statistical errors.
|
| Comment by rhl [ 16/Jun/21 ] |
|
This looks much better. I agree that we should close this out and try using the improved fluxes. If we find problems (and we will!), let's open a new ticket. |
| Comment by hassan [ 16/Jun/21 ] |
|
Changes look fine to me. Maybe write out the adjusted detectormap for debug purposes? But that can be a separate ticket (if not already supported). |
| Comment by price [ 16/Jun/21 ] |
|
Thank you, both. Merged. |