ChannelList#
- class gwpy.detector.ChannelList(iterable=(), /)[source]#
Bases:
listA
listofchannels, with parsing utilities.Attributes Summary
The
setof interferometer prefixes used in thisChannelList.Read a
ChannelListfrom a file.Write this
ChannelListto a file.Methods Summary
find(name)Find the
Channelwith a specific name in thisChannelList.from_names(*names)Create a new
ChannelListfrom a list of names.query(name, *[, kerberos])Query the LIGO Channel Information System a
ChannelList.query_nds2(names, *[, host, port, ...])Query an NDS server for channel information.
query_nds2_availability(channels, start, end)Query for when data are available for these channels in NDS2.
sieve([name, sample_rate, sample_range, ...])Find all channels in this list matching the specified criteria.
Attributes Documentation
- ifos[source]#
The
setof interferometer prefixes used in thisChannelList.
- read#
Read a
ChannelListfrom a file.- Parameters:
- source
str,pathlib.Path,file. File or path to read.
- format
str, optional Source format identifier. If not given, the format will be detected if possible. See below for list of acceptable formats.
- kwargs
Other keyword arguments depend on the format, See
ChannelList.read.help(format=<format>)for details, or callChannelList.read.help()to see all available formats.
- source
- Returns:
- channels
ChannelList The list of channels read from the source.
- channels
- write#
Write this
ChannelListto a file.Arguments and keywords depend on the output format, see the online documentation for full details for each format.
- Parameters:
- target
str Output filename.
- target
Methods Documentation
- find(name: str) int[source]#
Find the
Channelwith a specific name in thisChannelList.- Parameters:
- Returns:
- index
int the position of the first
Channelin thisChannelListwhosenamematches the search key.
- index
- Raises:
ValueErrorif no matching
Channelis found.
- classmethod from_names(*names: str) Self[source]#
Create a new
ChannelListfrom a list of names.The list of names can include comma-separated sets of names, in which case the return will be a flattened list of all parsed channel names.
- classmethod query(name: str, *, kerberos: bool | None = None, **kwargs) Self[source]#
Query the LIGO Channel Information System a
ChannelList.- Parameters:
- Returns:
- channels
ChannelList A new list containing all
Channelsfound.
- channels
- classmethod query_nds2(
- names: list[str],
- *,
- host: str | None = None,
- port: int | None = None,
- connection: nds2.connection | None = None,
- type: str | int | None = 127,
- unique: bool = False,
Query an NDS server for channel information.
- Parameters:
- names
str Names of requested channels.
- host
str, optional Name of NDS2 server.
- port
int, optional Port number for NDS2 connection.
- connection
nds2.connection, optional Open connection to use for query.
- type
str,int, optional NDS2 channel type with which to restrict query
- unique
bool, optional If
Truerequire a unique query result for each name given. Default isFalse.
- names
- Returns:
- channellist
ChannelList list of
Channelswith metadata retrieved from NDS2 server
- channellist
- Raises:
ValueErrorIf multiple channels are found for a given name and
unique=Trueis given.
Notes
Warning
One of
hostorconnectionis required.
- classmethod query_nds2_availability(
- channels: list[str | Channel],
- start: SupportsToGps,
- end: SupportsToGps,
- ctype: int | str = 127,
- connection: nds2.connection | None = None,
- host: str | None = None,
- port: int | None = None,
Query for when data are available for these channels in NDS2.
- Parameters:
- channels
listofstrorChannel - start
LIGOTimeGPS,float,str GPS start time of search. Any input parseable by
to_gpsis fine.- end
LIGOTimeGPS,float,str, optional GPS end time of search. Any input parseable by
to_gpsis fine.- ctype
int,str The NDS2 channel type name or enum ID against which to restrict results. Default is
127which means ‘all’.- host
str, optional Name of NDS2 server to use.
- port
int, optional Port number for NDS2 connection.
- connection
nds2.connection, optional Open connection to use for query.
- channels
- Returns:
- segdict
SegmentListDict dict of
(name, SegmentList)pairs
- segdict
- sieve(
- name: str | re.Pattern | None = None,
- sample_rate: float | None = None,
- *,
- sample_range: tuple[float, float] | None = None,
- exact_match: bool = False,
- **others,
Find all channels in this list matching the specified criteria.
- Parameters:
- name
str, orregularexpression Any part of the channel name against which to match (or full name if
exact_match=Falseis given).- sample_rate
float Rate (number of samples per second) to match exactly.
- sample_range2-
tuple [low, high]closed interval or rates to match within.- exact_match
bool If
Truereturn channels matchingnameexactly. IfFalse(default) allow partial matches.- others:
Other
(key, value)attribute pairs to match.
- name
- Returns:
- new
ChannelList A new
ChannelListcontaining the matching channels.
- new