edf2csv 0.9.9 → 0.9.11
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.d.ts +4 -2
- package/dist/convert/run.js +21 -7
- package/dist/convert/run.js.map +1 -1
- package/package.json +1 -1
package/dist/convert/run.d.ts
CHANGED
|
@@ -105,7 +105,7 @@ export declare function describeFsError(cause: unknown): string;
|
|
|
105
105
|
export declare function durationDiagnostics(annotations: readonly Annotation[], window: {
|
|
106
106
|
from: number;
|
|
107
107
|
to: number;
|
|
108
|
-
}): Diagnostic[];
|
|
108
|
+
}, gzip?: boolean): Diagnostic[];
|
|
109
109
|
/**
|
|
110
110
|
* What the descriptions in the events that will actually be written look like.
|
|
111
111
|
*
|
|
@@ -136,7 +136,9 @@ export declare function durationDiagnostics(annotations: readonly Annotation[],
|
|
|
136
136
|
export declare function descriptionDiagnostics(annotations: readonly Annotation[], window: {
|
|
137
137
|
from: number;
|
|
138
138
|
to: number;
|
|
139
|
-
}
|
|
139
|
+
},
|
|
140
|
+
/** The name the run writes the event list under; see `durationDiagnostics`. */
|
|
141
|
+
gzip?: boolean): Diagnostic[];
|
|
140
142
|
/**
|
|
141
143
|
* The window annotations are filtered by — the bounds as asked for, not as snapped to records.
|
|
142
144
|
*
|
package/dist/convert/run.js
CHANGED
|
@@ -157,8 +157,8 @@ export async function convert(inputPath, options = {}) {
|
|
|
157
157
|
const window = requestedAnnotationWindow(options, plan.range.recordingStartSeconds);
|
|
158
158
|
// Reported against the rows that will be written, not against the file; see
|
|
159
159
|
// durationDiagnostics.
|
|
160
|
-
plan.diagnostics.push(...durationDiagnostics(annotationData.annotations, window));
|
|
161
|
-
plan.diagnostics.push(...descriptionDiagnostics(annotationData.annotations, window));
|
|
160
|
+
plan.diagnostics.push(...durationDiagnostics(annotationData.annotations, window, plan.gzip));
|
|
161
|
+
plan.diagnostics.push(...descriptionDiagnostics(annotationData.annotations, window, plan.gzip));
|
|
162
162
|
const result = await writeAnnotationsCsv(outputDir, annotationData.annotations, window, options.gzip === true, options.bom === true);
|
|
163
163
|
written.push(result);
|
|
164
164
|
annotationsWritten = result.rows;
|
|
@@ -1176,8 +1176,19 @@ async function writeChannelsCsv(outputDir, file, plan, gzip, bom) {
|
|
|
1176
1176
|
* because `duration: null` cannot say whether the file gave one; a negative duration needs no
|
|
1177
1177
|
* flag, since the value is right there.
|
|
1178
1178
|
*/
|
|
1179
|
-
export function durationDiagnostics(annotations, window
|
|
1179
|
+
export function durationDiagnostics(annotations, window,
|
|
1180
|
+
/*
|
|
1181
|
+
And the name the run writes that file under, which these sentences did not have.
|
|
1182
|
+
|
|
1183
|
+
Both hints send the reader to `annotations.csv` to look at the rows they are about, and a
|
|
1184
|
+
`--gzip` run writes `annotations.csv.gz`. `emptyAnnotations` two functions down takes this
|
|
1185
|
+
for the same reason and has since 0.8.48 — "`--info` named `annotations.csv` for a run that
|
|
1186
|
+
wrote `annotations.csv.gz`" — and the four beside it were left naming a file that is not in
|
|
1187
|
+
the directory.
|
|
1188
|
+
*/
|
|
1189
|
+
gzip = false) {
|
|
1180
1190
|
const written = annotations.filter((a) => a.onset >= window.from && a.onset < window.to);
|
|
1191
|
+
const eventsFile = outputCsvName('annotations', gzip);
|
|
1181
1192
|
const diagnostics = [];
|
|
1182
1193
|
const negative = written.filter((a) => a.duration !== null && a.duration < 0).length;
|
|
1183
1194
|
if (negative > 0) {
|
|
@@ -1187,7 +1198,7 @@ export function durationDiagnostics(annotations, window) {
|
|
|
1187
1198
|
severity: 'warning',
|
|
1188
1199
|
message: `${counted(negative, 'annotation')} state${one ? 's' : ''} a duration below zero, ` +
|
|
1189
1200
|
`which is not a length of time.`,
|
|
1190
|
-
hint:
|
|
1201
|
+
hint: `The value is written to ${eventsFile} as the file gave it. Adding it to onset_s ` +
|
|
1191
1202
|
'ends the event before it starts, so check these rows before using the durations.',
|
|
1192
1203
|
});
|
|
1193
1204
|
}
|
|
@@ -1232,8 +1243,11 @@ export function durationDiagnostics(annotations, window) {
|
|
|
1232
1243
|
* reach `annotations.csv`, after the same window filter the writer applies, for the reason
|
|
1233
1244
|
* `durationDiagnostics` beside it gives.
|
|
1234
1245
|
*/
|
|
1235
|
-
export function descriptionDiagnostics(annotations, window
|
|
1246
|
+
export function descriptionDiagnostics(annotations, window,
|
|
1247
|
+
/** The name the run writes the event list under; see `durationDiagnostics`. */
|
|
1248
|
+
gzip = false) {
|
|
1236
1249
|
const written = annotations.filter((a) => a.onset >= window.from && a.onset < window.to);
|
|
1250
|
+
const eventsFile = outputCsvName('annotations', gzip);
|
|
1237
1251
|
const diagnostics = [];
|
|
1238
1252
|
const formulaic = written.filter((a) => startsFormula(a.text));
|
|
1239
1253
|
if (formulaic.length > 0) {
|
|
@@ -1245,7 +1259,7 @@ export function descriptionDiagnostics(annotations, window) {
|
|
|
1245
1259
|
message: `${counted(formulaic.length, 'annotation')} ${one ? 'has a description' : 'have descriptions'} ` +
|
|
1246
1260
|
`starting with ${shown}, which Excel, LibreOffice and Google Sheets read as the start ` +
|
|
1247
1261
|
`of a formula rather than as text.`,
|
|
1248
|
-
hint:
|
|
1262
|
+
hint: `The text is written to ${eventsFile} exactly as the file has it, so the cell is ` +
|
|
1249
1263
|
'what the recording says. Open the CSV with pandas or R, or import it into the ' +
|
|
1250
1264
|
'spreadsheet as text, if you do not want it evaluated.',
|
|
1251
1265
|
});
|
|
@@ -1261,7 +1275,7 @@ export function descriptionDiagnostics(annotations, window) {
|
|
|
1261
1275
|
severity: 'warning',
|
|
1262
1276
|
message: `${counted(marked.length, 'annotation')} ${one ? 'has a description' : 'have descriptions'} ` +
|
|
1263
1277
|
`carrying text a terminal does not print as itself (${shown}), written to ` +
|
|
1264
|
-
|
|
1278
|
+
`${eventsFile} exactly as the file has ${one ? 'it' : 'them'}.`,
|
|
1265
1279
|
hint: 'A control byte can drive the terminal and a bidirectional override reverses what ' +
|
|
1266
1280
|
'follows it, so read the file with pandas or R rather than with cat. The cell is ' +
|
|
1267
1281
|
'what the recording says either way.',
|