Which Format for an ASCII file?

So you have decided to make your own file converter. You know enough programming, you know the organization of your starting data. You ignore the file structure of iNMR files, but have read that iNMR can import ASCII files (ending in “.txt”), so you are just asking: “Which ASCII files?”.

First of all, let us remind you that this is neither the main nor the best route. You should ask for a built-in converter first. Anyway, let's say you have already asked, or you have no time to ask, or you want to create a spectrum from scratch. Now we can tell you: there are three formats, one for time domain data and two for frequency domain data. In all cases, lines are separated by a single Line Feed Character ('\n'), in Unix style. When two values are on the same row, they can be separated by any combination of spaces and tabs.

Time Domain

Write two columns. Real part at left, imaginary part at right. Here is an example:


   -3138.000	   10254.000
    4134.000	    9762.000
    3954.000	    1935.000
    -237.000	    3534.000
    3476.000	    6899.000
    9030.000	    2109.000

Before importing this file, open the Preferences dialog and, into the first panel, insert the value for the spectrometer frequency, because iNMR can't guess it otherwise. After importing the file, with the command “Edit/Metadata”, insert the correct value for the spectral width. This is also the place to set the spectrometer frequency, if you don't like changing your preferences. With the command “Format/Axes & Scales” set the frequency at the middle of the spectrum.

Frequency Domain

Copy and edit the example/template below. iNMR ignores whatever comes before “first frequency”. Substitute the upper case terms FIRST, LAST, N, STEP and FREQUENCY.

STEP is the distance, in Hz, between two adjacent points:
STEP = FREQUENCY • (LAST - FIRST) / (N - 1).
The spectral width is, therefore:
spectral width = LAST - FIRST + STEP / FREQUENCY.
After the header, enter the intensity values, from left to right (decreasing frequency).


optional comments ...

first frequency = FIRST ppm
last frequency = LAST ppm
number of points = N
step = STEP Hz
carrier frequency = FREQUENCY MHz

      22.680
      23.818
      24.206
      22.789
      27.823
      28.970
      32.008
       .... 

Frequency Domain (columnar alternative)

You can use the left column for frequencies and the right column for intensities. iNMR can tell it's a frequency domain spectrum by the small header that starts with “ppm”.


      ppm	   intensity
 10.82074	      22.680
 10.81667	      23.818
 10.81260	      24.206
  ......	       ....
 

Whatever comes before the header is ignored. iNMR also assumes that the frequency increment between points is constant. As in the case of FIDs, the spectrometer frequency is taken from your preferences. In a variation of this format, the two values are separated by a comma.


 
Copyright © 2005-2010 nucleomatica
Valid XHTML and CSS. UTF-8 encoding.