edf2csv 0.8.31 → 0.8.33

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 CHANGED
@@ -902,9 +902,25 @@ async function showInfo(input, shared, asJson, jsonIndent, batch = false, toStdo
902
902
  a conversion filters them by, rather than a second copy of it.
903
903
  */
904
904
  const eventWindow = requestedAnnotationWindow(shared, plan.range.recordingStartSeconds);
905
- const knownEvents = needsEveryRecordStart
906
- ? annotationData.annotations.filter((a) => a.onset >= eventWindow.from && a.onset < eventWindow.to).length
907
- : null;
905
+ /*
906
+ And zero where the header settles it, which `null` was claiming not to know.
907
+
908
+ `null` is this document's word for "not counted, because counting means reading the
909
+ channel record by record". A recording with no annotation channel has nothing to read
910
+ and nothing to count: the answer is none, and the header says so on the line above —
911
+ `annotation_channels: 0`. Plain EDF is most of the recordings anyone surveys, so a
912
+ script asking "which of these carry events" got `null` for the ones it could have been
913
+ told about and had to open them again to find out.
914
+
915
+ The text form has never had this ambiguity. It answers the same file with "and no
916
+ annotations.csv either, since this recording has no annotation channel", from the same
917
+ fact, in words.
918
+ */
919
+ const knownEvents = !hasAnnotations
920
+ ? 0
921
+ : needsEveryRecordStart
922
+ ? annotationData.annotations.filter((a) => a.onset >= eventWindow.from && a.onset < eventWindow.to).length
923
+ : null;
908
924
  plan.diagnostics.push(...timing.diagnostics);
909
925
  /*
910
926
  What the conversion would say about the durations it would write.
@@ -940,7 +956,10 @@ async function showInfo(input, shared, asJson, jsonIndent, batch = false, toStdo
940
956
  discontinuous file the whole channel has been read, and this is what the conversion
941
957
  will say, predicted before it runs.
942
958
  */
943
- if (!plan.writeSignals && knownEvents === 0) {
959
+ if (hasAnnotations && !plan.writeSignals && knownEvents === 0) {
960
+ // A file with no annotation channel is `noAnnotations`'s case, not this one: it says
961
+ // "--annotations-only was requested but this recording has no annotation channel",
962
+ // where this would say the channel carries no events. Only one of them is true.
944
963
  plan.diagnostics.push(emptyAnnotations(annotationData.annotations.length, eventWindow));
945
964
  }
946
965
  /*