Skip to content

Fix wrong numbers in four-point and van der Pauw files - #30

Merged
PEEKPerformer merged 28 commits into
stack/27-trial-fixesfrom
stack/28-lab-data-fixes
Nov 16, 2026
Merged

PEEKPerformer merged 28 commits into
stack/27-trial-fixesfrom
stack/28-lab-data-fixes

Conversation

@PEEKPerformer

@PEEKPerformer PEEKPerformer commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Lab four-point files from a 2420 held numbers that were wrong while looking fine. A review of the measurement path that followed found more of the same kind. This PR fixes them and ports the four-point current finder, which this branch never had.

  • Rows record the programmed source level. With one function sensed, the other element of a reading is not a measurement. Rows took it for an echo of the source level. In the lab's 1.13.1 files it approached the setpoint by a fixed fraction per reading (20 % on the first row) while V was steady, so V/I began five times too high and a 20-sample run averaged 55 % high. Four-point, source-I and source-V rows now use the level that was sent.
  • F84 sheet resistance needs no thickness. With a sample dimension and no thickness, Rs was ρ / t = NaN in every row.
  • The geometry factor uses the closed form outside the tables. F84 Table 3 was clamped at its last row for S/D > 0.10 (25 % high for a 5 mm disc). Squares and rectangles were interpolated between sparse Smits rows (up to 1.6 % low) and flat above D/s = 40. A sample the probe does not fit on has no factor.
  • Uncertainties use the range the run was on when auto range is off, and the source specification for the four-point current.
  • A van der Pauw result is marked invalid when its readings are. A run with every reading in compliance reported a clean, homogeneous result; two geometries with reversed sense leads halved Rs with every check passing. The result carries valid and invalid_reason through the file, the event, both UIs and the run summary. Rows gain a compliance column. The statistical uncertainty comes from the reciprocal pairs.
  • The file header says how the rows were made: the averaging filter, the four-point method and its inputs, delta mode, the cable null. Every footer has end_reason. CSV floats have ten significant digits.
  • Timing. The sampling period no longer includes the read time, elapsed_s is the middle of the read, read timeouts are sized from the settings, and a sweep over 2500 points is refused before anything is sent.
  • Settings. A user's stored keys are layered over the shared settings key by key. Every tab value is loaded on a user switch, and a Settings save no longer resets values typed on a tab. Export Summary writes the run's own values.
  • Four-point current finder (fpp_autoselect_current, off by default), ported from 1.13.0 to the session layer so the window, the API and the desktop app all have it. It never reads the current back from the instrument, discards readings after a range change, caps the selected voltage at half of compliance, and asks before running at a limit.
  • Sweeps, from the bench. A downward sweep sent a positive step, which a 2420 refuses, keeping the step of its reset point count (2500): five points from 0.5 V to 0 V stepped by 0.2 mV. A sweep's step delay was replaced by auto delay. Both fixed, and the corrected sequences replayed on the instrument.
  • A setting the instrument refuses now stops the run (configure_failed, with the instrument's messages) before the output comes on. A 2420 asked for 100 V stayed at 0 V and ran, under a header that said 100 V.
  • Smaller fixes: the rate preview was halved outside resistance mode; the current finder could start a run past the power stop; an overflow reading tripped the power stop; the runtime power warning repeated on every row; a 1 µA run was named 0.00mA.
  • The desktop app saves where the user chooses, by default Documents/ResistaMet. An installed build wrote to %APPDATA%\edu.uconn.adamson.resistamet\measurement_data, a hidden folder the lab found only by searching. It asks at first launch and shows the folder under Settings ▸ Files & output.
  • The backend has its own version, 2.0.0rc4, and the desktop app carries the same build as 2.0.0-4. It was held equal to CITATION.cff, so 2.0 development builds stamped files with a 1.x version. The citation stays at the last release.
  • Desktop CI runs the Rust shell's 33 unit tests, which nothing ran, and fails when a build changes Cargo.lock. The Tauri JavaScript packages move to 2.12 with the crate.
  • Desktop 2.0.0-4, with a dialog for the current finder's Proceed/Abort question and the selected current shown during a run. CI no longer runs Python 3.9 on Ubuntu, which ubuntu-latest (26.04) cannot install, and three tests that raced the run they were watching now wait for it.
  • main is merged in. The branch forked before 1.13.0; it now has the logo, the window icon and version 1.13.1. Take the 1.13.0 current finder out of the Qt worker #31 at the bottom of the stack takes the 1.13.0 finder out of the Qt worker so the stack applies to main.

Stack

Part 28 of 28, the last. Targets stack/27-trial-fixes. Merge bottom-up with Rebase and merge. This PR's tree is phase0/reviewable-baseline (d67e9a6) exactly.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing behavior to change)
  • Documentation only
  • CI / build / packaging only

Hardware testing

  • Tested against real hardware
  • Tested against software-only path
  • Not applicable

On a Keithley 2420 (firmware C30), with the output off throughout (2026-11-16): every configure sequence in tests/goldens/scpi was replayed and the error queue read after each command. All 16 leave it empty. The same session established the sweep findings above, that a trigger count above 2500 is refused, that :SENS:RES:RANG is accepted in manual-range resistance, and that an out-of-range source level is refused with -222 and leaves the level at 0 V. The simulator now refuses what the instrument refused.

Not run on an instrument, because they need the output on and a sample:

  • The current finder's probe and hand-over. Its three discarded readings and its 50 % compliance headroom are judgement, not measurement.
  • A four-point delta run or van der Pauw run whose profile asks for a moving filter, which now sends :SENS:AVER:TCON REP.
  • Why the un-sensed current element lagged in the lab's 1.13.1 files. The fix makes it harmless; the cause is not known. It did not appear in eight files written by the desktop app, which had no pre-run probe.

Test suite

  • QT_QPA_PLATFORM=offscreen pytest tests/ -v passes locally — 4344 passed, 51 skipped, 13 xfailed (desktop 167/167)
  • Added new tests for new behavior, or explained why none are needed

Every commit passes on its own, apart from the API, GPIB-driver and end-to-end suites, which were run on the last commit and in CI.

How to verify:

QT_QPA_PLATFORM=offscreen pytest tests/ -v
pytest tests/test_recorded_values.py tests/test_file_record.py tests/test_run_timing.py tests/test_vdp_validity.py tests/test_session_current_finder.py tests/test_sweep_setup.py tests/test_rejected_settings.py -v
cd desktop && npm ci && npm test && npx tsc --noEmit

Behaviour change

  • Data files:
    • I, I_set and V_set hold the programmed level; four-point I_unc_A is the source accuracy.
    • Floats have ten significant digits; elapsed_s is the middle of the read.
    • Headers gain filter.*, and for four-point params.method, diameter_cm, geometry, temperature_c, dopant_type, delta_mode, autoselect_current; resistance gains params.cable_null_ohm. Footers gain end_reason.
    • Sweep and van der Pauw headers lose sampling_rate_hz and settling_time_s.
    • van der Pauw rows gain compliance; the footer gains vdp_result.valid, invalid_reason, compliance, compliance_readings.
  • Four-point numbers: F2 changes for a circle with S/D > 0.10 and for every square and rectangle (by up to 0.06 % at a Smits row, more between rows). Rs on the F84 path with no thickness is a number, not NaN.
  • van der Pauw: a result with a reading in compliance or with sign-inconsistent readings is invalid; a single overflow reading ends the run after that geometry; one failed row write ends the run.
  • Filter: delta and van der Pauw runs use a repeat filter whatever the profile says.
  • Sampling: a run samples at the rate asked for where the instrument can deliver it.
  • Sweeps: a downward sweep steps by the amount asked for, and a sweep's step delay is the one in the header. A sweep no longer sends :SOUR:DEL:AUTO ON.
  • Every mode: a run whose configuration the instrument refuses does not start.
  • File names: a four-point run below 5 µA is named in microamps (1.00uA).
  • Desktop app: data goes to the chosen data folder, not the application-data directory. Files written by 2.0.0-1 to 2.0.0-3 are not moved.
  • Versions: software_version in a file is the backend's own (2.0.0rc4), no longer the citation's.
  • Settings: a user who has stored any setting now gets the shared values, not factory defaults, for the keys they never stored.
  • Export Summary: the file's rows and columns change (run settings, sample and excluded counts).

Checklist

  • My changes follow the existing code style
  • I have updated README.md / version history if user-visible
  • I have read the CONTRIBUTING guidelines

A user with any stored section got factory defaults for every other
section, not the shared settings. Storing one key was enough: ticking
"Don't show this again" on the voltage warning moved the next run's
data to the default folder and turned compression off.

Effective settings are now the factory defaults, then the shared
section, then the user's stored keys, merged per key. The machine-local
keys are still applied last.
F84 Table 3 ends at S/D = 0.10, and its last row, 4.171, was returned
for every smaller disc: 25 % high for a 5 mm disc on a 1.016 mm probe.
A circle past the table now uses the image solution the table was
computed from.

Squares and rectangles used straight lines between the sparse rows of
the Smits table, up to 1.6 % low, and the D/s = 40 value for anything
wider. They now use the image series at every size. The printed rows
agree with it to 6 parts in 10 000.

A sample the probe does not fit on has no factor. It was given the
value of the smallest tabulated sample.
With one function sensed, the other element of a reading is not a
measurement. The rows took it for an echo of the programmed source
level. On a 2420 it was not one: after the level changed it approached
the setpoint by a fixed fraction per reading, 20 % of it on the first
row, while the measured voltage was steady. Four-point V/I started
five times too high and a 20-sample run averaged 55 % high. Four-point,
source-I and source-V rows now record the level that was sent.

Three more ways a row held a number that was not what it claimed:

- On the F84 path the sheet resistance was rho / t, which is NaN with
  no thickness entered. It is F2 * V/I when there is no thickness.
- With auto range off, the accuracy lookup inferred the range from the
  reading while the instrument sat on the range that holds the
  compliance value: 1 mV on the 20 V range was given the 200 mV
  range's specification. The lookup now takes the pinned range.
- The four-point current is sourced, and its uncertainty came from the
  measurement table. It now comes from the source table, in the rows
  and in the per-spot instrument floor.

An overflow reading (9.9e37) no longer yields a resistance or an
uncertainty.
Two four-point files with identical headers held different numbers,
one of them NaN in every row, and nothing in either said why. The
header left out what decides how a row is acquired and computed.

The header now records:

- the averaging filter as sent: enabled, and when it is, type and count
- for four-point, the method (f84 or legacy) and the inputs that choose
  it: diameter, geometry, temperature, dopant type; and delta mode
- for resistance, the cable null subtracted from R_ohm

Sweep and van der Pauw headers lose sampling_rate_hz and
settling_time_s, which neither mode uses.

Every footer gains end_reason. The marker above it reads "run
completed" for a run that ended on a read error too.

CSV floats are written with ten significant digits, as the HDF5 writer
does. Six dropped the instrument's last digit, and wrote an elapsed
time past 28 h to the whole second.

A four-point delta run and a van der Pauw run send a repeat filter
whatever the profile asks for. A moving filter would average the two
polarities of one reading together.
The next reading was scheduled from when the last one came back, so
the read time was added to every period: 10 Hz asked for with a 50 ms
read ran at 6 Hz. It is now due one interval after the last was
requested. A row's elapsed_s is the middle of the read that produced
it, not the moment of the request.

The VISA timeout was a flat 5 s, and 1 s per point for a sweep. Slow
settings (10 PLC averaged ten times with auto-zero is 5 s a reading)
timed out every read and the run ended with no rows. Both are now
sized from the timing model: three readings for a sample, and every
point's conversions plus its step delay for a sweep's bulk read.

After a failed sweep read the instrument is sent a device clear and
:ABOR, since its sweep engine may still be stepping the source.

A sweep of more than 2500 points is refused before any command is
sent. The trigger count cannot hold more; the instrument rejected it,
kept a count of 1, and the log called the one point a completed sweep.
A run with every reading in voltage compliance finished as a normal
result: 22 662 ohm/sq, homogeneous, completed, with nothing in the
file to say the voltages were the limit and not the sample. Two
geometries with the sense leads reversed halved the sheet resistance
with every check passing, because Q took absolute values and the sum
did not.

A result now carries valid and invalid_reason. It is invalid when any
reading was in compliance (status bit, or at 99 % of the limit) or
when the readings disagree in sign. The numbers are kept for
diagnosis, homogeneous is false, and the resistivities are NaN where
the sheet resistance is. Rows gain a compliance column and the footer
names the readings.

The Qt panel, the vdp_result event, the desktop view and the run
summary all say INVALID with the reason. The summary used to report
such a run as not homogeneous at 0 % asymmetry.

Also in the van der Pauw run:

- Each raw reading is checked for overflow before averaging. One
  9.9e37 among five slipped past as a mean of 2e37.
- A row the file does not take ends the run as write_error.
- The statistical uncertainty is taken between the two readings of
  each reciprocal pair. It was the scatter of all four resistances,
  which differ by Q on any sample that is not square: 31 % on a
  noiseless Q = 3 sample.
- With auto range off, the instrument term uses the pinned range.
- The thickness box holds 1 nm. At six decimals of a centimetre a
  15 nm film was rounded to 20 nm.
A spot whose mean was NaN printed "Inter-spot RSD: nan%", and one
whose SD was NaN raised "Axis limits cannot be NaN or Inf". Such a
spot keeps its place on the axis and is left out of the range and of
the annotation.
Switching user left the previous user's values in any tab widget the
loader did not know: four-point delta mode and its settling, and the
whole sweep tab. The next run used them under the new user's name.

Saving the Settings dialog reloaded the stored profile into the tabs
and wiped what the operator had typed there. A four-point thickness or
diameter going back to 0 changes which formula the run uses.

One table of setters now covers every widget gather_settings_for_mode
reads, and a test fails by name for a widget that has none.

- Selecting a user sets every tab widget from that user's profile.
- A Settings save changes only the tab widgets whose value changed in
  that save.
- Load Profile restores every key Save Profile writes. It dropped the
  F84 inputs, delta mode, the sample count and the power limits.
- The cable-null label reads the value a run would apply. It showed a
  null after the applied value had gone back to 0, and OFF for a null
  stored in the profile.
Export Summary recomputed the results from the tab's widgets at export
time, with the legacy formula whatever the run had used, and averaged
the raw V/I of compliance rows that the run's own statistics leave
out. A saved spot with no value in a column was written as a mean of 0.

The export and the saved-spot table now take Rs, rho and sigma from
the rows the run produced, the header from the settings the run
started with, and the statistics from session.spot_stats, so
compliance rows are excluded and counted and a column with no value is
NaN.

The summary file changes with it: a legacy run writes K, an F84 run
writes its method, dimension, geometry, temperature and dopant type
where the model, K and alpha were, and there are rows for the sample
and excluded counts. A one-sample spot has no SD.

With auto range off, the live statistics and a saved spot's use the
range the run was pinned to, as the file's footer does.
The pre-run current finder of 1.13.0 was never on this branch, so a
profile with fpp_autoselect_current set ran at the seed current with
no word. On a 100 kOhm sample that is every row in compliance where
the release dropped to 1 uA and measured it.

The procedure is session/current_finder.py, Qt-free: a delta probe at
the requested current, a selection in calculations.py, and a
Proceed/Abort prompt through RunControl with the output off. It runs
after configure and before the file is opened, so the file name and
the header carry the current used. The Qt window gets its checkbox,
target-figures box and dialog back; the HTTP API and the desktop app
get the prompt as fpp_current_decision. The setting is off by default.

Three things differ from the release:

- The probe never reads the CURR element. R is the reversal-pair mean
  over the programmed current. The release's 1 uA re-probe divided V
  by that element one read after a range change.
- The probe drops the first reversal pair after a range change, and
  the run discards three readings after the final range and level are
  set, so the first row is not read through the probe's leftovers.
- A target the limits cannot reach asks before running, with the
  figures it can reach. It used to run at 90 % of compliance without
  asking. The selected voltage is capped at half of compliance.

The header records autoselect_current, and when it is on the requested
current and the target figures. A fpp_current_selected event reports
the choice.
The docs described rows and headers as they were: six-digit CSV
values, a current column read from the instrument, a measurement
accuracy on the sourced current, F2 from tables alone, elapsed_s at
the request, and van der Pauw rows without a compliance column.

The changelog gains the entries for the file changes, the van der
Pauw validity, the current finder and the settings fixes.
A run started from the desktop app records this version in the file
header as client.version, which is how its files are told from those
of the 2.0.0-1 build installed in the lab in September.
ubuntu-latest became Ubuntu 26.04, and setup-python has no 3.9 for it:
the job failed before it ran a test, on every push. Python 3.9 is still
tested on Windows.
…gins

The test answers each prompt a fixed half second after starting a
wait_for call, and asserts that the call waited. Each call first builds
a server and a client. On a slow runner that took longer than the half
second, the answer landed first, and the wait came back at once with
nothing left to wait for: two failures in three runs on Ubuntu with
Python 3.10, each taking the six tests after it down too.

The delay is now four times a measured call, and at least a second.
Checked on a 2420 with its output off:

- A downward sweep sent its step as a positive number. The instrument
  refuses that (-222) and keeps the step of its reset point count,
  2500, so a 0.5 V to 0 V sweep of five points stepped by 0.2 mV. The
  step is now sent with the sign that leads from start to stop.
- Auto delay was turned on after the sweep's step delay had been set,
  which replaces it with 1 ms. The header recorded the delay asked
  for. A sweep no longer sends :SOUR:DEL:AUTO ON.

The reverse leg of an up-and-down sweep was already right: swapping
start and stop keeps the point count and flips the step.

The simulator now refuses what the instrument refuses (a step away
from the stop value, a trigger count above 2500) and models the two
delay settings replacing each other. Its sweep used the step's
magnitude and the direction of the span, which is how the wrong sign
went unseen. The five sweep goldens are regenerated.
A setting the instrument refuses changes nothing and says so only in
its error queue, which nothing read after configuration. A 2420 asked
for 100 V queues -222 for the range and for the level and stays at
0 V; the run went on from there, and its header recorded 100 V.

The queue is now read once configuration is done, in every mode. If
it holds anything the run ends as configure_failed, with the
instrument's own messages, before the output comes on and before a
file is opened.

Every configure sequence a run sends was replayed on a 2420 with its
output off and left the queue empty.
Offset-compensated ohms halves the reading rate, and only a resistance
run uses it. The profile keeps the flag whatever mode runs, and the
settings preview and the run's read timeout counted it for every mode:
a four-point run on the default profile was promised 0.9 Hz where the
model gives 1.8. The Qt window already cleared the flag outside
resistance mode.
- The current finder checked its own choice against the warn level
  only. With a probe current below its 1 uA minimum, 1 uA at the
  compliance can exceed the power stop (1 uA at 200 V against 0.1 mW);
  the run started and tripped on its first row. The finder now refuses
  such a choice as the configure step refuses such a request.
- An overflow reading (9.9e37) was multiplied by the current and
  tripped the stop at 1e34 W. It is a compliance row, not a power.
- The runtime warning is logged once a run, not on every row.
The source current in a four-point file name is milliamps to two
decimals, so a 1 uA run, the current finder's minimum, was named
..._4PP_0.00mA.csv. Below the last current that form can show, the
name now gives microamps: 1.00uA.
The fpp_current_decision prompt fell through to the generic dialog,
which prints the prompt's detail as JSON. It now has its own: the
verdict as a title, the backend's reason, and the measured resistance,
probe and suggested current, expected voltage, noise floor and
significant figures against the target, with Abort and Proceed.

While a run is on, the Source current field shows the current the
finder selected. The field is disabled while auto-select is on, as in
the Qt window, and the toggle sits next to it.
The status document's four open items are brought up to date: three
are closed, by the resistivity fix of October, today's power and rate
fixes, and the lab's own files, which put the rate model within 3 %
on the 2420. The watchdog delay still needs the lab PC.

docs/outputs.md gets an example file written by the present code, with
the header keys and ten-digit rows it now has. The settings and
quickstart pages describe the four-point current finder.
The status shows a van der Pauw prompt as pending a moment before the
run logs it, and the test read the log as soon as the prompt appeared.
It failed once in CI on an empty log.
The code's version was held equal to CITATION.cff, which names the
last archived release. So every 2.0 development build stamped its
files with a 1.x software_version, the one a different program had
written, and files from the two could not be told apart by it.

The version is now the code's own: constants.py and pyproject.toml,
repeated in the README. The desktop app bundles this backend and
carries the same build in the semver spelling, 2.0.0-4; a test holds
the two together. CITATION.cff stays at the newest release with a
dated changelog entry, and is checked against that.
An installed build ran its backend in the per-user application-data
directory, and a profile's default data_directory is relative, so
every file went to %APPDATA%\edu.uconn.adamson.resistamet\
measurement_data: hidden, outside any backup, and found by the lab
only by searching the disk.

The shell now owns a data folder, the directory the backend runs in.
It is Documents/ResistaMet until the user picks another, which the
app asks for at first launch and shows under Settings > Files &
output. The choice is kept per machine in the app-data directory,
beside config.json, which stays where it was.

A chosen folder that cannot be used at launch is not replaced
silently: the backend starts in the default and the dialog says which
folder was unavailable. Changing the folder restarts the backend and
is refused while a run is in progress. Files already in the old place
are left there and the dialog shows their path.

The folder picker is tauri-plugin-dialog, called from Rust.
The Rust shell has 33 unit tests for its decisions: which backend to
launch, where data goes, when the window may close. No workflow ran
them. The desktop build now does, on both platforms.

Cargo.lock had gone stale, most recently when the folder picker was
added on a machine without cargo. The build does not pass --locked, so
it re-resolved 71 packages and built with other versions than the
ones committed, without a word. The lock file is the one that build
wrote, and the workflow now fails when a build changes it, uploading
the file to commit.
The folder picker, tauri-plugin-dialog 2.8, needs tauri 2.12, so the
lock file now holds the crate at 2.12.6 while @tauri-apps/api and the
CLI were at 2.11. The CLI refuses to build across a minor version, and
the build of the previous commit stopped there. Earlier builds passed
only because that check read the stale lock file before cargo
rewrote it.
The test averaged seven periods against a limit. On a Windows runner
the first was 0.32 s and the other six were right, and the mean went
over. The old scheduling made every period long, so the median tells
the two apart as well and does not fail on one slow start.
@PEEKPerformer
PEEKPerformer merged commit 9bd0d80 into stack/27-trial-fixes Nov 16, 2026
10 of 11 checks passed
@PEEKPerformer

Copy link
Copy Markdown
Owner Author

main was fast-forwarded to the top of this stack (348dade), so the commits of #31 and #3 through #30 are on main exactly as they appear in these PRs. Each PR was then merged into its own base branch so that it shows as merged; those stack/* branches are no longer needed.

This branch had an error being deployed

1 failed deployment
github-pages — 348dade0 Deployed Nov 16, 2026 by PEEKPerformer via Build and publish to GitHub Pages #13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant