From 86e5605714ce092961af7decf34bd73d55af988c Mon Sep 17 00:00:00 2001 From: Hugo Karas Date: Wed, 4 Oct 2023 15:40:55 +0200 Subject: [PATCH 1/6] Fixing Sophgrid bug --- deerlab/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deerlab/utils.py b/deerlab/utils.py index 5079bd5b..3b7f69d1 100644 --- a/deerlab/utils.py +++ b/deerlab/utils.py @@ -833,7 +833,7 @@ def sophegrid(octants,maxphi,size): weights = np.zeros(nOrientations) sindth2 = np.sin(dtheta/2) - w1 = 0.5 + w1 = 1.0 # North pole (z orientation) phi[0] = 0 @@ -841,7 +841,7 @@ def sophegrid(octants,maxphi,size): weights[0] = maxphi*(1 - np.cos(dtheta/2)) # All but equatorial slice - Start = 2 + Start = 1 for iSlice in np.arange(2,size): nPhi = nOct*(iSlice-1) + 1 dPhi = maxphi/(nPhi - 1) @@ -854,13 +854,13 @@ def sophegrid(octants,maxphi,size): # Equatorial slice nPhi = nOct*(size - 1) + 1 dPhi = maxphi/(nPhi - 1) - idx = Start + (np.arange(0,nPhi) - 1) + idx = Start + np.arange(0,nPhi) phi[idx] = np.linspace(0,maxphi,nPhi) theta[idx] = np.pi/2 weights[idx] = sindth2*dPhi*np.concatenate([[w1], np.ones(nPhi-2), [0.5]]) # Border removal - rmv = np.cumsum(nOct*np.arange(1,size-1)+1)+1 + rmv = np.cumsum(nOct*np.arange(1,size)+1) phi = np.delete(phi,rmv) theta = np.delete(theta,rmv) weights = np.delete(weights,rmv) From 034fc8262d5a3ba53eb21025226020a7edf666fd Mon Sep 17 00:00:00 2001 From: Hugo Karas Date: Thu, 5 Oct 2023 08:13:45 +0200 Subject: [PATCH 2/6] Add unit test for sophgrid --- test/test_utils.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/test_utils.py diff --git a/test/test_utils.py b/test/test_utils.py new file mode 100644 index 00000000..2df9a899 --- /dev/null +++ b/test/test_utils.py @@ -0,0 +1,16 @@ +import numpy as np +from deerlab import sophegrid + + +# ====================================================================== +# Test sophegrid function + +def test_sophegrid(): + # Test that the function returns the values and weights summing to 1 + # Comparison taken from EasySpin 6.0 + phi, theta, weights = sophegrid(4,np.pi*2,3) + + assert np.allclose(weights.sum(),1) + assert np.allclose(phi, np.array([0,0,1.57079632679490,3.14159265358979,4.71238898038469,0,0.785398163397448,1.57079632679490,2.35619449019235,3.14159265358979,3.92699081698724,4.71238898038469,5.49778714378214])) + assert np.allclose(theta, np.array([0,0.785398163397448,0.785398163397448,0.785398163397448,0.785398163397448,1.57079632679490,1.57079632679490,1.57079632679490,1.57079632679490,1.57079632679490,1.57079632679490,1.57079632679490,1.57079632679490])) + assert np.allclose(weights*4*np.pi, np.array([0.956558005801449,1.70021769237074,1.70021769237074,1.70021769237074,1.70021769237074,0.601117729884346,0.601117729884346,0.601117729884346,0.601117729884346,0.601117729884346,0.601117729884346,0.601117729884346,0.601117729884346])) \ No newline at end of file From 3806959972e8b4478c324ba0b0f40fc8029f7099 Mon Sep 17 00:00:00 2001 From: Hugo Karas Date: Wed, 10 Apr 2024 13:27:18 +0100 Subject: [PATCH 3/6] Minor doc update --- deerlab/fitresult.py | 2 ++ deerlab/solvers.py | 1 + deerlab/utils.py | 1 + 3 files changed, 4 insertions(+) diff --git a/deerlab/fitresult.py b/deerlab/fitresult.py index 80c99bcc..4841f9e6 100644 --- a/deerlab/fitresult.py +++ b/deerlab/fitresult.py @@ -42,6 +42,8 @@ class FitResult(dict): * ``stats['aic']`` - Akaike information criterion * ``stats['aicc']`` - Corrected Akaike information criterion * ``stats['bic']`` - Bayesian information criterion + * ``stats['autocorr']`` - Autocorrelation based on Durbin–Watson statistic + nonlin : ndarray Fitted non-linear parameters. [:ref:`snlls` specific attribute] diff --git a/deerlab/solvers.py b/deerlab/solvers.py index 1052d7b3..523afbe1 100644 --- a/deerlab/solvers.py +++ b/deerlab/solvers.py @@ -462,6 +462,7 @@ def snlls(y, Amodel, par0=None, lb=None, ub=None, lbl=None, ubl=None, nnlsSolver * ``stats['aic']`` - Akaike information criterion * ``stats['aicc']`` - Corrected Akaike information criterion * ``stats['bic']`` - Bayesian information criterion + * ``stats['autocorr']`` - Autocorrelation based on Durbin–Watson statistic success : bool Whether or not the optimizer exited successfully. cost : float diff --git a/deerlab/utils.py b/deerlab/utils.py index 3b7f69d1..eb06134d 100644 --- a/deerlab/utils.py +++ b/deerlab/utils.py @@ -282,6 +282,7 @@ def goodness_of_fit(x,xfit,Ndof,noiselvl): stats['aic'] - Akaike information criterion stats['aicc'] - Corrected Akaike information criterion stats['bic'] - Bayesian information criterion + stats['autocorr'] - Autocorrelation based on Durbin–Watson statistic """ sigma = noiselvl Ndof = np.maximum(Ndof,1) From 9f7c68bf066fd1fadffd8c28609524c691559f51 Mon Sep 17 00:00:00 2001 From: Hugo Karas Date: Wed, 10 Apr 2024 13:30:31 +0100 Subject: [PATCH 4/6] Bump version Number --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 0f1acbd5..99a4aef0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v1.1.2 +v1.1.3 From 81ee7d05b8e4f2e8156d451ca4621f8f087e589e Mon Sep 17 00:00:00 2001 From: Hugo Karas Date: Wed, 10 Apr 2024 13:30:44 +0100 Subject: [PATCH 5/6] Remove unnecessary doc files --- docsrc/package-lock.json | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 docsrc/package-lock.json diff --git a/docsrc/package-lock.json b/docsrc/package-lock.json deleted file mode 100644 index 02c9db5b..00000000 --- a/docsrc/package-lock.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "commander": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==" - }, - "katex": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.11.0.tgz", - "integrity": "sha512-RQsU3HSMjLW9AdPpi2zaBwM123goCbUcUbBJfmjcAdA982RgtEUNMmrf+3y8anGjgJLantcNLa/VSK73xztQBg==", - "requires": { - "commander": "^2.19.0" - } - } - } -} From 0e6eff137ceb626fa9b3eae527a06dfe79e7821a Mon Sep 17 00:00:00 2001 From: Hugo Karas Date: Wed, 10 Apr 2024 15:48:47 +0100 Subject: [PATCH 6/6] Update changelog --- docsrc/source/changelog.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docsrc/source/changelog.rst b/docsrc/source/changelog.rst index 4d430c38..dd83a641 100644 --- a/docsrc/source/changelog.rst +++ b/docsrc/source/changelog.rst @@ -24,6 +24,11 @@ Release Notes - |fix| : Something which was not working as expected or leading to errors has been fixed. - |api| : This will require changes in your scripts or code. +Release ``v1.1.3`` - Ongoing +------------------------------------------ +- |fix| : Removes unnecessary files from the docs + + Release ``v1.1.2`` - September 2023 ------------------------------------------ - |fix| : Fixes an error in the normalisation of the rice models (:pr:`459`).