romanisim.models#328
Conversation
…ile read in models.bandpass
… test_image, test_l1 unit tests
…bandpass to make it also compatible with SOC naming convention.
…arameters, wcs, psf, bandpass) with romanisim.models.(parameters, wcs, psf, bandpass)
|
Re
I'm going to start a thread with Rob Zellem about whether he wants to make roman-technical-information pip installable. If he doesn't, I'm going to propose that we just put a fixed version roman-technical-information in romanisim and update it periodically with romanisim releases. Presumably we could also support in romanisim getting data from a non-default roman-technical-information if an environment variable were set? Do you think that would be a good approach? |
Hi Eddie, this sounds good to me. I was using try except blocks for reading files from roman-technical-information so in principle it should run even the path is not valid. But it seems the build tests still complain. |
…eption. Add this try except block to models.bandpass
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #328 +/- ##
==========================================
- Coverage 89.63% 85.00% -4.63%
==========================================
Files 17 32 +15
Lines 2633 3615 +982
==========================================
+ Hits 2360 3073 +713
- Misses 273 542 +269 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I had a conversation with Rob Zellem, Eric Switzer, and Josh Schlieder about the roman-technical-information repo. They agreed that we should make it pip-installable. But they also thought that in order to avoid delaying this PR, we could put a copy of roman-technical-information in romanisim temporarily. I think the way that I would do this would be to introduce (sorry, you may already do this, I haven't actually reviewed!) a function that gives the roman-technical-information directory. It would look for it in an environment variable and fall back to something like romanisim/data/roman-technical-information if not present. Then when roman-technical-information becomes pip installable, you would update that function to instead point to roman-technical-information/data instead with no other changes? They're aiming for pip installability this build but not immediately. Does that make sense for this PR? |
Yes, I think that makes perfect sense. I'll proceed by including a temporary copy of roman-technical-information along with the helper function. I'll also try fixing the errors in the documents that are reported by doctest, not so familiar with this :) Thanks for the context from the discussion. Great it will be pip-installable. |
|
Oh, yeah, we hadn't been using doctests in this code base, so you're introducing the first ones and presumably that leads to issues. There's probably a way to turn off doctests; feel free to do that if resolving the infrastructural issues proves challenging. |
schlafly
left a comment
There was a problem hiding this comment.
Hi Yuedong,
This was a ton of work! Thanks.
I left a few comments in line that we should discuss. Broadly:
- we should think about how the current parameter defaults in parameters.reference_data interact with the new defaults
- it probably makes sense to move some of the logic for grabbing a reference file using either default information or the image model to a separate routine? It looks very similar among the different models.
- is there any documentation on the new data files added in this PR? I'm okay with adding them but I know that I personally can't maintain them; I don't really know where they come from, etc.. Some mixture of documentation & agreement that you're on the hook to maintain those at some level would be appreciated. On the flip side, we're on the hook to make sure we can do releases when you need them for your sims?
- Special treatment of persistence relative to other instrumental effects is because that one needs more than just a reference file?
| reference_data = { | ||
| "dark": 0.01, # electron/s | ||
| "darkdecaysignal": None, | ||
| "distortion": None, | ||
| "flat": None, | ||
| "gain": 2, # electron/DN | ||
| "inverselinearity": None, | ||
| "linearity": None, | ||
| "integralnonlinearity": None, | ||
| "readnoise": 5.0, # DN | ||
| "saturation": 55000, # DN | ||
| "ipc": None, | ||
| } |
There was a problem hiding this comment.
How much of this do you think we should keep vs. how much duplicates stuff you have elsewhere now?
There was a problem hiding this comment.
The duplication default values for dark, gain, and read_noise have been removed. There're still default coefficients for nonlinearity and the IPC kernel defined in the corresponding modules. Since these are not single scalar values, I don't think they naturally fit in the reference_data dict.
There was a problem hiding this comment.
The old approach would have been to leave them in parameters.py, just not in the reference_data dictionary. That's where ipc_kernel used to be. That has the mild advantage of letting people overwrite via a config file. OTOH pushing it into the models has the advantage of putting the definitions closer to where they're used. Basically this is fine, thanks.
| @@ -0,0 +1,508 @@ | |||
| import importlib.resources | |||
There was a problem hiding this comment.
I'm trying to decide how we conceptually separate romanisim.models.psf and romanisim.models.psf_utils. One approach would be to leave psf.py in the higher directory as "romanisim's special PSF wrapper" and leave this here as "the implementation of the PSF from galsim + technical repo" (though if that made sense we should try to put the zernickes in the technical repo?). I'm open to other thoughts here.
There was a problem hiding this comment.
I moved the romanisim.models.psf up to romanisim.psf. I'd support the idea of putting those zernicke coefficient files in the technical repo.
|
|
||
| # # m = resultants >= saturation | ||
| # # dq[m] |= parameters.dqbits['saturated'] | ||
| # # return resultants, dq |
There was a problem hiding this comment.
I had included this as an optional flag. I guess excluding it makes sense because the apply(...) interface only expects one image?
There was a problem hiding this comment.
I think that makes sense. If needed, we could implement a separate method in these modules, something like apply_dq().
Hi Eddie, Thanks for the careful review and helpful comments! I'll work through your inline comments shortly. Regarding your general points:
|
…ommit 229bd3c git-subtree-dir: romanisim/data/roman-technical-information git-subtree-split: 229bd3ccc23e1a37fba76b62ed537a24d31f2e13
|
Hi @schlafly , do you think there are any additional changes I should make to this branch before merging to main? Also, would it be okay for me to start removing |
…ct for an typo in the docstring in romanisim.models.bandpass
…/romanisim into combine_galsim_roman
…el as an input. Correspondingly updated the implementations in tests (test_l1 and test_linear).
… backward compatibility in romanisim.models.nonlinearity for the functions repair_coefficients and evaluate_nl_polynomial. Note that romanisim.nonlinearity.NL is deprecated and is replaced by romanisim.models.nonlinearity.Nonlinearity.
…the default per SCA throughputs (now the defaults point to roman-tech-info local copy)
for more information, see https://pre-commit.ci
…/romanisim into combine_galsim_roman
This PR integrates the
galsim.romanfunctionality intoromanisimand enables direct access to both CRDS and the Roman Technical Information repository:romanisim.modelsgalsim.romancalls throughout:romanisimcodebase, executables, and unit tests.Current status:
models.bandpassandmodels.backgroundcalls are reverted to the originalgalsim.romanimplementations.TODO (near term):
roman-technical-informationrepository.romanisim.modelsromanisim.models.flat