-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
With numpy version > 2.4.0, spekpy leads to error:
File "<stdin>", line 1, in <module>
File "/home/hbaldau/Software/spekpy_release/spekpy/SpekPy.py", line 159, in __init__
self.set_state_parameters(kvp=kvp, th=th, dk=dk, physics=physics,
File "/home/hbaldau/Software/spekpy_release/spekpy/SpekPy.py", line 246, in set_state_parameters
self.spectrum_from_model()
File "/home/hbaldau/Software/spekpy_release/spekpy/SpekPy.py", line 326, in spectrum_from_model
self.model = SpekModel().get_spectrum_parameters(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hbaldau/Software/spekpy_release/spekpy/SpekModel.py", line 148, in get_spectrum_parameters
s = aniso.SpekAniso(kvp=E0,x=x,y=y,z=z,target=anode_material,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hbaldau/Software/spekpy_release/spekpy/SpekAniso.py", line 104, in __init__
self.anode_self_filtration_char, self.t_char = self.__Char()
^^^^^^^^^^^^^
File "/home/hbaldau/Software/spekpy_release/spekpy/SpekAniso.py", line 813, in __Char
x = arange(0,dmax+0.5*dx,dx)
^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: only 0-dimensional arrays can be converted to Python scalars
After investigation, we cannot do anything on our side, the problem has to be resolved by spekpy:
diff --git a/spekpy/SpekAniso.py b/spekpy/SpekAniso.py
index 649fa18..7b5cf61 100644
--- a/spekpy/SpekAniso.py
+++ b/spekpy/SpekAniso.py
@@ -804,6 +804,7 @@ class SpekAniso:
dmax = 20.*csda_range
# Define the escape thickness depending on transmission or reflection
+ dmax = dmax[0]
x = arange(0,dmax+0.5*dx,dx)
if self.trans:
x_escape = self.thick - arange(0,dmax+0.5*dx,dx)
@@ -922,7 +923,7 @@ class SpekAniso:
sin(abs(self.varphi))**-1 * cos(self.vartheta)**-1 )
# Characteristic freq. dist. per solid angle per keV, with the
# ... self-filtration removed (applied again outside this class)
- char_kx[i,:] = divide(char_kx[i,:],attn_factor,
+ char_kx[i,:] = divide(char_kx[i,:],attn_factor, out=None,
where=attn_factor>finfo(dtype='float64').resolution)
if self.shape == 'kqp' or self.shape == 'sim': Metadata
Metadata
Assignees
Labels
No labels