edfcore 0.2.19 → 0.2.20

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/CHANGELOG.md CHANGED
@@ -6,6 +6,17 @@ alone does not tell you whether you were affected.
6
6
  edfcore is pre-1.0. Patch releases have carried behaviour changes where the old behaviour was a
7
7
  defect; those are called out below.
8
8
 
9
+ ## 0.2.20
10
+
11
+ - **Fixed** `filterAnnotationsByTime` dropping an annotation whose duration was written as an
12
+ explicit `0`. A TAL spells an instant either by omitting the duration field or by writing `0`;
13
+ the two are the same instant, and the docs say edfcore does not distinguish them. The left-edge
14
+ clause keyed on `durationTicks === undefined` — a fact about the writer, not the event — so an
15
+ explicitly-zero marker fell out of the window starting at its own onset AND out of the window
16
+ before it, belonging to no window at all in an adjacent-window partition. It also disagreed with
17
+ `annotationsAt`, which had always treated the two spellings alike. The clause now tests the
18
+ event's actual duration; positive-duration events and the half-open rule are untouched.
19
+
9
20
  ## 0.2.19
10
21
 
11
22
  - **Fixed** `mergeChunks` merging across a real gap whenever the index had not been scanned — the
@@ -1 +1 @@
1
- {"version":3,"file":"annotations-query.d.ts","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAErE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,MAAM,EAAE,mBAAmB,GAC1B,SAAS,aAAa,EAAE,CAe1B;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GACnD,SAAS,aAAa,EAAE,CAQ1B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,SAAS,aAAa,EAAE,GACpC,aAAa,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAQlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,OAAO,EAAE,MAAM,GACd,SAAS,aAAa,EAAE,CAS1B"}
1
+ {"version":3,"file":"annotations-query.d.ts","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAErE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,MAAM,EAAE,mBAAmB,GAC1B,SAAS,aAAa,EAAE,CAsB1B;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GACnD,SAAS,aAAa,EAAE,CAQ1B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,SAAS,aAAa,EAAE,GACpC,aAAa,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAQlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,OAAO,EAAE,MAAM,GACd,SAAS,aAAa,EAAE,CAS1B"}
@@ -35,8 +35,17 @@ export function filterAnnotationsByTime(annotations, window) {
35
35
  return Object.freeze(annotations.filter((annotation) => {
36
36
  const onset = annotation.onsetTicksFromFirstRecord;
37
37
  const end = onset + (annotation.durationTicks ?? 0n);
38
- // Half-open on both sides: [onset, end) against [from, to).
39
- return (onset < to && (end > from || (annotation.durationTicks === undefined && onset >= from)));
38
+ // Half-open on both sides: [onset, end) against [from, to). An instantaneous event has an
39
+ // empty interval, so `end > from` can never hold for one and it needs the second clause.
40
+ //
41
+ // That clause tests `end === onset` — the event's actual duration — and NOT
42
+ // `durationTicks === undefined`, which is a fact about the WRITER rather than the event. A
43
+ // TAL may spell an instant either by omitting the duration field or by writing `0`, the two
44
+ // are the same instant, and `annotations.md` says edfcore does not distinguish them. Keying
45
+ // on the spelling dropped every explicitly-zero event from the window starting at its own
46
+ // onset — and from the previous window too, so in an adjacent-window partition it belonged
47
+ // to no window at all (fixed in 0.2.20).
48
+ return onset < to && (end > from || (end === onset && onset >= from));
40
49
  }));
41
50
  }
42
51
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"annotations-query.js","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAqC,EACrC,MAA2B;IAE3B,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,EAAE,GAAG,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACzD,IAAI,EAAE,IAAI,IAAI;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAEzC,OAAO,MAAM,CAAC,MAAM,CAClB,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE;QAChC,MAAM,KAAK,GAAG,UAAU,CAAC,yBAAyB,CAAC;QACnD,MAAM,GAAG,GAAG,KAAK,GAAG,CAAC,UAAU,CAAC,aAAa,IAAI,EAAE,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CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CACxF,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC3B,WAAqC,EACrC,OAAe;IAEf,MAAM,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC,MAAM,CAClB,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE;QAChC,MAAM,KAAK,GAAG,UAAU,CAAC,yBAAyB,CAAC;QACnD,MAAM,QAAQ,GAAG,UAAU,CAAC,aAAa,IAAI,EAAE,CAAC;QAChD,OAAO,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC/E,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -109,5 +109,5 @@ export declare const SIGNAL_FIELD_BLOCK_OFFSETS: {
109
109
  readonly reserved: 224;
110
110
  };
111
111
  /** Published package version. Kept in sync with package.json by a test. */
112
- export declare const VERSION = "0.2.19";
112
+ export declare const VERSION = "0.2.20";
113
113
  //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -79,5 +79,5 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
79
79
  reserved: 224,
80
80
  };
81
81
  /** Published package version. Kept in sync with package.json by a test. */
82
- export const VERSION = '0.2.19';
82
+ export const VERSION = '0.2.20';
83
83
  //# sourceMappingURL=constants.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "Modern, typed, zero-dependency reader for EDF, EDF+, BDF and BDF+ biosignal files. Works in browsers and Node with true random access.",
5
5
  "keywords": [
6
6
  "edf",
@@ -42,10 +42,17 @@ export function filterAnnotationsByTime(
42
42
  annotations.filter((annotation) => {
43
43
  const onset = annotation.onsetTicksFromFirstRecord;
44
44
  const end = onset + (annotation.durationTicks ?? 0n);
45
- // Half-open on both sides: [onset, end) against [from, to).
46
- return (
47
- onset < to && (end > from || (annotation.durationTicks === undefined && onset >= from))
48
- );
45
+ // Half-open on both sides: [onset, end) against [from, to). An instantaneous event has an
46
+ // empty interval, so `end > from` can never hold for one and it needs the second clause.
47
+ //
48
+ // That clause tests `end === onset` — the event's actual duration — and NOT
49
+ // `durationTicks === undefined`, which is a fact about the WRITER rather than the event. A
50
+ // TAL may spell an instant either by omitting the duration field or by writing `0`, the two
51
+ // are the same instant, and `annotations.md` says edfcore does not distinguish them. Keying
52
+ // on the spelling dropped every explicitly-zero event from the window starting at its own
53
+ // onset — and from the previous window too, so in an adjacent-window partition it belonged
54
+ // to no window at all (fixed in 0.2.20).
55
+ return onset < to && (end > from || (end === onset && onset >= from));
49
56
  }),
50
57
  );
51
58
  }
package/src/constants.ts CHANGED
@@ -93,4 +93,4 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
93
93
  } as const;
94
94
 
95
95
  /** Published package version. Kept in sync with package.json by a test. */
96
- export const VERSION = '0.2.19';
96
+ export const VERSION = '0.2.20';