Example Scripts

From Powers Wiki
Revision as of 23:34, 12 August 2024 by Mjeppesen (talk | contribs) (→‎Example 1: 1D NMR Processing to Matrix Export)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Example Scripts for Various MVAPACK Patterns

Note: Patterns may be sensitive to file location and path variables.

Example 1: 1D NMR Processing to Matrix Export

%% indicates comment line. All lines can be copied and pasted to terminal.

%% Start file extraction from 1D NMR files located in nmrdata sub directory
filenames = glob("nmrdata/*");
[F.data, F.parms] = loadnmr(filenames);
%% Apply apodization and zero fills
apodizationWindowFunction = @expwindow);
F.data = apodize(F.data, F.parms, apodizationWindowFunction);
zeroFills = 2;
F.data = zerofill(F.data, F.parms, 2);
%% Fourier transform and phase
[S.data,S.ppm] = nmrft(F.data,F.parms);
phaseObjective = @simplex_entropy;
[S.data, S.phc0, S.phc1] = autophase(S.data, F.parms, phaseObjective);
%% Remove unreal portion and align spectra
X.data = realnmr(S.data, F.parms);
X.ppm = S.ppm;
X.data = icoshift(X.data, X.ppm);
%% Save matrix as csv
csvwrite("DataMatrix.csv", X.data);
csvwrite("ChemicalShiftsData.csv", X.ppm);