In conclusion I must say that I'm fairly happy with this piece of software. I haven't used it for production purposes, so I can't vouch for it spitting out reliable data though. It's definitely worth exploring though.

While it's possible -- even easy -- to write your own scripts for processing NMR data (e.g. here and here) there's still a value in having a GUI handy.

Either way, this entry is about NMRNotebook, which ultimately derives from another gratis program called Gifa which I experimented with in the early 00s. Apparently after Gifa v4 (article), NMRTec developed Gifa v5. After that there seems to have been a split in efforts (not a fork) where NMRTec developed NMRNotebook, and other people involved in Gifa developed NPK. NMRNotebook appears to use NPK as the underlying engine, but provides a nice GUI which is written in tk/tcl, java and python.

Note that Gifa 4 and Gifa 5 are still available for download, but require license files to run. I don't know if it's still possible to get licenses for Gifa. Based on my memory of running Gifa (4?) the interface was quite slick, and it had a terminal at the bottom, similar to xwinnmr.

License
Either way, NMRNotebook can be downloaded for free from NMRTec for academic users. You will need to register and then get a license, which can be had by following the instructions on their website and sending off an email with your details.

So I did that.

NOTE that the 1D line fitter is not included in the free version -- it's priced at 1,000 Euro, which sounds a bit insane to me, in particular if you compare with the price of the software (Euro 100 for a student license, 750 for an industry one). Either way, you can write your own fitter in octave in fifteen minutes..

Installation

There are two files to download: NMRnotebook.sh and NNBMACROS.zip

Run NMRnotebook.sh

sh NMRnotebook.sh

NMRnotebook installer - starting installation... please wait
NMRnotebook will be installed in your home directory.
Unpacking ...
Running post-install script ...
done !!
To run NMRnotebook, type '~/NMRnotebook/NMRnotebook'
to create a shortcut named nnb in your home directory, type 'ln -s ~/NMRnotebook/NMRnotebook ~/nnb'
To uninstall simply erase the directory ~/NMRnotebook and ~/.nmrnotebook
Some examples can be found in the '~/NMRnotebook/examples' directory
Thank you for using NMRnotebook.
NMRtec software team

Run nmrnotebook as indicated:

~/NMRnotebook/NMRnotebook

Import the license by going to File/Open and select the nnb file you got via email.

Right-clicking brings up a menu that allows you to integrate, label, draw boxes, lines etc.

Normalised integral

NMRnotebook can accept SR values for calibration

Spectrum overview

NMRnotebook only has a few features available, but is sufficient for basic NMR processing. Line-fitting is the most serious omission.

Overall I find NMRnotebook perfectly adequate for what I would see myself using it for -- simple processing of NMR spectra. Anything more serious and I'd use my own scripts -- but I'd do that anyway in order to be able to trust the data.

And that actually is (almost -- let's not get carried away here) exactly what I have been looking for. The main issue was that it's meant for metapost -- or rather, the main issue was my unfamiliarity with metapost. Anyway, my life is know complete.

19 December 2012

I wanted a set of scripts that behaved a little bit like the commands in bruker xwin-nmr/topspin, so that I could do some quick processing for visual inspection without having to do too much coding.

I also wanted some simple modules that I can plug into automated processing routines for large numbers of spectra (e.g. when doing kinetics).

So here are a few simple octave routines which should work in matlab as well. They won't change the world, but should be good enough for some basic 1D processing.

Because of the groupdelay (GRPDLY) used in by Bruker (see e.g. here (16th of June post) and here), you need to use the bruk2ana converter. There's little science behind the values which are applied since they are hardware specific.

function spectrum=ft(fid,pars)
%%Usage: spectrum=ft(fid,pars)
%% Spectrum is a complex array with the frequency in
%%the first column and the real and imaginary parts
%%in the second column
%%pars(3)=centrefreq, pars(1)=SW
spectrum=fftshift(fft(fid(:,3)+i*fid(:,2)));
tmp=size(spectrum);%matlab workaround
freq=linspace(pars(3)+pars(1)/2,pars(3)-pars(1)/2,tmp(1));
spectrum=[freq' spectrum];
endfunction

apk.m

function spectrum=apk(spectrum,phc1)
%%Usage spectrum=apk(spectrum,phc1)
%%Spectrum is a complex matrix with
%%the frequency in the first column
%%and the complex spectrum in the
%%second column. phc1 is the first order
%%phase correection
tmp=size(spectrum);
m=720;
ph=linspace(-2*pi,2*pi,m);
maxsig=0;k=1;
minsig=-inf;
for n=1:m;
spex=real( (spectrum(:,2)).*exp(i*(ph(n)+phc1*i/tmp(1))) );
localmin=min(spex);
localmax=max(spex);
if (localmin>minsig)
minsig=localmin;
k=n;
end
end
ph0=ph(k);
spectrum(:,2)=spectrum(:,2).*exp(i*(ph0+phc1*i/tmp(1)));
end

altapk.m

function [spectrum,ph]=altapk(spectrum,phc0,phc1)
%%Usage -spectrum,ph]=altapk(spectrum,phc0,phc1)
%%Spectrum is a complex matrix with the frequency in the first column
%%and the complex spectrum in the second column. phc0 and phc1 are the first order
%%phase correction parameters, respectively, and are used as initial guesses.
%%This is an implementation of Chen, Weng, Goh and Garland, J. Mag. Res., 2002, 158, 164-168 and depends on entropy.m.
ph=[phc0;phc1];
ph=minimize("entropy",{ph,spectrum});
%compute spectrum with optimal phase params
pts=linspace(1,size(spectrum(:,2),1),size(spectrum(:,2),1));
phi=(ph(1)+ph(2).*pts./max(pts))';
spectrum(:,2)=spectrum(:,2).*exp(i*phi);
end

function pltspec(spectrum)
%%Usage: pltspec(spectrum)
%%Where spectrum is a complex matrix
%%with the frequency in the first column
%%and the complex spectrum (a+i*b) in the
%%second column
plot(spectrum(:,1),real(spectrum(:,2)))
end

07 August 2011

phpScheduleIt is a nice web-driven instrument scheduling system, which I first come into contact with as an NMR user at the University of California at Davis, where it is used to manage the scheduling of the instruments in the NMR facility there.

1. create a directory under /var/www. In our example it will be /var/www/nmr
sudo mkdir /var/www/nmr. Unzip the file you downloaded from www.php.brickhost.com and put the files in the /var/www/nmr directory

The admin email is important, since this will become the administrator account.

5. go to http://localhost/nmr/install

If nothing happens, or you get an error message, it's time to start trouble-shooting. Going to the terminal and

cd /var/www/nmr/install

php index.php

might give some useful information. Most likely you have either a) made an error in config/config.php, or b) you haven't chmod:d the subdirectories.

6. If all goes well, you are asked for your root user name and root mysql password (which you set during the installation). Thus, login as root with the correct password. Once you're in, hit the button saying 'create tables'. If all went well you can now delete the /var/www/nmr/install directory.

7. Go to http://localhost/nmr

You should be greeted with a log in window. Important: select create new user and enter the email address you gave as the administrator email in the config.php file. This will then automatically become an administrator account. It has nothing to do with the order you create accounts in - it's all about what email address you put in the config.php file.

8. Once you've set up the account you are able to create instruments, user groups, booking restrictions etc.

Anyone who wants to use the facilities can create their own new registered users, BUT only the administrator(s) can assign resources to them.