Skip to content
m — Manipulate data

m — Manipulate data

Operations are organized by scope: point-level (within a spectrum), spectrum-level (reorders or merges spectra), and file-level (combines files in memory).

Protection

Command Action
m/ <spectra> Protect listed spectra from the next operation
m/- Lift all protections

Use protection to exclude a reference spectrum (e.g. an empty-cell measurement) while operating on the rest:

0 > m/ 0          # protect spectrum 0
0 > oy y-y[,0]    # subtract spectrum 0 from all others
0 > m/-

Point-level operations

Command Action
md <expr> Delete points where expression is true
mr <expr> Retain points where expression is true
mpd Per-point delete (interactive)
mpr Per-point retain (interactive)
mpa <factor> Bin points by a (possibly non-integer) factor
mpaf <n> Bin points by a fixed integer factor n
mpaea Bin until absolute error bound is met
mpaer Bin until relative error bound is met
mpo Sort points by x
mpq Average coincident x values
mpsym Symmetrize: average y(x) and y(−x) onto a common x > 0 grid

mpa vs mpaf

mpa <factor> bins adjacent points by an arbitrary factor, but the resulting x grid may be non-equidistant, which prevents fast convolution during fitting.

Prefer mpaf <n> whenever you plan to fit with cf: it bins by an integer n, always produces an equidistant grid, and keeps fast convolution available.

0 > mpaf 5        # bin 5→1, grid stays equidistant
0 > cf            # fast convolution works

Spectrum-level operations

Command Action
msd <range> Delete spectra
msr <range> Retain spectra
msa <groups> Average spectra in groups
msb Split file into one file per spectrum
msj Join corresponding spectra from multiple files
ms* Spawn: duplicate each spectrum n times, adding a copy-index z
msx Exchange: swap the last z coordinate with x
mso <expr> Sort spectra by expression
msoz Sort spectra by z-value
mzx Exchange or rotate z coordinates
mz- Delete the last z coordinate

msx — exchange x and z

msx swaps the x axis with the last z coordinate. The old x values become the new z, and the old z values become the new x. Each unique z-value in the original file becomes a spectrum.

Typical use: a file has spectra measured at different scattering angles q (z0), with energy transfer E as x. After msx, q is x and the E grid values become z — turning a set of S(E) spectra into a set of S(q) spectra.

mzx — rotate z coordinates

mzx interactively swaps or rotates the order of the z coordinates when a file has two or more of them (z0, z1, …). Use it to reorder which coordinate is treated as the “primary” z.

ms* — spawn spectra

ms* asks for a number n and produces n copies of each spectrum, adding a new z0 coordinate (0, 1, … n−1) to distinguish them. Useful for building a reference structure before assigning different y values to each copy.

File-level operations

Command Action
mfj Merge files end-to-end (concatenate spectra)
mfj+ Merge files, adding z = source file index
mfjp Merge files pointwise (concatenate data points per spectrum)
mr- Remove a file constant

mfjp — pointwise merge

mfjp merges the selected files by concatenating the data points of corresponding spectra, not the spectra themselves. All input files must have the same number of spectra and compatible x/y coordinates. The result has the same number of spectra but more data points per spectrum.

Typical use: combining the same measurement taken in two different x ranges into a single spectrum with full coverage.

Other operations

Command Action
mi Inverse interpolation: given y = y₀, find x such that y(x) = y₀
mhm Bin data into a histogram