Skip to content
Session 3: Simple Manipulations

Session 3: Simple Manipulations

In this session we learn basic data manipulations: selecting, binning, and reorganizing. We use the same test data as in session 1.

Overwrite or duplicate?

By default, most commands that modify data duplicate the file: the original is preserved and the result appears as a new workspace at the end of memory. This is the safe choice during exploration.

To operate in place instead, append ! to any command:

0 > msd! 0:3    # delete spectra 0–3 from file 0 itself (no new file)

Without !, the result would go to a new file 1. With !, file 0 is modified directly.

When to use !:

  • Working with very large files where duplicating wastes RAM.
  • Quick iterative cleanup where you do not need to compare before/after.

For full details see Overwrite or duplicate in the reference.

Delete some spectra

Command Action Inspection
? > fl gly180 Load one data file
0 > msd 0:3 Delete spectra 0–3, result stored as file 1
0:1 > dz Compare old and new file

Average spectra

Command Action
1 > msa 0,3,6 Average in groups: spectra 0–2 → new spectrum 0; 3–5 → 1; 6–8 → 2
2 > 1 msa ::3 Shorthand for the same: ::3 means every third starting at 0

Use dz and plot commands to verify that averaged spectra have better statistics.

Delete files from memory

1: > fdel    # delete all files starting from file 1

In the following examples, file 0 is always gly180 as loaded from disk.

Bin channels

Command Action
0 > mpa ::3 Within each spectrum, bin three consecutive points into one

Plot input and output to see the improved statistics.

Reduce dimension

Command Action
0 > msa 0 Average all spectra into one
0 > msr 6 Retain only spectrum 6, delete all others

Each command produces a file with a single spectrum. Use df, dc, dr to see the effect: when only one spectrum remains, the z0 coordinate is automatically converted into an rpar.

Merge files and save to disk

Command Action
? > : fdel Empty the internal memory (or start a fresh session)
? > fl gly??? Load all five test files
0:4 > msr 6 Retain spectrum 6 from each file → files 5–9
5:9 > mfj Merge five files into one → file 10
10 > dz The old rpar has become z0
10 > fs Save to disk using the auto-generated name gly
10 > mpa ::3 Channel binning
11 > fso Save, overwriting the existing file gly