edf2csv 0.8.70 → 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 +30 -15
- 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,
|
|
@@ -1574,9 +1574,20 @@ export function noSignalFile(file, plan) {
|
|
|
1574
1574
|
*
|
|
1575
1575
|
* `writesSignals` rather than the option, because the plan is what settles it.
|
|
1576
1576
|
*/
|
|
1577
|
-
export function withSignalTableUnwritten(diagnostics, writesSignals) {
|
|
1577
|
+
export function withSignalTableUnwritten(diagnostics, writesSignals, gzip) {
|
|
1578
1578
|
if (writesSignals)
|
|
1579
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);
|
|
1580
1591
|
return diagnostics.map((diagnostic) => {
|
|
1581
1592
|
/*
|
|
1582
1593
|
And the three calibration warnings, whose hints are about cells.
|
|
@@ -1617,7 +1628,9 @@ export function withSignalTableUnwritten(diagnostics, writesSignals) {
|
|
|
1617
1628
|
return {
|
|
1618
1629
|
...diagnostic,
|
|
1619
1630
|
message: diagnostic.message
|
|
1620
|
-
.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.
|
|
1621
1634
|
.replace("column cell and in channels.csv's", 'column cell and in its')
|
|
1622
1635
|
.replace(' in any conversion that writes one', ''),
|
|
1623
1636
|
};
|
|
@@ -1628,28 +1641,28 @@ export function withSignalTableUnwritten(diagnostics, writesSignals) {
|
|
|
1628
1641
|
...diagnostic,
|
|
1629
1642
|
hint: 'Their names are suffixed with the signal number so they stay distinguishable. ' +
|
|
1630
1643
|
'--annotations-only writes no signal table, so the suffixed names appear only in ' +
|
|
1631
|
-
|
|
1644
|
+
`${channelsFile}'s column cells.`,
|
|
1632
1645
|
};
|
|
1633
1646
|
}
|
|
1634
1647
|
if (diagnostic.code === 'DEGENERATE_DIGITAL_RANGE') {
|
|
1635
1648
|
return {
|
|
1636
1649
|
...diagnostic,
|
|
1637
1650
|
hint: 'No samples are converted with --annotations-only, so there are no cells to leave ' +
|
|
1638
|
-
|
|
1651
|
+
`empty. ${channelsFile} still records the digital range the header gives.`,
|
|
1639
1652
|
};
|
|
1640
1653
|
}
|
|
1641
1654
|
if (diagnostic.code === 'DEGENERATE_PHYSICAL_RANGE') {
|
|
1642
1655
|
return {
|
|
1643
1656
|
...diagnostic,
|
|
1644
1657
|
message: diagnostic.message.replace('so every sample converts to the same value.', 'so every sample would convert to the same value.'),
|
|
1645
|
-
hint:
|
|
1646
|
-
'calibration, one point wide.',
|
|
1658
|
+
hint: `No samples are converted with --annotations-only. ${channelsFile} still records ` +
|
|
1659
|
+
'the calibration, one point wide.',
|
|
1647
1660
|
};
|
|
1648
1661
|
}
|
|
1649
1662
|
if (diagnostic.code === 'INVERTED_PHYSICAL_RANGE') {
|
|
1650
1663
|
return {
|
|
1651
1664
|
...diagnostic,
|
|
1652
|
-
hint:
|
|
1665
|
+
hint: `No samples are converted with --annotations-only. ${channelsFile} records the ` +
|
|
1653
1666
|
'physical minimum and maximum in the order the header gives them, inversion included.',
|
|
1654
1667
|
};
|
|
1655
1668
|
}
|
|
@@ -1659,15 +1672,15 @@ export function withSignalTableUnwritten(diagnostics, writesSignals) {
|
|
|
1659
1672
|
return {
|
|
1660
1673
|
...diagnostic,
|
|
1661
1674
|
hint: '--annotations-only writes no signal rows, so nothing here is timed from the ' +
|
|
1662
|
-
|
|
1663
|
-
'from in record_index.',
|
|
1675
|
+
`records. ${annotationsFile} carries each event's own onset, and the record it ` +
|
|
1676
|
+
'came from in record_index.',
|
|
1664
1677
|
};
|
|
1665
1678
|
}
|
|
1666
1679
|
if (diagnostic.hint.startsWith('Rows are written in file order')) {
|
|
1667
1680
|
return {
|
|
1668
1681
|
...diagnostic,
|
|
1669
1682
|
hint: '--annotations-only writes no signal rows, so no time column is affected. ' +
|
|
1670
|
-
|
|
1683
|
+
`${annotationsFile}'s record_index still names the record each event came from.`,
|
|
1671
1684
|
};
|
|
1672
1685
|
}
|
|
1673
1686
|
if (diagnostic.hint.startsWith('Sample times are written from zero')) {
|
|
@@ -1722,8 +1735,10 @@ export function withSidecarsNamed(diagnostics, { toStdout, gzip }) {
|
|
|
1722
1735
|
return {
|
|
1723
1736
|
...diagnostic,
|
|
1724
1737
|
message: diagnostic.message
|
|
1725
|
-
.
|
|
1726
|
-
.
|
|
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),
|
|
1727
1742
|
};
|
|
1728
1743
|
}
|
|
1729
1744
|
/*
|
|
@@ -1946,7 +1961,7 @@ bom) {
|
|
|
1946
1961
|
notes: withSidecarsNamed(withSignalTableUnwritten([
|
|
1947
1962
|
...withTimingPromiseKept(withoutFileRateWarning(file.diagnostics), timedFromRecords),
|
|
1948
1963
|
...plan.diagnostics,
|
|
1949
|
-
], plan.writeSignals),
|
|
1964
|
+
], plan.writeSignals, plan.gzip),
|
|
1950
1965
|
// metadata.json is only written into a directory, so this is never the stdout case.
|
|
1951
1966
|
{ toStdout: false, gzip: plan.gzip }).map((d) => ({
|
|
1952
1967
|
code: d.code,
|