edf2csv 0.8.69 → 0.8.71
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 +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/convert/run.d.ts +1 -1
- package/dist/convert/run.js +39 -16
- package/dist/convert/run.js.map +1 -1
- package/package.json +1 -1
package/dist/convert/run.d.ts
CHANGED
|
@@ -239,7 +239,7 @@ export declare function noSignalFile(file: EdfFile, plan: ConversionPlan): Diagn
|
|
|
239
239
|
*
|
|
240
240
|
* `writesSignals` rather than the option, because the plan is what settles it.
|
|
241
241
|
*/
|
|
242
|
-
export declare function withSignalTableUnwritten(diagnostics: readonly Diagnostic[], writesSignals: boolean): Diagnostic[];
|
|
242
|
+
export declare function withSignalTableUnwritten(diagnostics: readonly Diagnostic[], writesSignals: boolean, gzip: boolean): Diagnostic[];
|
|
243
243
|
/**
|
|
244
244
|
* The sidecar files a `--stdout` run does not write, taken out of the sentences about them.
|
|
245
245
|
*
|
package/dist/convert/run.js
CHANGED
|
@@ -101,7 +101,7 @@ export async function convert(inputPath, options = {}) {
|
|
|
101
101
|
diagnostics: withSidecarsNamed(withSignalTableUnwritten([
|
|
102
102
|
...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timing.starts !== null),
|
|
103
103
|
...plan.diagnostics,
|
|
104
|
-
], plan.writeSignals), { toStdout: true, gzip: plan.gzip }),
|
|
104
|
+
], plan.writeSignals, plan.gzip), { toStdout: true, gzip: plan.gzip }),
|
|
105
105
|
plan,
|
|
106
106
|
file,
|
|
107
107
|
elapsedMs: Date.now() - startedAt,
|
|
@@ -203,7 +203,7 @@ export async function convert(inputPath, options = {}) {
|
|
|
203
203
|
...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timing.starts !== null),
|
|
204
204
|
...plan.diagnostics,
|
|
205
205
|
...stale,
|
|
206
|
-
], plan.writeSignals), { toStdout: false, gzip: plan.gzip }),
|
|
206
|
+
], plan.writeSignals, plan.gzip), { 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.
|
|
@@ -1566,9 +1574,20 @@ export function noSignalFile(file, plan) {
|
|
|
1566
1574
|
*
|
|
1567
1575
|
* `writesSignals` rather than the option, because the plan is what settles it.
|
|
1568
1576
|
*/
|
|
1569
|
-
export function withSignalTableUnwritten(diagnostics, writesSignals) {
|
|
1577
|
+
export function withSignalTableUnwritten(diagnostics, writesSignals, gzip) {
|
|
1570
1578
|
if (writesSignals)
|
|
1571
1579
|
return [...diagnostics];
|
|
1580
|
+
/*
|
|
1581
|
+
The sidecars named here are named as the run writes them.
|
|
1582
|
+
|
|
1583
|
+
These sentences send the reader to the one file an `--annotations-only` run does write, and
|
|
1584
|
+
said `channels.csv` to a `--gzip` run that writes `channels.csv.gz` — five hints pointing at
|
|
1585
|
+
a name that is not in the directory, one of them beside the `_ch` collision hint that 0.8.48
|
|
1586
|
+
had already taught to say `channels.csv.gz`. So a single run named both spellings, and only
|
|
1587
|
+
the second one existed.
|
|
1588
|
+
*/
|
|
1589
|
+
const channelsFile = outputCsvName('channels', gzip);
|
|
1590
|
+
const annotationsFile = outputCsvName('annotations', gzip);
|
|
1572
1591
|
return diagnostics.map((diagnostic) => {
|
|
1573
1592
|
/*
|
|
1574
1593
|
And the three calibration warnings, whose hints are about cells.
|
|
@@ -1609,7 +1628,9 @@ export function withSignalTableUnwritten(diagnostics, writesSignals) {
|
|
|
1609
1628
|
return {
|
|
1610
1629
|
...diagnostic,
|
|
1611
1630
|
message: diagnostic.message
|
|
1612
|
-
.replace("as the channel's name in signals.csv",
|
|
1631
|
+
.replace("as the channel's name in signals.csv", `as the channel's name in ${channelsFile}'s column cell`)
|
|
1632
|
+
// Matched on the name the header diagnostic used, which the line above has not
|
|
1633
|
+
// touched: it renames the first mention, and this collapses the second.
|
|
1613
1634
|
.replace("column cell and in channels.csv's", 'column cell and in its')
|
|
1614
1635
|
.replace(' in any conversion that writes one', ''),
|
|
1615
1636
|
};
|
|
@@ -1620,28 +1641,28 @@ export function withSignalTableUnwritten(diagnostics, writesSignals) {
|
|
|
1620
1641
|
...diagnostic,
|
|
1621
1642
|
hint: 'Their names are suffixed with the signal number so they stay distinguishable. ' +
|
|
1622
1643
|
'--annotations-only writes no signal table, so the suffixed names appear only in ' +
|
|
1623
|
-
|
|
1644
|
+
`${channelsFile}'s column cells.`,
|
|
1624
1645
|
};
|
|
1625
1646
|
}
|
|
1626
1647
|
if (diagnostic.code === 'DEGENERATE_DIGITAL_RANGE') {
|
|
1627
1648
|
return {
|
|
1628
1649
|
...diagnostic,
|
|
1629
1650
|
hint: 'No samples are converted with --annotations-only, so there are no cells to leave ' +
|
|
1630
|
-
|
|
1651
|
+
`empty. ${channelsFile} still records the digital range the header gives.`,
|
|
1631
1652
|
};
|
|
1632
1653
|
}
|
|
1633
1654
|
if (diagnostic.code === 'DEGENERATE_PHYSICAL_RANGE') {
|
|
1634
1655
|
return {
|
|
1635
1656
|
...diagnostic,
|
|
1636
1657
|
message: diagnostic.message.replace('so every sample converts to the same value.', 'so every sample would convert to the same value.'),
|
|
1637
|
-
hint:
|
|
1638
|
-
'calibration, one point wide.',
|
|
1658
|
+
hint: `No samples are converted with --annotations-only. ${channelsFile} still records ` +
|
|
1659
|
+
'the calibration, one point wide.',
|
|
1639
1660
|
};
|
|
1640
1661
|
}
|
|
1641
1662
|
if (diagnostic.code === 'INVERTED_PHYSICAL_RANGE') {
|
|
1642
1663
|
return {
|
|
1643
1664
|
...diagnostic,
|
|
1644
|
-
hint:
|
|
1665
|
+
hint: `No samples are converted with --annotations-only. ${channelsFile} records the ` +
|
|
1645
1666
|
'physical minimum and maximum in the order the header gives them, inversion included.',
|
|
1646
1667
|
};
|
|
1647
1668
|
}
|
|
@@ -1651,15 +1672,15 @@ export function withSignalTableUnwritten(diagnostics, writesSignals) {
|
|
|
1651
1672
|
return {
|
|
1652
1673
|
...diagnostic,
|
|
1653
1674
|
hint: '--annotations-only writes no signal rows, so nothing here is timed from the ' +
|
|
1654
|
-
|
|
1655
|
-
'from in record_index.',
|
|
1675
|
+
`records. ${annotationsFile} carries each event's own onset, and the record it ` +
|
|
1676
|
+
'came from in record_index.',
|
|
1656
1677
|
};
|
|
1657
1678
|
}
|
|
1658
1679
|
if (diagnostic.hint.startsWith('Rows are written in file order')) {
|
|
1659
1680
|
return {
|
|
1660
1681
|
...diagnostic,
|
|
1661
1682
|
hint: '--annotations-only writes no signal rows, so no time column is affected. ' +
|
|
1662
|
-
|
|
1683
|
+
`${annotationsFile}'s record_index still names the record each event came from.`,
|
|
1663
1684
|
};
|
|
1664
1685
|
}
|
|
1665
1686
|
if (diagnostic.hint.startsWith('Sample times are written from zero')) {
|
|
@@ -1714,8 +1735,10 @@ export function withSidecarsNamed(diagnostics, { toStdout, gzip }) {
|
|
|
1714
1735
|
return {
|
|
1715
1736
|
...diagnostic,
|
|
1716
1737
|
message: diagnostic.message
|
|
1717
|
-
.
|
|
1718
|
-
.
|
|
1738
|
+
// Past a name the pass above already suffixed: `channels.csv.gz` contains
|
|
1739
|
+
// `channels.csv`, and a second rename made it `channels.csv.gz.gz`.
|
|
1740
|
+
.replace(/\bsignals\.csv\b(?!\.gz)/gu, outputCsvName('signals', true))
|
|
1741
|
+
.replace(/\bchannels\.csv\b(?!\.gz)/gu, channels),
|
|
1719
1742
|
};
|
|
1720
1743
|
}
|
|
1721
1744
|
/*
|
|
@@ -1938,7 +1961,7 @@ bom) {
|
|
|
1938
1961
|
notes: withSidecarsNamed(withSignalTableUnwritten([
|
|
1939
1962
|
...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timedFromRecords),
|
|
1940
1963
|
...plan.diagnostics,
|
|
1941
|
-
], plan.writeSignals),
|
|
1964
|
+
], plan.writeSignals, plan.gzip),
|
|
1942
1965
|
// metadata.json is only written into a directory, so this is never the stdout case.
|
|
1943
1966
|
{ toStdout: false, gzip: plan.gzip }).map((d) => ({
|
|
1944
1967
|
code: d.code,
|