Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
HKaras committed Nov 12, 2024
2 parents b1f80f6 + da8175a commit 9d5a5e0
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
5 changes: 4 additions & 1 deletion autodeer/DEER_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,10 @@ def calc_DEER_settings(relaxation_data,mode='auto', target_time=2,
raise ValueError("No signal at either optimal")

# Select between five-pulse and four-pulse DEER
if (V_4p > V_5p * 0.9) or (tau1_5p < 1.5) or mode =='4pDEER':
if (tau2_4p >= 2*tau1_5p) and (V_4p > V_5p * 0.9):
mode = '4pDEER'

if (tau1_5p < 1.5) or mode =='4pDEER':
# Use four-pulse DEER
deer_settings = {
'ExpType': '4pDEER',
Expand Down
13 changes: 8 additions & 5 deletions autodeer/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,11 @@ def initialise_deer_settings(self):
if 'T2_relax' in self.current_results:
relax_data['Tm'] = self.current_results['T2_relax']
if 'relax2D' in self.current_results:
relax_data['Ref2D'] = self.current_results['relax2D']

relax_data['Ref2D'] = self.current_results['relax2D']

#debug only, remove later
store_pickle(relax_data,os.path.join(self.data_folder,'relax_data.pkl'))

self.deer_settings = ad.calc_DEER_settings(relax_data,exp,self.aim_time,aim_SNR,self.waveform_precision)

self.deer_settings['criteria'] = self.aim_MNR
Expand Down Expand Up @@ -949,12 +952,12 @@ def update_tau_delays_figure(self, SNRs, MeasTimes, labels=None):
axs.cla()
# Only supports 5pDEER expand to 4pDEER
CP_analysis = self.current_results['relax']
ad.plot_optimal_tau(CP_analysis,SNRs,MeasTimes,MaxMeasTime=36, labels=['5pDEER'],fig=fig,axs=axs,cmap=[ad.primary_colors[0]])
ad.plot_optimal_tau(CP_analysis,SNRs,MeasTimes,MaxMeasTime=36, labels=['5pDEER'],fig=fig,axs=axs,cmap=[ad.primary_colors[0]],corr_factor=self.correction_factor)

if 'relax2D' in self.current_results:
ad.plot_optimal_tau(self.current_results['relax2D'],SNRs,MeasTimes,MaxMeasTime=36, labels=['4pDEER'],fig=fig,axs=axs,cmap=[ad.primary_colors[1]])
ad.plot_optimal_tau(self.current_results['relax2D'],SNRs,MeasTimes,MaxMeasTime=36, labels=['4pDEER'],fig=fig,axs=axs,cmap=[ad.primary_colors[1]],corr_factor=self.correction_factor)
elif 'T2_relax' in self.current_results:
ad.plot_optimal_tau(self.current_results['T2_relax'],SNRs,MeasTimes,MaxMeasTime=36, labels=['4pDEER'],fig=fig,axs=axs,cmap=[ad.primary_colors[1]])
ad.plot_optimal_tau(self.current_results['T2_relax'],SNRs,MeasTimes,MaxMeasTime=36, labels=['4pDEER'],fig=fig,axs=axs,cmap=[ad.primary_colors[1]],corr_factor=self.correction_factor)

axs.set_title(labels[0])

Expand Down
8 changes: 5 additions & 3 deletions autodeer/relaxation_autodeer.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ def calc_correction_factor(CPanalysis,DEER_fit_result):

actual_time = DEER_sequence._estimate_time() *(DEER_fit_result.dataset.nAvgs/DEER_fit_result.dataset.averages)

actual_MNR = DEER_fit_result.MNR
# actual_MNR = DEER_fit_result.MNR
actual_SNR = 1/DEER_fit_result.noiselvl

if DEER_sequence.name == '5pDEER':
dataset = CPanalysis.dataset
Expand All @@ -238,7 +239,8 @@ def calc_correction_factor(CPanalysis,DEER_fit_result):
est_SNR = V(tau)/(noise*np.sqrt(CP_averages))
est_SNR *= np.sqrt(nPointsInTime(actual_time)/t_axis.shape[0])

correction_factor = actual_MNR/est_SNR
correction_factor = actual_SNR/est_SNR

elif DEER_sequence.name == '4pDEER':
dataset = CPanalysis.dataset
CP_averages = dataset.nAvgs * dataset.shots * dataset.nPcyc
Expand All @@ -250,7 +252,7 @@ def calc_correction_factor(CPanalysis,DEER_fit_result):
est_SNR = V(tau)/(noise*np.sqrt(CP_averages))
est_SNR *= np.sqrt(nPointsInTime(actual_time)/t_axis.shape[0])

correction_factor = actual_MNR/est_SNR
correction_factor = actual_SNR/est_SNR
else:
correction_factor = 1

Expand Down
16 changes: 16 additions & 0 deletions docsrc/source/releasenotes.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
Release Notes
=============

Version 0.9.0 (2024-11-11):
+++++++++++++++++++++++++++

- Faster implmenetation of excite profile
- Implementation of DeerLab based fitting into relaxation traces
- New implementation of correction factor
- Updated MNR and SNR parameters
- Improved versioning (including git branch for dev versions)
- Added a button for keep running (not to automatically stop)
- Implementation of a global waveform precision
- Added autoextending relxation data traces
- New save folder for raw data folder
- Improved calc_DEER_delays function, with new plot


Version 0.8.0 (TBA):
+++++++++++++++++++++++++++

- Major Support Update for 2D Decoherence
- `RefocusedEcho2DSequence` reforumlated to support match normal style
- Added 2D Decoherence to the GUI
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"Matlab": ["matlabengine"],
"Docs": ["sphinx", "furo", "sphinx-gallery", "sphinx-design","myst-parser","sphinx-copybutton","sphinx-toolbox","sphinx-autoapi","sphinxcontrib-bibtex","numpydoc"],
"GUI": ["PyQt6","threadpoolctl", "pyinstaller"],
"test": ["pytest", "pytest-cov", "pytest-qt", "pytest-xdist"],
"test": ["pytest", "pytest-cov", "pytest-qt", "pytest-xdist", "GitPython"],
}
extras["Dev"] = extras["Docs"] + extras["test"] + ['GitPython']
extras["Dev"] = extras["Docs"] + extras["test"]
setup(
name='autoDEER',
version=str(__version__),
Expand All @@ -19,10 +19,10 @@
url = "https://github.com/HKaras/autoDeer",
python_requires=">=3.8",
install_requires=[
'numpy',
'numpy >= 2.0',
'scipy',
'matplotlib',
'deerlab >= 1.0',
'deerlab >= 1.1.4',
'pyyaml',
'reportlab',
'svglib',
Expand Down

0 comments on commit 9d5a5e0

Please sign in to comment.