edfcore 0.2.30 → 0.2.32
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 +36 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/envelope.d.ts +9 -0
- package/dist/envelope.d.ts.map +1 -1
- package/dist/envelope.js +33 -9
- package/dist/envelope.js.map +1 -1
- package/dist/sample-grid.d.ts +18 -0
- package/dist/sample-grid.d.ts.map +1 -1
- package/dist/sample-grid.js +18 -0
- package/dist/sample-grid.js.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/envelope.ts +46 -12
- package/src/sample-grid.ts +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,42 @@ 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.
|
|
9
|
+
## 0.2.32
|
|
10
|
+
|
|
11
|
+
- **Documented, not fixed**, and the distinction is the point: `sampleIndexAt`, `sampleStartTicks`
|
|
12
|
+
and `sampleStartSeconds` measure the signal's own SAMPLE GRID, which equals elapsed recording
|
|
13
|
+
time only when the recording is contiguous. On a file with a seven-second hole,
|
|
14
|
+
`sampleStartSeconds(signal, 12, d)` answers 3 s for a sample whose record truly begins at 10 s,
|
|
15
|
+
and `sampleIndexAt(signal, 10, d)` names record 10 of a six-record file. This is the fifth
|
|
16
|
+
instance the 0.2.25 property test found, and the one that cannot be fixed by arithmetic: the
|
|
17
|
+
three take a signal, a number and a record duration — no index, no timeline — so a gap is not in
|
|
18
|
+
their arguments and nothing inside them could find it. Changing that would mean changing their
|
|
19
|
+
signatures, which is a 0.3 decision, not a patch. Until then the contract is stated in the source,
|
|
20
|
+
in the docs and in the property test, which now pins both regimes: exact agreement with
|
|
21
|
+
`readRecords` on a contiguous file, and the grid behaviour on a discontinuous one. `index.locate`,
|
|
22
|
+
`segmentAt`/`gapAt` and `chunk.firstSampleIndex` are the recording-axis answers.
|
|
23
|
+
|
|
24
|
+
## 0.2.31
|
|
25
|
+
|
|
26
|
+
- **Fixed** `readEnvelopeAtResolution` not delivering the resolution it was asked for. A chunk
|
|
27
|
+
covers one record-aligned contiguous run, and a run is not the window, but one bucket count was
|
|
28
|
+
computed from the window and handed to every chunk. A window of 11 s over an EDF+D file asked at
|
|
29
|
+
1 s per bucket came back as 0.27 s per bucket in one chunk and 0.09 s in the other — widths that
|
|
30
|
+
are not commensurable, so a viewer could not place the two on one axis, which is the entire
|
|
31
|
+
promise of the function. A contiguous window that did not start on a record boundary got 1.33 s
|
|
32
|
+
per bucket for the same reason. The count is now derived from each run's own span; the ceil rule
|
|
33
|
+
is unchanged, so the tail of a window is still never dropped.
|
|
34
|
+
|
|
35
|
+
### A note on version numbers
|
|
36
|
+
|
|
37
|
+
`0.2.29` was never released: a failed release run consumed the number before the tag was cut.
|
|
38
|
+
`0.2.26` has a git tag and a GitHub release but is **not on npm** — GitHub Actions was dropping
|
|
39
|
+
events and failing to acquire runners while these went out, and by the time 0.2.26 was retried npm
|
|
40
|
+
refused to tag it `latest` because 0.2.28 was already above it. Everything 0.2.26 fixed, including
|
|
41
|
+
the patient-identification leak, is present in 0.2.27 and every release after it; that was verified
|
|
42
|
+
against the published 0.2.27 tarball rather than assumed.
|
|
43
|
+
|
|
44
|
+
## 0.2.30
|
|
10
45
|
|
|
11
46
|
- **Fixed** `validateRecording({ scanSamples: true })` refusing a small file for a scratch buffer
|
|
12
47
|
it could never fill. The buffer was sized from `chunkRecords` — a chunk size chosen from the
|
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.2.
|
|
112
|
+
export declare const VERSION = "0.2.32";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
package/dist/envelope.d.ts
CHANGED
|
@@ -60,6 +60,15 @@ export declare function envelopeOfSamples(chunkSignal: EdfChunkSignal, buckets:
|
|
|
60
60
|
* which is what a fixed-scale view wants — 30 s per bucket for a sleep hypnogram, whatever the
|
|
61
61
|
* window length. Deriving one from the other by hand means dividing and rounding, and rounding
|
|
62
62
|
* the wrong way produces a final bucket covering a sliver of time that reads as a dropout.
|
|
63
|
+
*
|
|
64
|
+
* The bucket count is computed PER RUN, from that run's own span, not once from the window. A
|
|
65
|
+
* chunk covers one record-aligned contiguous run, and a run is not the window: an EDF+D window
|
|
66
|
+
* spanning a gap produces two runs of different lengths, and even a contiguous window that does
|
|
67
|
+
* not start on a record boundary produces a run wider than it asked for. Handing one bucket count
|
|
68
|
+
* to every chunk therefore delivered a different resolution in each — a window of 11 s asked at
|
|
69
|
+
* 1 s per bucket came back as 0.27 s per bucket in one chunk and 0.09 s in the other, which are
|
|
70
|
+
* not commensurable, so a viewer cannot place the two on one axis. That is the whole promise of
|
|
71
|
+
* this function, so it is computed where the run's length is known (fixed in 0.2.31).
|
|
63
72
|
*/
|
|
64
73
|
export declare function readEnvelopeAtResolution(recording: EdfRecording, selection: {
|
|
65
74
|
readonly signalIndices: readonly number[];
|
package/dist/envelope.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../src/envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAUH,OAAO,KAAK,EACV,cAAc,EAEd,gBAAgB,EAChB,iBAAiB,EAEjB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,WAAW,EAEZ,MAAM,YAAY,CAAC;AAsBpB;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,YAAY,EACvB,SAAS,EAAE,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Q,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC,EACD,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAAC,CA8CtC"}
|
package/dist/envelope.js
CHANGED
|
@@ -293,6 +293,15 @@ export function envelopeOfSamples(chunkSignal, buckets) {
|
|
|
293
293
|
* which is what a fixed-scale view wants — 30 s per bucket for a sleep hypnogram, whatever the
|
|
294
294
|
* window length. Deriving one from the other by hand means dividing and rounding, and rounding
|
|
295
295
|
* the wrong way produces a final bucket covering a sliver of time that reads as a dropout.
|
|
296
|
+
*
|
|
297
|
+
* The bucket count is computed PER RUN, from that run's own span, not once from the window. A
|
|
298
|
+
* chunk covers one record-aligned contiguous run, and a run is not the window: an EDF+D window
|
|
299
|
+
* spanning a gap produces two runs of different lengths, and even a contiguous window that does
|
|
300
|
+
* not start on a record boundary produces a run wider than it asked for. Handing one bucket count
|
|
301
|
+
* to every chunk therefore delivered a different resolution in each — a window of 11 s asked at
|
|
302
|
+
* 1 s per bucket came back as 0.27 s per bucket in one chunk and 0.09 s in the other, which are
|
|
303
|
+
* not commensurable, so a viewer cannot place the two on one axis. That is the whole promise of
|
|
304
|
+
* this function, so it is computed where the run's length is known (fixed in 0.2.31).
|
|
296
305
|
*/
|
|
297
306
|
export async function readEnvelopeAtResolution(recording, selection, options) {
|
|
298
307
|
const { secondsPerBucket } = selection;
|
|
@@ -300,14 +309,29 @@ export async function readEnvelopeAtResolution(recording, selection, options) {
|
|
|
300
309
|
throw new RangeError(`readEnvelopeAtResolution(): secondsPerBucket must be a positive finite number, received ` +
|
|
301
310
|
`${secondsPerBucket}.`);
|
|
302
311
|
}
|
|
303
|
-
//
|
|
304
|
-
//
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
+
// Validated before the window is resolved, exactly as `readEnvelope` does it and for the same
|
|
313
|
+
// reason: a bad signalIndices must not read back as an empty stretch of recording.
|
|
314
|
+
resolveEnvelopeSignals(recording.header, selection.signalIndices);
|
|
315
|
+
// Resolved here, rather than inside `readEnvelope`, so each run's own span is known before its
|
|
316
|
+
// bucket count is chosen.
|
|
317
|
+
const ranges = resolveTimeWindow(recording.timeline, recording.index, selection.startSeconds, selection.durationSeconds);
|
|
318
|
+
const recordSeconds = recording.header.recordDurationSeconds;
|
|
319
|
+
const chunks = [];
|
|
320
|
+
for (const records of ranges) {
|
|
321
|
+
// A run's span is exactly its record count times the record duration: records within one run
|
|
322
|
+
// are contiguous by construction. A zero record duration is legal EDF and leaves no time axis
|
|
323
|
+
// at all, so one bucket is the only honest answer for it.
|
|
324
|
+
const runSeconds = records.count * recordSeconds;
|
|
325
|
+
// Ceil, not round: 100 s at 30 s per bucket needs four buckets, not three. Three would
|
|
326
|
+
// silently drop the last 10 s off the end of the picture.
|
|
327
|
+
const buckets = runSeconds > 0 ? Math.max(1, Math.ceil(runSeconds / secondsPerBucket)) : 1;
|
|
328
|
+
chunks.push(await reduceRange(recording, records, {
|
|
329
|
+
signalIndices: selection.signalIndices,
|
|
330
|
+
startSeconds: selection.startSeconds,
|
|
331
|
+
durationSeconds: selection.durationSeconds,
|
|
332
|
+
buckets,
|
|
333
|
+
}, options));
|
|
334
|
+
}
|
|
335
|
+
return Object.freeze(chunks);
|
|
312
336
|
}
|
|
313
337
|
//# sourceMappingURL=envelope.js.map
|
package/dist/envelope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.js","sourceRoot":"","sources":["../src/envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO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ecord)` instead, which is the
|
|
16
16
|
* same rule `trimToWindow` follows.
|
|
17
|
+
*
|
|
18
|
+
* WHAT THEY MEASURE, PRECISELY: position on the SIGNAL'S OWN SAMPLE GRID. Sample `n` is the `n`th
|
|
19
|
+
* sample the file stores for that signal, and its time is `n * recordDuration / samplesPerRecord`.
|
|
20
|
+
* On a CONTIGUOUS recording that is also elapsed recording time, and the two ideas are the same
|
|
21
|
+
* number — which is why the distinction is easy to miss.
|
|
22
|
+
*
|
|
23
|
+
* ON A DISCONTINUOUS FILE THEY ARE NOT THE SAME. Samples are adjacent in the array across a gap
|
|
24
|
+
* while their times are not, so `sampleStartSeconds(signal, 12, d)` answers 3 s for a sample whose
|
|
25
|
+
* record truly begins at 10 s, and `sampleIndexAt(signal, 10, d)` answers with a record index past
|
|
26
|
+
* the end of a six-record file. These functions receive a signal, a number and a record duration —
|
|
27
|
+
* no index, no timeline — so they CANNOT detect a gap, cannot bound the answer by the record
|
|
28
|
+
* count, and are not being modest about it: the information is not in their arguments.
|
|
29
|
+
*
|
|
30
|
+
* So the contract is stated rather than guessed at. For a file that may be discontinuous, use
|
|
31
|
+
* `index.locate(seconds)` for time to record, `segmentAt`/`gapAt` to find out whether an instant
|
|
32
|
+
* has data at all, and `chunk.firstSampleIndex` for the sample index a read actually produced.
|
|
33
|
+
* `contiguityOf(index)` answers which regime you are in. On a contiguous file — the common case,
|
|
34
|
+
* and every plain EDF or EDF+C — these are exact and are what you want.
|
|
17
35
|
*/
|
|
18
36
|
import type { EdfSampleLocation, EdfSignal } from './types.js';
|
|
19
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sample-grid.d.ts","sourceRoot":"","sources":["../src/sample-grid.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sample-grid.d.ts","sourceRoot":"","sources":["../src/sample-grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA0B/D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,MAAM,EACf,mBAAmB,EAAE,MAAM,GAC1B,iBAAiB,CAoBnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,MAAM,GAC1B,MAAM,CAcR;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,MAAM,GAC1B,MAAM,CAKR"}
|
package/dist/sample-grid.js
CHANGED
|
@@ -14,6 +14,24 @@
|
|
|
14
14
|
*
|
|
15
15
|
* These do the arithmetic in integers on `(record, sampleWithinRecord)` instead, which is the
|
|
16
16
|
* same rule `trimToWindow` follows.
|
|
17
|
+
*
|
|
18
|
+
* WHAT THEY MEASURE, PRECISELY: position on the SIGNAL'S OWN SAMPLE GRID. Sample `n` is the `n`th
|
|
19
|
+
* sample the file stores for that signal, and its time is `n * recordDuration / samplesPerRecord`.
|
|
20
|
+
* On a CONTIGUOUS recording that is also elapsed recording time, and the two ideas are the same
|
|
21
|
+
* number — which is why the distinction is easy to miss.
|
|
22
|
+
*
|
|
23
|
+
* ON A DISCONTINUOUS FILE THEY ARE NOT THE SAME. Samples are adjacent in the array across a gap
|
|
24
|
+
* while their times are not, so `sampleStartSeconds(signal, 12, d)` answers 3 s for a sample whose
|
|
25
|
+
* record truly begins at 10 s, and `sampleIndexAt(signal, 10, d)` answers with a record index past
|
|
26
|
+
* the end of a six-record file. These functions receive a signal, a number and a record duration —
|
|
27
|
+
* no index, no timeline — so they CANNOT detect a gap, cannot bound the answer by the record
|
|
28
|
+
* count, and are not being modest about it: the information is not in their arguments.
|
|
29
|
+
*
|
|
30
|
+
* So the contract is stated rather than guessed at. For a file that may be discontinuous, use
|
|
31
|
+
* `index.locate(seconds)` for time to record, `segmentAt`/`gapAt` to find out whether an instant
|
|
32
|
+
* has data at all, and `chunk.firstSampleIndex` for the sample index a read actually produced.
|
|
33
|
+
* `contiguityOf(index)` answers which regime you are in. On a contiguous file — the common case,
|
|
34
|
+
* and every plain EDF or EDF+C — these are exact and are what you want.
|
|
17
35
|
*/
|
|
18
36
|
import { TICKS_PER_SECOND } from './constants.js';
|
|
19
37
|
import { secondsToTicks } from './tal/ticks.js';
|
package/dist/sample-grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sample-grid.js","sourceRoot":"","sources":["../src/sample-grid.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sample-grid.js","sourceRoot":"","sources":["../src/sample-grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,SAAS,UAAU,CAAC,MAAiB,EAAE,mBAA2B;IAChE,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QAClC,MAAM,IAAI,UAAU,CAClB,UAAU,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B;YACpF,uFAAuF;YACvF,2CAA2C,CAC9C,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,gBAAgB,IAAI,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,UAAU,CAClB,UAAU,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa;YAClE,GAAG,MAAM,CAAC,gBAAgB,0DAA0D;YACpF,6DAA6D,CAChE,CAAC;IACJ,CAAC;IACD,IAAI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AAC;QACvC,MAAM,IAAI,UAAU,CAClB,oEAAoE,WAAW,GAAG,CACnF,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,mBAAmB,CAAC;IAC5D,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACvC,6FAA6F;IAC7F,6DAA6D;IAC7D,IAAI,SAAS,GAAG,SAAS,KAAK,EAAE;QAAE,OAAO,QAAQ,CAAC;IAClD,OAAO,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AACnD,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,kBAAkB,CAChC,MAAiB,EACjB,WAAmB,EACnB,mBAA2B;IAE3B,MAAM,KAAK,GAAG,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC;IACzE,MAAM,KAAK,GAAG,KAAK,GAAG,gBAAgB,CAAC;IACvC,MAAM,SAAS,GAAG,KAAK,GAAG,gBAAgB,CAAC;IAC3C,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACtE,CAAC"}
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/envelope.ts
CHANGED
|
@@ -387,6 +387,15 @@ export function envelopeOfSamples(chunkSignal: EdfChunkSignal, buckets: number):
|
|
|
387
387
|
* which is what a fixed-scale view wants — 30 s per bucket for a sleep hypnogram, whatever the
|
|
388
388
|
* window length. Deriving one from the other by hand means dividing and rounding, and rounding
|
|
389
389
|
* the wrong way produces a final bucket covering a sliver of time that reads as a dropout.
|
|
390
|
+
*
|
|
391
|
+
* The bucket count is computed PER RUN, from that run's own span, not once from the window. A
|
|
392
|
+
* chunk covers one record-aligned contiguous run, and a run is not the window: an EDF+D window
|
|
393
|
+
* spanning a gap produces two runs of different lengths, and even a contiguous window that does
|
|
394
|
+
* not start on a record boundary produces a run wider than it asked for. Handing one bucket count
|
|
395
|
+
* to every chunk therefore delivered a different resolution in each — a window of 11 s asked at
|
|
396
|
+
* 1 s per bucket came back as 0.27 s per bucket in one chunk and 0.09 s in the other, which are
|
|
397
|
+
* not commensurable, so a viewer cannot place the two on one axis. That is the whole promise of
|
|
398
|
+
* this function, so it is computed where the run's length is known (fixed in 0.2.31).
|
|
390
399
|
*/
|
|
391
400
|
export async function readEnvelopeAtResolution(
|
|
392
401
|
recording: EdfRecording,
|
|
@@ -405,17 +414,42 @@ export async function readEnvelopeAtResolution(
|
|
|
405
414
|
`${secondsPerBucket}.`,
|
|
406
415
|
);
|
|
407
416
|
}
|
|
408
|
-
//
|
|
409
|
-
//
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
options,
|
|
417
|
+
// Validated before the window is resolved, exactly as `readEnvelope` does it and for the same
|
|
418
|
+
// reason: a bad signalIndices must not read back as an empty stretch of recording.
|
|
419
|
+
resolveEnvelopeSignals(recording.header, selection.signalIndices);
|
|
420
|
+
|
|
421
|
+
// Resolved here, rather than inside `readEnvelope`, so each run's own span is known before its
|
|
422
|
+
// bucket count is chosen.
|
|
423
|
+
const ranges = resolveTimeWindow(
|
|
424
|
+
recording.timeline,
|
|
425
|
+
recording.index,
|
|
426
|
+
selection.startSeconds,
|
|
427
|
+
selection.durationSeconds,
|
|
420
428
|
);
|
|
429
|
+
|
|
430
|
+
const recordSeconds = recording.header.recordDurationSeconds;
|
|
431
|
+
const chunks: EdfEnvelopeChunk[] = [];
|
|
432
|
+
for (const records of ranges) {
|
|
433
|
+
// A run's span is exactly its record count times the record duration: records within one run
|
|
434
|
+
// are contiguous by construction. A zero record duration is legal EDF and leaves no time axis
|
|
435
|
+
// at all, so one bucket is the only honest answer for it.
|
|
436
|
+
const runSeconds = records.count * recordSeconds;
|
|
437
|
+
// Ceil, not round: 100 s at 30 s per bucket needs four buckets, not three. Three would
|
|
438
|
+
// silently drop the last 10 s off the end of the picture.
|
|
439
|
+
const buckets = runSeconds > 0 ? Math.max(1, Math.ceil(runSeconds / secondsPerBucket)) : 1;
|
|
440
|
+
chunks.push(
|
|
441
|
+
await reduceRange(
|
|
442
|
+
recording,
|
|
443
|
+
records,
|
|
444
|
+
{
|
|
445
|
+
signalIndices: selection.signalIndices,
|
|
446
|
+
startSeconds: selection.startSeconds,
|
|
447
|
+
durationSeconds: selection.durationSeconds,
|
|
448
|
+
buckets,
|
|
449
|
+
},
|
|
450
|
+
options,
|
|
451
|
+
),
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
return Object.freeze(chunks);
|
|
421
455
|
}
|
package/src/sample-grid.ts
CHANGED
|
@@ -14,6 +14,24 @@
|
|
|
14
14
|
*
|
|
15
15
|
* These do the arithmetic in integers on `(record, sampleWithinRecord)` instead, which is the
|
|
16
16
|
* same rule `trimToWindow` follows.
|
|
17
|
+
*
|
|
18
|
+
* WHAT THEY MEASURE, PRECISELY: position on the SIGNAL'S OWN SAMPLE GRID. Sample `n` is the `n`th
|
|
19
|
+
* sample the file stores for that signal, and its time is `n * recordDuration / samplesPerRecord`.
|
|
20
|
+
* On a CONTIGUOUS recording that is also elapsed recording time, and the two ideas are the same
|
|
21
|
+
* number — which is why the distinction is easy to miss.
|
|
22
|
+
*
|
|
23
|
+
* ON A DISCONTINUOUS FILE THEY ARE NOT THE SAME. Samples are adjacent in the array across a gap
|
|
24
|
+
* while their times are not, so `sampleStartSeconds(signal, 12, d)` answers 3 s for a sample whose
|
|
25
|
+
* record truly begins at 10 s, and `sampleIndexAt(signal, 10, d)` answers with a record index past
|
|
26
|
+
* the end of a six-record file. These functions receive a signal, a number and a record duration —
|
|
27
|
+
* no index, no timeline — so they CANNOT detect a gap, cannot bound the answer by the record
|
|
28
|
+
* count, and are not being modest about it: the information is not in their arguments.
|
|
29
|
+
*
|
|
30
|
+
* So the contract is stated rather than guessed at. For a file that may be discontinuous, use
|
|
31
|
+
* `index.locate(seconds)` for time to record, `segmentAt`/`gapAt` to find out whether an instant
|
|
32
|
+
* has data at all, and `chunk.firstSampleIndex` for the sample index a read actually produced.
|
|
33
|
+
* `contiguityOf(index)` answers which regime you are in. On a contiguous file — the common case,
|
|
34
|
+
* and every plain EDF or EDF+C — these are exact and are what you want.
|
|
17
35
|
*/
|
|
18
36
|
|
|
19
37
|
import { TICKS_PER_SECOND } from './constants.js';
|