You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Group per-channel header fields into coherent signal metadata #744
Record stores per-channel header fields in parallel lists: sig_name, file_name, fmt, units, samps_per_frame, adc_gain, baseline, and others. Their entries must remain aligned with each other, the signal array columns, and n_sig as records are selected, edited, and written.
Decisions to make
Should logical signal metadata and signal-file layout/encoding metadata be separate objects? Which fields belong to each?
How should the model represent several signals sharing a file, and variable-layout multi-segment records?
Should counts and name lists be derived from channel entries? How would legacy in-place edits such as record.sig_name[0] = "ECG" remain compatible?
Should omitted header defaults, such as one sample per frame, be normalized to explicit values when read? When should type checks and cross-field validation happen?
One concrete case to include when deciding whether counts should be derived: after read_record("sample-data/100", stop=4), assigning record.n_sig = 5 makes record.metadata.n_signals report 5, but record.write(...) writes a two-channel header. Conversely, slicing record.p_signal down to one column leaves both counts at 2, and record.write(...) fails with a NumPy broadcasting error. I reproduced both cases while reviewing #802.
I removed the proposed writable n_signals alias from #802 so the new name does not inherit this ambiguity. A future count API should decide which value is authoritative when several signal arrays are loaded, and make Record.metadata and writing behave consistently with that decision. This fits the count and cross-field validation questions already tracked here.
One remaining writer case for this issue: Record.wrsamp() still raises NumPy's non-broadcastable output operand error after a loaded two-channel p_signal is sliced to one column without updating the per-channel fields. I reproduced it with read_record("sample-data/100", stop=4). PR #803 improves validation and diagnostics for write_record() and Record.write(); the legacy writer's validation path still needs a separate compatibility review.
We have settled the count contract for this part of the work. n_sig is the mutable, declared channel count for the current record view. In #805, n_signals is an alias for that same stored value, and each access to Record.metadata takes a fresh snapshot of it. The count is not inferred from a loaded array: a record may be header-only or hold more than one signal form.
Edits can leave the declaration, arrays, and per-channel lists temporarily inconsistent. #803 and #804 make the single-segment writers reject those inconsistencies before writing. #805 adds a check that a MultiRecord master count agrees with its fixed-layout segments or variable-layout header. The larger question of grouping per-channel fields into a coherent metadata model remains open here.
Activity
Group parsed fields by signal line (#755)
tompollard commentedon Nov 30, 2026
One concrete case to include when deciding whether counts should be derived: after
read_record("sample-data/100", stop=4), assigningrecord.n_sig = 5makesrecord.metadata.n_signalsreport 5, butrecord.write(...)writes a two-channel header. Conversely, slicingrecord.p_signaldown to one column leaves both counts at 2, andrecord.write(...)fails with a NumPy broadcasting error. I reproduced both cases while reviewing #802.I removed the proposed writable
n_signalsalias from #802 so the new name does not inherit this ambiguity. A future count API should decide which value is authoritative when several signal arrays are loaded, and makeRecord.metadataand writing behave consistently with that decision. This fits the count and cross-field validation questions already tracked here.Add signal_names alias to Record and MultiRecord (#802)
tompollard commentedon Nov 30, 2026
One remaining writer case for this issue:
Record.wrsamp()still raises NumPy'snon-broadcastable output operanderror after a loaded two-channelp_signalis sliced to one column without updating the per-channel fields. I reproduced it withread_record("sample-data/100", stop=4). PR #803 improves validation and diagnostics forwrite_record()andRecord.write(); the legacy writer's validation path still needs a separate compatibility review.Validate record channel counts before writing (#803)
Validate selected channels before legacy record writes (#804)
tompollard commentedon Nov 30, 2026
We have settled the count contract for this part of the work.
n_sigis the mutable, declared channel count for the current record view. In #805,n_signalsis an alias for that same stored value, and each access toRecord.metadatatakes a fresh snapshot of it. The count is not inferred from a loaded array: a record may be header-only or hold more than one signal form.Edits can leave the declaration, arrays, and per-channel lists temporarily inconsistent. #803 and #804 make the single-segment writers reject those inconsistencies before writing. #805 adds a check that a
MultiRecordmaster count agrees with its fixed-layout segments or variable-layout header. The larger question of grouping per-channel fields into a coherent metadata model remains open here.Add n_signals alias for declared record channel count (#805)
Add n_frames alias for record frame count (#808)
Add samples_per_frame alias to Record (#809)
Use on-demand channel views for record selection (#840)
Separate current storage fields from logical metadata (#841)
Reject new skew when writing aligned signals (#842)
Use a channel snapshot throughout header writes (#845)
Calculate channel defaults from one snapshot (#847)
Use one channel snapshot for header and signal writes (#848)
Expose grouped current channel metadata (#850)