ndtatbristol / arim Goto Github PK
View Code? Open in Web Editor NEWA Python library for array imaging in ultrasonic testing.
License: MIT License
A Python library for array imaging in ultrasonic testing.
License: MIT License
Running a multifrequency immersion simulation on both Windows and Linux machines, the Windows one runs correctly but Linux results in the following error:
TypeError: ufunc '_model_amplitudes_with_scat_matrix' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
I've done a little digging around, it looks as though it's coming from the @numba.guvectorize
decorator for the _model_amplitudes_with_scat_matrix
function in model.py
. It takes (among other things) the tx and rx list as arguments, which are ndarrays of type int64
. The signature of the decorator currently specifies that tx
and rx
should be int32
s, and presumably is throwing the error because it can't cast between these types. A quick fix is to change / add to the signature allowing tx
and rx
to be int64
as well, so it reads:
@numba.guvectorize(
[
"void(int32[:], int32[:], complex128[:,:], complex128[:], complex128[:], float64[:], float64[:], float64[:], complex128[:])",
"void(int64[:], int64[:], complex128[:,:], complex128[:], complex128[:], float64[:], float64[:], float64[:], complex128[:])",
],
"(n),(n),(s,s),(e),(e),(e),(e),()->(n)",
nopython=True,
target="parallel",
)
def _model_amplitudes_with_scat_matrix( ...
I don't 100% know why it's happening as I'm working with a 64-element array so I would have thought the cast is valid. Might be something on my end in my setup where the Linux install is less flexible than the Windows one, or possibly a result from when we changed the default types from the numpy
ones to the python
ones. However as it's a single addition that resolves it, it might be worth adding.
python setup.py install
in admin promptimport arim
works in admin promptimport arim
hangs indefinitely in non-admin promptSame result with pip install .
. Workaround: pip install -e .
.
Ping @rltb
There's an IO module, it would be useful to have a MFMC handling code here.
There is a @numba:jit function which cannot be adaptable for 32 bit raspbian system (Linux) due to the 'parallel=True' option.
There are several places of this issue in the das.py script.
Traceback (most recent call last):
File "/home/pi/arim/arim-master/examples/contact_tfm.py", line 70, in <module>
tfm = arim.im.tfm.contact_tfm(frame, grid, speed)
File "/home/pi/.local/lib/python3.7/site-packages/arim/im/tfm.py", line 331, in contact_tfm
res = das.delay_and_sum(frame, focal_law, **kwargs_delay_and_sum)
File "/home/pi/.local/lib/python3.7/site-packages/arim/im/das.py", line 940, in delay_and_sum
return delay_and_sum_numba_noamp(frame, focal_law, *args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/arim/im/das.py", line 463, in delay_and_sum_numba_noamp
result
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/dispatcher.py", line 487, in _compile_for_args
raise e
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/dispatcher.py", line 420, in _compile_for_args
return_val = self.compile(tuple(argtypes))
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/dispatcher.py", line 965, in compile
cres = self._compiler.compile(args, return_type)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/dispatcher.py", line 125, in compile
status, retval = self._compile_cached(args, return_type)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/dispatcher.py", line 139, in _compile_cached
retval = self._compile_core(args, return_type)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/dispatcher.py", line 157, in _compile_core
pipeline_class=self.pipeline_class)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/compiler.py", line 716, in compile_extra
return pipeline.compile_extra(func)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/compiler.py", line 452, in compile_extra
return self._compile_bytecode()
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/compiler.py", line 520, in _compile_bytecode
return self._compile_core()
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/compiler.py", line 499, in _compile_core
raise e
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/compiler.py", line 486, in _compile_core
pm.run(self.state)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/compiler_machinery.py", line 368, in run
raise patched_exception
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/compiler_machinery.py", line 356, in run
self._runPass(idx, pass_inst, state)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock
return func(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/compiler_machinery.py", line 311, in _runPass
mutated |= check(pss.run_pass, internal_state)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/compiler_machinery.py", line 273, in check
mangled = func(compiler_state)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/typed_passes.py", line 394, in run_pass
lower.lower()
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/lowering.py", line 168, in lower
self.lower_normal_function(self.fndesc)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/lowering.py", line 222, in lower_normal_function
entry_block_tail = self.lower_function_body()
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/lowering.py", line 251, in lower_function_body
self.lower_block(block)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/lowering.py", line 265, in lower_block
self.lower_inst(inst)
File "/home/pi/.local/lib/python3.7/site-packages/numba/core/lowering.py", line 567, in lower_inst
func(self, inst)
File "/home/pi/.local/lib/python3.7/site-packages/numba/parfors/parfor_lowering.py", line 58, in _lower_parfor_parallel
ensure_parallel_support()
File "/home/pi/.local/lib/python3.7/site-packages/numba/parfors/parfor.py", line 5016, in ensure_parallel_support
raise errors.UnsupportedParforsError(msg)
numba.core.errors.UnsupportedParforsError: Failed in nopython mode pipeline (step: native lowering)
The 'parallel' target is not currently supported on 32 bit hardware.
�[0m
�[0m�[1mDuring: lowering "id=0[LoopNest(index_variable = parfor_index.22, range = (0, $numpoints.27, 1))]{130: <ir.Block at /home/pi/.local/lib/python3.7/site-packages/arim/im/das.py (497)>, 164: <ir.Block at /home/pi/.local/lib/python3.7/site-packages/arim/im/das.py (497)>, 36: <ir.Block at /home/pi/.local/lib/python3.7/site-packages/arim/im/das.py (485)>, 112: <ir.Block at /home/pi/.local/lib/python3.7/site-packages/arim/im/das.py (494)>, 148: <ir.Block at /home/pi/.local/lib/python3.7/site-packages/arim/im/das.py (488)>, 52: <ir.Block at /home/pi/.local/lib/python3.7/site-packages/arim/im/das.py (488)>, 54: <ir.Block at /home/pi/.local/lib/python3.7/site-packages/arim/im/das.py (488)>, 120: <ir.Block at /home/pi/.local/lib/python3.7/site-packages/arim/im/das.py (495)>}Var(parfor_index.22, das.py:485)" at /home/pi/.local/lib/python3.7/site-packages/arim/im/das.py (485)�[0m
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.