edfcore 0.6.169 → 0.6.171
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.
- package/README.md +1 -1
- package/dist/annotations-query.d.ts.map +1 -1
- package/dist/annotations-query.js +20 -0
- package/dist/annotations-query.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/sample-grid.d.ts.map +1 -1
- package/dist/sample-grid.js +22 -6
- package/dist/sample-grid.js.map +1 -1
- package/docs/CHANGELOG.md +28 -0
- package/package.json +1 -1
- package/src/annotations-query.ts +22 -0
- package/src/constants.ts +1 -1
- package/src/sample-grid.ts +24 -8
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ for (const event of annotations) {
|
|
|
81
81
|
}
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
> **Status: 0.6.x, early.** edfcore runs 4,
|
|
84
|
+
> **Status: 0.6.x, early.** edfcore runs 4,500+ tests on generated fixtures, and it's checked
|
|
85
85
|
> against public corpora it didn't author: the EDF, EDF+ and 24-bit BDF+ test files from
|
|
86
86
|
> teuniz.net, and PhysioNet's sleep-edfx (a real 22-hour polysomnography recording and its
|
|
87
87
|
> sleep-staging file). Those checks are numeric. Channels labelled `sine 8.5 Hz` decode to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations-query.d.ts","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAwBrE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,MAAM,EAAE,mBAAmB,GAC1B,SAAS,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"annotations-query.d.ts","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAwBrE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,MAAM,EAAE,mBAAmB,GAC1B,SAAS,aAAa,EAAE,CAwD1B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GACnD,SAAS,aAAa,EAAE,CAiB1B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,SAAS,aAAa,EAAE,GACpC,aAAa,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CASlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,OAAO,EAAE,MAAM,GACd,SAAS,aAAa,EAAE,CAU1B"}
|
|
@@ -60,6 +60,26 @@ export function filterAnnotationsByTime(annotations, window) {
|
|
|
60
60
|
throw new RangeError(`filterAnnotationsByTime(): the window is ${describeValue(window)}, not an object. ` +
|
|
61
61
|
'Next: pass a window carrying startSeconds and durationSeconds.');
|
|
62
62
|
}
|
|
63
|
+
/*
|
|
64
|
+
* An ARRAY, which is an object and therefore walked straight past the check above.
|
|
65
|
+
*
|
|
66
|
+
* 0.6.167 closed this route for the reading API's selection and recorded what it costs: an array
|
|
67
|
+
* "reproduced the exact failure 0.6.79 removed — each call named whichever field it happened to
|
|
68
|
+
* read first". Here that field is `window.startSeconds`, and the advice attached to an absent
|
|
69
|
+
* bound is about "an object whose bounds are spelled something else" — which sends a reader to
|
|
70
|
+
* rename fields on a value that has none.
|
|
71
|
+
*
|
|
72
|
+
* The array a caller has in hand is the one this function's own neighbour returns.
|
|
73
|
+
* `resolveTimeWindow` is named for the window and returns the RECORD RANGES it maps to, so
|
|
74
|
+
* `const window = resolveTimeWindow(timeline, index, from, span)` reads exactly like the argument
|
|
75
|
+
* this takes.
|
|
76
|
+
*/
|
|
77
|
+
if (Array.isArray(window)) {
|
|
78
|
+
throw new RangeError('filterAnnotationsByTime(): the window is an array, and this call bounds events by time ' +
|
|
79
|
+
'rather than by record. resolveTimeWindow() returns the record ranges a window maps to, ' +
|
|
80
|
+
'not the window. Next: pass the startSeconds and durationSeconds you gave that call, on ' +
|
|
81
|
+
'an object.');
|
|
82
|
+
}
|
|
63
83
|
const from = secondsToTicks(window.startSeconds, 'window.startSeconds');
|
|
64
84
|
const to = from + secondsToTicks(window.durationSeconds, 'window.durationSeconds');
|
|
65
85
|
if (to <= from)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations-query.js","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;;;;;;;;GAYG;AACH,SAAS,iBAAiB,CAAC,WAAqC,EAAE,IAAY;IAC5E,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO;IACvC,MAAM,IAAI,UAAU,CAClB,GAAG,IAAI,2BAA2B,aAAa,CAAC,WAAW,CAAC,iCAAiC;QAC3F,0FAA0F;QAC1F,4CAA4C,CAC/C,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAqC,EACrC,MAA2B;IAE3B,iBAAiB,CAAC,WAAW,EA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AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC3B,WAAqC,EACrC,OAAe;IAEf,iBAAiB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAChD,MAAM,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,MAAM,CAClB,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE;QAChC,MAAM,KAAK,GAAG,UAAU,CAAC,yBAAyB,CAAC;QACnD,MAAM,QAAQ,GAAG,UAAU,CAAC,aAAa,IAAI,EAAE,CAAC;QAChD,OAAO,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC/E,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -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.6.
|
|
112
|
+
export declare const VERSION = "0.6.171";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sample-grid.d.ts","sourceRoot":"","sources":["../src/sample-grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"sample-grid.d.ts","sourceRoot":"","sources":["../src/sample-grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA+E/D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,MAAM,EACf,mBAAmB,EAAE,MAAM,GAC1B,iBAAiB,CAoBnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,MAAM,GAC1B,MAAM,CAUR;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,MAAM,GAC1B,MAAM,CASR"}
|
package/dist/sample-grid.js
CHANGED
|
@@ -87,6 +87,26 @@ function assertGrid(signal, recordDurationTicks, call) {
|
|
|
87
87
|
'Next: index by record with readRecords().');
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* The INDEX, named by the call the reader actually wrote.
|
|
92
|
+
*
|
|
93
|
+
* `assertGrid` above takes a `call` for exactly this reason, and `sampleStartSecondsOf` grew its own
|
|
94
|
+
* copy of a guard in 0.6.101 on the same argument: "a reader who wrote this call should not be told
|
|
95
|
+
* about `sampleStartTicksOf`". This check lived inside `gridSampleStartTicks` alone, so
|
|
96
|
+
* `gridSampleStartSeconds(signal, 1.5, d)` — the display form, which delegates one line down — was
|
|
97
|
+
* refused in the name of a function it never called.
|
|
98
|
+
*
|
|
99
|
+
* The two arguments of one call were then described by two different functions: `assertGrid` named
|
|
100
|
+
* `gridSampleStartSeconds` for a bad signal and this named `gridSampleStartTicks` for a bad index,
|
|
101
|
+
* on the same line of the same file.
|
|
102
|
+
*/
|
|
103
|
+
function assertSampleIndex(sampleIndex, call) {
|
|
104
|
+
if (Number.isSafeInteger(sampleIndex))
|
|
105
|
+
return;
|
|
106
|
+
throw new RangeError(`${call}(): sampleIndex must be a whole number, received ${describeValue(sampleIndex)}. ` +
|
|
107
|
+
"Next: pass a whole index; this family measures the signal's own grid, so a fractional " +
|
|
108
|
+
'one has no position on it.');
|
|
109
|
+
}
|
|
90
110
|
/**
|
|
91
111
|
* The sample covering `seconds` elapsed from the start of the recording.
|
|
92
112
|
*
|
|
@@ -128,12 +148,7 @@ export function gridSampleIndexAt(signal, seconds, recordDurationTicks) {
|
|
|
128
148
|
*/
|
|
129
149
|
export function gridSampleStartTicks(signal, sampleIndex, recordDurationTicks) {
|
|
130
150
|
assertGrid(signal, recordDurationTicks, 'gridSampleStartTicks');
|
|
131
|
-
|
|
132
|
-
throw new RangeError(`gridSampleStartTicks(): sampleIndex must be a whole number, received ` +
|
|
133
|
-
`${describeValue(sampleIndex)}. ` +
|
|
134
|
-
"Next: pass a whole index; this family measures the signal's own grid, so a fractional " +
|
|
135
|
-
'one has no position on it.');
|
|
136
|
-
}
|
|
151
|
+
assertSampleIndex(sampleIndex, 'gridSampleStartTicks');
|
|
137
152
|
const perRecord = BigInt(signal.samplesPerRecord);
|
|
138
153
|
const numerator = BigInt(sampleIndex) * recordDurationTicks;
|
|
139
154
|
const quotient = numerator / perRecord;
|
|
@@ -148,6 +163,7 @@ export function gridSampleStartSeconds(signal, sampleIndex, recordDurationTicks)
|
|
|
148
163
|
// Its own, before the delegation, for the reason `sampleStartSecondsOf` grew one in 0.6.101: a
|
|
149
164
|
// reader who wrote this call should not be told about `gridSampleStartTicks`.
|
|
150
165
|
assertGrid(signal, recordDurationTicks, 'gridSampleStartSeconds');
|
|
166
|
+
assertSampleIndex(sampleIndex, 'gridSampleStartSeconds');
|
|
151
167
|
const ticks = gridSampleStartTicks(signal, sampleIndex, recordDurationTicks);
|
|
152
168
|
const whole = ticks / TICKS_PER_SECOND;
|
|
153
169
|
const remainder = ticks % TICKS_PER_SECOND;
|
package/dist/sample-grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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AG,gBAAgB,CAAC;IACvC,MAAM,SAAS,GAAG,KAAK,GAAG,gBAAgB,CAAC;IAC3C,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACtE,CAAC"}
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,34 @@ 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.6.171
|
|
10
|
+
|
|
11
|
+
- **Fixed** `gridSampleStartSeconds` refusing a bad index in the name of a function the caller never
|
|
12
|
+
wrote. The index guard hard-coded `gridSampleStartTicks`, the one-line delegate underneath it, so
|
|
13
|
+
`gridSampleStartSeconds(signal, 1.5, d)` was answered by `gridSampleStartTicks():`.
|
|
14
|
+
- The two arguments of one call were described by two different functions: the signal by
|
|
15
|
+
`assertGrid`, which takes the call name for exactly this reason, and the index by the other name,
|
|
16
|
+
on the same line of the same file.
|
|
17
|
+
- It matters more in this module than most. Its own docblock spends four paragraphs on the `grid`
|
|
18
|
+
prefix being load-bearing, because the neighbouring family measures a different quantity — so a
|
|
19
|
+
refusal that hands over the wrong name sends a reader to a call they did not make.
|
|
20
|
+
|
|
21
|
+
## 0.6.170
|
|
22
|
+
|
|
23
|
+
- **Fixed** an array taken as a time window by `filterAnnotationsByTime`, the one function left in
|
|
24
|
+
the package that takes a window object. An array is an object, so it walked past the check added
|
|
25
|
+
for the absent case and was read for bounds it does not have.
|
|
26
|
+
- The array a caller holds comes from the neighbour this module is documented against.
|
|
27
|
+
`resolveTimeWindow` is named for the window and returns the record RANGES it maps to, so
|
|
28
|
+
`filterAnnotationsByTime(annotations, resolveTimeWindow(...))` is the call that reads correctly
|
|
29
|
+
and is not.
|
|
30
|
+
- The refusal it got named `window.startSeconds` and advised "an object whose bounds are spelled
|
|
31
|
+
something else" — a clause written in 0.6.158 for a bound that is genuinely absent, which here
|
|
32
|
+
sends a reader to rename fields on a value that has none. Same shape as 0.6.167, in the window.
|
|
33
|
+
- The three places that print the size of the suite say 4,500 rather than 4,000, which the tests
|
|
34
|
+
added here took it past. As at 0.4.415, a floor claim can never be wrong and is therefore never
|
|
35
|
+
re-read, so it is checked against the suite in the direction it rots.
|
|
36
|
+
|
|
9
37
|
## 0.6.169
|
|
10
38
|
|
|
11
39
|
- **Fixed** `streamRecords` handing the read options to the generator unchecked. `readRecords`
|
package/package.json
CHANGED
package/src/annotations-query.ts
CHANGED
|
@@ -70,6 +70,28 @@ export function filterAnnotationsByTime(
|
|
|
70
70
|
'Next: pass a window carrying startSeconds and durationSeconds.',
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
+
/*
|
|
74
|
+
* An ARRAY, which is an object and therefore walked straight past the check above.
|
|
75
|
+
*
|
|
76
|
+
* 0.6.167 closed this route for the reading API's selection and recorded what it costs: an array
|
|
77
|
+
* "reproduced the exact failure 0.6.79 removed — each call named whichever field it happened to
|
|
78
|
+
* read first". Here that field is `window.startSeconds`, and the advice attached to an absent
|
|
79
|
+
* bound is about "an object whose bounds are spelled something else" — which sends a reader to
|
|
80
|
+
* rename fields on a value that has none.
|
|
81
|
+
*
|
|
82
|
+
* The array a caller has in hand is the one this function's own neighbour returns.
|
|
83
|
+
* `resolveTimeWindow` is named for the window and returns the RECORD RANGES it maps to, so
|
|
84
|
+
* `const window = resolveTimeWindow(timeline, index, from, span)` reads exactly like the argument
|
|
85
|
+
* this takes.
|
|
86
|
+
*/
|
|
87
|
+
if (Array.isArray(window)) {
|
|
88
|
+
throw new RangeError(
|
|
89
|
+
'filterAnnotationsByTime(): the window is an array, and this call bounds events by time ' +
|
|
90
|
+
'rather than by record. resolveTimeWindow() returns the record ranges a window maps to, ' +
|
|
91
|
+
'not the window. Next: pass the startSeconds and durationSeconds you gave that call, on ' +
|
|
92
|
+
'an object.',
|
|
93
|
+
);
|
|
94
|
+
}
|
|
73
95
|
const from = secondsToTicks(window.startSeconds, 'window.startSeconds');
|
|
74
96
|
const to = from + secondsToTicks(window.durationSeconds, 'window.durationSeconds');
|
|
75
97
|
if (to <= from) return Object.freeze([]);
|
package/src/constants.ts
CHANGED
package/src/sample-grid.ts
CHANGED
|
@@ -101,6 +101,28 @@ function assertGrid(signal: EdfSignal, recordDurationTicks: bigint, call: string
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* The INDEX, named by the call the reader actually wrote.
|
|
106
|
+
*
|
|
107
|
+
* `assertGrid` above takes a `call` for exactly this reason, and `sampleStartSecondsOf` grew its own
|
|
108
|
+
* copy of a guard in 0.6.101 on the same argument: "a reader who wrote this call should not be told
|
|
109
|
+
* about `sampleStartTicksOf`". This check lived inside `gridSampleStartTicks` alone, so
|
|
110
|
+
* `gridSampleStartSeconds(signal, 1.5, d)` — the display form, which delegates one line down — was
|
|
111
|
+
* refused in the name of a function it never called.
|
|
112
|
+
*
|
|
113
|
+
* The two arguments of one call were then described by two different functions: `assertGrid` named
|
|
114
|
+
* `gridSampleStartSeconds` for a bad signal and this named `gridSampleStartTicks` for a bad index,
|
|
115
|
+
* on the same line of the same file.
|
|
116
|
+
*/
|
|
117
|
+
function assertSampleIndex(sampleIndex: number, call: string): void {
|
|
118
|
+
if (Number.isSafeInteger(sampleIndex)) return;
|
|
119
|
+
throw new RangeError(
|
|
120
|
+
`${call}(): sampleIndex must be a whole number, received ${describeValue(sampleIndex)}. ` +
|
|
121
|
+
"Next: pass a whole index; this family measures the signal's own grid, so a fractional " +
|
|
122
|
+
'one has no position on it.',
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
104
126
|
/**
|
|
105
127
|
* The sample covering `seconds` elapsed from the start of the recording.
|
|
106
128
|
*
|
|
@@ -153,14 +175,7 @@ export function gridSampleStartTicks(
|
|
|
153
175
|
recordDurationTicks: bigint,
|
|
154
176
|
): bigint {
|
|
155
177
|
assertGrid(signal, recordDurationTicks, 'gridSampleStartTicks');
|
|
156
|
-
|
|
157
|
-
throw new RangeError(
|
|
158
|
-
`gridSampleStartTicks(): sampleIndex must be a whole number, received ` +
|
|
159
|
-
`${describeValue(sampleIndex)}. ` +
|
|
160
|
-
"Next: pass a whole index; this family measures the signal's own grid, so a fractional " +
|
|
161
|
-
'one has no position on it.',
|
|
162
|
-
);
|
|
163
|
-
}
|
|
178
|
+
assertSampleIndex(sampleIndex, 'gridSampleStartTicks');
|
|
164
179
|
const perRecord = BigInt(signal.samplesPerRecord);
|
|
165
180
|
const numerator = BigInt(sampleIndex) * recordDurationTicks;
|
|
166
181
|
const quotient = numerator / perRecord;
|
|
@@ -179,6 +194,7 @@ export function gridSampleStartSeconds(
|
|
|
179
194
|
// Its own, before the delegation, for the reason `sampleStartSecondsOf` grew one in 0.6.101: a
|
|
180
195
|
// reader who wrote this call should not be told about `gridSampleStartTicks`.
|
|
181
196
|
assertGrid(signal, recordDurationTicks, 'gridSampleStartSeconds');
|
|
197
|
+
assertSampleIndex(sampleIndex, 'gridSampleStartSeconds');
|
|
182
198
|
const ticks = gridSampleStartTicks(signal, sampleIndex, recordDurationTicks);
|
|
183
199
|
const whole = ticks / TICKS_PER_SECOND;
|
|
184
200
|
const remainder = ticks % TICKS_PER_SECOND;
|