snax.multichannel_datasource module

class snax.multichannel_datasource.DataSourceInfo(options)[source]

Bases: object

! Hold the data associated with data source command lines.

snax.multichannel_datasource.append_options(parser)[source]
!

Append generic data source options to an OptionParser object in order to have consistent an unified command lines and parsing throughout the project for applications that read GW data.

  • –data-source [string]

    Set the data source from [framexmit|lvshm|frames|silence|white|white_live].

  • –block-size [int] (bytes)

    Data block size to read in bytes. Default 16384 * 8 * 512 which is 512 seconds of double precision data at 16384 Hz. This parameter is only used if –data-source is one of white, silence, AdvVirgo, LIGO, AdvLIGO, nds.

  • –gps-start-time [int] (seconds)

    Set the start time of the segment to analyze in GPS seconds. Required unless –data-source in lvshm,framexmit

  • --gps-end-time

    [int] (seconds) Set the end time of the segment to analyze in GPS seconds. Required unless –data-source in lvshm,framexmit

  • –channel-list [string]

    Set the list of the channels to process. File needs to be in format channel-name[spaces]sampling_rate with a new channel in each line. Command given as –channel-list=location/to/file.

  • –channel-name [string]

    Set the name of the channels to process. Can be given multiple times as –channel-name=IFO:AUX-CHANNEL-NAME:RATE

  • –max-streams [int]

    Set the maximum number of streams to process at a given time (num_channels * num_rates = num_streams). Used to split up channels given into roughly equal subsets to be processed in sequence.

  • --equal-subsets

    If set, forces an equal number of channels processed per channel subset.

  • –max-sampling-rate [int]

    Maximum sampling rate for a given channel. If a given channel has a higher native sampling rate, it will be downsampled to this target rate.

  • –min-sampling-rate [int]

    Minimum sampling rate for a given channel when splitting a given channel into multiple frequency bands. If a channel has a lower sampling rate than this minimum, however, it will not be upsampled to this sampling rate.

  • –framexmit-addr [string]

    Set the address of the framexmit service. Can be given multiple times as –framexmit-addr=IFO=xxx.xxx.xxx.xxx:port

  • –framexmit-iface [string]

    Set the address of the framexmit interface.

  • –shared-memory-partition [string]

    Set the name of the shared memory partition for a given instrument. Can be given multiple times as –shared-memory-partition=IFO=PARTITION-NAME

  • –shared-memory-assumed-duration [int]

    Set the assumed span of files in seconds. Default = 4 seconds.

  • –shared-memory-block-size [int]

    Set the byte size to read per buffer. Default = 4096 bytes.

  • –frame-type [string]

    Set the frame type required by the channels being used.

  • –frame-segments-file [filename]

    Set the name of the LIGO light-weight XML file from which to load frame segments. Optional iff –data-source is frames

  • –frame-segments-name [string]

    Set the name of the segments to extract from the segment tables. Required iff –frame-segments-file is given

  • –section-include [string]

    Set the channel sections to be included from the INI file. Can be given multiple times. Pass in spaces as underscores instead. If not specified, assumed to include all sections.

  • –safety-include [string]

    Set the safety values for channels to be included from the INI file. Can be given multiple times. Default = “safe”.

  • –fidelity-exclude [string]

    Set the fidelity values to be excluded from the INI file. Can be given multiple times.

  • –safe-channel-include [string]

    Set the channel names to be included from the INI file. Can be given multiple times. If not specified, assumed to include all channels.

  • –unsafe-channel-include [string]

    Include this channel when reading the INI file, disregarding safety information (requires exact match). Can be repeated.

  • --latency-output

    Set whether to print out latency (in seconds) at various stages of the pipeline.

    #### Typical usage case examples

    -# Reading data from frames

    –data-source=frames –gps-start-time=999999000 –gps-end-time=999999999 –channel-name=H1:AUX-CHANNEL-NAME:RATE

    -# Reading online data via framexmit

    –data-source=framexmit –channel-list=H1=location/to/file

    -# Many other combinations possible, please add some!

snax.multichannel_datasource.channel_dict_from_channel_file(channel_file)[source]

! Given a file of channel names with sampling rates, produce a dictionary keyed by ifo:

The file here comes from the output of a configuration file parser.

snax.multichannel_datasource.channel_dict_from_channel_ini(**kwargs)[source]

! Given a channel list INI, produces a dictionary keyed by ifo, filtered by frame type.

snax.multichannel_datasource.channel_dict_from_channel_list(channel_list)[source]

! Given a list of channels, produce a dictionary keyed by channel names:

The list here typically comes from an option parser with options that specify the “append” action.

Examples:

>>> channel_dict_from_channel_list(["H1:AUX-CHANNEL-NAME_1:2048", "H1:AUX-CHANNEL-NAME-2:512"])
{'H1:AUX-CHANNEL-NAME_1': {'fsamp': 2048.0, 'ifo': 'H1', 'flow': None, 'fhigh': None, 'qhigh': None, 'frametype': None}, 'H1:AUX-CHANNEL-NAME-2': {'fsamp': 512.0, 'ifo': 'H1', 'flow': None, 'fhigh': None, 'qhigh': None, 'frametype': None}}
snax.multichannel_datasource.partition_channels_to_equal_subsets(channel_dict, max_streams, min_sample_rate, max_sample_rate)[source]

! Given a channel dictionary, will produce partitions of channel subsets where the number of channels in each partition is equal (except possibly the last partition). This is given max_streams, and well as max and min sample rates enforced to determine the number of streams that a particular channel will generate.

Returns a list of disjoint channel lists.

snax.multichannel_datasource.partition_channels_to_subsets(channel_dict, max_streams, min_sample_rate, max_sample_rate)[source]

! Given a channel dictionary, will produce roughly equal partitions of channel subsets, given max_streams, and well as max and min sample rates enforced to determine the number of streams that a particular channel will generate.

Returns a list of disjoint channel lists.

snax.multichannel_datasource.partition_list(lst, target_sum)[source]

! Partition list to roughly equal partitioned chunks based on a target sum, given a list with items in the form (int, value), where ints are used to determine partitions.

Returns a sublist with items value.