Skip to content
Session 2: Inspect and plot data files

Session 2: Inspect and plot data files

In this session we familiarize ourselves with the command-line interface, read demo files from disk, inspect their contents, and learn how to plot.

Test data

All sessions use the same test data set, located in demo/testdata1/ in the Frida source tree.

The five files are measurements from the neutron backscattering spectrometer SPHERES. They contain incoherent neutron scattering spectra of glycerol (a glass-forming liquid) at five different temperatures, expressed in the file names gly180, gly200, …

Load files into memory

Launch Frida in the directory that contains the test files.

Command Action
> h Print program version, explain one-letter commands, list command group initials
> fl gly??? Load all files matching the pattern (bash expansion)
0:4 > The prompt now shows files 0–4 are selected

Inspect files

Command Action
0:4 > d List all commands starting with d
0:4 > df List files in Frida’s internal memory
0:4 > dr List sample temperatures (one rpar per file)
0:4 > 0 Change default selection to file 0
0 > dd Show the file history (documentation log)
0 > 1 dd Same for file 1
1 > dc Show coordinate meanings for x, y, z0

In this example the tabular structure y(x, z0) holds a neutron scattering law S(E, q): energy E is x, wavenumber q is z0, and scattering intensity S is y.

Command Action
1 > dz For each spectrum: show z entries and the x range

Here we have 14 wavenumbers q, each with a spectrum S(ω) from −14 to 14 μeV consisting of 351 data triples x-y-dy.

Plot spectra

File 0 (gly180) is the instrumental resolution function — a good first plot example.

Command Action
1 > 0 p 0 Plot spectrum 0 of file 0 (use mouse or Ctrl-Space to return to the terminal)
0 > a 1 Add spectrum 1 to the plot
0 > a 2 Add spectrum 2 (y scale may be wrong)
0 > ga Auto-range: let the next plot determine the range
0 > p 0:2 Replot — all data now fit the range
0 > pr 5:9 Plot spectra 5–9 with fresh auto-ranges (shorthand for ga + p)
0 > pr : Plot all spectra of file 0
0 > gx -5 5 Set x range to [−5, 5]
0 > p : Replot with new x range
0 > gya Reset y range for auto-determination on next plot
0 > 4 p : Plot all spectra of file 4
0 > gy 0 40 Fix y range to [0, 40]
0 > 0:4 p 6 Plot spectrum 6 for all five files
0:4 > g List all graphics commands
0:4 > gw List plot windows (active window marked with *)
0:4 > g2 Switch to plot window 2 (linear x, logarithmic y)
0:4 > p 6 Plot spectrum 6 in log-y
0:4 > gp Save current plot to a PostScript file
0:4 > quit Terminate the Frida session