@open_connection<EOL>@reset_epoch<EOL>def get_availability(channels, start, end,<EOL>connection=None, host=None, port=None):<EOL>
from ..segments import (Segment, SegmentList, SegmentListDict)<EOL>connection.set_epoch(start, end)<EOL>names = list(map(<EOL>_get_nds2_name, find_channels(channels, epoch=(start, end),<EOL>connection=connection, unique=True),<EOL>))<EOL>result = connection.get_availability(names)<EOL>out = SegmentListDict()<EOL>for name, result in zip(channels, result):<EOL><INDENT>out[name] = SegmentList([Segment(s.gps_start, s.gps_stop) for s in<EOL>result.simple_list()])<EOL><DEDENT>return out<EOL>
Query an NDS2 server for data availability

    Parameters
    ----------
    channels : `list` of `str`
        list of channel names to query; this list is mapped to NDS channel
        names using :func:`find_channels`.

    start : `int`
        GPS start time of query

    end : `int`
        GPS end time of query

    connection : `nds2.connection`, optional
        open NDS2 connection to use for query

    host : `str`, optional
        name of NDS2 server to query, required if ``connection`` is not
        given

    port : `int`, optional
        port number on host to use for NDS2 connection

    Returns
    -------
    segdict : `~gwpy.segments.SegmentListDict`
        dict of ``(name, SegmentList)`` pairs

    Raises
    ------
    ValueError
        if the given channel name cannot be mapped uniquely to a name
        in the NDS server database.

    See also
    --------
    nds2.connection.get_availability
        for documentation on the underlying query method