Skip to content

Latest commit

 

History

58 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

* DNPy

  *DNPy* is a Python code package to evaluate continuous wave (CW) Overhauser dynamic nuclear polarization (ODNP) experiments. DNPy has taken the core functionality from [[https://github.com/bennomeier/pyNMR][pyNMR]].
#+attr_html: :width 100%
[[file:http://www.spintoolbox.com/media/filer_public_thumbnails/filer_public/cf/bd/cfbd3600-4c85-4a8f-a6ba-e616ada2ca95/dnpyui.jpg__799x681_q85_subsampling-2_upscale.jpg]]

* Sample output
#+attr_html: :width 100%
[[https://www.spintoolbox.com/media/filer_public_thumbnails/filer_public/c8/1e/c81e7f88-2403-4324-ae6c-37762452fb32/06_ft_after_phasing_magn_3d.jpg__3250x2000_q85_crop_subsampling-2_upscale.jpg]]
#+attr_html: :width 100%
[[http://www.spintoolbox.com/media/filer_public_thumbnails/filer_public/ad/43/ad43ea9a-c23a-42d4-a7e8-2b5bbe76a637/dnpyoutput.jpg__1000x562_q85_subsampling-2_upscale.jpg]]

* Experiments naming style

  To be able to use this code package, you need to have power set written in your experiment title with the following style:

~XXXXX - set XX dBm~ example: ~CWODNP - set 10 dBm~, ~T1 experiment - set 5 dBm~

If you have a calibration curve based on main attenuation setting, you can use the following instead:

~XXXXX - set XX dB~ example: ~CWODNP - set 10 dB~

This however requires you to have a data calibration file as a CSV when using DNPy which should have comma as a separator and 2 columns (dB set - dBm output).
* Installation
  You need to have python3 with following packages installed:
- Numpy:
  Install using ~pip3 install --user numpy~ or ~sudo apt install python3-numpy~ on linux.
- Scipy:
  Install using ~pip3 install --user scipy~ or ~sudo apt install python3-scipy~ on linux.
- Matplotlib:
  Install using ~pip3 install --user matplotlib~ or ~sudo apt install python3-matplotlib~ on linux.
- PyQt5 (not needed if you don't need UI)
  Install using ~pip3 install --user pyqt5~.

Additionally, if you want to have JPG output plots, you need to install pillow: ~pip3 install --user pillow~. 

** GNU/Linux
On GNU/Linux you can also use the setuptools package. Download installer DNPyUI-x.x.x_installer.tar.gz from [[https://github.com/haditim/DNPy/tree/master/dist][dist]], extract and run ~python3 setup.py install~ or download DNPyUI-x.x.x_linux.tar.gz binary from  [[https://github.com/haditim/DNPy/tree/master/dist][dist]], extract and run DNPyUI.

** Windows
You can install [[https://www.anaconda.com/download/][ANCONDA]] for windows to have all necessary packages installed (don't forget to pick python3 package). After installation you can run the folowing in the command prompt:
~C:\ProgramData\Anaconda3\python.exe DNPyUI.py~. Installation directory can differ based on your selection when installing Anaconda.

* Usage
** User interface
DNPyUI can be run with the following. It will show you an intuitive UI.
#+BEGIN_SRC shell
python3 DNPyUI.py
#+END_SRC
** Function call
If you prefer to use DNPy as a function call, you can import functions and setup kwargs for ~return_exps()~ function. A sample usage is implemented in ~dnpEval.py~. You need to set the following variables in your dnpEval:
#+BEGIN_SRC python
path = '/path/to/exp/folder/'
powerFile = 'powers'
kwargs = {
    't1Calc': 'PCreal',  # 'PCreal' for real phase cycled channel or 'PCmagn' or 'real' or 'magn'
    'phase': 'first',  # all, none, first
    'ftWindow': 200,  # X domain for FT plot, int. and phase calculation
    'maxWin': 1000,  # Does not allow peaks out of this domain to be calculated in int.
    'lS': 70,  # Left shift points or 'auto'
    'lSt1': 70,  # LS for t1 experiments (this differs from DNP sometimes)
    'rS': 110,  # Right shift points
    'rSt1': 75,
    'lB': 2,  # Line boradening [Hz]
    'offCor': True,  # offset correctioon
    'basCor': True,  # baseline correction
    'evalPath': 'evalHadiTest',
    'plotDpi': 250,  # plot file resolution
    'plotExts': [],  # remove all if you do not want plots to be saved
    'process': True,
    'debug': False,
    'dumpToCsv': True,
    'figSize': (13, 8),
    'powerFile': powerFile,
    't1SeriesEval': True,
    't1SeriesPolDeg': 1,  # Polynomial degree for T1 series fit (default = 1)
    'kSigmaCalc': True,
}

#+END_SRC
- ~path~ defines the ODNP experiment root folder.
- ~powerFile~ is used when you have "ODNP - set .. dB" style title in your experiments and is a csv file containing dB to dBm conversion table.
- ~debug~ boolean turns verbose evaluation on and gives you more information.
- ~plotExts~ denotes the plot file extensions you want to have saved.

Finally, we call the main function using:
#+BEGIN_SRC python
exps = return_exps(path, **kwargs) 
#+END_SRC

About

Evaluate ODNP experiments

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages