isce-framework / isce-framework/isce3
problem with isce3.cal.point_target_info.oversample
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 239
- Forks
- 90
- Avg merge
- 13d 1h
- Merged PRs (30d)
- 5
Description
isce3 version 0.13.0, installed from conda-forge
I find when apply oversample to an array, the original array will be changed.
A minimum test case:
from isce3.cal.point_target_info import oversample
import numpy as np
a = np.random.rand(10,10)+1j*np.random.rand(10,10)
a_copy = a.copy()
np.testing.assert_array_equal(a,a_copy) # it passed with no error
a_oversampled = oversample(a,nov=5)
np.testing.assert_array_equal(a,a_copy) # it failed
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In[38], line 1
----> 1 np.testing.assert_array_equal(a,a_copy)
[... skipping hidden 1 frame]
File /lustre/work/client/users/kangl/.conda/envs/gslc_13/lib/python3.11/contextlib.py:81, in ContextDecorator.__call__.<locals>.inner(*args, **kwds)
78 @wraps(func)
79 def inner(*args, **kwds):
80 with self._recreate_cm():
---> 81 return func(*args, **kwds)
File /lustre/work/client/users/kangl/.conda/envs/gslc_13/lib/python3.11/site-packages/numpy/testing/_private/utils.py:862, in assert_array_compare(comparison, x, y, err_msg, verbose, header, precision, equal_nan, equal_inf, strict)
858 err_msg += '\n' + '\n'.join(remarks)
859 msg = build_err_msg([ox, oy], err_msg,
860 verbose=verbose, header=header,
861 names=('x', 'y'), precision=precision)
--> 862 raise AssertionError(msg)
863 except ValueError:
864 import traceback
AssertionError:
Arrays are not equal
Mismatched elements: 99 / 100 (99%)
Max absolute difference: 0.60713429
Max relative difference: 0.64424912
x: array([[0.662784+0.404032j, 0.666327+0.449343j, 0.673974+0.373827j,
0.501126+0.900433j, 0.676094+0.160175j, 0.771293+0.304292j,
0.875867+0.731421j, 0.461425-0.130037j, 0.856009-0.075911j,...
y: array([[0.662784+0.404032j, 0.642459+0.482853j, 0.632233+0.440759j,
0.357471+0.9665j , 0.629393+0.294318j, 0.669114+0.489666j,
0.613705+0.962022j, 0.47772 +0.040072j, 0.815438+0.271247j,...
I suspect the problem is in
https://github.com/isce-framework/isce3/blob/cc62efcd7ef97b561bc56d451d63e406f804ecb7/python/packages/isce3/cal/point_target_info.py#L42-L47
The *= is in-place operator. It shouldn't be used here. But I haven't do any test on it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in python/packages/isce3/cal/point_target_info.py at the linked lines 42-47 and run the provided NumPy reproducer. Verify that oversample leaves its input array unchanged, then add or update coverage for this behavior and rerun the relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100