edfcore 0.3.10 → 0.3.11
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/CHANGELOG.md +15 -0
- 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 +15 -1
- package/dist/format-header.js.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/format-header.ts +15 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,21 @@ 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.3.11
|
|
10
|
+
|
|
11
|
+
- **Changed** `formatHeader` to stop calling the declared coverage the "duration" on a file that
|
|
12
|
+
says it has gaps. `recordCount * recordDuration` is what the records COVER; on an EDF+D or BDF+D
|
|
13
|
+
file the recording reaches further by whatever the gaps add up to. A four-record file with an
|
|
14
|
+
hour-long hole in it printed `duration 00:00:04` for a recording spanning 3604 s — and this
|
|
15
|
+
string exists to be pasted into a bug report, where it reads as "a 4-second file".
|
|
16
|
+
- The line is now labelled `covered` on those files, with two lines under it saying that the gaps
|
|
17
|
+
are not in the number and that `buildRecordIndex(recording)` is what reports the span and where
|
|
18
|
+
the gaps are. Continuous files are untouched and still say `duration`.
|
|
19
|
+
- The number itself has not changed and was never wrong; only its name was. A header ALONE cannot
|
|
20
|
+
report the span — that is the last record's onset minus the first's, and those live in the
|
|
21
|
+
timekeeping TALs, which `formatHeader` has never read. Saying which of the two quantities is on
|
|
22
|
+
screen is the whole fix, and it is the same fix 0.3.0 made to the sample-grid function names.
|
|
23
|
+
|
|
9
24
|
## 0.3.10
|
|
10
25
|
|
|
11
26
|
- **Changed** `toPhysicalEnvelope` to return `NaN` for a bucket no sample landed in, instead of a
|
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.3.
|
|
112
|
+
export declare const VERSION = "0.3.11";
|
|
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;AAKH,OAAO,KAAK,EAAmB,SAAS,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAgClF;;;;;;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;AAKH,OAAO,KAAK,EAAmB,SAAS,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAgClF;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAoFrF"}
|
package/dist/format-header.js
CHANGED
|
@@ -59,8 +59,22 @@ export function formatHeader(header, options) {
|
|
|
59
59
|
` (local, no timezone)`);
|
|
60
60
|
lines.push(`record ${header.recordDurationSeconds} s · ${header.recordByteLength} bytes · ` +
|
|
61
61
|
`${header.bytesPerSample} bytes/sample`);
|
|
62
|
-
|
|
62
|
+
// "duration" is only honest for a file whose records run end to end. On an EDF+D file this
|
|
63
|
+
// number is what the records COVER, and the recording reaches further by however much the gaps
|
|
64
|
+
// add up to — a four-record file with an hour-long hole in it printed `duration 00:00:04` for a
|
|
65
|
+
// recording that spans 3604 s. Someone pasting that into a bug report says "a 4-second file".
|
|
66
|
+
//
|
|
67
|
+
// A header alone cannot know the span: it is the last record's onset minus the first's, and
|
|
68
|
+
// those live in the timekeeping TALs. What a header does know is that this file claims to have
|
|
69
|
+
// gaps, so the label says what the number is and the next line says where the span comes from.
|
|
70
|
+
const discontinuous = header.continuity === 'discontinuous';
|
|
71
|
+
const label = discontinuous ? 'covered ' : 'duration ';
|
|
72
|
+
lines.push(`${label} ${formatDurationTicks(header.recordDurationTicks * BigInt(header.recordCount))} ` +
|
|
63
73
|
`(${header.recordCount} × ${header.recordDurationSeconds} s)`);
|
|
74
|
+
if (discontinuous) {
|
|
75
|
+
lines.push(' what the records cover; the gaps between them are not in it');
|
|
76
|
+
lines.push(' buildRecordIndex(recording) reports the span and where the gaps are');
|
|
77
|
+
}
|
|
64
78
|
if (header.recordCountSource === 'sourceByteLength') {
|
|
65
79
|
// Worth saying out loud: the count came from the file size, not from the header field.
|
|
66
80
|
lines.push(' record count recovered from the source length');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-header.js","sourceRoot":"","sources":["../src/format-header.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,SAAS,UAAU,CAAC,IAAiC;IACnD,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAClD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9C,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,KAAK,IAAI,GAA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,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,8FAA8F;QAC9F,sFAAsF;QACtF,MAAM,OAAO,GAAG,oBAAoB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACzD,MAAM,OAAO,GACX;YACE,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC;YACzB,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC;YAC7B,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;SAE1B;aACE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;aAC9B,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,QAAQ,EAAE,CAAC;aAClD,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,mBAAmB,OAAO,EAAE,CAAC,CAAC;QACrE,KAAK,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/format-header.ts
CHANGED
|
@@ -70,10 +70,24 @@ export function formatHeader(header: EdfHeader, options?: FormatHeaderOptions):
|
|
|
70
70
|
`record ${header.recordDurationSeconds} s · ${header.recordByteLength} bytes · ` +
|
|
71
71
|
`${header.bytesPerSample} bytes/sample`,
|
|
72
72
|
);
|
|
73
|
+
// "duration" is only honest for a file whose records run end to end. On an EDF+D file this
|
|
74
|
+
// number is what the records COVER, and the recording reaches further by however much the gaps
|
|
75
|
+
// add up to — a four-record file with an hour-long hole in it printed `duration 00:00:04` for a
|
|
76
|
+
// recording that spans 3604 s. Someone pasting that into a bug report says "a 4-second file".
|
|
77
|
+
//
|
|
78
|
+
// A header alone cannot know the span: it is the last record's onset minus the first's, and
|
|
79
|
+
// those live in the timekeeping TALs. What a header does know is that this file claims to have
|
|
80
|
+
// gaps, so the label says what the number is and the next line says where the span comes from.
|
|
81
|
+
const discontinuous = header.continuity === 'discontinuous';
|
|
82
|
+
const label = discontinuous ? 'covered ' : 'duration ';
|
|
73
83
|
lines.push(
|
|
74
|
-
|
|
84
|
+
`${label} ${formatDurationTicks(header.recordDurationTicks * BigInt(header.recordCount))} ` +
|
|
75
85
|
`(${header.recordCount} × ${header.recordDurationSeconds} s)`,
|
|
76
86
|
);
|
|
87
|
+
if (discontinuous) {
|
|
88
|
+
lines.push(' what the records cover; the gaps between them are not in it');
|
|
89
|
+
lines.push(' buildRecordIndex(recording) reports the span and where the gaps are');
|
|
90
|
+
}
|
|
77
91
|
if (header.recordCountSource === 'sourceByteLength') {
|
|
78
92
|
// Worth saying out loud: the count came from the file size, not from the header field.
|
|
79
93
|
lines.push(' record count recovered from the source length');
|