DataSource V2 API Reference¶
The datasource_v2 package provides a composable, dataclass-based API for creating gravitational wave data sources.
Main Entry Points¶
DataSource (Dispatcher)¶
sgnligo.sources.datasource_v2.DataSource
¶
Dispatcher namespace for composed data sources.
Calling DataSource(data_source=..., ...) looks up the registered
source class for data_source and returns an instance of it
directly — the returned object IS a TSComposedSourceElement,
not a wrapper, so pipeline.connect(source, sink) works without
a .element indirection.
The returned instance also carries a data_source attribute set
to the dispatch key for introspection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_source
|
Source type identifier ("white", "gwdata-noise", ...). |
required | |
name
|
Name for the composed element. |
required | |
**kwargs
|
Forwarded to the selected source class. |
required |
The classmethods on this class (from_argv, from_parser,
create_cli_parser, list_sources, get_source_class) are a
CLI-integration namespace — they also return composed-source
instances directly.
Source code in sgnligo/sources/datasource_v2/datasource.py
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 | |
create_cli_parser(prog=None, description=None)
classmethod
¶
Create CLI argument parser with options for all registered sources.
Use this when you need to add custom arguments to the parser.
Example
parser = DataSource.create_cli_parser() parser.add_argument("--snr-threshold", type=float, default=8.0) source, args = DataSource.from_parser(parser, name="pipeline")
Returns:
| Type | Description |
|---|---|
ArgumentParser
|
ArgumentParser configured with --data-source and all source options. |
Source code in sgnligo/sources/datasource_v2/datasource.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
list_sources()
staticmethod
¶
List all available source types.
Source code in sgnligo/sources/datasource_v2/datasource.py
196 197 198 199 | |
get_source_class(source_type)
staticmethod
¶
Get the source class for a given type.
Source code in sgnligo/sources/datasource_v2/datasource.py
201 202 203 204 | |
CLI Support¶
sgnligo.sources.datasource_v2.cli
¶
CLI support for composed data sources.
This module provides CLI argument parsing and help generation for the dataclass-based composed source classes.
CLI arguments are defined by mixin classes that sources inherit from.
The build_composed_cli_parser() function aggregates CLI arguments
from all registered sources by walking their MRO and collecting
arguments from mixins.
Example
from sgnligo.sources.datasource_v2.cli import ( ... build_composed_cli_parser, ... check_composed_help_options, ... )
if check_composed_help_options(): ... sys.exit(0)
parser = build_composed_cli_parser() args = parser.parse_args()
build_composed_cli_parser(prog=None, description=None)
¶
Build CLI parser by aggregating arguments from source mixins.
This function walks the MRO of all registered source classes and collects CLI arguments from mixins that implement the CLIMixinProtocol. Duplicate arguments (same arg defined by multiple mixins) raise an error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prog
|
Optional[str]
|
Program name for help text |
None
|
description
|
Optional[str]
|
Description for help text |
None
|
Returns:
| Type | Description |
|---|---|
ArgumentParser
|
ArgumentParser configured with all source options |
Raises:
| Type | Description |
|---|---|
ValueError
|
If duplicate CLI arguments are detected |
Source code in sgnligo/sources/datasource_v2/cli.py
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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
check_composed_help_options(argv=None)
¶
Check for --list-sources and --help-source before full parsing.
Call this before parse_args() to handle help options that don't require --data-source to be specified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argv
|
Optional[List[str]]
|
Command line arguments (defaults to sys.argv[1:]) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if help was handled (caller should exit), False otherwise. |
Source code in sgnligo/sources/datasource_v2/cli.py
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 | |
namespace_to_datasource_kwargs(args, parser=None, ignore_unconsumed=None)
¶
Convert argparse namespace to DataSource kwargs.
This function walks the MRO of the selected source class and calls
process_cli_args() on each mixin to convert CLI arguments to field values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Namespace
|
Parsed argparse namespace |
required |
parser
|
Optional[ArgumentParser]
|
The ArgumentParser that produced args. When provided, raises ValueError if the user set options that the selected source type does not use. |
None
|
ignore_unconsumed
|
Optional[Set[str]]
|
Field names that the calling application consumes
itself, exempting them from the strict unconsumed-arg check. Use
when a tool legitimately repurposes a registered source option at
the application level (e.g., sgnl-inspiral reads |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict of kwargs for DataSource |
Source code in sgnligo/sources/datasource_v2/cli.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
format_composed_source_help(source_type)
¶
Generate detailed help for a specific source type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_type
|
str
|
The source type to show help for |
required |
Returns:
| Type | Description |
|---|---|
str
|
Formatted help string |
Source code in sgnligo/sources/datasource_v2/cli.py
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 | |
format_composed_source_list()
¶
Generate list of all available sources.
Returns:
| Type | Description |
|---|---|
str
|
Formatted string listing all sources |
Source code in sgnligo/sources/datasource_v2/cli.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
Registry¶
sgnligo.sources.datasource_v2.composed_registry
¶
Registry for dataclass-based composed source classes.
This module provides registration and lookup for the new dataclass-based source classes that inherit from ComposedSourceBase.
Example
from sgnligo.sources.datasource_v2.composed_registry import ( ... register_composed_source, ... get_composed_source_class, ... )
@register_composed_source @dataclass class MySource(ComposedSourceBase): ... source_type: ClassVar[str] = "my-source" ... ...
register_composed_source(cls)
¶
Decorator to register a composed source class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
Type[ComposedSourceBase]
|
The composed source class to register |
required |
Returns:
| Type | Description |
|---|---|
Type[ComposedSourceBase]
|
The same class (unchanged) |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the source_type is empty or already registered |
Example
@register_composed_source @dataclass class WhiteSource(ComposedSourceBase): source_type: ClassVar[str] = "white" ...
Source code in sgnligo/sources/datasource_v2/composed_registry.py
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 | |
get_composed_source_class(source_type)
¶
Get the composed source class for a given type string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_type
|
str
|
The source type identifier |
required |
Returns:
| Type | Description |
|---|---|
Type[ComposedSourceBase]
|
The composed source class |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the source type is not registered |
Source code in sgnligo/sources/datasource_v2/composed_registry.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
list_composed_source_types()
¶
List all registered composed source types.
Returns:
| Type | Description |
|---|---|
List[str]
|
Sorted list of registered source type names |
Source code in sgnligo/sources/datasource_v2/composed_registry.py
81 82 83 84 85 86 87 | |
get_composed_registry()
¶
Get the full composed source registry.
Returns:
| Type | Description |
|---|---|
Dict[str, Type[ComposedSourceBase]]
|
Dict mapping source type to class |
Source code in sgnligo/sources/datasource_v2/composed_registry.py
90 91 92 93 94 95 96 | |
Source Classes¶
Fake Sources¶
sgnligo.sources.datasource_v2.sources.fake
¶
Fake signal source classes (white, sin, impulse).
These sources generate synthetic test signals for pipeline development and testing without requiring real detector data.
Supports both offline (batch) and real-time modes via the real_time flag:
- Offline (default): Requires start and end (or duration)
- Real-time: GPS times optional, generates data synchronized with wall clock
Example
Offline mode (default)¶
source = WhiteComposedSource( ... name="noise", ... ifos=["H1", "L1"], ... channel_dict={"H1": "FAKE-STRAIN", "L1": "FAKE-STRAIN"}, ... sample_rate=4096, ... start=1000, ... end=1010, ... )
Real-time mode¶
source = WhiteComposedSource( ... name="noise", ... ifos=["H1"], ... channel_dict={"H1": "FAKE-STRAIN"}, ... sample_rate=4096, ... real_time=True, ... )
WhiteComposedSource
dataclass
¶
Bases: FakeSourceBase
flowchart TD
sgnligo.sources.datasource_v2.sources.fake.WhiteComposedSource[WhiteComposedSource]
sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase[FakeSourceBase]
sgnligo.sources.composed_base.ComposedSourceBase[ComposedSourceBase]
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin[ChannelOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin[SampleRateOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin[GPSOptionsFlexibleMixin]
sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin[SegmentsOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin[VerboseOptionsMixin]
sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase --> sgnligo.sources.datasource_v2.sources.fake.WhiteComposedSource
sgnligo.sources.composed_base.ComposedSourceBase --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
click sgnligo.sources.datasource_v2.sources.fake.WhiteComposedSource href "" "sgnligo.sources.datasource_v2.sources.fake.WhiteComposedSource"
click sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase href "" "sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase"
click sgnligo.sources.composed_base.ComposedSourceBase href "" "sgnligo.sources.composed_base.ComposedSourceBase"
click sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin"
click sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin"
Gaussian white noise source.
Generates uncorrelated Gaussian white noise for each IFO channel. Useful for basic pipeline testing where spectral characteristics don't matter.
Supports both offline and real-time modes: - Offline (default): Specify start and end (or duration) - Real-time: Set real_time=True, GPS times become optional
Example
Offline mode¶
source = WhiteComposedSource( ... name="noise", ... ifos=["H1", "L1"], ... channel_dict={"H1": "FAKE-STRAIN", "L1": "FAKE-STRAIN"}, ... sample_rate=4096, ... start=1000, ... end=1010, ... )
Real-time mode¶
source = WhiteComposedSource( ... name="noise", ... ifos=["H1"], ... channel_dict={"H1": "FAKE-STRAIN"}, ... sample_rate=4096, ... real_time=True, ... )
Source code in sgnligo/sources/datasource_v2/sources/fake.py
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 252 253 254 255 256 257 258 | |
SinComposedSource
dataclass
¶
Bases: FakeSourceBase
flowchart TD
sgnligo.sources.datasource_v2.sources.fake.SinComposedSource[SinComposedSource]
sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase[FakeSourceBase]
sgnligo.sources.composed_base.ComposedSourceBase[ComposedSourceBase]
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin[ChannelOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin[SampleRateOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin[GPSOptionsFlexibleMixin]
sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin[SegmentsOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin[VerboseOptionsMixin]
sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase --> sgnligo.sources.datasource_v2.sources.fake.SinComposedSource
sgnligo.sources.composed_base.ComposedSourceBase --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
click sgnligo.sources.datasource_v2.sources.fake.SinComposedSource href "" "sgnligo.sources.datasource_v2.sources.fake.SinComposedSource"
click sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase href "" "sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase"
click sgnligo.sources.composed_base.ComposedSourceBase href "" "sgnligo.sources.composed_base.ComposedSourceBase"
click sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin"
click sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin"
Sinusoidal test signal source.
Generates a sinusoidal signal for each IFO channel. Useful for testing frequency-domain processing.
Supports both offline and real-time modes.
Example
source = SinComposedSource( ... name="sine", ... ifos=["H1"], ... channel_dict={"H1": "FAKE-STRAIN"}, ... sample_rate=4096, ... start=1000, ... end=1010, ... )
Source code in sgnligo/sources/datasource_v2/sources/fake.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
ImpulseComposedSource
dataclass
¶
Bases: FakeSourceBase, ImpulsePositionOptionsMixin
flowchart TD
sgnligo.sources.datasource_v2.sources.fake.ImpulseComposedSource[ImpulseComposedSource]
sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase[FakeSourceBase]
sgnligo.sources.composed_base.ComposedSourceBase[ComposedSourceBase]
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin[ChannelOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin[SampleRateOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin[GPSOptionsFlexibleMixin]
sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin[SegmentsOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin[VerboseOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.ImpulsePositionOptionsMixin[ImpulsePositionOptionsMixin]
sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase --> sgnligo.sources.datasource_v2.sources.fake.ImpulseComposedSource
sgnligo.sources.composed_base.ComposedSourceBase --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase
sgnligo.sources.datasource_v2.cli_mixins.ImpulsePositionOptionsMixin --> sgnligo.sources.datasource_v2.sources.fake.ImpulseComposedSource
click sgnligo.sources.datasource_v2.sources.fake.ImpulseComposedSource href "" "sgnligo.sources.datasource_v2.sources.fake.ImpulseComposedSource"
click sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase href "" "sgnligo.sources.datasource_v2.sources.fake.FakeSourceBase"
click sgnligo.sources.composed_base.ComposedSourceBase href "" "sgnligo.sources.composed_base.ComposedSourceBase"
click sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.SampleRateOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin"
click sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.ImpulsePositionOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.ImpulsePositionOptionsMixin"
Impulse test signal source.
Generates an impulse signal (single spike) for each IFO channel. Useful for testing impulse response.
Supports both offline and real-time modes.
Fields inherited from mixins
impulse_position: Sample index for impulse (-1 for random)
Example
source = ImpulseComposedSource( ... name="impulse", ... ifos=["H1"], ... channel_dict={"H1": "FAKE-STRAIN"}, ... sample_rate=4096, ... start=1000, ... end=1010, ... impulse_position=100, ... )
Source code in sgnligo/sources/datasource_v2/sources/fake.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
GWData Noise Sources¶
sgnligo.sources.datasource_v2.sources.gwdata_noise
¶
GWData noise composed source class.
Generates colored Gaussian noise with realistic LIGO PSDs, suitable for testing and development without real detector data.
Supports both offline (batch) and real-time modes via the real_time flag:
- Offline (default): Requires start and end (or duration)
- Real-time: GPS times optional, generates data synchronized with wall clock
Example
Offline mode¶
source = GWDataNoiseComposedSource( ... name="noise", ... ifos=["H1", "L1"], ... channel_dict={"H1": "FAKE-STRAIN", "L1": "FAKE-STRAIN"}, ... start=1000, ... end=1010, ... )
Real-time mode¶
source = GWDataNoiseComposedSource( ... name="noise", ... ifos=["H1"], ... channel_dict={"H1": "FAKE-STRAIN"}, ... real_time=True, ... )
GWDataNoiseComposedSource
dataclass
¶
Bases: ComposedSourceBase, ChannelOptionsMixin, GPSOptionsFlexibleMixin, StateVectorOnDictOnlyMixin, VerboseOptionsMixin
flowchart TD
sgnligo.sources.datasource_v2.sources.gwdata_noise.GWDataNoiseComposedSource[GWDataNoiseComposedSource]
sgnligo.sources.composed_base.ComposedSourceBase[ComposedSourceBase]
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin[ChannelOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin[GPSOptionsFlexibleMixin]
sgnligo.sources.datasource_v2.cli_mixins.StateVectorOnDictOnlyMixin[StateVectorOnDictOnlyMixin]
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin[VerboseOptionsMixin]
sgnligo.sources.composed_base.ComposedSourceBase --> sgnligo.sources.datasource_v2.sources.gwdata_noise.GWDataNoiseComposedSource
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin --> sgnligo.sources.datasource_v2.sources.gwdata_noise.GWDataNoiseComposedSource
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin --> sgnligo.sources.datasource_v2.sources.gwdata_noise.GWDataNoiseComposedSource
sgnligo.sources.datasource_v2.cli_mixins.StateVectorOnDictOnlyMixin --> sgnligo.sources.datasource_v2.sources.gwdata_noise.GWDataNoiseComposedSource
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin --> sgnligo.sources.datasource_v2.sources.gwdata_noise.GWDataNoiseComposedSource
click sgnligo.sources.datasource_v2.sources.gwdata_noise.GWDataNoiseComposedSource href "" "sgnligo.sources.datasource_v2.sources.gwdata_noise.GWDataNoiseComposedSource"
click sgnligo.sources.composed_base.ComposedSourceBase href "" "sgnligo.sources.composed_base.ComposedSourceBase"
click sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin"
click sgnligo.sources.datasource_v2.cli_mixins.StateVectorOnDictOnlyMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.StateVectorOnDictOnlyMixin"
click sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin"
Colored Gaussian noise source with optional state vector gating.
Generates colored Gaussian noise with LIGO PSD. Supports both offline and real-time modes, with optional segment-based state vector gating.
Fields inherited from mixins
ifos: List of detector prefixes (from ChannelOptionsMixin) channel_dict: Dict mapping IFO to channel name (from ChannelOptionsMixin) start: GPS start time (from GPSOptionsFlexibleMixin) end: GPS end time (from GPSOptionsFlexibleMixin) duration: Duration in seconds, alternative to end (from GPSOptionsFlexibleMixin) real_time: Enable real-time mode (from GPSOptionsFlexibleMixin) state_vector_on_dict: Bitmask dict (from StateVectorOnDictOnlyMixin) state_segments_file: State segments file (from StateVectorOnDictOnlyMixin) state_sample_rate: State vector sample rate (from StateVectorOnDictOnlyMixin) verbose: Enable verbose output (from VerboseOptionsMixin)
Example
Offline mode¶
source = GWDataNoiseComposedSource( ... name="noise", ... ifos=["H1", "L1"], ... channel_dict={"H1": "FAKE-STRAIN", "L1": "FAKE-STRAIN"}, ... start=1000, ... end=1010, ... )
Real-time mode¶
source = GWDataNoiseComposedSource( ... name="noise", ... ifos=["H1"], ... channel_dict={"H1": "FAKE-STRAIN"}, ... real_time=True, ... )
Source code in sgnligo/sources/datasource_v2/sources/gwdata_noise.py
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 | |
Frame Sources¶
sgnligo.sources.datasource_v2.sources.frames
¶
Frame file composed source classes.
These sources read gravitational wave data from GWF frame files, the standard format for LIGO/Virgo data.
Example
source = FramesComposedSource( ... name="data", ... ifos=["H1", "L1"], ... frame_cache="/path/to/frames.cache", ... channel_dict={"H1": "GDS-CALIB_STRAIN", "L1": "GDS-CALIB_STRAIN"}, ... start=1000000000, ... end=1000000100, ... ) pipeline.connect(source, sink)
FramesComposedSource
dataclass
¶
Bases: ComposedSourceBase, ChannelOptionsMixin, FrameCacheOptionsMixin, GPSOptionsMixin, SegmentsOptionsMixin, StateVectorOptionsMixin, InjectionOptionsMixin, VerboseOptionsMixin
flowchart TD
sgnligo.sources.datasource_v2.sources.frames.FramesComposedSource[FramesComposedSource]
sgnligo.sources.composed_base.ComposedSourceBase[ComposedSourceBase]
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin[ChannelOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.FrameCacheOptionsMixin[FrameCacheOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsMixin[GPSOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin[SegmentsOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin[StateVectorOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.InjectionOptionsMixin[InjectionOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin[VerboseOptionsMixin]
sgnligo.sources.composed_base.ComposedSourceBase --> sgnligo.sources.datasource_v2.sources.frames.FramesComposedSource
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin --> sgnligo.sources.datasource_v2.sources.frames.FramesComposedSource
sgnligo.sources.datasource_v2.cli_mixins.FrameCacheOptionsMixin --> sgnligo.sources.datasource_v2.sources.frames.FramesComposedSource
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsMixin --> sgnligo.sources.datasource_v2.sources.frames.FramesComposedSource
sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin --> sgnligo.sources.datasource_v2.sources.frames.FramesComposedSource
sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin --> sgnligo.sources.datasource_v2.sources.frames.FramesComposedSource
sgnligo.sources.datasource_v2.cli_mixins.InjectionOptionsMixin --> sgnligo.sources.datasource_v2.sources.frames.FramesComposedSource
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin --> sgnligo.sources.datasource_v2.sources.frames.FramesComposedSource
click sgnligo.sources.datasource_v2.sources.frames.FramesComposedSource href "" "sgnligo.sources.datasource_v2.sources.frames.FramesComposedSource"
click sgnligo.sources.composed_base.ComposedSourceBase href "" "sgnligo.sources.composed_base.ComposedSourceBase"
click sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.FrameCacheOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.FrameCacheOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.SegmentsOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.InjectionOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.InjectionOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin"
Frame file source for offline analysis.
Reads strain data from GWF frame files specified in a LAL cache file. Supports optional noiseless injections, segment-based gating, and state vector gating.
Fields inherited from mixins
ifos: List of detector prefixes (from ChannelOptionsMixin) channel_dict: Dict mapping IFO to channel name (from ChannelOptionsMixin) frame_cache: Path to LAL cache file (from FrameCacheOptionsMixin) start: GPS start time (from GPSOptionsMixin) end: GPS end time (from GPSOptionsMixin) segments_file: Path to LIGO XML segments file (from SegmentsOptionsMixin) segments_name: Segment name in XML (from SegmentsOptionsMixin) state_channel_dict: Dict mapping IFO to state vector channel (from StateVectorOptionsMixin) state_vector_on_dict: Dict mapping IFO to bitmask (from StateVectorOptionsMixin) state_segments_file: Path to state segments file (from StateVectorOptionsMixin) state_sample_rate: State vector sample rate (from StateVectorOptionsMixin) noiseless_inj_frame_cache: Injection frame cache (from InjectionOptionsMixin) noiseless_inj_channel_dict: Injection channels (from InjectionOptionsMixin) verbose: Enable verbose output (from VerboseOptionsMixin)
Example
source = FramesComposedSource( ... name="data", ... ifos=["H1"], ... frame_cache="/path/to/frames.cache", ... channel_dict={"H1": "GDS-CALIB_STRAIN"}, ... start=1000000000, ... end=1000000100, ... ) pipeline.connect(source, sink)
Source code in sgnligo/sources/datasource_v2/sources/frames.py
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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | |
all_analysis_ifos
property
¶
IFOs declared in the segments file, or self.ifos if none.
This is the analysis-wide IFO set, not this job's: with a
segments_file configured, it returns every detector the XML
declares, even ones this job does not analyze (matching v1's
DataSourceInfo.all_analysis_ifos). Offline DAGs run per-combo
filter jobs against one shared segments file, and downstream
likelihood-ratio marginalization requires every job to stamp the
same instrument set into its output regardless of which subset it
analyzed. The per-job segments (filtered to self.ifos) live in
_load_segments(); only this property exposes the full set. The
property is kept as a distinct concept because the legacy
DataSourceInfo.all_analysis_ifos was intended to come from a
separate source (e.g., a time-slide file in gstlal) and may be
extended that way later.
DevShm Sources¶
sgnligo.sources.datasource_v2.sources.devshm
¶
Shared memory (devshm) composed source classes.
These sources read low-latency data from shared memory for online gravitational wave analysis.
Example
source = DevShmComposedSource( ... name="low_latency", ... ifos=["H1"], ... channel_dict={"H1": "GDS-CALIB_STRAIN"}, ... shared_memory_dict={"H1": "/dev/shm/kafka/H1_O4Replay"}, ... state_channel_dict={"H1": "GDS-CALIB_STATE_VECTOR"}, ... state_vector_on_dict={"H1": 3}, ... ) pipeline.connect(source, sink)
DevShmComposedSource
dataclass
¶
Bases: ComposedSourceBase, ChannelOptionsMixin, DevShmOptionsMixin, QueueTimeoutOptionsMixin, StateVectorOptionsMixin, VerboseOptionsMixin
flowchart TD
sgnligo.sources.datasource_v2.sources.devshm.DevShmComposedSource[DevShmComposedSource]
sgnligo.sources.composed_base.ComposedSourceBase[ComposedSourceBase]
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin[ChannelOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.DevShmOptionsMixin[DevShmOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.QueueTimeoutOptionsMixin[QueueTimeoutOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin[StateVectorOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin[VerboseOptionsMixin]
sgnligo.sources.composed_base.ComposedSourceBase --> sgnligo.sources.datasource_v2.sources.devshm.DevShmComposedSource
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin --> sgnligo.sources.datasource_v2.sources.devshm.DevShmComposedSource
sgnligo.sources.datasource_v2.cli_mixins.DevShmOptionsMixin --> sgnligo.sources.datasource_v2.sources.devshm.DevShmComposedSource
sgnligo.sources.datasource_v2.cli_mixins.QueueTimeoutOptionsMixin --> sgnligo.sources.datasource_v2.sources.devshm.DevShmComposedSource
sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin --> sgnligo.sources.datasource_v2.sources.devshm.DevShmComposedSource
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin --> sgnligo.sources.datasource_v2.sources.devshm.DevShmComposedSource
click sgnligo.sources.datasource_v2.sources.devshm.DevShmComposedSource href "" "sgnligo.sources.datasource_v2.sources.devshm.DevShmComposedSource"
click sgnligo.sources.composed_base.ComposedSourceBase href "" "sgnligo.sources.composed_base.ComposedSourceBase"
click sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.DevShmOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.DevShmOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.QueueTimeoutOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.QueueTimeoutOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin"
Shared memory source with state vector gating.
Reads low-latency strain data from shared memory and applies state vector gating to ensure only valid data is processed.
Fields inherited from mixins
ifos: List of detector prefixes (from ChannelOptionsMixin) channel_dict: Dict mapping IFO to channel name (from ChannelOptionsMixin) shared_memory_dict: Dict mapping IFO to shm path (from DevShmOptionsMixin) discont_wait_time: Discontinuity wait time (from DevShmOptionsMixin) queue_timeout: Queue timeout (from QueueTimeoutOptionsMixin) state_channel_dict: Dict mapping IFO to state vector channel (from StateVectorOptionsMixin) state_vector_on_dict: Dict mapping IFO to bitmask (from StateVectorOptionsMixin) state_segments_file: Path to state segments file (from StateVectorOptionsMixin) state_sample_rate: State vector sample rate (from StateVectorOptionsMixin) verbose: Enable verbose output (from VerboseOptionsMixin)
Note
state_channel_dict and state_vector_on_dict are required for DevShm sources (validation will fail if not provided).
Example
source = DevShmComposedSource( ... name="low_latency", ... ifos=["H1"], ... channel_dict={"H1": "GDS-CALIB_STRAIN"}, ... shared_memory_dict={"H1": "/dev/shm/kafka/H1_O4Replay"}, ... state_channel_dict={"H1": "GDS-CALIB_STATE_VECTOR"}, ... state_vector_on_dict={"H1": 3}, ... ) pipeline.connect(source, sink)
Source code in sgnligo/sources/datasource_v2/sources/devshm.py
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 | |
Arrakis Sources¶
sgnligo.sources.datasource_v2.sources.arrakis
¶
Arrakis composed source classes.
These sources read streaming data via Arrakis for online gravitational wave analysis.
Example
source = ArrakisComposedSource( ... name="kafka_data", ... ifos=["H1", "L1"], ... channel_dict={"H1": "GDS-CALIB_STRAIN", "L1": "GDS-CALIB_STRAIN"}, ... ) pipeline.connect(source, sink)
ArrakisComposedSource
dataclass
¶
Bases: ComposedSourceBase, ChannelOptionsMixin, GPSOptionsFlexibleMixin, QueueTimeoutOptionsMixin, ReplayOptionsMixin, StateVectorOptionsMixin, VerboseOptionsMixin
flowchart TD
sgnligo.sources.datasource_v2.sources.arrakis.ArrakisComposedSource[ArrakisComposedSource]
sgnligo.sources.composed_base.ComposedSourceBase[ComposedSourceBase]
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin[ChannelOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin[GPSOptionsFlexibleMixin]
sgnligo.sources.datasource_v2.cli_mixins.QueueTimeoutOptionsMixin[QueueTimeoutOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.ReplayOptionsMixin[ReplayOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin[StateVectorOptionsMixin]
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin[VerboseOptionsMixin]
sgnligo.sources.composed_base.ComposedSourceBase --> sgnligo.sources.datasource_v2.sources.arrakis.ArrakisComposedSource
sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin --> sgnligo.sources.datasource_v2.sources.arrakis.ArrakisComposedSource
sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin --> sgnligo.sources.datasource_v2.sources.arrakis.ArrakisComposedSource
sgnligo.sources.datasource_v2.cli_mixins.QueueTimeoutOptionsMixin --> sgnligo.sources.datasource_v2.sources.arrakis.ArrakisComposedSource
sgnligo.sources.datasource_v2.cli_mixins.ReplayOptionsMixin --> sgnligo.sources.datasource_v2.sources.arrakis.ArrakisComposedSource
sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin --> sgnligo.sources.datasource_v2.sources.arrakis.ArrakisComposedSource
sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin --> sgnligo.sources.datasource_v2.sources.arrakis.ArrakisComposedSource
click sgnligo.sources.datasource_v2.sources.arrakis.ArrakisComposedSource href "" "sgnligo.sources.datasource_v2.sources.arrakis.ArrakisComposedSource"
click sgnligo.sources.composed_base.ComposedSourceBase href "" "sgnligo.sources.composed_base.ComposedSourceBase"
click sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.ChannelOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.GPSOptionsFlexibleMixin"
click sgnligo.sources.datasource_v2.cli_mixins.QueueTimeoutOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.QueueTimeoutOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.ReplayOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.ReplayOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.StateVectorOptionsMixin"
click sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin href "" "sgnligo.sources.datasource_v2.cli_mixins.VerboseOptionsMixin"
Arrakis source for streaming data.
Reads streaming gravitational wave data from topics. Optionally supports state vector gating.
This source defaults to real-time mode. GPS times are optional.
Fields inherited from mixins
ifos: List of detector prefixes (from ChannelOptionsMixin) channel_dict: Dict mapping IFO to channel name (from ChannelOptionsMixin) start: GPS start time (optional, from GPSOptionsFlexibleMixin) end: GPS end time (optional, from GPSOptionsFlexibleMixin) duration: Duration in seconds (optional, from GPSOptionsFlexibleMixin) real_time: Enable real-time mode (default: True, from GPSOptionsFlexibleMixin) queue_timeout: Queue timeout (from QueueTimeoutOptionsMixin) replay_id: Server-registered replay identifier (from ReplayOptionsMixin) state_channel_dict: State channel dict (from StateVectorOptionsMixin) state_vector_on_dict: Bitmask dict (from StateVectorOptionsMixin) state_segments_file: State segments file (from StateVectorOptionsMixin) state_sample_rate: State vector sample rate (from StateVectorOptionsMixin) verbose: Enable verbose output (from VerboseOptionsMixin)
Example
source = ArrakisComposedSource( ... name="kafka_data", ... ifos=["H1"], ... channel_dict={"H1": "GDS-CALIB_STRAIN"}, ... ) pipeline.connect(source, sink)
Source code in sgnligo/sources/datasource_v2/sources/arrakis.py
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 | |
Base Classes¶
sgnligo.sources.composed_base
¶
Base class for composed source elements.
This module provides a base class for creating composed source elements that
combine multiple internal elements into a single source. Subclasses declare
parameters as dataclass fields and override _build() to wire internal
elements using self.insert() and self.connect(). The resulting
object IS a TS source element — pass it directly to pipeline.connect().
Example
from dataclasses import dataclass from typing import ClassVar, List from sgnts.sources import FakeSeriesSource from sgnligo.sources.composed_base import ComposedSourceBase
@dataclass(kw_only=True) ... class WhiteSource(ComposedSourceBase): ... source_type: ClassVar[str] = "white" ... description: ClassVar[str] = "Gaussian white noise" ... ... ifos: List[str] ... sample_rate: int ... start: float ... end: float ... ... def build(self): ... for ifo in self.ifos: ... self.insert(FakeSeriesSource( ... name=f"{self.name}{ifo}", ... source_pad_names=(f"{ifo}:STRAIN",), ... rate=self.sample_rate, ... start=self.start, ... end=self.end, ... signal_type="white", ... ))
source = WhiteSource( ... name="noise", ifos=["H1", "L1"], ... sample_rate=4096, start=1000, end=1010, ... ) pipeline.connect(source, sink)
ComposedSourceBase
dataclass
¶
Bases: TSComposedSourceElement
flowchart TD
sgnligo.sources.composed_base.ComposedSourceBase[ComposedSourceBase]
click sgnligo.sources.composed_base.ComposedSourceBase href "" "sgnligo.sources.composed_base.ComposedSourceBase"
Base class for composed source elements.
Subclasses declare their parameters as dataclass fields and override
_build() to wire internal elements using self.insert() and
self.connect(). __post_init__ (inherited from
TSComposedSourceElement) calls _validate() then _build()
then sets up boundary pads.
This class adds to the bare TSComposedSourceElement API:
source_type/descriptionclass vars for CLI/registry use.latency_intervalfield and_add_latency_tracking()helper for optional latency-monitoring side outputs.- CLI integration (
add_cli_arguments/get_cli_arg_names/process_cli_args).
Class Attributes
source_type: String identifier for registry (e.g., "white", "frames"). Leave empty for classes that should not be registered. description: Human-readable description for help text.
Source code in sgnligo/sources/composed_base.py
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 | |
add_cli_arguments(parser)
classmethod
¶
Add CLI arguments for latency tracking.
Source code in sgnligo/sources/composed_base.py
137 138 139 140 141 142 143 144 145 146 | |
get_cli_arg_names()
classmethod
¶
Return set of CLI argument names defined by this class.
Source code in sgnligo/sources/composed_base.py
148 149 150 151 | |
process_cli_args(args)
classmethod
¶
Convert CLI args to field values.
Source code in sgnligo/sources/composed_base.py
153 154 155 156 157 158 159 160 | |
Utilities¶
sgnligo.sources.datasource_v2.sources.utils
¶
Utility functions for composed sources.
This module contains reusable building blocks that are shared across multiple composed source classes.
add_state_vector_gating(composed, strain_source, state_source, ifo, bit_mask, strain_pad, state_pad, output_pad)
¶
Wire a BitMask + Gate into composed for state vector gating.
Common pattern for devshm, arrakis, and gwdata-noise sources. Applies a bitmask to the state vector channel, then uses a Gate to control strain data based on the masked state vector.
The pattern is
strain_source[strain_pad] ─────────────────┐ ├─> Gate[output_pad] state_source[state_pad] -> BitMask[state] ─┘
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
composed
|
ComposedElementMixin
|
The composed element being built (a |
required |
strain_source
|
Source element providing strain data. |
required | |
state_source
|
Source element providing state vector data. |
required | |
ifo
|
str
|
Interferometer prefix (e.g., "H1"). |
required |
bit_mask
|
int
|
Bitmask to apply to state vector. |
required |
strain_pad
|
str
|
Name of the strain output pad on |
required |
state_pad
|
str
|
Name of the state vector output pad on |
required |
output_pad
|
str
|
Name for the gated output pad. |
required |
Returns:
| Type | Description |
|---|---|
Gate
|
The Gate element for downstream use (e.g., latency tracking). |
Source code in sgnligo/sources/datasource_v2/sources/utils.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 67 68 | |