edf2csv 0.8.68 → 0.8.70
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/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/convert/run.js +35 -8
- package/dist/convert/run.js.map +1 -1
- package/package.json +1 -1
package/dist/convert/run.js
CHANGED
|
@@ -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: withSignalTableUnwritten(
|
|
101
|
+
diagnostics: withSidecarsNamed(withSignalTableUnwritten([
|
|
102
102
|
...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timing.starts !== null),
|
|
103
103
|
...plan.diagnostics,
|
|
104
|
-
], { toStdout: true, gzip: plan.gzip }),
|
|
104
|
+
], plan.writeSignals), { toStdout: true, gzip: plan.gzip }),
|
|
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: withSignalTableUnwritten(
|
|
202
|
+
diagnostics: withSidecarsNamed(withSignalTableUnwritten([
|
|
203
203
|
...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timing.starts !== null),
|
|
204
204
|
...plan.diagnostics,
|
|
205
205
|
...stale,
|
|
206
|
-
], { toStdout: false, gzip: plan.gzip }),
|
|
206
|
+
], plan.writeSignals), { toStdout: false, gzip: plan.gzip }),
|
|
207
207
|
plan,
|
|
208
208
|
file,
|
|
209
209
|
elapsedMs: Date.now() - startedAt,
|
|
@@ -1481,7 +1481,15 @@ export function stdoutRefusal(file, plan) {
|
|
|
1481
1481
|
? `--stdout has no signal data to write: this recording has no signal channels, ` +
|
|
1482
1482
|
`only ${file.header.isBdf ? 'BDF+' : 'EDF+'} annotations.`
|
|
1483
1483
|
: '--stdout has no signal data to write: nothing was selected that carries samples.', file.dataSignals.length === 0
|
|
1484
|
-
?
|
|
1484
|
+
? /*
|
|
1485
|
+
Named the way that conversion would name it, since `--gzip` is already on the
|
|
1486
|
+
command line this is refusing. This hint is nothing but a command to run, and the
|
|
1487
|
+
command it names writes `annotations.csv.gz` — so a reader who follows it finds
|
|
1488
|
+
nothing under the name they were given. Same fault 0.8.48 fixed for the warnings,
|
|
1489
|
+
in the one refusal that names a file.
|
|
1490
|
+
*/
|
|
1491
|
+
`Convert to a directory to get its ${outputCsvName('annotations', plan.gzip)}, or ` +
|
|
1492
|
+
`drop --stdout.`
|
|
1485
1493
|
: 'Check --channels and the requested window, or convert to a directory instead.');
|
|
1486
1494
|
}
|
|
1487
1495
|
// The long layout is one table whatever the rates are, so it has nothing to refuse.
|
|
@@ -1699,6 +1707,25 @@ export function withSidecarsNamed(diagnostics, { toStdout, gzip }) {
|
|
|
1699
1707
|
const channels = outputCsvName('channels', gzip);
|
|
1700
1708
|
const annotations = outputCsvName('annotations', gzip);
|
|
1701
1709
|
return diagnostics.map((diagnostic) => {
|
|
1710
|
+
/*
|
|
1711
|
+
The last message of this kind, and the one that names its files mid-sentence.
|
|
1712
|
+
|
|
1713
|
+
`NONPRINTABLE_LABEL` says where an invisible byte lands — the channel's name in
|
|
1714
|
+
signals.csv, a cell of channels.csv — and `--gzip` writes neither of those names. It was
|
|
1715
|
+
left out of 0.8.48 because the file is named inside a sentence assembled from which of
|
|
1716
|
+
the four header fields carry bytes, and out of 0.8.54 for the same reason. Renaming is
|
|
1717
|
+
all it needs, once the sentence is settled: this runs after `withSignalTableUnwritten`
|
|
1718
|
+
has had its say about the layout, so whichever file the sentence ended up naming is the
|
|
1719
|
+
one that gets the suffix.
|
|
1720
|
+
*/
|
|
1721
|
+
if (gzip && diagnostic.code === 'NONPRINTABLE_LABEL') {
|
|
1722
|
+
return {
|
|
1723
|
+
...diagnostic,
|
|
1724
|
+
message: diagnostic.message
|
|
1725
|
+
.replace(/\bsignals\.csv\b/gu, outputCsvName('signals', true))
|
|
1726
|
+
.replace(/\bchannels\.csv\b/gu, channels),
|
|
1727
|
+
};
|
|
1728
|
+
}
|
|
1702
1729
|
/*
|
|
1703
1730
|
The header's own `NO_SAMPLES`, which names the file that describes the channel it is
|
|
1704
1731
|
about — and under `--stdout` there is no such file, so the reassurance is empty:
|
|
@@ -1916,12 +1943,12 @@ bom) {
|
|
|
1916
1943
|
decimals: g.channels.map((c) => c.decimals),
|
|
1917
1944
|
})),
|
|
1918
1945
|
},
|
|
1919
|
-
notes: withSignalTableUnwritten(
|
|
1946
|
+
notes: withSidecarsNamed(withSignalTableUnwritten([
|
|
1920
1947
|
...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timedFromRecords),
|
|
1921
1948
|
...plan.diagnostics,
|
|
1922
|
-
],
|
|
1949
|
+
], plan.writeSignals),
|
|
1923
1950
|
// metadata.json is only written into a directory, so this is never the stdout case.
|
|
1924
|
-
{ toStdout: false, gzip: plan.gzip })
|
|
1951
|
+
{ toStdout: false, gzip: plan.gzip }).map((d) => ({
|
|
1925
1952
|
code: d.code,
|
|
1926
1953
|
severity: d.severity,
|
|
1927
1954
|
message: d.message,
|