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/base.py
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 67 68 69 70 71 72 73 74 75 |
|
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/base.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
TSTransform
dataclass
¶
Bases: TransformElement
, _TSTransSink
A time-series transform element.
Source code in sgnts/base/base.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
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
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
TSSink
dataclass
¶
Bases: SinkElement
, _TSTransSink
A time-series sink element.
Source code in sgnts/base/base.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
|
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
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 |
|
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
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 |
|