Skip to content

np.gradient can not be called with the current pythonnet API #1804

Closed
@henon

Description

@henon

I am reopening an issue which was previously demoted to a question but turns out to be a shortcoming of the pythonnet API. As the discussion #1772 shows, there is no way to successfully call the function numpy.gradient(f, *varargs, axis=None, edge_order=1) as documented here: https://numpy.org/doc/stable/reference/generated/numpy.gradient.html

Here is an example in python

>>> import numpy as np
>>> dx=4.0
>>> dy=5.0
>>> zX=[[1,2,3],[4,5,6],[8,9,0]]
>>> np.gradient(zX, dx, dy)
[array([[ 0.75 ,  0.75 ,  0.75 ],
       [ 0.875,  0.875, -0.375],
       [ 1.   ,  1.   , -1.5  ]]), array([[ 0.2,  0.2,  0.2],
       [ 0.2,  0.2,  0.2],
       [ 0.2, -0.8, -1.8]])]
>>>

Various ways to call the function have been tried in #1772 but none work. This should be considered a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions