sgnts.base
¶
AdapterConfig
dataclass
¶
Config to hold parameters used for the audioadapter in _TSTransSink.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
overlap
|
tuple[int, int]
|
tuple[int, int], the overlap before and after the data segment to process, in offsets |
(0, 0)
|
stride
|
int
|
int, the stride to produce, in offsets |
0
|
pad_zeros_startup
|
bool
|
bool, when overlap is provided, whether to pad zeros in front of the first buffer, or wait until there is enough data. |
False
|
skip_gaps
|
bool
|
bool, produce a whole gap buffer if there are any gaps in the copied data segment |
False
|
backend
|
type[ArrayBackend]
|
type[ArrayBackend], the ArrayBackend wrapper |
NumpyBackend
|
Source code in sgnts/base/audioadapter.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
valid_buffer(buf, data=0)
¶
Return a new buffer corresponding to the non overlapping part of a buffer "buf" as defined by this classes overlap properties As a special case, if the buffer is shape zero (a heartbeat buffer) a new heartbeat buffer is returned with the offsets shifted by overlap[0]. Otherwise, in order for the buffer to be valid it must be what is expected based on the adapter's overlap and stride etc.
Source code in sgnts/base/audioadapter.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
TSTransform
dataclass
¶
Bases: TimeSeriesMixin[TSFrame]
, TransformElement[TSFrame]
A time-series transform element.
Source code in sgnts/base/base.py
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
|
new(pad)
¶
The transform function must be provided by the subclass.
It should take the source pad as an argument and return a new TSFrame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pad
|
SourcePad
|
SourcePad, The source pad that is producing the transformed frame |
required |
Returns:
Type | Description |
---|---|
TSFrame
|
TSFrame, The transformed frame |
Source code in sgnts/base/base.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
|
TSSink
dataclass
¶
TSSource
dataclass
¶
Bases: _TSSource
A time-series source that generates data in fixed-size buffers where the user can specify the start time and end time. If you want a data driven source consider using TSResourceSource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t0
|
float | None
|
float, start time of first buffer, in seconds |
None
|
end
|
float | None
|
float, end time of the last buffer, in seconds |
None
|
duration
|
float | None
|
float, alternative to end option, specify the duration of time to be covered in seconds. Cannot be given if end is given. |
None
|
Source code in sgnts/base/base.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
|
set_pad_buffer_params(pad, sample_shape, rate)
¶
Set variables on the pad that are needed to construct SeriesBuffers.
These should remain constant throughout the duration of the pipeline so this method may only be called once.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pad
|
SourcePad
|
SourcePad, the pad to setup buffers on |
required |
sample_shape
|
tuple[int, ...]
|
tuple[int, ...], the shape of a single sample of the data, or put another way, the shape of the data except for the last (time) dimension, i.e. sample_shape=data.shape[:-1] |
required |
rate
|
int
|
int, the sample rate of the data the pad will produce |
required |
Source code in sgnts/base/base.py
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
|