-
Notifications
You must be signed in to change notification settings - Fork 22
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
Streamline specsim-quickgen interaction #89
Comments
There are four types of information flowing from specsim to quickgen:
Quickgen also adds Gaussian noise to the specim-calculated means, but I would rather do this in specsim (e.g., for consistency between quickgen and quickbrick). See desihub/specsim#3. |
On the issue of wavelength grids, we had some discussion in #86 and desihub/desimodel#7 is very relevant. The coverage of each camera is implicitly specified by two arrays, throughput and resolution, and explicitly by header keywords Specsim works with two different ranges for each camera: the physical extent of active pixels ( Here are the numbers, for reference:
Note that the Note also that the throughput limits are sometimes used in
However, the simulation should never actually need to use wavelengths outside of the tighter "Response" values above, since wavelengths outside this range can never disperse into the CCD, even if they have non-zero throughput. The simulation wavelength is currently specified (in
The limits could be tightened to the response range above, 3565.0 - 9838.0, without changing the simulation results. However, there are two practical considerations:
Simspec currently uses 3533.0 - 9913.0 so this is effectively now determining the minimum simulation wavelength limits used by Questions:
|
The wavelength grid for downsampled results in each camera is currently determined by (1) the global The current scheme is fragile since you might reasonably use a finer simulation grid but that then redefines each camera's output grid. The output grid cannot be specified completely independently, since we want to downsample rather than resample, but a more robust parameterization would be to specify an My concrete proposal is to replace the |
@sbailey On second thought, shouldn't specsim output physical pixels in each camera, calculated from |
I am proceeding with the original integer downsampling scheme (with per-camera I propose to define the canonical simulation range as 3550 - 9850A. This fits within the throughput ranged used by simspec (3533 - 9913A), has enough padding beyond the 5-sigma response range (3565 - 9839A) to allow resolution model fiddling, and is nicely rounded for plotting, etc. |
I just noticed that |
Wavelength gridFor most uses of specsim, having the final output grid match the grid that we would extract (e.g. 0.5 A) would be most useful. If using specsim to propagate photons for pixel sims, then we'd use a much finer grid (smaller than CCD pixels). I don't see a need for simulating on exactly the grid of the CCD pixels. i.e. the 3533 - 9913 covers the maximal range seen by any fibers (no single fiber sees that entire range). The median range is 3561 - 9893 so I'd suggest a default simspec range of 3550 - 9900. NoiseSky should have some noise, since it will be measured from interpolating O(40) sky fibers. One could imagine some physical modeling or smoothing to minimize the noise, but it won't be perfect. The current code includes a factor of 25 fibers (quickgen line 292), which is semi-realistic since not all 40 sky fibers will contribute to the sky model for every science fiber. object frame vs. cframe : I think you mean the uncalibrated frame vs. the calibrated cframe? It would be more accurate to have them use calibrated/scaled versions of the same noise realization instead of completely different realizations. Flux calibration and sky subtraction will add additional noise that somewhat breaks that equivalence. In practice that hasn't mattered in the past since we've used quickgen runs for either frame or cframe outputs, but not for using them together. But it would be good to fix this as part of the quickgen/specsim cleanup. |
I assume you are referring to throughput here, since that is the range of the throughput vector in desimodel:
Is this vector actually the max envelope of the individual fiber throughputs? Specsim does not model variations of throughput, pixel size, etc, across the focal plane so the simulation range should be chosen for typical / median fiber. If we want to account for this variation in future, a next step could be to create configs Even if the median filter has non-zero throughput up to 9893A, the simulated z-CCD only extends up to 9834A. So flux above ~9838A will never contributed to the simulated output. I am happy to use your proposed 3550 - 9900A but just want to be sure we agree that increasing from 9850 to 9900A will give identical results (with arrays padded by 500 extra zeros). |
The attached plot shows the minimum and maximum wavelength coverage vs. fiber number:
The limiting factor in the min/max is the light actually going off the edge of the CCD, not some throughput coefficient going to 0. It is not a coincidence that the throughput model covers 3533-9913 A, i.e. the maximum possible range. psf-quicksim covers 3569 - 9834A, which was chosen as the worst case scenario — every fiber sees at least that range. My proposal to have specsim to cover the median fiber case of 3550 - 9900A only makes sense if we update psf-quicksim to also cover that range. It might be better to keep the current more conservative range so that analyses don't use specsim for the median case thinking that it applies to all fibers. For the record, the plot was made with desimodel 0.4.2.dev32 and:
|
@sbailey This is illuminating! Are there expected throughput variations vs fiber number, or is falling off the CCD the main fiber-dependent effect? I will stick with 3550 - 9850A for the current config, to accompany the current psf-quicksim, etc, but we can revisit this later by changing the baseline and/or create alternate configs for specific extreme fibers. If we ever do decide to simulate a fiber that reaches either limit (3353, 9913) we would need to extend the tabulated throughput slightly (~5A) to model photons that disperse across this edge, with a corresponding extension of the simspec coverage. |
There will be random variations in the fiber throughput due to manufacturing, but it isn't a function of fiber number. Effects that are predictable:
We should be careful about feature creep for specsim — the original idea of quicksim was to be "good enough" for a "typical fiber". Adding some level of variation for different fibers could be good, but at some point is can also be ok to just say that the desired level of fidelity is beyond the scope of this particular simulation tool. |
I agree about the feature creep and that specsim is only aiming to be good enough for a typical / worst case fiber. There are some open issues to introduce some of these focal-plane variations, but we should be guided by how important the effects are and how easy they are to implement before tackling any of them. |
The next question is how to calculate the perfectly calibrated flux in each camera. Currently quickgen and quickbrick approach this quite differently:
where:
The quickbrick method makes more sense to me, as being closer to how we actually calibrate flux, so I propose to have quickgen use the same method. (Neither of these corresponds to the decorrelated flux calculated by spectroperfectionism, but that's an issue for another day.) |
agreed |
The per-camera frame noise added by quickgen is more problematic since it samples the coadded ivar, so does not blow up as the camera throughput goes to zero. I am fixing this now. |
What should we use for the downsampled resolution matrix?
Both programs should use the same resolution matrix, but which one? |
I decided to use the |
Quickgen's use of specsim is quite convoluted and exposes a lot of specsim implementation details because specsim does not provide convenient access to the information it needs (see for example desihub/specsim#17 and desihub/specsim#18). This issue is to review this interaction and make changes to specsim and quickgen to reduce the coupling and generally make quickgen more maintainable.
The text was updated successfully, but these errors were encountered: