Example Scripts: Difference between revisions

From Powers Wiki
(Created page with "=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. <code> %% 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...")
 
 
Line 6: Line 6:


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

Latest revision as of 23:34, 12 August 2024

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);