edf2csv 0.8.50 → 0.8.51

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 sidecar files a `--stdout` run does not write, taken out of the sentences about them.
222
+ *
223
+ * `--stdout` puts one table on the stream and writes nothing else — "No sidecar files are
224
+ * written", as `ConvertOptions` puts it. Two diagnostics raised before the destination is
225
+ * known end by pointing at one of those files:
226
+ *
227
+ * warning: The header's start date and time ("XX.XX.XX" and "YY.YY.YY") are not a date
228
+ * and a time, so the recording has no start instant.
229
+ * ... and metadata.json records start_datetime_local as null.
230
+ *
231
+ * warning: This recording's timekeeping annotations place it 1e17s from its own start
232
+ * date ...
233
+ * ... Add the onsets in annotations.csv to recover absolute times.
234
+ *
235
+ * Neither file exists after such a run. The second is advice a reader can follow into an
236
+ * empty directory — there is no directory.
237
+ *
238
+ * Amended where the answer is, the same way `withTimingPromiseKept` rewrites a `DISCONTINUOUS`
239
+ * hint the parser could not have known was false, and `withoutFileRateWarning` drops a header
240
+ * diagnostic the plan supersedes. A conversion to a directory keeps every word.
241
+ */
242
+ export declare function withSidecarsUnwritten(diagnostics: readonly Diagnostic[], toStdout: boolean): Diagnostic[];
220
243
  /**
221
244
  * `--annotations-only` on a recording that has no annotations.
222
245
  *
@@ -97,7 +97,11 @@ export async function convert(inputPath, options = {}) {
97
97
  files: written,
98
98
  readerHungUp,
99
99
  annotationCount: 0,
100
- diagnostics: [...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timing.starts !== null), ...plan.diagnostics],
100
+ // Over both lists, because the timing warnings are pushed onto the plan's.
101
+ diagnostics: withSidecarsUnwritten([
102
+ ...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timing.starts !== null),
103
+ ...plan.diagnostics,
104
+ ], true),
101
105
  plan,
102
106
  file,
103
107
  elapsedMs: Date.now() - startedAt,
@@ -1490,6 +1494,53 @@ export function noSignalFile(file, plan) {
1490
1494
  `table --info prints, and in the ${outputCsvName('channels', plan.gzip)} a conversion writes.`,
1491
1495
  };
1492
1496
  }
1497
+ /**
1498
+ * The sidecar files a `--stdout` run does not write, taken out of the sentences about them.
1499
+ *
1500
+ * `--stdout` puts one table on the stream and writes nothing else — "No sidecar files are
1501
+ * written", as `ConvertOptions` puts it. Two diagnostics raised before the destination is
1502
+ * known end by pointing at one of those files:
1503
+ *
1504
+ * warning: The header's start date and time ("XX.XX.XX" and "YY.YY.YY") are not a date
1505
+ * and a time, so the recording has no start instant.
1506
+ * ... and metadata.json records start_datetime_local as null.
1507
+ *
1508
+ * warning: This recording's timekeeping annotations place it 1e17s from its own start
1509
+ * date ...
1510
+ * ... Add the onsets in annotations.csv to recover absolute times.
1511
+ *
1512
+ * Neither file exists after such a run. The second is advice a reader can follow into an
1513
+ * empty directory — there is no directory.
1514
+ *
1515
+ * Amended where the answer is, the same way `withTimingPromiseKept` rewrites a `DISCONTINUOUS`
1516
+ * hint the parser could not have known was false, and `withoutFileRateWarning` drops a header
1517
+ * diagnostic the plan supersedes. A conversion to a directory keeps every word.
1518
+ */
1519
+ export function withSidecarsUnwritten(diagnostics, toStdout) {
1520
+ if (!toStdout)
1521
+ return [...diagnostics];
1522
+ return diagnostics.map((diagnostic) => {
1523
+ if (diagnostic.code === 'START_TIME_UNREADABLE' &&
1524
+ diagnostic.hint?.includes('metadata.json records')) {
1525
+ return {
1526
+ ...diagnostic,
1527
+ hint: 'time_s is unaffected — it counts from the start of the recording either way. What ' +
1528
+ 'cannot be done is turning it into a wall-clock instant, and --stdout writes no ' +
1529
+ 'metadata.json to record start_datetime_local as null in.',
1530
+ };
1531
+ }
1532
+ if (diagnostic.code === 'DISCONTINUOUS' &&
1533
+ diagnostic.hint?.includes('onsets in annotations.csv')) {
1534
+ return {
1535
+ ...diagnostic,
1536
+ hint: 'Sample times are written from zero instead, so every row is present and the ' +
1537
+ 'column increases. The onsets that recover absolute times are in the annotation ' +
1538
+ 'channel; --stdout writes no annotations.csv, so convert to a directory for them.',
1539
+ };
1540
+ }
1541
+ return diagnostic;
1542
+ });
1543
+ }
1493
1544
  /**
1494
1545
  * `--annotations-only` on a recording that has no annotations.
1495
1546
  *