Skip to content

Recrystallizations - fix allow for different shot nb per datapoint#101

Draft
FlorenceBerterottiere wants to merge 49 commits into
mainfrom
fix/recrystallizations
Draft

Recrystallizations - fix allow for different shot nb per datapoint#101
FlorenceBerterottiere wants to merge 49 commits into
mainfrom
fix/recrystallizations

Conversation

@FlorenceBerterottiere

Copy link
Copy Markdown
Collaborator

This allows us to run with different numbers of shots for each datapoints (some shots are retaken, if a recrystallization occurs). Fix is in commit f066f3b, the rest are other commits to be able to run it with fitting + recent fixes + TTL.

antti-ethz and others added 30 commits March 19, 2026 10:24
This replaces the filelock mechanism by the hdf5 builtin lock mechanism
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Florence Berterottiere and others added 12 commits May 18, 2026 15:00
Adds server-side control of the 32 Zedboard FPGA TTL output channels.
Each channel can be set to OFF (forced LOW), ON (forced HIGH), or CONTROL
(pulse-sequence driven) using the ttlMasks / setTTLMasks RPC calls. Mask
state is persisted to SQLite so it survives hardware power cycles.

Changes:
- TTLController (pydase.DataService) registered on APIService as .ttl
- TTLRepository + ttl_mask_states SQLite table (alembic migration)
- HardwareController.get_ttl_masks() / set_ttl_masks() wrappers
- HardwareConfig.n_ttl_channels config field (default 32)
- 19 unit tests covering mask encode/decode and controller logic
- docs/ttl_server_implementation.md design reference

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…utton UX

Adds a dedicated /ttl page with 32-channel grid. Each channel mirrors ionizer's
ControlButton (blue=FPGA, grey=manual) + StateButton (green=ON, red=OFF) layout.
StateButton retains its value when in CONTROL mode and applies it on switch-back,
matching ionizer behaviour exactly.

Also adds server-side label persistence (TTLController.get_labels/set_label,
labels column on ttl_mask_states via migration b2c3d4e5f6a1). Labels are
editable inline via double-click and persisted to SQLite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Points down_revision to the actual HEAD of main's migration chain
instead of the branching point fc9af856df20.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@FlorenceBerterottiere FlorenceBerterottiere self-assigned this May 20, 2026
@FlorenceBerterottiere FlorenceBerterottiere changed the title Fix/recrystallizations Recrystallizations - fix allow for different shot nb per datapoint May 20, 2026
Florence Berterottiere and others added 7 commits May 20, 2026 20:57
useMemo in HistogramPlot depended on categories/seriesData computed outside
it, so new object references on every render meant the memo never skipped.
Move all computation inside the memo and filter NaN values from shot arrays
(padding added when recrystallized shot count exceeds the HDF5 dataset width).

Also remove three references to ExperimentDataRepository.LOCK_EXTENSION in
standalone fit functions that were missed when the attribute was deleted in
the h5_open refactor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two separate O(N * data_points) operations ran on every incoming data point,
causing the browser to freeze progressively:

1. HistogramPlot searched for the latest shot array by iterating all
   accumulated data-point keys on every update. Track latestShotData
   (Record<channel, number[]>) in useExperimentData instead and pass it
   directly to HistogramPlot, making the histogram O(N_shots) regardless
   of how many points have been collected.

2. autoYBounds in JobView iterated every result-channel value on every update
   (unbounded scan). Track resultBounds incrementally in the hook so the
   windowSize=null case is O(1) per update; the windowed case scans only
   the last windowSize points (bounded).

Also replace O(N) Object.values(firstChannel).length with total_data_points
for the dataLength lookup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Points in a centred scan arrive in centre-out order. ECharts draws
lines connecting data points in array order, causing zigzag artefacts.

Sort fullDataSet (and per-repetition repData) by x-value after
building them in buildResultChannelChartSeries, and apply the same
sort in the windowed live-display path in ResultChannelPlot.

As a side-effect this also makes the lttb downsampling algorithm
work correctly, since it assumes x-ordered data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e so as to have always the max contrast for 2D scans
…an mode, where the center value is the previously calibrated value and the span is provided by the user
Adds a `timeout` field to `HardwareConfig` (default 5 s) and threads it
through to the hardware controller connection, preventing indefinite hangs
when the instrument is unreachable. Also silences the pycrystal library
logger to ERROR to reduce noise.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

3 participants