edfcore 0.5.15 → 0.5.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -109,5 +109,5 @@ export declare const SIGNAL_FIELD_BLOCK_OFFSETS: {
109
109
  readonly reserved: 224;
110
110
  };
111
111
  /** Published package version. Kept in sync with package.json by a test. */
112
- export declare const VERSION = "0.5.15";
112
+ export declare const VERSION = "0.5.17";
113
113
  //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -79,5 +79,5 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
79
79
  reserved: 224,
80
80
  };
81
81
  /** Published package version. Kept in sync with package.json by a test. */
82
- export const VERSION = '0.5.15';
82
+ export const VERSION = '0.5.17';
83
83
  //# sourceMappingURL=constants.js.map
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,59 @@ alone does not tell you whether you were affected.
6
6
  edfcore is pre-1.0. Patch releases have carried behaviour changes where the old behaviour was a
7
7
  defect; those are called out below.
8
8
 
9
+ ## 0.5.17
10
+
11
+ - **Added** the record onsets that quietly stop being true when a read is narrowed to a secondary
12
+ annotations signal. EDF+ permits several and reserves timekeeping to the first;
13
+ `annotations.md` documents the consequence in a sentence that reads like a footnote: "Leaving out
14
+ the file's first annotations signal means no timekeeping TAL is read at all. Every entry of
15
+ `result.recordOnsetTicks` then falls back to the nominal grid, and no diagnostic is emitted for
16
+ it."
17
+ - On an EDF+D file that is the difference between the truth and a fiction. The same page calls
18
+ `recordOnsetTicks` "the primitive every timeline in edfcore is built from", and
19
+ `{ signalIndices: [2] }` — a narrowing a caller reaches for to make a read cheaper, or because the
20
+ events they want are on the second channel — turns it into `recordIndex * recordDuration` for a
21
+ file whose records are nowhere near that. The fixture has a five-second hole after record 1, so
22
+ the true onsets are 0, 1, 7, 8 s and the narrowed read returns 0, 1, 2, 3 s.
23
+ - Nothing throws and nothing is logged: `diagnostics` is empty in both readings, the array has the
24
+ right length and the right type, and the events of the second signal come back byte-identical to
25
+ the ones a full read returns. Only the onsets are wrong, which is why this is worth a test rather
26
+ than a sentence. The page's remedy — read them all — is asserted to recover them.
27
+ - The two refusals the same option reaches are checked with it: a plain `RangeError` for a data
28
+ signal, compared word for word against the transcript the page prints, and
29
+ `EdfChannelNotFoundError` carrying `selector` and `availableLabels` for an index the file does not
30
+ have. `isEdfError` tells them apart, which is the distinction the page draws — parsing samples as
31
+ text is a caller's mistake and never a file's.
32
+
33
+ ## 0.5.16
34
+
35
+ - **Added** the last program on `annotations.md`, run. That page ends with the conversion it exists
36
+ to teach — an event onset to a sample index, in integers, because `Math.round(onset * sampleRateHz)`
37
+ drifts and the rate is `undefined` outright when the record duration is zero. It is thirty lines,
38
+ it prints two lines of output, and it is the thing a reader copies. `annotations-page.test.ts`
39
+ runs the top of the page and stops before it.
40
+ - The fixture is the page's own file, reconstructed from numbers the page already prints elsewhere
41
+ on it: `region.recordByteOffset` is 768, so the data signals hold 384 two-byte samples a record,
42
+ and the worked example's `256n` at one second fixes `EEG Fpz-Cz` at 256 of them, leaving 128 for
43
+ the second channel. One fixture now produces the four-event transcript at the top and the two
44
+ output lines at the bottom, both compared against text read out of the page.
45
+ - The printed float turns out to be load-bearing. `0.007629510948348211` is `bitValue * offset` on a
46
+ ±500 µV signal against the standard 16-bit digital range — the physical value of digital zero,
47
+ which is the first sample of every record — and it is printed twice because both events land on a
48
+ record boundary. It is asserted as that expression rather than as sixteen copied digits.
49
+ - Four claims in the prose under the program are checked with it. The `floorDiv` the page tells you
50
+ to write is compared character for character against the body of `floorDiv` in `src/tal/ticks.ts`.
51
+ Step 4's own recommendation — that `firstSampleIndex` comes back as `recordIndex x samplesPerRecord`
52
+ — is asserted rather than assumed. The floor "matters for negative onsets" is checked off the
53
+ sample grid, where the sentence has content: the page's own `-0.75` is an exact multiple at 256
54
+ samples a second, so both roundings agree on it, and a `-0.7501` onset is where truncation lands
55
+ one sample later, toward the file start, exactly as the page says.
56
+ - The Warning at the end is checked too, and it is the sharpest of the four. On an EDF+D file with a
57
+ five-second hole the formula answers for an instant inside it with `640n` — an ordinary index,
58
+ well inside the samples the file holds — while `index.locate(2.5)` correctly returns `undefined`.
59
+ For an instant past the gap that IS in the file, the formula names record 7 in a four-record file
60
+ and the scanned index names record 2.
61
+
9
62
  ## 0.5.15
10
63
 
11
64
  - **Added** direct tests for `floorDiv` and `ceilDiv`, which had none. `tal/ticks.ts` owns them, and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.5.15",
3
+ "version": "0.5.17",
4
4
  "description": "Modern, typed, zero-dependency reader for EDF, EDF+, BDF and BDF+ biosignal files. Works in browsers and Node with true random access.",
5
5
  "keywords": [
6
6
  "edf",
package/src/constants.ts CHANGED
@@ -93,4 +93,4 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
93
93
  } as const;
94
94
 
95
95
  /** Published package version. Kept in sync with package.json by a test. */
96
- export const VERSION = '0.5.15';
96
+ export const VERSION = '0.5.17';