edfcore 0.6.299 → 0.6.301
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/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/format-header.d.ts.map +1 -1
- package/dist/format-header.js +7 -2
- package/dist/format-header.js.map +1 -1
- package/dist/io/read.d.ts.map +1 -1
- package/dist/io/read.js +36 -0
- package/dist/io/read.js.map +1 -1
- package/docs/CHANGELOG.md +37 -0
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/format-header.ts +7 -2
- package/src/io/read.ts +39 -0
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.301";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-header.d.ts","sourceRoot":"","sources":["../src/format-header.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,OAAO,KAAK,EAAmB,SAAS,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAsElF;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"format-header.d.ts","sourceRoot":"","sources":["../src/format-header.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,OAAO,KAAK,EAAmB,SAAS,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAsElF;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CA8QrF"}
|
package/dist/format-header.js
CHANGED
|
@@ -234,9 +234,14 @@ export function formatHeader(header, options) {
|
|
|
234
234
|
lines.push(`${label} ${formatDurationTicks(header.recordDurationTicks * BigInt(header.recordCount))} ` +
|
|
235
235
|
`(${header.recordCount} × ${header.recordDurationSeconds} s)`);
|
|
236
236
|
if (discontinuous) {
|
|
237
|
+
// Three hand-wrapped lines are ONE sentence, and it ran straight from "each other" into
|
|
238
|
+
// "buildRecordIndex(recording)" with nothing between them — so the only place `edfcore header`
|
|
239
|
+
// explains a discontinuous file printed two independent clauses as a run-on. The terminator
|
|
240
|
+
// also settles what the last clause points at: "which it is" had nothing to attach to across
|
|
241
|
+
// the break, and gaps-or-overlaps is the choice it means (0.6.301).
|
|
237
242
|
lines.push(' what the records cover, which on this file is not the span: its');
|
|
238
|
-
lines.push(' records may leave gaps between them, and may overlap each other');
|
|
239
|
-
lines.push(' buildRecordIndex(recording) reports the span and which
|
|
243
|
+
lines.push(' records may leave gaps between them, and may overlap each other.');
|
|
244
|
+
lines.push(' buildRecordIndex(recording) reports the span and which of the two.');
|
|
240
245
|
}
|
|
241
246
|
if (header.recordCountSource === 'sourceByteLength') {
|
|
242
247
|
// Worth saying out loud: the count came from the file size, not from the header field.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-header.js","sourceRoot":"","sources":["../src/format-header.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAA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AO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/io/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAWH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAoBhG;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAuC9F;AAmKD;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC,CAgGrB"}
|
package/dist/io/read.js
CHANGED
|
@@ -285,6 +285,42 @@ export async function readRecordBytes(source, header, records, options) {
|
|
|
285
285
|
'parseHeader(bytes, sourceByteLength) returned.');
|
|
286
286
|
}
|
|
287
287
|
assertRecordRange(header, records);
|
|
288
|
+
/*
|
|
289
|
+
* The SOURCE against the HEADER, which are this function's own two arguments and are paired by
|
|
290
|
+
* nobody but the caller.
|
|
291
|
+
*
|
|
292
|
+
* `openEdf` establishes the relation at open time — a source too small for the header it parsed
|
|
293
|
+
* lowers `recordCount` and sets `recordCountSource` to `'sourceByteLength'` — and nothing
|
|
294
|
+
* re-checks it afterwards. `readWindow`'s docblock teaches rebuilding a recording by spread,
|
|
295
|
+
* `readWindow({ ...rec, index }, selection)`, so a recording whose four fields do not all come
|
|
296
|
+
* from one file is a shape the package asks for. `resolveTimeWindow` catches the index against
|
|
297
|
+
* the timeline; this is the other pair.
|
|
298
|
+
*
|
|
299
|
+
* What it did was blame the source. The first read asked for a range the HEADER describes, the
|
|
300
|
+
* source was shorter, and `assertReadRange` answered "ByteSource.read(offset 768, length 720)
|
|
301
|
+
* ends at byte 1488, past the end of a 1088-byte source. Next: clamp the request, or check that
|
|
302
|
+
* the source was built over the whole file rather than a prefix of it" — advice to clamp a range
|
|
303
|
+
* that is inside the file it was computed for, about a source that is the whole of a different
|
|
304
|
+
* one.
|
|
305
|
+
*
|
|
306
|
+
* A LOWER bound only, and that is the whole of what can be checked here: trailing bytes are legal
|
|
307
|
+
* and diagnosed rather than refused (`TRAILING_BYTES`, `PARTIAL_FINAL_RECORD`), so a source
|
|
308
|
+
* longer than the header implies is a real file and must keep reading. The reverse mix — a header
|
|
309
|
+
* describing less than its source holds — is therefore indistinguishable from one of those files
|
|
310
|
+
* and is not caught.
|
|
311
|
+
*
|
|
312
|
+
* Integer arithmetic on fields `assertRecordRange` above has already established, so a matched
|
|
313
|
+
* pair cannot reach it (0.6.300).
|
|
314
|
+
*/
|
|
315
|
+
const impliedByteLength = header.headerByteLength + header.recordCount * header.recordByteLength;
|
|
316
|
+
if (source.byteLength < impliedByteLength) {
|
|
317
|
+
throw new EdfRangeError(`this header describes a ${impliedByteLength}-byte file — a ${header.headerByteLength}-byte ` +
|
|
318
|
+
`header and ${pluralise(header.recordCount, 'record')} of ` +
|
|
319
|
+
`${header.recordByteLength} bytes — but the source holds ${source.byteLength}. A shorter ` +
|
|
320
|
+
'source is not a shorter file here: openEdf() lowers recordCount for one and records that ' +
|
|
321
|
+
'it did, so these two were not opened together. Next: pass the source this header was ' +
|
|
322
|
+
'parsed from — recording.source is the one openEdf() kept.', { requested: records, available: { start: 0, count: header.recordCount } });
|
|
323
|
+
}
|
|
288
324
|
const byteLength = records.count * header.recordByteLength;
|
|
289
325
|
if (byteLength === 0)
|
|
290
326
|
return new Uint8Array(0);
|
package/dist/io/read.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/io/read.ts"],"names":[],"mappings":"AAAA;;;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AO,CAAC,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAC3D,IAAI,UAAU,KAAK,CAAC;QAAE,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/C,kBAAkB,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,GAAG,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACrF,OAAO,eAAe,CACpB,MAAM,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAClD,UAAU,EACV,UAAU,CACX,CAAC;AACJ,CAAC"}
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,43 @@ 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.301
|
|
10
|
+
|
|
11
|
+
- **Fixed** the note `edfcore header` prints for a discontinuous file running two clauses together.
|
|
12
|
+
It is three hand-wrapped lines forming one sentence, and there was nothing between the second and
|
|
13
|
+
the third: "...may leave gaps between them, and may overlap each other" then straight into
|
|
14
|
+
"buildRecordIndex(recording) reports the span and which it is".
|
|
15
|
+
- The break did more than look wrong. "which it is" is a back-reference to the gaps-or-overlaps
|
|
16
|
+
choice in the clause before it, and with no terminator between them it reads as attaching to
|
|
17
|
+
`buildRecordIndex(recording)` instead — which is not a thing a span can be. The clause now reads
|
|
18
|
+
"and which of the two".
|
|
19
|
+
- This is the note a reader meets when the tool tells them their file is EDF+D, so it is the sentence
|
|
20
|
+
that has to survive being read once, quickly, in a terminal. `counted.ts` records what this package
|
|
21
|
+
thinks of that: the first line of `edfcore header` once read "1 signals", and "two commands over
|
|
22
|
+
one file disagreed about the same number".
|
|
23
|
+
- The continuous-file path prints none of it, which is pinned.
|
|
24
|
+
|
|
25
|
+
## 0.6.300
|
|
26
|
+
|
|
27
|
+
- **Fixed** a read blaming the source for a header from another file. `readRecordBytes(source,
|
|
28
|
+
header, records)` takes the two as separate arguments and nothing but the caller pairs them.
|
|
29
|
+
`openEdf` establishes the relation at open time — a source too small for the header it parsed
|
|
30
|
+
lowers `recordCount` and records that it did — and nothing re-checked it afterwards.
|
|
31
|
+
- The first read then asked for a range the HEADER describes, the source was shorter, and the
|
|
32
|
+
refusal was "ByteSource.read(...) past the end of a 1088-byte source. Next: clamp the request, or
|
|
33
|
+
check that the source was built over the whole file rather than a prefix of it" — advice to clamp a
|
|
34
|
+
range that is inside the file it was computed for, about a source that is the whole of a different
|
|
35
|
+
one.
|
|
36
|
+
- `readWindow`'s docblock teaches rebuilding a recording by spread, so a recording whose four fields
|
|
37
|
+
do not all come from one file is a shape the package asks for. `resolveTimeWindow` catches the
|
|
38
|
+
index against the timeline; this is the other pair, and it reaches every read because they all
|
|
39
|
+
funnel through this one function.
|
|
40
|
+
- **A lower bound only, and that is the whole of what can be checked here.** Trailing bytes are legal
|
|
41
|
+
and diagnosed rather than refused — `TRAILING_BYTES`, `PARTIAL_FINAL_RECORD` — so a source longer
|
|
42
|
+
than its header implies is a real file and keeps reading. The reverse mix, a header describing less
|
|
43
|
+
than its source holds, is indistinguishable from one of those files and is still not caught; a test
|
|
44
|
+
pins that it reads, so the limit is on the record rather than implied.
|
|
45
|
+
|
|
9
46
|
## 0.6.299
|
|
10
47
|
|
|
11
48
|
- **Fixed** `sampleAt` naming a record the file does not have. Its scanned-index branch bounded the
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/format-header.ts
CHANGED
|
@@ -263,9 +263,14 @@ export function formatHeader(header: EdfHeader, options?: FormatHeaderOptions):
|
|
|
263
263
|
`(${header.recordCount} × ${header.recordDurationSeconds} s)`,
|
|
264
264
|
);
|
|
265
265
|
if (discontinuous) {
|
|
266
|
+
// Three hand-wrapped lines are ONE sentence, and it ran straight from "each other" into
|
|
267
|
+
// "buildRecordIndex(recording)" with nothing between them — so the only place `edfcore header`
|
|
268
|
+
// explains a discontinuous file printed two independent clauses as a run-on. The terminator
|
|
269
|
+
// also settles what the last clause points at: "which it is" had nothing to attach to across
|
|
270
|
+
// the break, and gaps-or-overlaps is the choice it means (0.6.301).
|
|
266
271
|
lines.push(' what the records cover, which on this file is not the span: its');
|
|
267
|
-
lines.push(' records may leave gaps between them, and may overlap each other');
|
|
268
|
-
lines.push(' buildRecordIndex(recording) reports the span and which
|
|
272
|
+
lines.push(' records may leave gaps between them, and may overlap each other.');
|
|
273
|
+
lines.push(' buildRecordIndex(recording) reports the span and which of the two.');
|
|
269
274
|
}
|
|
270
275
|
if (header.recordCountSource === 'sourceByteLength') {
|
|
271
276
|
// Worth saying out loud: the count came from the file size, not from the header field.
|
package/src/io/read.ts
CHANGED
|
@@ -324,6 +324,45 @@ export async function readRecordBytes(
|
|
|
324
324
|
);
|
|
325
325
|
}
|
|
326
326
|
assertRecordRange(header, records);
|
|
327
|
+
/*
|
|
328
|
+
* The SOURCE against the HEADER, which are this function's own two arguments and are paired by
|
|
329
|
+
* nobody but the caller.
|
|
330
|
+
*
|
|
331
|
+
* `openEdf` establishes the relation at open time — a source too small for the header it parsed
|
|
332
|
+
* lowers `recordCount` and sets `recordCountSource` to `'sourceByteLength'` — and nothing
|
|
333
|
+
* re-checks it afterwards. `readWindow`'s docblock teaches rebuilding a recording by spread,
|
|
334
|
+
* `readWindow({ ...rec, index }, selection)`, so a recording whose four fields do not all come
|
|
335
|
+
* from one file is a shape the package asks for. `resolveTimeWindow` catches the index against
|
|
336
|
+
* the timeline; this is the other pair.
|
|
337
|
+
*
|
|
338
|
+
* What it did was blame the source. The first read asked for a range the HEADER describes, the
|
|
339
|
+
* source was shorter, and `assertReadRange` answered "ByteSource.read(offset 768, length 720)
|
|
340
|
+
* ends at byte 1488, past the end of a 1088-byte source. Next: clamp the request, or check that
|
|
341
|
+
* the source was built over the whole file rather than a prefix of it" — advice to clamp a range
|
|
342
|
+
* that is inside the file it was computed for, about a source that is the whole of a different
|
|
343
|
+
* one.
|
|
344
|
+
*
|
|
345
|
+
* A LOWER bound only, and that is the whole of what can be checked here: trailing bytes are legal
|
|
346
|
+
* and diagnosed rather than refused (`TRAILING_BYTES`, `PARTIAL_FINAL_RECORD`), so a source
|
|
347
|
+
* longer than the header implies is a real file and must keep reading. The reverse mix — a header
|
|
348
|
+
* describing less than its source holds — is therefore indistinguishable from one of those files
|
|
349
|
+
* and is not caught.
|
|
350
|
+
*
|
|
351
|
+
* Integer arithmetic on fields `assertRecordRange` above has already established, so a matched
|
|
352
|
+
* pair cannot reach it (0.6.300).
|
|
353
|
+
*/
|
|
354
|
+
const impliedByteLength = header.headerByteLength + header.recordCount * header.recordByteLength;
|
|
355
|
+
if (source.byteLength < impliedByteLength) {
|
|
356
|
+
throw new EdfRangeError(
|
|
357
|
+
`this header describes a ${impliedByteLength}-byte file — a ${header.headerByteLength}-byte ` +
|
|
358
|
+
`header and ${pluralise(header.recordCount, 'record')} of ` +
|
|
359
|
+
`${header.recordByteLength} bytes — but the source holds ${source.byteLength}. A shorter ` +
|
|
360
|
+
'source is not a shorter file here: openEdf() lowers recordCount for one and records that ' +
|
|
361
|
+
'it did, so these two were not opened together. Next: pass the source this header was ' +
|
|
362
|
+
'parsed from — recording.source is the one openEdf() kept.',
|
|
363
|
+
{ requested: records, available: { start: 0, count: header.recordCount } },
|
|
364
|
+
);
|
|
365
|
+
}
|
|
327
366
|
const byteLength = records.count * header.recordByteLength;
|
|
328
367
|
if (byteLength === 0) return new Uint8Array(0);
|
|
329
368
|
|