edfcore 0.6.23 → 0.6.25

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.6.23";
112
+ export declare const VERSION = "0.6.25";
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.6.23';
82
+ export const VERSION = '0.6.25';
83
83
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-annotations.d.ts","sourceRoot":"","sources":["../src/format-annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,kGAAkG;IAClG,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AA0CD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,OAAO,CAAC,EAAE,wBAAwB,GACjC,MAAM,CA6BR"}
1
+ {"version":3,"file":"format-annotations.d.ts","sourceRoot":"","sources":["../src/format-annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,kGAAkG;IAClG,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AA0CD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,OAAO,CAAC,EAAE,wBAAwB,GACjC,MAAM,CAsDR"}
@@ -65,18 +65,42 @@ export function formatAnnotations(annotations, options) {
65
65
  if (annotations.length === 0)
66
66
  return '';
67
67
  const limit = requireItemLimit(options?.maxItems, annotations.length);
68
- const rows = [];
68
+ /*
69
+ * Both time columns are sized from the rows being printed, the way `formatHeader` sizes its
70
+ * index column, because both can hold a value wider than a fixed width.
71
+ *
72
+ * `hh:mm:ss.mmm` is twelve characters until it is not. A negative onset spends one on the sign —
73
+ * `-00:00:01.500`, which the note at the top of this file argues is legal and which 0.3.45
74
+ * exists to print correctly — and the hours are deliberately not wrapped at 24, so a week of
75
+ * long-term monitoring reads `168:00:00.000`. Either one on one row of a listing moved the text
76
+ * column on that row and no other, and the onset column was not padded at all, so the misaligned
77
+ * row was usually the first: a pre-stimulus baseline sorts before everything (fixed in 0.6.25).
78
+ *
79
+ * Twelve is the floor, so a listing whose times all fit prints exactly what it printed before —
80
+ * including one where every event is instantaneous and every duration is empty.
81
+ */
82
+ const cells = [];
69
83
  for (let i = 0; i < limit; i += 1) {
70
84
  const annotation = annotations[i];
71
85
  if (annotation === undefined)
72
86
  continue;
87
+ cells.push({
88
+ onset: clock(annotation.onsetTicksFromFirstRecord),
89
+ duration: duration(annotation),
90
+ annotation,
91
+ });
92
+ }
93
+ const onsetWidth = Math.max(12, ...cells.map((cell) => cell.onset.length));
94
+ const durationWidth = Math.max(12, ...cells.map((cell) => cell.duration.length));
95
+ const rows = [];
96
+ for (const { onset, duration: span, annotation } of cells) {
73
97
  // Annotation text is exposed verbatim by design — the TAL grammar reserves 0x00, 0x14 and
74
98
  // 0x15 and nothing else, so 0x0a and 0x09 reach `text` unchanged. One event holding a newline
75
99
  // would print as two rows, and the second would carry no time of its own, so it reads as an
76
100
  // event at the time above it. `annotation.text` still holds the bytes as written.
77
101
  const parts = [
78
- clock(annotation.onsetTicksFromFirstRecord),
79
- duration(annotation).padEnd(12),
102
+ onset.padEnd(onsetWidth),
103
+ span.padEnd(durationWidth),
80
104
  printable(annotation.text),
81
105
  ];
82
106
  if (options?.includeChannel === true && annotation.channelLabel !== undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"format-annotations.js","sourceRoot":"","sources":["../src/format-annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAehD,MAAM,qBAAqB,GAAG,gBAAgB,GAAG,KAAK,CAAC;AAEvD;;;;;;GAMG;AACH,SAAS,KAAK,CAAC,KAAa;IAC1B,2FAA2F;IAC3F,gGAAgG;IAChG,gGAAgG;IAChG,6FAA6F;IAC7F,wFAAwF;IACxF,MAAM,mBAAmB,GAAG,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,mBAAmB,GAAG,EAAE,CAAC;IAC1C,MAAM,iBAAiB,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC;IAEhF,MAAM,YAAY,GAAG,iBAAiB,GAAG,KAAK,CAAC;IAC/C,MAAM,YAAY,GAAG,iBAAiB,GAAG,KAAK,CAAC;IAC/C,MAAM,OAAO,GAAG,YAAY,GAAG,GAAG,CAAC;IACnC,MAAM,YAAY,GAAG,YAAY,GAAG,GAAG,CAAC;IACxC,MAAM,OAAO,GAAG,YAAY,GAAG,GAAG,CA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AAM,CAAC,aAAa,CAAC;YAC1B,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC;SAC3B,CAAC;QACF,IAAI,OAAO,EAAE,cAAc,KAAK,IAAI,IAAI,UAAU,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YAC9E,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,GAAG,KAAK,CAAC;IAC1C,mFAAmF;IACnF,IAAI,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,IAAI,CAAC,WAAW,MAAM,OAAO,CAAC,CAAC;IAEpD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"format-header.d.ts","sourceRoot":"","sources":["../src/format-header.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,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,CA+HrF"}
1
+ {"version":3,"file":"format-header.d.ts","sourceRoot":"","sources":["../src/format-header.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,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,CA4IrF"}
@@ -152,13 +152,24 @@ export function formatHeader(header, options) {
152
152
  lines.push(`recording ${printable(trimEdfField(header.recording.raw)) || 'unknown'}`);
153
153
  }
154
154
  lines.push('');
155
+ /*
156
+ * Wide enough for the largest index in THIS file, never narrower than the three the heading has
157
+ * always used. EDF's signal-count field is four characters, so 9999 signals is a legal file and
158
+ * a thousand-channel one is an ordinary high-density recording — and a fixed width of three put
159
+ * signal 1000 one column to the right of signal 999, in the middle of the same table. Rows
160
+ * either side of that boundary had their last three columns in different places, which is worse
161
+ * than a table that is uniformly wrong: nothing about it looks like a formatting decision.
162
+ *
163
+ * A file with fewer than a thousand signals prints exactly what it printed before (0.6.24).
164
+ */
165
+ const indexWidth = Math.max(3, `${Math.max(0, header.signals.length - 1)}`.length);
155
166
  // Built from the SAME widths as the data rows below, not spaced by hand. The hand-spaced literal
156
167
  // had one space too many after `label` and one after `kind`, so `kind` sat at column 27 over data
157
168
  // at 26 and `rate` and `range` were two out — on every file, in the output whose whole purpose is
158
169
  // being read in a terminal (fixed in 0.3.96).
159
- lines.push(` # ${'label'.padEnd(21)}${'kind'.padEnd(12)}${'rate'.padEnd(9)} range`);
170
+ lines.push(`${'#'.padStart(indexWidth)} ${'label'.padEnd(21)}${'kind'.padEnd(12)}${'rate'.padEnd(9)} range`);
160
171
  for (const signal of header.signals) {
161
- const index = String(signal.index).padStart(3);
172
+ const index = String(signal.index).padStart(indexWidth);
162
173
  // Control characters are replaced, not printed. A label holding a newline would otherwise
163
174
  // render as two rows and forge a signal the file does not contain; a tab would shift every
164
175
  // column after it. EDF pads labels with spaces and says nothing about what else may be in
@@ -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,kB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,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;YAC/B,yFAAyF;YACzF,sFAAsF;aACrF,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;aACtD,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QAChF,IAAI,OAAO,EAAE,eAAe,KAAK,KAAK,EAAE,CAAC;YACvC,KAAK,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,47 @@ 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.25
10
+
11
+ - **Fixed** an event listing losing its columns to a time wider than twelve characters.
12
+ `formatAnnotations` padded the duration to twelve and did not pad the onset at all, which works
13
+ for exactly as long as every time is `hh:mm:ss.mmm`. Two documented cases are not.
14
+ - A NEGATIVE onset spends one character on the sign. That file's own note argues at length that a
15
+ negative onset is legal — EDF+ measures from the header start time and a recording may begin
16
+ after its first annotation — and 0.3.45 exists to print one correctly. It is also how a
17
+ pre-stimulus baseline is spelled, so it sorts before everything: the misaligned row was usually
18
+ the first one in the listing.
19
+ - A recording past 100 HOURS does it too. The hours are deliberately not wrapped at 24, because
20
+ "a 30-hour recording is a real thing and `30:12:00.000` is more useful than `06:12:00.000` on day
21
+ two" — and long-term epilepsy monitoring runs for a week, which is `168:00:00.000`. A duration
22
+ that long overflowed the padded column outright.
23
+ - Both widths come from the rows being printed now, with twelve as the floor, so a listing whose
24
+ times all fit prints byte for byte what it printed before — including one where every event is
25
+ instantaneous and every duration is blank.
26
+ - Same defect as the sample rate (0.6.23) and the signal index (0.6.24), in the third formatter: a
27
+ value wider than the width it was given. `an-event-listing-lines-up.test.ts` checks the property
28
+ rather than the three cases, over the matrix as well as the cases, because the property is what
29
+ survives the next column.
30
+
31
+ ## 0.6.24
32
+
33
+ - **Fixed** the signal-index column being three characters wide whatever the file, so signal 1000
34
+ sat one column to the right of signal 999 — in the middle of the same table, with the rows either
35
+ side of that boundary putting their last three columns in different places. That is worse than a
36
+ table that is uniformly wrong: nothing about it looks like a formatting decision.
37
+ - EDF's signal-count field is four characters, so 9999 signals is a legal file, and a
38
+ thousand-channel recording is ordinary high-density work rather than a corner case. `inspect.ts`
39
+ already discusses a 512-signal file as the realistic one.
40
+ - The width comes from the largest index in the file and is never narrower than the three it has
41
+ always used, so every file with fewer than a thousand signals prints exactly what it printed
42
+ before. The heading is built from that width rather than spaced by hand, which is the rule 0.3.96
43
+ established for the other four columns.
44
+ - `a-rate-that-does-not-divide.test.ts` now reads the range column off the heading instead of from
45
+ a constant, which is what lets one property cover a width that depends on the file: every row's
46
+ `range` starts where the heading's does, on all thirteen shapes and on a 1200-signal file. The
47
+ 0.6.23 rate fix and this one are the same defect in two columns — a value wider than the width it
48
+ was given — and they are checked by the same property now.
49
+
9
50
  ## 0.6.23
10
51
 
11
52
  - **Fixed** a derived sample rate blowing the column it is printed in. `sampleRateHz` is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.6.23",
3
+ "version": "0.6.25",
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.6.23';
96
+ export const VERSION = '0.6.25';
@@ -90,17 +90,42 @@ export function formatAnnotations(
90
90
 
91
91
  const limit = requireItemLimit(options?.maxItems, annotations.length);
92
92
 
93
- const rows: string[] = [];
93
+ /*
94
+ * Both time columns are sized from the rows being printed, the way `formatHeader` sizes its
95
+ * index column, because both can hold a value wider than a fixed width.
96
+ *
97
+ * `hh:mm:ss.mmm` is twelve characters until it is not. A negative onset spends one on the sign —
98
+ * `-00:00:01.500`, which the note at the top of this file argues is legal and which 0.3.45
99
+ * exists to print correctly — and the hours are deliberately not wrapped at 24, so a week of
100
+ * long-term monitoring reads `168:00:00.000`. Either one on one row of a listing moved the text
101
+ * column on that row and no other, and the onset column was not padded at all, so the misaligned
102
+ * row was usually the first: a pre-stimulus baseline sorts before everything (fixed in 0.6.25).
103
+ *
104
+ * Twelve is the floor, so a listing whose times all fit prints exactly what it printed before —
105
+ * including one where every event is instantaneous and every duration is empty.
106
+ */
107
+ const cells = [];
94
108
  for (let i = 0; i < limit; i += 1) {
95
109
  const annotation = annotations[i];
96
110
  if (annotation === undefined) continue;
111
+ cells.push({
112
+ onset: clock(annotation.onsetTicksFromFirstRecord),
113
+ duration: duration(annotation),
114
+ annotation,
115
+ });
116
+ }
117
+ const onsetWidth = Math.max(12, ...cells.map((cell) => cell.onset.length));
118
+ const durationWidth = Math.max(12, ...cells.map((cell) => cell.duration.length));
119
+
120
+ const rows: string[] = [];
121
+ for (const { onset, duration: span, annotation } of cells) {
97
122
  // Annotation text is exposed verbatim by design — the TAL grammar reserves 0x00, 0x14 and
98
123
  // 0x15 and nothing else, so 0x0a and 0x09 reach `text` unchanged. One event holding a newline
99
124
  // would print as two rows, and the second would carry no time of its own, so it reads as an
100
125
  // event at the time above it. `annotation.text` still holds the bytes as written.
101
126
  const parts = [
102
- clock(annotation.onsetTicksFromFirstRecord),
103
- duration(annotation).padEnd(12),
127
+ onset.padEnd(onsetWidth),
128
+ span.padEnd(durationWidth),
104
129
  printable(annotation.text),
105
130
  ];
106
131
  if (options?.includeChannel === true && annotation.channelLabel !== undefined) {
@@ -165,13 +165,26 @@ export function formatHeader(header: EdfHeader, options?: FormatHeaderOptions):
165
165
  }
166
166
 
167
167
  lines.push('');
168
+ /*
169
+ * Wide enough for the largest index in THIS file, never narrower than the three the heading has
170
+ * always used. EDF's signal-count field is four characters, so 9999 signals is a legal file and
171
+ * a thousand-channel one is an ordinary high-density recording — and a fixed width of three put
172
+ * signal 1000 one column to the right of signal 999, in the middle of the same table. Rows
173
+ * either side of that boundary had their last three columns in different places, which is worse
174
+ * than a table that is uniformly wrong: nothing about it looks like a formatting decision.
175
+ *
176
+ * A file with fewer than a thousand signals prints exactly what it printed before (0.6.24).
177
+ */
178
+ const indexWidth = Math.max(3, `${Math.max(0, header.signals.length - 1)}`.length);
168
179
  // Built from the SAME widths as the data rows below, not spaced by hand. The hand-spaced literal
169
180
  // had one space too many after `label` and one after `kind`, so `kind` sat at column 27 over data
170
181
  // at 26 and `rate` and `range` were two out — on every file, in the output whose whole purpose is
171
182
  // being read in a terminal (fixed in 0.3.96).
172
- lines.push(` # ${'label'.padEnd(21)}${'kind'.padEnd(12)}${'rate'.padEnd(9)} range`);
183
+ lines.push(
184
+ `${'#'.padStart(indexWidth)} ${'label'.padEnd(21)}${'kind'.padEnd(12)}${'rate'.padEnd(9)} range`,
185
+ );
173
186
  for (const signal of header.signals) {
174
- const index = String(signal.index).padStart(3);
187
+ const index = String(signal.index).padStart(indexWidth);
175
188
  // Control characters are replaced, not printed. A label holding a newline would otherwise
176
189
  // render as two rows and forge a signal the file does not contain; a tab would shift every
177
190
  // column after it. EDF pads labels with spaces and says nothing about what else may be in