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

Draft: Update interpolate.py #131

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

adrabent
Copy link
Collaborator

@adrabent adrabent commented Jul 4, 2022

Current runs with recent numpy cause the following error:

/usr/local/lib/python3.8/dist-packages/losoto/operations/interpolate.py:149: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you m 
ust specify 'dtype=object' when creating the ndarray. 
  new_vals[selection] = np.interp(new_axisvals, orig_axisvals[unflagged], 
Traceback (most recent call last): 
  File "/usr/local/bin/losoto", line 154, in <module> 
    returncode += ops[ op ]._run_parser( soltab, parser, step ) 
  File "/usr/local/lib/python3.8/dist-packages/losoto/operations/interpolate.py", line 18, in _run_parser 
    return run( soltab, outSoltab, axisToRegrid, newDelta, delta, maxFlaggedWidth, log) 
  File "/usr/local/lib/python3.8/dist-packages/losoto/operations/interpolate.py", line 149, in run 
    new_vals[selection] = np.interp(new_axisvals, orig_axisvals[unflagged], 
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

This branch aims for fixing it.

@adrabent
Copy link
Collaborator Author

adrabent commented Jul 4, 2022

Please DO NOT merge the branch yet. Changes need testing.

@tikk3r
Copy link
Contributor

tikk3r commented Oct 20, 2022

Is there any update/progress on this? I'm running into the same issue now as well since we made our containers up-to-date.

I missed this pull request, so I made my own fix by casting selection to a tuple before slicing with it: tikk3r@d9c41de This seems to work for me, but then I noticed this open pull request. I can't find it clearly in the official NumPy release notes or documentation, but according to this post it does have to do something with tuples vs lists as indices.

It would be great if one of the fixes could make it into master soon.

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

Successfully merging this pull request may close these issues.

2 participants