b2spinach.m

From Spinach Documentation Wiki
Revision as of 10:10, 30 August 2026 by Kuprov (talk | contribs) (version fragment to 2.13 per IK 2026-08-30)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Imports time-domain NMR data recorded by Bruker instruments: reads the binary fid or ser file together with the acquisition and processing parameter files from the numbered experiment directory. The dimension of the data set is deduced from the presence of the acqu2s, acqu3s, and acqu4s status parameter files; data sets with more than four dimensions are refused. The parameter files are parsed from JCAMP-DX into Matlab structures, the binary byte order is taken from BYTORDA, the storage type and the file block size from DTYPA, the padding to whole 1024-byte blocks is stripped, complex fids are assembled in the Bruker sign convention as the real part minus the imaginary part times the imaginary unit, and the amplitudes are scaled by 2^NC. The group delay of the digital filter is zero when DIGMOD reports analogue filtering, is taken from GRPDLY when the hardware supplies it, comes from the tabulated DECIM and DSPFVS combinations for the DSP firmware families 10 to 12, and from the closed form 3-1/(2*DECIM) for firmware family 13. The difflist, vdlist, vclist, and nuslist files are read when they are present.

Syntax

    bdata=b2spinach(inpath)

Parameters

    inpath  -  character string with the path to the numbered
               Bruker experiment directory containing the ac-
               qus file and the fid or ser file

Outputs

    bdata.fid         - matrix of complex free induction de-
                        cays, one per column, in the order
                        they are stored in the file; for data
                        sets with three and more dimensions
                        the loop order over the indirect di-
                        mensions is determined by the AQSEQ
                        parameter of the acqus structure

    bdata.acqus       - structure with every parameter found
                        in the acqus file: numeric parameters
                        as scalars or column vectors, string
                        parameters as character strings or
                        cell arrays thereof

    bdata.acqu2s      - same for the acqu2s file of data sets
                        with two or more dimensions

    bdata.acqu3s      - same for the acqu3s file of data sets
                        with three or more dimensions

    bdata.acqu4s      - same for the acqu4s file of four-di-
                        mensional data sets

    bdata.procs       - same for the procs file of the first
                        processed data directory when present

    bdata.dirname     - experiment directory name

    bdata.ndims_data  - number of dimensions in the data set

    bdata.arraydim    - number of fids the status parameter
                        files declare as acquired

    bdata.fids_in_file - number of fid slots held by the bina-
                        ry file, and the column count of the
                        fid matrix; exceeds arraydim when the
                        acquisition was preallocated or inter-
                        rupted, and falls short of it for non-
                        uniformly sampled data sets, where the
                        fids follow the acquisition order of
                        the sampling schedule in nus_list

    bdata.npoints     - complex points per fid

    bdata.pulprog     - pulse programme name

    bdata.nucleus     - observe nucleus, e.g. '1H'

    bdata.gamma       - magnetogyric ratio of the observe
                        nucleus, rad/(s*T)

    bdata.sfrq        - spectrometer frequency, MHz

    bdata.at          - acquisition time, seconds

    bdata.sw_ppm      - spectral width, ppm

    bdata.spec_start  - lower edge of the spectrum, ppm

    bdata.digshift    - group delay of the digital filter in
                        complex points; the first round(dig-
                        shift) points of each fid precede the
                        start of the true signal

    bdata.grad_amps   - gradient amplitudes, T/m, present
                        when the difflist file exists

    bdata.vd_list     - variable delay list, seconds, present
                        when the vdlist file exists

    bdata.vc_list     - variable counter list, present when
                        the vclist file exists

    bdata.nus_list    - non-uniform sampling schedule, pre-
                        sent when the nuslist file exists

Notes

The lower edge of the spectrum is taken from the OFFSET parameter of the procs file when the processed data directory is present, and computed from SFO1, BF1, and SW otherwise; the two routes need not agree to the last digit.

The function reads status parameter files (acqus, acqu2s, ...), not the acquisition input files (acqu, acqu2, ...), so the numbers it reports are those of the acquisition that actually took place.

Adapted from the brukerimport() function of the GNAT package by:

    Dr. Mathias Nilsson
    School of Chemistry, University of Manchester,
    Oxford Road, Manchester M13 9PL, UK
    mathias.nilsson@manchester.ac.uk

See also

v2spinach.m, c2spinach.m, g2spinach.m, x2spinach.m, read_wave.m, Import,_export,_and_visualisation

Version 2.13, authors: Ilya Kuprov, Mathias Nilsson