edf2csv 0.8.54 → 0.8.56

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.
@@ -217,6 +217,29 @@ export declare function stdoutRefusal(file: EdfFile, plan: ConversionPlan): Conv
217
217
  * on is in the file and the plan, both of which `--info` already has.
218
218
  */
219
219
  export declare function noSignalFile(file: EdfFile, plan: ConversionPlan): Diagnostic | null;
220
+ /**
221
+ * The signal table an `--annotations-only` run does not write, taken out of the hints about it.
222
+ *
223
+ * That mode writes the event list and nothing else — no signal files at all — and four hints
224
+ * about record timing describe the rows of one. On a recording whose records run backwards it
225
+ * printed both of these over an annotations.csv holding its header and no rows:
226
+ *
227
+ * warning: This is a discontinuous (EDF+D) recording: its data records are not
228
+ * contiguous in time.
229
+ * Each row carries its true recording time, so gaps stay visible instead of
230
+ * being closed.
231
+ * warning: 2 data records start earlier than the record before them.
232
+ * Rows are written in file order, so the time column will not increase
233
+ * monotonically.
234
+ *
235
+ * There are no rows and no time column. The facts above the hints are about the recording and
236
+ * stay; what changes is the sentence describing what the conversion will do with them, which
237
+ * is the same surgery `withTimingPromiseKept` does to the first of these when the record
238
+ * starts cannot be derived.
239
+ *
240
+ * `writesSignals` rather than the option, because the plan is what settles it.
241
+ */
242
+ export declare function withSignalTableUnwritten(diagnostics: readonly Diagnostic[], writesSignals: boolean): Diagnostic[];
220
243
  /**
221
244
  * The sidecar files a `--stdout` run does not write, taken out of the sentences about them.
222
245
  *
@@ -98,10 +98,10 @@ export async function convert(inputPath, options = {}) {
98
98
  readerHungUp,
99
99
  annotationCount: 0,
100
100
  // Over both lists, because the timing warnings are pushed onto the plan's.
101
- diagnostics: withSidecarsNamed([
101
+ diagnostics: withSignalTableUnwritten(withSidecarsNamed([
102
102
  ...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timing.starts !== null),
103
103
  ...plan.diagnostics,
104
- ], { toStdout: true, gzip: plan.gzip }),
104
+ ], { toStdout: true, gzip: plan.gzip }), plan.writeSignals),
105
105
  plan,
106
106
  file,
107
107
  elapsedMs: Date.now() - startedAt,
@@ -199,11 +199,11 @@ export async function convert(inputPath, options = {}) {
199
199
  annotationCount: annotationsWritten,
200
200
  // The directory path needs it too: `--gzip` changes the names, and two of these
201
201
  // sentences are a file name and nothing else. See withSidecarsNamed.
202
- diagnostics: withSidecarsNamed([
202
+ diagnostics: withSignalTableUnwritten(withSidecarsNamed([
203
203
  ...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timing.starts !== null),
204
204
  ...plan.diagnostics,
205
205
  ...stale,
206
- ], { toStdout: false, gzip: plan.gzip }),
206
+ ], { toStdout: false, gzip: plan.gzip }), plan.writeSignals),
207
207
  plan,
208
208
  file,
209
209
  elapsedMs: Date.now() - startedAt,
@@ -1500,6 +1500,58 @@ export function noSignalFile(file, plan) {
1500
1500
  `table --info prints, and in the ${outputCsvName('channels', plan.gzip)} a conversion writes.`,
1501
1501
  };
1502
1502
  }
1503
+ /**
1504
+ * The signal table an `--annotations-only` run does not write, taken out of the hints about it.
1505
+ *
1506
+ * That mode writes the event list and nothing else — no signal files at all — and four hints
1507
+ * about record timing describe the rows of one. On a recording whose records run backwards it
1508
+ * printed both of these over an annotations.csv holding its header and no rows:
1509
+ *
1510
+ * warning: This is a discontinuous (EDF+D) recording: its data records are not
1511
+ * contiguous in time.
1512
+ * Each row carries its true recording time, so gaps stay visible instead of
1513
+ * being closed.
1514
+ * warning: 2 data records start earlier than the record before them.
1515
+ * Rows are written in file order, so the time column will not increase
1516
+ * monotonically.
1517
+ *
1518
+ * There are no rows and no time column. The facts above the hints are about the recording and
1519
+ * stay; what changes is the sentence describing what the conversion will do with them, which
1520
+ * is the same surgery `withTimingPromiseKept` does to the first of these when the record
1521
+ * starts cannot be derived.
1522
+ *
1523
+ * `writesSignals` rather than the option, because the plan is what settles it.
1524
+ */
1525
+ export function withSignalTableUnwritten(diagnostics, writesSignals) {
1526
+ if (writesSignals)
1527
+ return [...diagnostics];
1528
+ return diagnostics.map((diagnostic) => {
1529
+ if (diagnostic.code !== 'DISCONTINUOUS' || diagnostic.hint === undefined)
1530
+ return diagnostic;
1531
+ if (diagnostic.hint.startsWith('Each row carries its true recording time')) {
1532
+ return {
1533
+ ...diagnostic,
1534
+ hint: '--annotations-only writes no signal rows, so nothing here is timed from the ' +
1535
+ "records. annotations.csv carries each event's own onset, and the record it came " +
1536
+ 'from in record_index.',
1537
+ };
1538
+ }
1539
+ if (diagnostic.hint.startsWith('Rows are written in file order')) {
1540
+ return {
1541
+ ...diagnostic,
1542
+ hint: '--annotations-only writes no signal rows, so no time column is affected. ' +
1543
+ "annotations.csv's record_index still names the record each event came from.",
1544
+ };
1545
+ }
1546
+ if (diagnostic.hint.startsWith('Sample times are written from zero')) {
1547
+ return {
1548
+ ...diagnostic,
1549
+ hint: '--annotations-only writes no signal rows, so no sample times are written at all.',
1550
+ };
1551
+ }
1552
+ return diagnostic;
1553
+ });
1554
+ }
1503
1555
  /**
1504
1556
  * The sidecar files a `--stdout` run does not write, taken out of the sentences about them.
1505
1557
  *
@@ -1745,12 +1797,12 @@ bom) {
1745
1797
  decimals: g.channels.map((c) => c.decimals),
1746
1798
  })),
1747
1799
  },
1748
- notes: withSidecarsNamed([
1800
+ notes: withSignalTableUnwritten(withSidecarsNamed([
1749
1801
  ...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timedFromRecords),
1750
1802
  ...plan.diagnostics,
1751
1803
  ],
1752
- // metadata.json is only written into a directory, so this one is never the stdout case.
1753
- { toStdout: false, gzip: plan.gzip }).map((d) => ({
1804
+ // metadata.json is only written into a directory, so this is never the stdout case.
1805
+ { toStdout: false, gzip: plan.gzip }), plan.writeSignals).map((d) => ({
1754
1806
  code: d.code,
1755
1807
  severity: d.severity,
1756
1808
  message: d.message,