Loading pkgs/development/python-modules/tess/default.nix +12 −8 Original line number Diff line number Diff line { lib, buildPythonPackage, fetchPypi, cython, setuptools, fetchPypi, lib, numpy, scipy, pytestCheckHook, python, scipy, setuptools, }: buildPythonPackage rec { buildPythonPackage (finalAttrs: { pname = "tess"; version = "0.3.1"; pyproject = true; src = fetchPypi { inherit pname version; inherit (finalAttrs) pname version; hash = "sha256-5Ic06+K7CWRh1t2v3aJ5JlBACvHXqQyYzvU71jZJFtI="; }; Loading @@ -30,6 +30,10 @@ buildPythonPackage rec { scipy ]; # scipy has depecrated since version 1.15.0 the function `sph_harm`, and has # been removed in 1.17.0 in favor of `sph_harm_y` patches = [ ./scipy_sph_harm.patch ]; pythonImportsCheck = [ "tess" ]; nativeCheckInputs = [ pytestCheckHook ]; Loading @@ -44,6 +48,6 @@ buildPythonPackage rec { description = "Module for calculating and analyzing Voronoi tessellations"; homepage = "https://tess.readthedocs.org"; license = lib.licenses.bsd3; maintainers = [ ]; maintainers = with lib.maintainers; [ drawbu ]; }; } }) pkgs/development/python-modules/tess/scipy_sph_harm.patch 0 → 100644 +20 −0 Original line number Diff line number Diff line diff --git a/tess/__init__.py b/tess/__init__.py index b7f8f80..91c518f 100644 --- a/tess/__init__.py +++ b/tess/__init__.py @@ -374,13 +374,13 @@ def orderQ(l, xyz, weights=1): :math:`w_i` are the `weights`, defaulting to uniform: (:math:`\frac{1}{N_b}`) """ import numpy as np - from scipy.special import sph_harm + from scipy.special import sph_harm_y theta, phi = cart_to_spher(xyz).T weights = np.ones(xyz.shape[0]) * weights weights /= np.sum(weights) mmeans = np.zeros(2 * l + 1, dtype=float) for m in range(-l, l + 1): - sph_weighted = sph_harm(m, l, phi, theta).dot(weights) # Average of Y_{6m} + sph_weighted = sph_harm_y(l, m, theta, phi).dot(weights) # Average of Y_{6m} mmeans[m] = abs(sph_weighted) ** 2 return np.sqrt(4 * np.pi / (2 * l + 1) * np.sum(mmeans)) Loading
pkgs/development/python-modules/tess/default.nix +12 −8 Original line number Diff line number Diff line { lib, buildPythonPackage, fetchPypi, cython, setuptools, fetchPypi, lib, numpy, scipy, pytestCheckHook, python, scipy, setuptools, }: buildPythonPackage rec { buildPythonPackage (finalAttrs: { pname = "tess"; version = "0.3.1"; pyproject = true; src = fetchPypi { inherit pname version; inherit (finalAttrs) pname version; hash = "sha256-5Ic06+K7CWRh1t2v3aJ5JlBACvHXqQyYzvU71jZJFtI="; }; Loading @@ -30,6 +30,10 @@ buildPythonPackage rec { scipy ]; # scipy has depecrated since version 1.15.0 the function `sph_harm`, and has # been removed in 1.17.0 in favor of `sph_harm_y` patches = [ ./scipy_sph_harm.patch ]; pythonImportsCheck = [ "tess" ]; nativeCheckInputs = [ pytestCheckHook ]; Loading @@ -44,6 +48,6 @@ buildPythonPackage rec { description = "Module for calculating and analyzing Voronoi tessellations"; homepage = "https://tess.readthedocs.org"; license = lib.licenses.bsd3; maintainers = [ ]; maintainers = with lib.maintainers; [ drawbu ]; }; } })
pkgs/development/python-modules/tess/scipy_sph_harm.patch 0 → 100644 +20 −0 Original line number Diff line number Diff line diff --git a/tess/__init__.py b/tess/__init__.py index b7f8f80..91c518f 100644 --- a/tess/__init__.py +++ b/tess/__init__.py @@ -374,13 +374,13 @@ def orderQ(l, xyz, weights=1): :math:`w_i` are the `weights`, defaulting to uniform: (:math:`\frac{1}{N_b}`) """ import numpy as np - from scipy.special import sph_harm + from scipy.special import sph_harm_y theta, phi = cart_to_spher(xyz).T weights = np.ones(xyz.shape[0]) * weights weights /= np.sum(weights) mmeans = np.zeros(2 * l + 1, dtype=float) for m in range(-l, l + 1): - sph_weighted = sph_harm(m, l, phi, theta).dot(weights) # Average of Y_{6m} + sph_weighted = sph_harm_y(l, m, theta, phi).dot(weights) # Average of Y_{6m} mmeans[m] = abs(sph_weighted) ** 2 return np.sqrt(4 * np.pi / (2 * l + 1) * np.sum(mmeans))