diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d60c50a..bd51afb 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 diff --git a/postpic/datahandling.py b/postpic/datahandling.py index 6d63a53..e8f05d8 100644 --- a/postpic/datahandling.py +++ b/postpic/datahandling.py @@ -794,6 +794,7 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ats = self.axes_transform_state[:] tao = self.transformed_axes_origins[:] reduceaxis = kwargs.get('axis', 0) + reduceaxis = range(len(axes)) if reduceaxis is None else reduceaxis if not isinstance(reduceaxis, Iterable): reduceaxis = (reduceaxis,) for axis in reversed(sorted(set(reduceaxis))): @@ -1742,7 +1743,7 @@ def _integrate_constant(self, axes): def _integrate_scipy(self, axes, method): ret = copy.copy(self) for axis in reversed(sorted(axes)): - ret._matrix = method(ret, ret.axes[axis].grid, axis=axis) + ret._matrix = method(ret, x=ret.axes[axis].grid, axis=axis) del ret.axes[axis] del ret.axes_transform_state[axis] del ret.transformed_axes_origins[axis] @@ -1787,7 +1788,7 @@ def _integrate_fast(self, axes): return ret - def integrate(self, axes=None, method=scipy.integrate.simps): + def integrate(self, axes=None, method=scipy.integrate.simpson): ''' Calculates the definite integral along the given axes. diff --git a/postpic/datareader/dummy.py b/postpic/datareader/dummy.py index c2789b0..61a91e6 100644 --- a/postpic/datareader/dummy.py +++ b/postpic/datareader/dummy.py @@ -132,7 +132,7 @@ def simgridpoints(self, axis): def simextent(self, axis): g = self.grid(None, axis) - return np.asfarray([g[0], g[-1]]) + return np.asarray([g[0], g[-1]], dtype=np.float64) def gridnode(self, key, axis): ''' diff --git a/postpic/helper.py b/postpic/helper.py index 55ff655..aa5141f 100644 --- a/postpic/helper.py +++ b/postpic/helper.py @@ -946,7 +946,7 @@ def _linear_phase(field, dx, phi0=0.0): # calculate linear phase # arg = sum([dx[i]*mesh[i] for i in dx.keys()]) - arg_expr = '+'.join('({}*k{})'.format(repr(v), i) for i, v in dx.items()) + arg_expr = '+'.join('({:}*k{})'.format(v, i) for i, v in dx.items()) if transform_state is True: exp_ikdx_expr = 'exp(1j * ({arg} + phi0))'.format(arg=arg_expr) @@ -1039,7 +1039,7 @@ def _kspace_propagate_generator(kspace, dt, moving_window_vect=None, raise ValueError("Argument moving_window_vect has the wrong length. " "Please make sure that len(moving_window_vect) == kspace.dimensions.") - moving_window_vect = np.asfarray(moving_window_vect) + moving_window_vect = np.asarray(moving_window_vect, dtype=np.float64) moving_window_vect /= npl.norm(moving_window_vect) moving_window_dict = dict(enumerate([dz*x for x in moving_window_vect])) @@ -1057,7 +1057,7 @@ def _kspace_propagate_generator(kspace, dt, moving_window_vect=None, # m = kspace.matrix.copy() # m[sum(k*dx for k, dx in zip(kspace.meshgrid(), moving_window_vect)) < 0.0] = 0.0 # kspace = kspace.replace_data(m) - arg_expr = '+'.join('({}*k{})'.format(repr(v), i) + arg_expr = '+'.join('({:}*k{})'.format(v, i) for i, v in enumerate(moving_window_vect)) numexpr_vars = dict(kspace=kspace) diff --git a/test/test_datahandling.py b/test/test_datahandling.py index e0428a9..bbdb25b 100755 --- a/test/test_datahandling.py +++ b/test/test_datahandling.py @@ -612,8 +612,8 @@ def test_integrate(self): print('type(a.matrix)', type(a.matrix)) self.assertTrue(np.isclose(a, b)) - b = self.f2d_fine.integrate(method=scipy.integrate.simps) - c = self.f2d_fine.integrate(method=scipy.integrate.trapz) + b = self.f2d_fine.integrate(method=scipy.integrate.simpson) + c = self.f2d_fine.integrate(method=scipy.integrate.trapezoid) self.assertTrue(np.isclose(b, 0)) self.assertTrue(np.isclose(c, 0))