edfcore 0.3.40 → 0.3.42
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 +29 -0
- package/dist/chunks.d.ts.map +1 -1
- package/dist/chunks.js +20 -4
- package/dist/chunks.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/decode/physical.js +2 -2
- package/dist/decode/physical.js.map +1 -1
- package/package.json +1 -1
- package/src/chunks.ts +20 -4
- package/src/constants.ts +1 -1
- package/src/decode/physical.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,35 @@ 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.3.42
|
|
10
|
+
|
|
11
|
+
- **Fixed** `toPhysical` and `clampToDigitalRange` reporting a *"NaN-byte maxMaterializeBytes
|
|
12
|
+
budget"* — the exact message 0.3.21 says it eliminated — and advising the caller to "produce
|
|
13
|
+
fewer samples per call", which no sample count can satisfy against `NaN`.
|
|
14
|
+
- 0.3.21 routed four budget reads through one resolver and **missed a fifth**: `decode/physical.ts`
|
|
15
|
+
carries its own copy of the guard, and grepping for the option's name found the four in the I/O
|
|
16
|
+
and scan paths. They are the only two allocating primitives on the public surface that never
|
|
17
|
+
validated it.
|
|
18
|
+
- Both now go through `resolveMaterializeBudget`, so a non-finite or negative value is a plain
|
|
19
|
+
`RangeError` naming `options.maxMaterializeBytes` and pointing at the expression that produced
|
|
20
|
+
it. A real budget still refuses a too-large allocation exactly as before, which is asserted.
|
|
21
|
+
|
|
22
|
+
## 0.3.41
|
|
23
|
+
|
|
24
|
+
- **Fixed** `mergeChunks` refusing an overlap with *"chunk 1 is preceded by a gap of -0.2 s"* — a
|
|
25
|
+
gap of negative duration — and explaining it as the inverse of what happened. Across a GAP two
|
|
26
|
+
samples either side of the join are seconds apart; across an OVERLAP they cover the same time,
|
|
27
|
+
so concatenating stores it twice rather than skipping it. The message asserted the first.
|
|
28
|
+
- **0.3.33's own headline was "in the two places that still said it was", and it named exactly
|
|
29
|
+
two.** This is a third. `src/chunks.ts` contained no mention of an overlap anywhere, so the
|
|
30
|
+
partition 0.3.3 stated — *a gap is time no record covers; an overlap is one instant two records
|
|
31
|
+
both claim* — had never reached it. Counting the sites from memory was the mistake, twice now.
|
|
32
|
+
- The refusal is unchanged and correct either way; only the wording branches on the sign, and the
|
|
33
|
+
magnitude is printed positive.
|
|
34
|
+
- `api-reading.md`'s `precededByGap` example printed `gap of ${durationSeconds} s` unconditionally,
|
|
35
|
+
which produces `gap of -0.2 s` on the same file. It branches on the sign now, since that is what
|
|
36
|
+
a reader will copy.
|
|
37
|
+
|
|
9
38
|
## 0.3.40
|
|
10
39
|
|
|
11
40
|
- **Fixed a regression introduced two releases ago.** 0.3.37 split the 206 `Content-Range` guard on
|
package/dist/chunks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAiC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAiC,MAAM,YAAY,CAAC;AA8G1E;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ,CA6EjE"}
|
package/dist/chunks.js
CHANGED
|
@@ -44,10 +44,26 @@ function at(chunks, index) {
|
|
|
44
44
|
*/
|
|
45
45
|
function assertJoinable(previous, next, index) {
|
|
46
46
|
if (next.precededByGap !== undefined) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
// Branch on the sign. An overlap travels in `index.gaps` with a NEGATIVE duration (0.2.69), so
|
|
48
|
+
// `chunk.precededByGap` carries it too, and a hardcoded gap reading produced "preceded by a
|
|
49
|
+
// gap of -0.2 s" — a gap of negative duration — with an explanation that inverts what an
|
|
50
|
+
// overlap does: across a gap two samples are seconds APART, across an overlap they cover the
|
|
51
|
+
// SAME time, so concatenating duplicates it rather than skipping it.
|
|
52
|
+
//
|
|
53
|
+
// 0.3.3 stated the partition and 0.3.33 applied it to "the two places that still said it was".
|
|
54
|
+
// This is the third; `src/chunks.ts` contained no mention of an overlap at all (fixed in
|
|
55
|
+
// 0.3.41). The refusal itself is unchanged and right either way.
|
|
56
|
+
const gap = next.precededByGap;
|
|
57
|
+
const overlapping = gap.durationTicks < 0n;
|
|
58
|
+
throw new RangeError(overlapping
|
|
59
|
+
? `mergeChunks: chunk ${index} is preceded by an overlap of ${-gap.durationSeconds} s — ` +
|
|
60
|
+
'the records on either side of the join both claim that time. Concatenating them would ' +
|
|
61
|
+
'store it twice and date every sample after the join late by it. Merge each contiguous ' +
|
|
62
|
+
'run separately.'
|
|
63
|
+
: `mergeChunks: chunk ${index} is preceded by a gap of ${gap.durationSeconds} s. ` +
|
|
64
|
+
'Concatenating across it would put two samples that are seconds apart next to each ' +
|
|
65
|
+
'other in one array, and every time computed from an index after the join would be ' +
|
|
66
|
+
'wrong by the gap. Merge each contiguous run separately.');
|
|
51
67
|
}
|
|
52
68
|
const expectedStart = previous.records.start + previous.records.count;
|
|
53
69
|
if (next.records.start !== expectedStart) {
|
package/dist/chunks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunks.js","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,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D,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;KACxC,CAAC;AACJ,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -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.3.
|
|
112
|
+
export declare const VERSION = "0.3.42";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
package/dist/decode/physical.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
* read: EDFlib clamps silently when it loads samples, edfcore does not, and reproducing that
|
|
9
9
|
* behaviour has to be something a caller asks for explicitly.
|
|
10
10
|
*/
|
|
11
|
-
import { DEFAULT_MAX_MATERIALIZE_BYTES } from '../constants.js';
|
|
12
11
|
import { EdfBudgetError, EdfScalingError } from '../errors.js';
|
|
12
|
+
import { resolveMaterializeBudget } from '../options.js';
|
|
13
13
|
const BYTES_PER_FLOAT64 = 8;
|
|
14
14
|
const BYTES_PER_INT32 = 4;
|
|
15
15
|
/** The physical dimension that marks a log-compressed channel (EDFlib `edffloat.html`). */
|
|
16
16
|
const LOG_TRANSFORMED_DIMENSION = 'Filtered';
|
|
17
17
|
function assertWithinBudget(requiredBytes, what, options) {
|
|
18
|
-
const budgetBytes = options?.maxMaterializeBytes
|
|
18
|
+
const budgetBytes = resolveMaterializeBudget(options?.maxMaterializeBytes);
|
|
19
19
|
if (requiredBytes <= budgetBytes)
|
|
20
20
|
return;
|
|
21
21
|
throw new EdfBudgetError(`Producing ${what} needs a ${requiredBytes}-byte array, above the ${budgetBytes}-byte ` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physical.js","sourceRoot":"","sources":["../../src/decode/physical.ts"],"names":[],"mappings":"AAAA;;;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A6B;YAClE,IAAI,MAAM,CAAC,GAAG,CAAC,cAAc,0BAA0B,MAAM,CAAC,GAAG,CAAC,cAAc,KAAK;YACrF,mFAAmF;YACnF,qCAAqC,CACxC,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,kEAAkE;QAClE,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC;QAC1B,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
package/src/chunks.ts
CHANGED
|
@@ -47,11 +47,27 @@ function at(chunks: readonly EdfChunk[], index: number): EdfChunk {
|
|
|
47
47
|
*/
|
|
48
48
|
function assertJoinable(previous: EdfChunk, next: EdfChunk, index: number): void {
|
|
49
49
|
if (next.precededByGap !== undefined) {
|
|
50
|
+
// Branch on the sign. An overlap travels in `index.gaps` with a NEGATIVE duration (0.2.69), so
|
|
51
|
+
// `chunk.precededByGap` carries it too, and a hardcoded gap reading produced "preceded by a
|
|
52
|
+
// gap of -0.2 s" — a gap of negative duration — with an explanation that inverts what an
|
|
53
|
+
// overlap does: across a gap two samples are seconds APART, across an overlap they cover the
|
|
54
|
+
// SAME time, so concatenating duplicates it rather than skipping it.
|
|
55
|
+
//
|
|
56
|
+
// 0.3.3 stated the partition and 0.3.33 applied it to "the two places that still said it was".
|
|
57
|
+
// This is the third; `src/chunks.ts` contained no mention of an overlap at all (fixed in
|
|
58
|
+
// 0.3.41). The refusal itself is unchanged and right either way.
|
|
59
|
+
const gap = next.precededByGap;
|
|
60
|
+
const overlapping = gap.durationTicks < 0n;
|
|
50
61
|
throw new RangeError(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
overlapping
|
|
63
|
+
? `mergeChunks: chunk ${index} is preceded by an overlap of ${-gap.durationSeconds} s — ` +
|
|
64
|
+
'the records on either side of the join both claim that time. Concatenating them would ' +
|
|
65
|
+
'store it twice and date every sample after the join late by it. Merge each contiguous ' +
|
|
66
|
+
'run separately.'
|
|
67
|
+
: `mergeChunks: chunk ${index} is preceded by a gap of ${gap.durationSeconds} s. ` +
|
|
68
|
+
'Concatenating across it would put two samples that are seconds apart next to each ' +
|
|
69
|
+
'other in one array, and every time computed from an index after the join would be ' +
|
|
70
|
+
'wrong by the gap. Merge each contiguous run separately.',
|
|
55
71
|
);
|
|
56
72
|
}
|
|
57
73
|
|
package/src/constants.ts
CHANGED
package/src/decode/physical.ts
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* behaviour has to be something a caller asks for explicitly.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { DEFAULT_MAX_MATERIALIZE_BYTES } from '../constants.js';
|
|
13
12
|
import { EdfBudgetError, EdfScalingError } from '../errors.js';
|
|
13
|
+
import { resolveMaterializeBudget } from '../options.js';
|
|
14
14
|
import type { EdfDiagnosticCode, EdfSignal } from '../types.js';
|
|
15
15
|
import type { MaterializeOptions } from './digital.js';
|
|
16
16
|
|
|
@@ -40,7 +40,7 @@ function assertWithinBudget(
|
|
|
40
40
|
what: string,
|
|
41
41
|
options: MaterializeOptions | undefined,
|
|
42
42
|
): void {
|
|
43
|
-
const budgetBytes = options?.maxMaterializeBytes
|
|
43
|
+
const budgetBytes = resolveMaterializeBudget(options?.maxMaterializeBytes);
|
|
44
44
|
if (requiredBytes <= budgetBytes) return;
|
|
45
45
|
throw new EdfBudgetError(
|
|
46
46
|
`Producing ${what} needs a ${requiredBytes}-byte array, above the ${budgetBytes}-byte ` +
|