diff --git a/README.md b/README.md index 9d5d0d212..685e3464c 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,16 @@ More details on the installation of DeerLab can be found [here](https://jeschkel ### Citation -A paper about DeerLab is currently submitted for publication. When you use DeerLab in your work, for now, please cite the preprint - -> Fábregas Ibáñez, L., Jeschke, G., and Stoll, S.: a comprehensive software package for analyzing dipolar electron paramagnetic resonance spectroscopy data, Magn. Reson., 1, 209–224, 2020, doi.org/10.5194/mr-1-209-2020 - -Please check back frequently for updated publication information. +When you use DeerLab in your work, please cite the following publication: + +
+
+

DeerLab: a comprehensive software package for analyzing dipolar electron paramagnetic resonance spectroscopy data

+ Luis Fábregas Ibáñez, Gunnar Jeschke, Stefan Stoll
+ Magn. Reson., 1, 209–224, 2020
+ doi.org/10.5194/mr-1-209-2020 +
+
### License diff --git a/docsrc/source/funding.rst b/docsrc/source/funding.rst index 3c55b2ec6..59b21c736 100644 --- a/docsrc/source/funding.rst +++ b/docsrc/source/funding.rst @@ -11,7 +11,7 @@ DeerLab is a project that has been funded by the following sources: Grant ETH-35 18-2
- +
@@ -25,7 +25,7 @@ DeerLab is a project that has been funded by the following sources: Grant GM127325
- +
@@ -38,7 +38,7 @@ DeerLab is a project that has been funded by the following sources: Grant CHE-1452967
- +
\ No newline at end of file diff --git a/examples/plot_analyzing_pake_pattern.py b/examples/plot_analyzing_pake_pattern.py index 4b7f29436..d766ba11c 100644 --- a/examples/plot_analyzing_pake_pattern.py +++ b/examples/plot_analyzing_pake_pattern.py @@ -27,11 +27,11 @@ # Plot plt.plot(t,V,'k.') -plt.tight_layout() -plt.grid() +plt.grid(alpha=0.3) plt.xlabel('Time [$\\mu s$]') plt.ylabel('V(t)') - +plt.tight_layout() +plt.show() # %% [markdown] # Prepare the signal # ------------------ @@ -71,11 +71,11 @@ def Bmodel(par): Vcorr = (V/Bfit - (1 - lam))/lam plt.plot(t,Vcorr,'k.') -plt.tight_layout() plt.grid(alpha=0.3) plt.xlabel('Time [$\\mu s$]') plt.ylabel('V(t)') - +plt.tight_layout() +plt.show() # %% [markdown] # Computing the dipolar spectrum # -------------------------------- @@ -99,13 +99,13 @@ def Bmodel(par): # Plot results plt.plot(nu,pake,'k',nuapo,pakeapo,'b',linewidth=1.5) -plt.tight_layout() plt.grid(alpha=0.3) plt.xlim([-10, 10]) plt.xlabel('Frequency [MHz]') plt.ylabel('Intensity [a.u.]') plt.legend(['Raw','Apodized']) - +plt.tight_layout() +plt.show() # %% [markdown] # We do not need to worry about the zero-filling since ``fftspec`` takes care # of setting it to twice the amount of points in the signal, to preserve all information. diff --git a/examples/plot_comparing_uncertainties_for_regularization.py b/examples/plot_comparing_uncertainties_for_regularization.py index 8986488bd..97e06a7e4 100644 --- a/examples/plot_comparing_uncertainties_for_regularization.py +++ b/examples/plot_comparing_uncertainties_for_regularization.py @@ -22,7 +22,7 @@ r = np.linspace(2,5,160) # distance axis, nm P = dl.dd_gauss2(r,[3, 0.1, 0.6, 3.5, 0.2, 0.4]) # model distribution lam = 0.32 # modulatio depth -B = dl.bg_strexp(t,[0.04,1],lam) # background decay +B = dl.bg_strexp(t,[0.04,1]) # background decay K = dl.dipolarkernel(t,r,lam,B) # dipolar kernel matrix V = K@P + dl.whitegaussnoise(t,0.01) # signal with added noise @@ -66,7 +66,7 @@ def mybootfcn(V): # matrices. This is because bootstrapping takes the nonnegativity constraint of P into # account, whereas the curvature matrix CIs do not. -fig, ax = plt.subplots(1,2,sharey=True) +fig, ax = plt.subplots(2,1,sharey=True) ax[0].plot(r,P,'k',r,Pfit,'r',linewidth=1) ax[0].fill_between(r,Pci50_cm[:,0],Pci50_cm[:,1],color='r',linestyle='None',alpha=0.45) ax[0].fill_between(r,Pci95_cm[:,0],Pci95_cm[:,1],color='r',linestyle='None',alpha=0.25) @@ -85,5 +85,6 @@ def mybootfcn(V): ax[1].set_xlabel('r [nm]') ax[1].set_title('Bootstrapped CI') ax[1].legend(['Truth','Fit','50%-CI','95%-CI']) - +plt.tight_layout() +plt.show() # %% diff --git a/examples/plot_emulating_deeranalysis_workflow.py b/examples/plot_emulating_deeranalysis_workflow.py index 349541c97..c7e5cdf2c 100644 --- a/examples/plot_emulating_deeranalysis_workflow.py +++ b/examples/plot_emulating_deeranalysis_workflow.py @@ -39,7 +39,8 @@ plt.ylabel('V(t)') plt.grid(alpha=0.3) plt.legend(['real','imag']) - +plt.tight_layout() +plt.show() # %% [markdown] # DeerAnalysis workflow # --------------------- @@ -58,17 +59,17 @@ mask = t>tstart def Bmodel(par): lam,kappa,d = par # unpack parameters - B = (1-lam)*dl.bg_strexp(t[mask],[kappa,d],lam) + B = (1-lam)*dl.bg_strexp(t[mask],[kappa,d]) return B # lam k d par0 = [0.5, 0.5, 3] -lb = [0.1, 0.1, 1] +lb = [0.1, 0, 1] ub = [1, 5, 6] fit = dl.fitparamodel(V[mask],Bmodel,par0,lb,ub,rescale=False) lamfit,kappa,d = fit.param -Bfit = dl.bg_strexp(t,[kappa,d],lamfit) +Bfit = dl.bg_strexp(t,[kappa,d]) # Background "correction" by division Vcorr = (V/Bfit - 1 + lamfit)/lamfit @@ -99,6 +100,7 @@ def Bmodel(par): plt.xlabel('r [nm]') plt.ylabel('P [nm^{-1}]') plt.legend(['truth','fit']) - +plt.tight_layout() +plt.show() # %% diff --git a/examples/plot_multigauss_fitting_4pdeer.py b/examples/plot_multigauss_fitting_4pdeer.py index 315e85f7d..49fb1ad47 100644 --- a/examples/plot_multigauss_fitting_4pdeer.py +++ b/examples/plot_multigauss_fitting_4pdeer.py @@ -96,7 +96,6 @@ def K4pdeer(par,t,r): plt.plot(t,V,'k.') plt.plot(t,Vfit,'b',linewidth=1.5) plt.plot(t,(1-Kparfit[0])*dl.bg_hom3d(t,Kparfit[1],Kparfit[0]),'b--',linewidth=1.5) -plt.tight_layout() plt.grid(alpha=0.3) plt.legend(['data','Vfit','Bfit']) plt.xlabel('t [µs]') @@ -107,7 +106,6 @@ def K4pdeer(par,t,r): plt.plot(r,Pfit,'b',linewidth=1.5) plt.fill_between(r,Pci50[:,0],Pci50[:,1],color='b',linestyle='None',alpha=0.45) plt.fill_between(r,Pci95[:,0],Pci95[:,1],color='b',linestyle='None',alpha=0.25) -plt.tight_layout() plt.grid(alpha=0.3) plt.legend(['truth','optimal fit','95%-CI']) plt.xlabel('r [nm]') @@ -115,14 +113,12 @@ def K4pdeer(par,t,r): plt.subplot(323) plt.bar(np.arange(NGauss)+1,metrics + abs(min(metrics)),facecolor='b',alpha=0.6) -plt.tight_layout() plt.grid(alpha=0.3) plt.ylabel('$\Delta AIC$') plt.xlabel('Number of Gaussians') plt.subplot(325) plt.bar(np.arange(NGauss)+1,Akaikeweights,facecolor='b',alpha=0.6) -plt.tight_layout() plt.grid(alpha=0.3) plt.ylabel('Akaike Weight [%]') plt.xlabel('Number of Gaussians') @@ -130,11 +126,12 @@ def K4pdeer(par,t,r): plt.subplot(3,2,(4,6)) for i in range(len(Peval)): plt.plot(r,P + 2*i,'k',r,Peval[i] + 2*i,'b-',linewidth=1.5) -plt.tight_layout() plt.grid(alpha=0.3) plt.xlabel('r [nm]') plt.ylabel('Number of Gaussians') plt.legend(['truth','fit']) +plt.tight_layout() +plt.show() # %% diff --git a/examples/plot_pseudotitration_parameter_free.py b/examples/plot_pseudotitration_parameter_free.py index 3e99fdfd6..76e527c0b 100644 --- a/examples/plot_pseudotitration_parameter_free.py +++ b/examples/plot_pseudotitration_parameter_free.py @@ -63,7 +63,7 @@ def Kmodel(par,ts,rA,rB,L): Ks = [[]]*Nsignals # General the dipolar kernels for i in range(Nsignals): - B = dl.bg_exp(ts[i],k,lam) + B = dl.bg_exp(ts[i],k) # Kernel for fraction A KstateA = dl.dipolarkernel(ts[i],rA,lam,B) # Kernel for fraction B @@ -153,7 +153,7 @@ def Kmodel(par,ts,rA,rB,L): plt.subplot(3,2,(1,3)) for i in range(Nsignals): Vsfit.append(Ksfit[i]@Pfit) - plt.plot(ts[i],Vs[i]+i/9,'k.',ts[i],Vsfit[i]+i/9,'r',linewidth=1.5) + plt.plot(ts[i],Vs[i]+i/9,'k.',ts[i],Vsfit[i]+i/9,'tab:blue',linewidth=1.5) plt.grid(alpha =0.3) plt.xlabel('t [$\mu s$]') plt.ylabel('V(t) [a.u.]') @@ -164,7 +164,7 @@ def Kmodel(par,ts,rA,rB,L): for i in range(Nsignals): PAfit = xAfit[i]*Pfit[0:len(rA)] PBfit = xBfit[i]*Pfit[len(rA):len(rB)+len(rA)] - plt.plot(rA,PAfit+2*i,'r',rB,PBfit+2*i,'b',linewidth=1.5) + plt.plot(rA,PAfit+1.2*i,'tab:red',rB,PBfit+1.2*i,'tab:blue',linewidth=1.5) plt.grid(alpha =0.3) plt.xlabel('r [nm]') @@ -173,10 +173,15 @@ def Kmodel(par,ts,rA,rB,L): plt.xlim([2,7]) plt.subplot(325) -plt.plot(np.log10(L),xA,'r-',np.log10(L),xB,'b-') -plt.plot(np.log10(L),xAfit,'ro',np.log10(L),xBfit,'bo',linewidth=1.5) +plt.plot(np.log10(L),xA,'tab:red',np.log10(L),xB,'tab:blue') +plt.plot(np.log10(L),xAfit,'o',color='tab:red') +plt.plot(np.log10(L),xBfit,'o',color='tab:blue') plt.grid(alpha =0.3) plt.xlabel('log$_{10}$([L])') plt.ylabel('Fractions') plt.legend(['state A','state B']) plt.ylim([0,1]) + +plt.tight_layout() +plt.show() +# %%