Skip to content
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

Use context array for exposure time calculation #1384

Closed
braingram opened this issue Aug 26, 2024 · 6 comments
Closed

Use context array for exposure time calculation #1384

braingram opened this issue Aug 26, 2024 · 6 comments

Comments

@braingram
Copy link
Collaborator

#959 improved the level 3 exposure time calculation by adding an additional resampling step.

Although I don't yet fully understand the details I have a hunch the context array (generated during the science data resampling) would be sufficient to perform the calculation.

@schlafly
Copy link
Collaborator

I agree that there's a similar approach that is something like:

total_exptime = 0
for i in range(metas):
    total_exptime += (context & 2**i) * metas[i]['exptime']

that would save a drizzle. That's a good idea.

More broadly I have the impression that there is a large amount of repeated computations among the different drizzles---drizzling the data and various variances, which all have the same kernels and WCSes. I feel like there's another win there if we could tell drizzle "drizzle all of the following arrays in the same way."

@schlafly
Copy link
Collaborator

Oh, a subtlety here is that for small pixfrac and large oversampling some input pixels won't touch some output pixels. We use pixfrac = 1 here to avoid that issue: https://github.com/spacetelescope/romancal/pull/959/files#diff-f87241f9a890ac31d6813379a09b6eb7e1052e3ab53039449a8f0df91aa030e1R453
Conceptually we want these exposure times to indicate "how long was this bit of the sky being observed by Roman" and not "given our choice of resampling and oversampling parameters, how many seconds did input pixels contribute to this output pixel." So there may be something to worry about there for replacements of this kind, presuming that the context image does really track "this input image actually touched this output pixel given the kernel."

@braingram
Copy link
Collaborator Author

braingram commented Aug 27, 2024

Doesn't hard-coding pixfrac mean that the calculated exposure times won't match the actual exposure times for the mosaic if a non-1.0 pixfrac is used for resampling?

@schlafly
Copy link
Collaborator

It depends on what is meant by the "actual exposure time." For these values we want the meaning of that quantity to be "how much time did Roman spend pointed at this part of the sky."

i.e., we want the metadata to support people asking questions like "give me the parts of the sky where Roman has spent the most time looking." We don't want it to exclude regions because we chose to process them with a different pixfrac / oversampling which means that fewer input pixels contribute to each output pixel, when ultimately the same total depths & sensitivities are possible.

@braingram
Copy link
Collaborator Author

Thanks for the clarification!

Given that information I don't think the context array will work. I'll close this issue but as you noted consolidating the resampling should make the extra resampling of the exposure time less costly.

@schlafly
Copy link
Collaborator

Sounds good. FWIW, the exposure time calculations could still be sped up---e.g., don't really care about the details of the boundaries and would be satisfied filling everything between the corners with a constant, for example, so it's still the case that drizzling is overkill. But I didn't want to write and test custom code here when I could "just" do another drizzle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants