Reference Data
The Reference Data window (menu Help → Reference Data, shortcut Ctrl-R) collects the small reference tools that do not belong to any particular experiment: a periodic table with nuclear data, an experiment-time planner and a set of programmable calculators. The window is non-modal — it can stay open next to the Experiment Editor while an experiment is running.
Tab |
Contents |
Periodic Table |
Clickable periodic table. Selecting an element lists its isotopes with nuclear spin, gn, Larmor frequency at the chosen magnetic field, natural abundance and quadrupole moment. |
Experiment Planner |
Estimates the duration of an experiment from the number of points in up to three dimensions, the number of shots, the repetition time and a percentage overhead. |
Formulas |
The programmable calculator described below. |
The Formulas tab
Introduced in version 3.8.5
A formula is a set of named scalar variables tied together by one equation — for example the EPR field, the microwave frequency and the g-factor. The tree on the left lists all available formulas grouped by topic; selecting a leaf builds the input panel for that formula on the fly and shows the formula's description in the Help box underneath.
Every variable occupies one row of the panel: a caption, a unified edit control carrying the variable's unit, range and resolution, and — for variables that can be solved for — a = toggle button. The pressed toggle marks the output: the value that is recalculated whenever any other field on the panel changes. Press a different toggle to invert the calculation and solve for that variable instead. Variables shown read-only carry no toggle; they are derived read-back values (for example beta in the Qoc formula, or the dBm reading next to a power in watts) and are recomputed after every change.
Nothing about a formula is hard-coded in the program: the panel, the units, the limits and the equations all come from a data description (see below). Adding a formula therefore requires no new version of SpecMan4EPR.
Each formula remembers the values you entered, the variable solved for and its option, also across restarts (section [Formulas] of SpecMan4EPR.ini; only values that differ from the defaults are kept). Reset this formula to its defaults in the right-click menu of the tree brings back the built-in values.
Adding your own formulas
User formulas are read at start-up from the optional file cfg\formulas.json next to SpecMan4EPR.exe. The file is merged after the built-in list: it never replaces the built-in formulas, it only appends to them, and a missing or malformed file is silently ignored. Formulas with a group that already exists join that branch of the tree.
The file is a single object with one formulas array. Each entry describes one tree leaf:
Key |
Meaning |
group |
Caption of the tree branch the formula is filed under. Entries sharing a group are collected under one node. |
name |
Required. Caption of the tree leaf. An entry without a name is skipped. |
help |
Text shown in the Help box when the formula is selected. |
constants |
Object of named numeric constants (for example |
vars |
Required. Array of variables, one panel row each, in display order. An entry with no usable variable is skipped. |
Each element of vars describes one variable. All keys except sym are optional; defaults are given in brackets.
Key |
Meaning |
sym |
The name the variable has inside expressions. Keep it short and unique within the formula ( |
caption |
Label displayed above the edit control. |
unit |
Unit shown by the edit control. Standard SI prefixes may then be typed into the field (see Unified Edit Control). |
value |
Initial value [0]. |
lsd |
Last significant digit, as a power of ten — it fixes how the value is displayed and rounded [0]. |
min, max |
Allowed range of the input [±1e30]. |
inc, minInc |
Spin-button step and the smallest step the modifier keys can reach [1 and 1e-6]. |
solve |
The expression that produces this variable from the others — the equation already rearranged for it. Its presence is what makes the variable computable. |
derived |
|
How the role of a variable is decided. No symbolic inversion is performed — every solvable variable carries its own rearranged expression, so the three roles follow directly from the two keys above:
Keys |
Role |
no |
Input — editable, never recomputed, no toggle button. |
|
Output — joins the toggle group; the one selected toggle is recalculated when another field changes. |
|
Derived — read-only, recomputed on every change, in declaration order. |
The toggle initially pressed is the last output variable declared. A formula with no output variable at all is a pure forward calculator: only its derived rows are updated.
Expression syntax
The solve expressions are evaluated by a small arithmetic parser belonging to the calculator itself — it is not the PPL expression engine and knows nothing about devices or experiment variables.
Element |
Supported |
Operators |
|
Functions of one argument |
|
Functions of two arguments |
|
AWG hrepeat body |
Introduced in version 3.8.17 awgbody(dt, step, minblock, f, tol): the number of samples (sampling time dt) in the shortest hrepeat body an AWG plays as one looped block — a multiple of step samples, at least minblock — that holds a whole number of periods of the carrier frequency f to within tol degrees per pass (0: exact). Every pass of a hardware loop is a copy of the first, so the carrier phase slips by the fraction of a period left over at each pass. The built-in formula AWG → hrepeat body for a carrier (and its twin hrepeat body for a carrier (sampling frequency), which takes the sampling frequency instead of the sampling time, as awgbody(1/fs, ...)) use it and also show the body length, the number of carrier periods and the remaining slip per pass. |
Names |
The |
Angles are in radians. An expression that cannot be parsed, refers to an unknown name or leaves the domain of a function (a negative sqrt, a division by zero) simply produces no update — the field keeps its previous value instead of showing an error.
Example
A two-variable converter between a vacuum wavelength and a frequency, filed under a new Optics branch of the tree. Either field can be made the output by pressing its = button:
{
"formulas": [
{
"group": "Optics",
"name": "Wavelength and frequency",
"help": "Vacuum wavelength against frequency.",
"constants": { "c": 2.99792458e8 },
"vars": [
{ "sym":"L", "caption":"Wavelength", "unit":"m", "value":1e-3, "lsd":-9,
"min":1e-9, "max":1, "minInc":1e-9, "inc":1e-6, "solve":"c/F" },
{ "sym":"F", "caption":"Frequency", "unit":"Hz", "value":3e11, "lsd":3,
"min":1e6, "max":1e16, "minInc":1e3, "inc":1e9, "solve":"c/L" }
]
}
]
}
Saving and loading definitions
A right click on the formula tree opens a menu with three commands:
Command |
Action |
Save this formula as... |
Writes the selected formula to a |
Save all formulas as... |
Writes the whole current list, built-in formulas included, to one file. |
Load formulas... |
Reads a |
Values entered on a panel are not preserved: every formula starts again from the value given in its definition.
See also

