Looking up and counting channels

You can look up information (channel metadata or simple channel counts) about available channels using the versatile connection.find_channels() and connection.count_channels() methods. You can look up a single channel by its name, or you can look up multiple channels with bash-compatible pattern matching. Channel name patterns support the following syntax:

As an example containing all of the above features, the pattern ?????, * {l{on,ov}e}ly {world,planet} matches the text Hello, very lovely world.

You can optionally limit the search by channel type: ONLINE, RAW, RDS, STREND, MTREND, TEST_POINT, STATIC, or any bitwise combination of these flags.

You can also limit the search by data type: INT16, INT32, and INT64 for signed 16-, 32-, and 64-bit integers respectively; FLOAT32 and FLOAT64 for 32- and 64-bit floating point, COMPLEX32 for floating point complex; or any bitwise combination of these flags.

Finally, you can restrict the search by minimum and maximum sample rate in Hz.

When requesting channel counts there are a few items to concider. On NDS1 all counts are done against the locally cached channel database. On NDS2 simple requests (filtering on name, and channel type [RAW, ONLINE, ...]) are simple requests to the servers, more detailed requests will require the server to send a partial channel list for client side filtering. For NDS2 the channel count information is also constrained to the currently set NDS2.

Example 4.7. Looking up channel information in Python with connection.find_channels()

List all channels.
>>> conn.find_channels()
Equivalent to:
>>> conn.find_channels('*')
('<G1:ASC_BDO3_EP-ROT (512Hz, RAW, INT16)>', '<G1:ASC_BDO3_EP-TILT (512Hz, RAW, INT16)>', ...

Look up a single channel by name.
>>> conn.find_channels('H0:PEM-EY_SEISX')
('<H0:PEM-EY_SEISX (256Hz, RAW, INT16)>',)

Look up multiple channels by name with a ? wildcard, standing for exactly one free character.
>>> conn.find_channels('H0:PEM-EY_SEIS?')
('<H0:PEM-EY_SEISX (256Hz, RAW, INT16)>', '<H0:PEM-EY_SEISY (256Hz, RAW, INT16)>', '<H0:PEM-EY_SEISZ (256Hz, RAW, INT16)>')

Look up multiple channels by name with a ? wildcard, standing for any number (zero or more) free characters.
>>> conn.find_channels('H0:PEM-EY_*')
('<H0:PEM-EY_BPO5 (16Hz, RAW, FLOAT32)>', '<H0:PEM-EY_BPO5.max (0.0166667Hz, MTREND, FLOAT32)>', '<H0:PEM-EY_BPO5.mean (0.0166667Hz, MTREND, FLOAT64)>', ...

Look up all ONLINE-type channels with any name.
>>> conn.find_channels('*', nds2.channel.CHANNEL_TYPE_ONLINE)

Look up all 16-bit and 32-bit integer, ONLINE-type channels with names ending in 'SEISY'.
>>> conn.find_channels('*SEISY', nds2.channel.CHANNEL_TYPE_ONLINE, nds2.channel.DATA_TYPE_INT16 | nds2.channel.DATA_TYPE_INT32)

Look up all 16-bit integer, ONLINE-type channels with names ending in 'SEISY' and whose sample rates are between 128 Hz and 512 Hz.
>>> conn.find_channels('*SEISY', nds2.channel.CHANNEL_TYPE_ONLINE, nds2.channel.DATA_TYPE_INT16, 128, 512)

Example 4.8. Counting available channels in Python with connection.count_channels()

Count all channels.
>>> conn.count_channels()
9686715L
Equivalent to:
>>> conn.count_channels('*')
9686715L

Count all L1 online channels (connected to nds.ligo-la.caltech.edu)
>>> conn.count_channels('L1:*', nds.channel.CHANNEL_TYPE_ONLINE)
1036L

Example 4.9. Looking up channel information in Octave with connection.find_channels()

List all channels.
octave:1> conn.find_channels()
Equivalent to:
octave:2> conn.find_channels('*')
('<G1:ASC_BDO3_EP-ROT (512Hz, RAW, INT16)>', '<G1:ASC_BDO3_EP-TILT (512Hz, RAW, INT16)>', ...

Look up a single channel by name.
octave:3> conn.find_channels('H0:PEM-EY_SEISX')
('<H0:PEM-EY_SEISX (256Hz, RAW, INT16)>',)

Look up multiple channels by name with a ? wildcard, standing for exactly one free character.
octave:4> conn.find_channels('H0:PEM-EY_SEIS?')
('<H0:PEM-EY_SEISX (256Hz, RAW, INT16)>', '<H0:PEM-EY_SEISY (256Hz, RAW, INT16)>', '<H0:PEM-EY_SEISZ (256Hz, RAW, INT16)>')

Look up multiple channels by name with a ? wildcard, standing for any number (zero or more) free characters.
octave:5> conn.find_channels('H0:PEM-EY_*')
('<H0:PEM-EY_BPO5 (16Hz, RAW, FLOAT32)>', '<H0:PEM-EY_BPO5.max (0.0166667Hz, MTREND, FLOAT32)>', '<H0:PEM-EY_BPO5.mean (0.0166667Hz, MTREND, FLOAT64)>', ...

Look up all ONLINE-type channels with any name.
octave:6> conn.find_channels('*', nds2.channel.CHANNEL_TYPE_ONLINE)

Look up all 16-bit and 32-bit integer, ONLINE-type channels with names ending in 'SEISY'.
octave:7> conn.find_channels('*SEISY', nds2.channel.CHANNEL_TYPE_ONLINE, bitor(nds2.channel.DATA_TYPE_INT16, nds2.channel.DATA_TYPE_INT32))

Look up all 16-bit integer, ONLINE-type channels with names ending in 'SEISY' and whose sample rates are between 128 Hz and 512 Hz.
octave:8> conn.find_channels('*SEISY', nds2.channel.CHANNEL_TYPE_ONLINE, nds2.channel.DATA_TYPE_INT16, 128, 512)

Example 4.10. Counting available channels in Octave with connection.count_channels()

Count all channels.
octave:1> conn.count_channels()
9686715L
Equivalent to:
octave:2> conn.count_channels('*')
9686715L

Count all L1 online channels (connected to nds.ligo-la.caltech.edu)
octave:3> conn.count_channels('L1:*', nds.channel.CHANNEL_TYPE_ONLINE)
1036L

Example 4.11. Looking up channel information in MATLAB with connection.findChannels()

List all channels.
>> conn.findChannels()
Equivalent to:
>> conn.findChannels('*')
('<G1:ASC_BDO3_EP-ROT (512Hz, RAW, INT16)>', '<G1:ASC_BDO3_EP-TILT (512Hz, RAW, INT16)>', ...

Look up a single channel by name.
>> conn.findChannels('H0:PEM-EY_SEISX')
('<H0:PEM-EY_SEISX (256Hz, RAW, INT16)>',)

Look up multiple channels by name with a ? wildcard, standing for exactly one free character.
>> conn.findChannels('H0:PEM-EY_SEIS?')
('<H0:PEM-EY_SEISX (256Hz, RAW, INT16)>', '<H0:PEM-EY_SEISY (256Hz, RAW, INT16)>', '<H0:PEM-EY_SEISZ (256Hz, RAW, INT16)>')

Look up multiple channels by name with a ? wildcard, standing for any number (zero or more) free characters.
>> conn.findChannels('H0:PEM-EY_*')
('<H0:PEM-EY_BPO5 (16Hz, RAW, FLOAT32)>', '<H0:PEM-EY_BPO5.max (0.0166667Hz, MTREND, FLOAT32)>', '<H0:PEM-EY_BPO5.mean (0.0166667Hz, MTREND, FLOAT64)>', ...

Look up all ONLINE-type channels with any name.
>> conn.findChannels('*', nds2.channel.CHANNEL_TYPE_ONLINE)

Look up all 16-bit and 32-bit integer, ONLINE-type channels with names ending in 'SEISY'.
>> conn.findChannels('*SEISY', nds2.channel.CHANNEL_TYPE_ONLINE, bitor(nds2.channel.DATA_TYPE_INT16, nds2.channel.DATA_TYPE_INT32))

Look up all 16-bit integer, ONLINE-type channels with names ending in 'SEISY' and whose sample rates are between 128 Hz and 512 Hz.
>> conn.findChannels('*SEISY', nds2.channel.CHANNEL_TYPE_ONLINE, nds2.channel.DATA_TYPE_INT16, 128, 512)

Example 4.12. Counting available channels in Matlab with connection.count_channels()

Count all channels.
>> conn.count_channels()
9686715L
Equivalent to:
>> conn.count_channels('*')
9686715L

Count all L1 online channels (connected to nds.ligo-la.caltech.edu)
>> conn.count_channels('L1:*', nds.channel.CHANNEL_TYPE_ONLINE)
1036L