Showing posts with label nmr pulse. Show all posts
Showing posts with label nmr pulse. Show all posts

23 August 2013

498. Briefly: Drawing NMR pulse sequences using APSEQ and Mathematica

There are two things that have been bothering me on linux -- one is the difficulty of creating annotated PDF documents, but it seems like things are slowly improving (we still don't have a really good way of creating /editable/ annotations). Another is the issue of creating NMR pulse-sequence drawings. To be fair, it doesn't seem like the situation is much better on Windows or OSX.

Anyway, I still don't have a good way of doing this, but at least I have A way of getting it done: APSEQ. The main drawback is that it requires Mathematica, which I don't like much (I get by with octave and maxima) in addition to being proprietary. But it will do for now.

NOTE: I just needed to 'Get It Done' quickly, so I didn't spend any time looking at the following potential alternatives:
http://www.celos.net/comp/pulses/ (metapost -- which should be tex compatible, right)
https://code.google.com/p/nmrtype/ (python code)
http://nmrwiki.org/wiki/index.php?title=NMRPulse_-_pulse_sequence_drawing_extension_for_MediaWiki (the URL is fairly descriptive)
They all seem to depend on latex in some way or another.

There's also http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9656&rep=rep1&type=pdf but I haven't actually found the sources.

Anyway, here's how to get started with APSEQ:

mkdir ~/tmp/apseq -p
cd ~/tmp/apseq
wget https://www.princeton.edu/~nmr/apseq/apsDistribution.tar.gz
tar xvf apsDistribution.tar.gz
cd zip.feb15/
math
Mathematica 7.0 for Linux x86 (64-bit) Copyright 1988-2009 Wolfram Research, Inc. In[1]:= <<nmr.auto part01 loaded part02 loaded part03 loaded part04 loaded mscp loaded nmr.extra loaded nmr.auto loaded In[2]:= draw[pulseSeq[hahn, echo]={channels[1H],pulse[90],delay[t1],pulse[180],delay[t1],delay[t2],acquire[taq]}] Out[2]= hahn_echo.pdf In[3]:=

which gives you something like this:
Spin echo sequence
The figure is output as a pdf, but it's easy enough to open it in inkscape and converting it to an .eps file.