-
Notifications
You must be signed in to change notification settings - Fork 174
replace check_memory_allocation in resample # 8000 8324
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
Conversation
|
||
allowed_memory = kwargs['allowed_memory'] | ||
if allowed_memory is None: | ||
allowed_memory = os.environ.get('DMODEL_ALLOWED_MEMORY', allowed_memory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this is the only use of this variable in the code.
There is one test that uses it:
jwst/jwst/regtest/test_fgs_guider.py
Line 46 in e121595
monkeypatch.setenv('DMODEL_ALLOWED_MEMORY', "0.9") |
Perhaps this should be deprecated/removed and it's usage replaced? Is there a way to provide this parameter to calwebb_image3
without using an environment variable?
If it is kept, renaming it might be considered.
Regression tests show 1 unrelated error: |
This looks good. |
b55d127
to
517403e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed t 8000 o describe this comment to others. Learn more.
LGTM
Great idea! I will take a look and open an stcal issue. What about something like the following?
|
@braingram The plan sounds good. |
This PR repaces
check_memory_allocation
inresample
.The replaced function allocates a large array, then measures the size of the array to determine if it's safe to allocate an array of that size. See spacetelescope/stdatamodels#272 for more details.
The replacement instead allocates a small (1x1) array to get the expected dtype then computes the expected size of the upcoming array allocation.
Checklist for maintainers
CHANGES.rst
within the relevant release sectionHow to run regression tests on a PR