edf2csv 0.9.46 → 0.9.48

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.
@@ -1791,6 +1791,31 @@ emptiedByWindow = new Set()) {
1791
1791
  */
1792
1792
  const channelsFile = outputCsvName('channels', gzip && !toStdout);
1793
1793
  const annotationsFile = outputCsvName('annotations', gzip);
1794
+ /*
1795
+ And the event list, which `--stdout --annotations-only` does not write either.
1796
+
1797
+ 0.9.29 taught `channelsFile` that `--stdout` writes no sidecar and gave every sentence
1798
+ offering one a `--stdout` form; the file the *other* four rewrites offer was left naming
1799
+ itself. All four say the events keep their own onsets whatever the records do, and send
1800
+ the reader to `annotations.csv` for them — and `--stdout --annotations-only` is refused
1801
+ outright, so `--info` is where it is read and nothing is written at all:
1802
+
1803
+ $ edf2csv scored.edf --info --stdout --gzip --annotations-only
1804
+ warning: This recording is marked discontinuous (EDF+D): ...
1805
+ --annotations-only writes no signal rows, so nothing here is timed from
1806
+ the records. annotations.csv.gz carries each event's own onset, and the
1807
+ record it came from in record_index.
1808
+ warning: --stdout would refuse this run: has no signal data to write because
1809
+ --annotations-only was given.
1810
+
1811
+ `annotations.csv.gz` under a flag pair that writes no file under either name. Named as
1812
+ the conversion that does write it, which is the advice the refusal under it gives.
1813
+ */
1814
+ const eventsInstead = toStdout && !writesSignals
1815
+ ? `--stdout writes no ${outputCsvName('annotations', false)} either, so nothing is ` +
1816
+ `written at all; a conversion to a directory carries each event's own onset and the ` +
1817
+ `record it came from in record_index.`
1818
+ : null;
1794
1819
  /*
1795
1820
  What channels.csv still holds about the channel, or that there is no channels.csv.
1796
1821
 
@@ -2070,8 +2095,9 @@ emptiedByWindow = new Set()) {
2070
2095
  return {
2071
2096
  ...diagnostic,
2072
2097
  hint: `${writes}, so nothing is timed from ${one ? 'that record' : 'those records'}. ` +
2073
- `The events in ${one ? 'it' : 'them'} carry their own onsets, and ` +
2074
- `${annotationsFile}'s record_index still names ${one ? 'it' : 'them'}.`,
2098
+ (eventsInstead ??
2099
+ `The events in ${one ? 'it' : 'them'} carry their own onsets, and ` +
2100
+ `${annotationsFile}'s record_index still names ${one ? 'it' : 'them'}.`),
2075
2101
  };
2076
2102
  }
2077
2103
  if (diagnostic.code !== 'DISCONTINUOUS' || diagnostic.hint === undefined)
@@ -2079,16 +2105,18 @@ emptiedByWindow = new Set()) {
2079
2105
  if (diagnostic.hint.startsWith('Each row carries its true recording time')) {
2080
2106
  return {
2081
2107
  ...diagnostic,
2082
- hint: `${writes}, so nothing here is timed from the ` +
2083
- `records. ${annotationsFile} carries each event's own onset, and the record it ` +
2084
- 'came from in record_index.',
2108
+ hint: `${writes}, so nothing here is timed from the records. ` +
2109
+ (eventsInstead ??
2110
+ `${annotationsFile} carries each event's own onset, and the record it ` +
2111
+ 'came from in record_index.'),
2085
2112
  };
2086
2113
  }
2087
2114
  if (diagnostic.hint.startsWith('Rows are written in file order')) {
2088
2115
  return {
2089
2116
  ...diagnostic,
2090
2117
  hint: `${writes}, so no time column is affected. ` +
2091
- `${annotationsFile}'s record_index still names the record each event came from.`,
2118
+ (eventsInstead ??
2119
+ `${annotationsFile}'s record_index still names the record each event came from.`),
2092
2120
  };
2093
2121
  }
2094
2122
  if (diagnostic.hint.startsWith('Sample times are written from zero')) {
@@ -2125,9 +2153,10 @@ emptiedByWindow = new Set()) {
2125
2153
  if (diagnostic.hint.startsWith('Times are written as if the records were contiguous')) {
2126
2154
  return {
2127
2155
  ...diagnostic,
2128
- hint: `${writes}, so no times are written from the ` +
2129
- `records at all. ${annotationsFile} carries each event's own onset, which the ` +
2130
- 'records do not decide.',
2156
+ hint: `${writes}, so no times are written from the records at all. ` +
2157
+ (eventsInstead ??
2158
+ `${annotationsFile} carries each event's own onset, which the ` +
2159
+ 'records do not decide.'),
2131
2160
  };
2132
2161
  }
2133
2162
  // The marker warning's hint, which `withTimingPromiseKept` has already rewritten once and
@@ -2248,6 +2277,26 @@ export function withSidecarsNamed(diagnostics, { toStdout, gzip }) {
2248
2277
  Two consecutive warnings, the first offering the file the second says to convert to a
2249
2278
  directory to get. Named as the conversion that does write them, which is that advice.
2250
2279
  */
2280
+ /*
2281
+ And the empty event list, whose message ends in the file that holds nothing.
2282
+
2283
+ `emptyAnnotations` is only raised where no signal table is written, which under
2284
+ `--stdout` means `--annotations-only` — a pair this tool refuses, so `--info` is where
2285
+ it is read. Both forms of the message name the file, and `--gzip` named the compressed
2286
+ one: "annotations.csv.gz holds its header and no rows", of a run that writes no file
2287
+ under either name, two lines above the warning saying the run would be refused.
2288
+
2289
+ The message stays a statement about the recording — its channel really does carry no
2290
+ events, or none inside the window — and what moves is the file: the one a conversion to
2291
+ a directory would write, which is where the refusal under it sends the reader.
2292
+ */
2293
+ if (toStdout && diagnostic.code === 'NO_ANNOTATIONS' && / holds its header and no rows\.$/u.test(diagnostic.message)) {
2294
+ return {
2295
+ ...diagnostic,
2296
+ message: diagnostic.message.replace(/, so [\w.]+ holds its header and no rows\.$/u, `, and --stdout writes no ${outputCsvName('annotations', false)}; a conversion ` +
2297
+ `to a directory writes one holding its header and no rows.`),
2298
+ };
2299
+ }
2251
2300
  if (toStdout &&
2252
2301
  diagnostic.code === 'NO_SAMPLES' &&
2253
2302
  diagnostic.hint?.includes('holds whatever events it carries') === true) {