JuliaPy / JuliaPy/PyCall.jl

indexing using pycall get differs from python

Aperta
#234 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
1.5k
Fork
186
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I have read this:

Given o::PyObject, get(o, key) is equivalent to o[key] in Python, with automatic type conversion. To get as a PyObject without type conversion, do get(o, PyObject, key), or more generally get(o, SomeType, key). You can also supply a default value to use if the key is not found by get(o, key, default) or get(o, SomeType, key, default)

With this I successfully sliced a Python object ndarray in the first direction using:
image = get(image, PyObject, 5:70)
The problem is that I want to be able to do (in python) img[5:70, 5:200], use multiple arguments in brackets, but when typing
image = get(image, PyObject, 5:70, 5:200)
the second argument in seen as the default argument. So wouldn't it be nice to be able to give multiple arguments using get?

image = get(image, PyObject, (5:70, 5:200)) results in

LoadError: Only two or three spatial dimensions are permitted
while loading In[55], in expression starting on line 102
in call at /home/frank/.julia/v0.4/ImageView/src/display.jl:143
in view at /home/frank/.julia/v0.4/ImageView/src/display.jl:239
in obtainDataFromImages at In[55]:88
[inlined code] from In[55]:108
in anonymous at no file:0

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by tracing the PyCall get API described in the issue and reproduce multidimensional indexing against a Python ndarray. Compare separate slice arguments with the tuple form and determine how default arguments are currently distinguished. Done means multidimensional indexing works as requested, or the supported behavior is clarified with a regression test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
julia, python
Ambito
backend-api-design
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.