sgnts.sinks
¶
NullSeriesSink
dataclass
¶
Bases: TSSink
flowchart TD
sgnts.sinks.NullSeriesSink[NullSeriesSink]
sgnts.base.base.TSSink[TSSink]
sgnts.base.base.TimeSeriesMixin[TimeSeriesMixin]
sgnts.base.base.TSSink --> sgnts.sinks.NullSeriesSink
sgnts.base.base.TimeSeriesMixin --> sgnts.base.base.TSSink
click sgnts.sinks.NullSeriesSink href "" "sgnts.sinks.NullSeriesSink"
click sgnts.base.base.TSSink href "" "sgnts.base.base.TSSink"
click sgnts.base.base.TimeSeriesMixin href "" "sgnts.base.base.TimeSeriesMixin"
A series sink that does precisely nothing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verbose
|
bool
|
bool, print frames as they pass through the internal pad |
False
|
Source code in sgnts/sinks/null.py
process(input_frames)
¶
Print frames if verbose.
Source code in sgnts/sinks/null.py
DumpSeriesSink
dataclass
¶
Bases: TSSink
flowchart TD
sgnts.sinks.DumpSeriesSink[DumpSeriesSink]
sgnts.base.base.TSSink[TSSink]
sgnts.base.base.TimeSeriesMixin[TimeSeriesMixin]
sgnts.base.base.TSSink --> sgnts.sinks.DumpSeriesSink
sgnts.base.base.TimeSeriesMixin --> sgnts.base.base.TSSink
click sgnts.sinks.DumpSeriesSink href "" "sgnts.sinks.DumpSeriesSink"
click sgnts.base.base.TSSink href "" "sgnts.base.base.TSSink"
click sgnts.base.base.TimeSeriesMixin href "" "sgnts.base.base.TimeSeriesMixin"
A sink element that dumps time series data to a txt file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fname
|
str
|
str, output file name |
required |
verbose
|
bool
|
bool, be verbose |
False
|
Source code in sgnts/sinks/dump.py
process(input_frame)
¶
Write out time-series data.
Source code in sgnts/sinks/dump.py
write_to_file(buf)
¶
Write time series data to txt file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buf
|
SeriesBuffer, the buffer with time series data to write out |
required |
Source code in sgnts/sinks/dump.py
TSFrameCollectSink
dataclass
¶
Bases: CollectSink
flowchart TD
sgnts.sinks.TSFrameCollectSink[TSFrameCollectSink]
click sgnts.sinks.TSFrameCollectSink href "" "sgnts.sinks.TSFrameCollectSink"
Sink that collects input SeriesBuffers
sgn.CollectSink with an additional method out_frames that will
return a dictionary, keyed by sink pad names, where the values are
single TSFrames containing all buffers collected on the sink pads
during pipeline operation.
Source code in sgnts/sinks/collect.py
out_frames()
¶
The collected frames.
Source code in sgnts/sinks/collect.py
TSPlotSink
dataclass
¶
Bases: TSFrameCollectSink
flowchart TD
sgnts.sinks.TSPlotSink[TSPlotSink]
sgnts.sinks.collect.TSFrameCollectSink[TSFrameCollectSink]
sgnts.sinks.collect.TSFrameCollectSink --> sgnts.sinks.TSPlotSink
click sgnts.sinks.TSPlotSink href "" "sgnts.sinks.TSPlotSink"
click sgnts.sinks.collect.TSFrameCollectSink href "" "sgnts.sinks.collect.TSFrameCollectSink"
Sink that collects frames and provides plotting methods.
Extends TSFrameCollectSink with convenient plotting capabilities for visualizing collected data after pipeline completion.
Example::
sink = TSPlotSink(name="detector_data", sink_pad_names=("H1", "L1"))
pipeline.connect(source, sink)
pipeline.run()
# Both pads overlaid, labeled "H1" and "L1"
fig, ax = sink.plot(time_unit="s")
ax.legend()
plt.show()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Element name (used as default title for multi-pad plots) |
required | |
sink_pad_names
|
Names of input pads (used as default labels) |
required |
Source code in sgnts/sinks/plot.py
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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
plot(pads=None, layout='overlay', labels=None, title=None, time_unit='gps', show_gaps=True, gap_color='red', gap_alpha=0.3, figsize=None, ax=None, **kwargs)
¶
Plot collected frames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pads
|
Optional[Sequence[str]]
|
Which pads to plot. Default: all pads in order they were defined. |
None
|
layout
|
Literal['overlay', 'subplots']
|
How to arrange multiple pads:
|
'overlay'
|
labels
|
Optional[dict[str, str]]
|
Custom labels for pads as |
None
|
title
|
Optional[str]
|
Figure title. Default: element name if multiple pads, None for single pad. |
None
|
time_unit
|
Literal['s', 'ms', 'ns', 'gps']
|
Time unit for x-axis: |
'gps'
|
show_gaps
|
bool
|
Show gap regions as shaded areas. |
True
|
gap_color
|
str
|
Color for gap shading. |
'red'
|
gap_alpha
|
float
|
Transparency for gap shading. |
0.3
|
figsize
|
Optional[tuple[float, float]]
|
Figure size as |
None
|
ax
|
Existing matplotlib axes to plot on. Only used when
|
None
|
|
**kwargs
|
Additional arguments passed to matplotlib |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
|
|
|
subplots layout where |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an unknown pad name is specified. |
ImportError
|
If matplotlib is not installed. |
Source code in sgnts/sinks/plot.py
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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |