Hi guys !
Thanks to the forum I managed to work on optimizing my python code which is now pretty fast in regards to what it was before.
My only concern is that now I’m trying to optimize another part of it but I’m being a bit lost.
I don’t understand if it is a problem due to numba not implementing a certain part of the where function or something that has to do with my code.
Thank you very much if you can help me sort out what’s the issue and how I can get over it !
Being still quite new to python/numba, I tried to look for infos on the internet but didn’t find anything that could be helpful…
Best regards,
Damien
What I am trying to do:
a, b, c= where((voxelNormalized >= threshold) & (mask))
The parameters (theoretically):
voxelNormalized: NumpyArray[0:82][0:512][0:512] # Array that contains an array that contains an array itself (float values).
threshold: float # fixed value
mask: NumpyArray[0:82][0:512][0:512] # boolean values
The error:
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<intrinsic length_of_iterator>) found for signature:
>>> length_of_iterator(zip(iter(array(int64, 1d, C)), iter(array(int64, 1d, C)), iter(array(int64, 1d, C))))
There are 2 candidate implementations:
- Of which 2 did not match due to:
Intrinsic in function 'length_of_iterator': File: numba\cpython\rangeobj.py: Line 181.
With argument(s): '(zip(iter(array(int64, 1d, C)), iter(array(int64, 1d, C)), iter(array(int64, 1d, C))))':
Rejected as the implementation raised a specific error:
TypingError: Unsupported iterator found in array comprehension, try preallocating the array and filling manually.
raised from C:\Python310\lib\site-packages\numba\cpython\rangeobj.py:235
During: resolving callee type: Function(<intrinsic length_of_iterator>)
During: typing of call at my_numbaUtils.py (41)
File "services\numbaUtils.py", line 41:
def getSpotsNucleus(nucleusId, threshold, maskNucleus, voxelNormalized, frameId, penality):
spotZ, spotX, spotY = where((voxelNormalized >= threshold) & (maskNucleus))
^
During: resolving callee type: type(CPUDispatcher(<function getSpotsNucleus at 0x0000029DBD4CCC10>))
During: typing of call at my_numbaUtils.py (69)
During: resolving callee type: type(CPUDispatcher(<function getSpotsNucleus at 0x0000029DBD4CCC10>))
During: typing of call at my_numbaUtils.py (69)
During: resolving callee type: type(CPUDispatcher(<function getSpotsNucleus at 0x0000029DBD4CCC10>))
During: typing of call at my_numbaUtils.py (69)