Open moustakas opened 4 months ago
if useful, I ve written a small script to loop on all cframes from a night, look at the sky fibers, and measure the median value of the 500 pixels on both edges of each amplifier.
I ll polish a bit that, and I ll then share more results, but here s an example for iron of one night (from early sv1, included in the bottom right spectrum of @moustakas plot above (which has fiber=2680).
I m plotting in different colors the difference at each boundary (with some y-offset for clarity). we clearly see around fiber 2700 the blue amp of the z-camera having issue, with the -0.5 offset between the r- and z-camera, as can be seen in the spectrum above. that feature is at least present from 20201214 to 20210107; so I guess that ~all spectra in that fiber range from that period have a similar r-z break.
when flipping through nights, we see some features appearing / disappearing. that approach allows one to know post-facto if some fibers from a night have some issue.
if people are curious, I ve generated (large...) pdf files: https://data.desi.lbl.gov/desi/users/raichoor/spectro/iron/peramp-medians/peramp-median-iron-sv.pdf (74M) https://data.desi.lbl.gov/desi/users/raichoor/spectro/iron/peramp-medians/peramp-median-iron-main-y1.pdf (175M)
I currently select sky fibers with:
sel = d["OBJTYPE"] == "SKY"
sel &= (d["FIBERSTATUS"] & fibermask["POORPOSITION"]) == 0
but I m happy to implement something more relevant, if suggested.
I notice that for the main survey, the fiber sampling is sparser: I think it s because we then turned on the use of stuck fibers for sky; hence the ~same fibers are often use.
so I ll also explore if considering all spectra, not just sky spectra, could provide something meaningful.
@sbailey noticed that we are missing a batch of Nightwatch QA from the start of SV1 so at his request I reprocessed several missing nights at NERSC: 20201216, 20201217, and 20201218. The NW calibration files covering that period were a little patchy. I did my best to clean it up quickly, but a few of the reported errors, like a wavelength (DY) offset in the trace shifts of Z8, could be spurious.
On z5 there is a masked hot column around fiber 2663, including a large masked "bloom" at the bottom of the CDD impacting many fibers, e.g. https://nightwatch.desi.lbl.gov/20201216/00068227/preproc-z5-00068227-4x.html (thanks to @sybenzvi for generating those nightwatch pages).
@araichoor do your plots consider masked pixels? I suspect that much of the red/purple offset problem in your plots is coming from this CCD masked region which should have propagated into masked fluxes. From a quick look it also appears that the fiberflat is messed up but not masked in that region. I have another meeting now, but that could use more investigation too.
"do your plots consider masked pixels?" => I exclude pixels with ivar=0, so that probably also removes the masked pixels, right?
I set flux=np.nan to all ivar=0 pixels, then use a np.nanmedian(); looks like this:
fs, ivs = fitsio.read(fn, "FLUX"), fitsio.read(fn, "IVAR")
fs[ivs == 0] = np.nan
d["MEDFLUX_{}_AMPAB_BLUE".format(camera.upper())] = np.nanmedian(
fs[:, :500], axis=1
)
When directly comparing flux calibrated signal spectra, I think we should focus on a noise-weighted difference comparison, rather than a comparison of medians. e.g. median( (flux1 - flux2) / sqrt(err1^2+err2^2) ) rather than (median(flux1) - median(flux2)) / error for 500 pix. That should reduce the false positive rate from spectra that have a genuine significant slope/break in the overlap. The wavelength grids are aligns such that B/R share 51 pixels of overlap, and R/Z have 126 pixels. The downside is that it is fewer pixels. Regardless, @moustakas original method identified some obvious problems to investigate.
For sky spectra it is a different story, since the correct answer is supposed to be noise about a flat flux=0, so medians of ranges of pixels might be more valid (less susceptible to true signal details, since signal=0). Thanks @araichoor for posting the multi-night analysis. More to investigate...
Half of the examples from @moustakas's list and the prominent feature from @araichoor's plot come from z5 fibers 2675-2699. Looking at CCD data, there is a dark shadow from the saturated columns impacting many fibers. This CCD was replaced 2022-11-10, but unfortunately was used for almost 2 years. In the plot below, red are the fibers we are already masking, and cyan are additional problematic ones that aren't yet masked:
This isn't captured by the darks, presumably because it is a non-linear feature from saturated pixels so simply extrapolating from one exposure time to another for a feature that is variable anyway doesn't work.
Looking at the spectra, there is a clear offset and we could consider masking ~25 fibers (x-direction) for about half the wavelengths (y-direction). The white vertical band is the already masked fibers; the reddish excess to the right of that is unphysical negative flux offset.
The CCD feature is time-variable so we might put a custom mask night-by-night if we are trying to preserve some of these fibers. But yuck! Thanks to @julienguy for consultation on this.
@sbailey, if useful for jura:
I ve browsed the pdf files I posted above, and I noted the following "features":
# STRENGTH NIGHTMIN NIGHTMAX APPROX_FIBER AMPS COMMENT
small 20210514 ++ 4000-4175 b_ampcd_blue/b_ampab_red wiggles (cte?)
mild 20210204 20210224 3000-3175 z_ampcd_blue/z_ampab_red spike
mild 20211026 20211106 3000-3500 z_ampcd_blue/z_ampab_red offset
small 20211126 ++ 2000-2175 b_ampcd_blue/b_ampab_red wiggles (cte?)
small 20211203 20211212 0750-1000 z_ampab_blue/r_ampcd_red offset
strong 20211212 20211212 4500-5000 r_ampab_blue/b_ampcd_red+z_ampab_blue/r_ampcd_red spike
comments:
NIGHTMAX
.The following plot shows the offset in the counts in preprocessed images to the right of the bright columns of z5 for some random dark time exposures with about 1000s exp. time.
There is some variation of the offset from exposure to exposure. This is the reason why it's hard to fix this. I suggest we simply mask out more fibers. Currently we have BADCOLUMNFIBERS: 2663:2675
. I suggest we extend that to BADCOLUMNFIBERS: 2663:2692
, the upper limit being given by the Y1 LSS catalog mask.
( see https://data.desi.lbl.gov/desi/survey/catalogs/Y1/LSS/iron/unique_badfibers.txt )
Note the offset in the above figure is measured in CCD rows below the region used for spectroscopy. The effect is smaller in the CCD rows used for the spectral extractions.
The change has been committed to $DESI_SPECTRO_CALIB/spec/sm9/sm9-z.yaml
@julienguy thanks for investigating and picking the specific extended range of fibers to mask and committing that. I'm going to flag this as "done" for the purposes of Jura, but leave the ticket open in case we explore other cases (which could also spin off ot other dedicated tickets).
Cross-posted from https://github.com/desihub/redrock/issues/286 with additional information requested by @sbailey.
I measure the spectral break across cameras with this bit of code: https://github.com/moustakas/fastspecfit-projects/blob/586c9341cc745e90f6ac9036fc9ca1f088ba2c07/redrock-templates/stack-templates#L3688-L3819
TL;DR: I just measure the median and robust sigma of the pixel values in the last N pixels of the blue camera, the first and last N pixels of the red camera, and the first N pixels of the NIR camera, where I take
N=500
. Fancier methods are of course possible.The output catalog for the set of SV1 tiles I've been on is here:
/global/cfs/cdirs/desicollab/users/ioannis/fastspecfit/redrock-templates/stacks/powerlaw-vitiles-NMF-0.5b-zscan01.fits
I then measure the S/N of the
blue-red
andred-NIR
breaks like thisThe resulting scatter in the derived redshifts (relative to the "true" VI redshifts) vs S/N is:
Here, the redshift residuals are defined as
Selecting the ones with
dz>4e3
andS/N>20
(in either inter-camera break), I get 31 objects:Finally, here are four of these objects which I showed in my presentation on the data telecon today: