def read(source, channels, start=None, end=None, series_class=TimeSeries,
         scaled=None):
    """Read data from one or more GWF files using the LALFrame API
    """
    # scaled must be provided to provide a consistent API with frameCPP
    if scaled is not None:
        warnings.warn(
            "the `scaled` keyword argument is not supported by lalframe, "
            "if you require ADC scaling, please install "
            "python-ldas-tools-framecpp",
        )

    stream = open_data_source(source)

    # parse times and restrict to available data
    epoch = lal.LIGOTimeGPS(stream.epoch.gpsSeconds,
                            stream.epoch.gpsNanoSeconds)
    streamdur = get_stream_duration(stream)
    if start is None:
        start = epoch
    else:
        start = max(epoch, lalutils.to_lal_ligotimegps(start))
    if end is None:
        offset = float(start - epoch)
        duration = streamdur - offset
    else:
        end = min(epoch + streamdur, lalutils.to_lal_ligotimegps(end))
        duration = float(end - start)

    # read data
    out = series_class.DictClass()
    for name in channels:
        out[name] = series_class.from_lal(
            _read_channel(stream, str(name), start=start, duration=duration),
            copy=False)
        lalframe.FrStreamSeek(stream, epoch)
    return out
def read ( source , channels , start = None , end = None , series_class = TimeSeries , scaled = None ) : if scaled is not None : warnings . warn ( "the `scaled` keyword argument is not supported by lalframe, " "if you require ADC scaling, please install " "python-ldas-tools-framecpp" , ) stream = open_data_source ( source ) epoch = lal . LIGOTimeGPS ( stream . epoch . gpsSeconds , stream . epoch . gpsNanoSeconds ) streamdur = get_stream_duration ( stream ) if start is None : start = epoch else : start = max ( epoch , lalutils . to_lal_ligotimegps ( start ) ) if end is None : offset = float ( start - epoch ) duration = streamdur - offset else : end = min ( epoch + streamdur , lalutils . to_lal_ligotimegps ( end ) ) duration = float ( end - start ) out = series_class . DictClass ( ) for name in channels : out [ name ] = series_class . from_lal ( _read_channel ( stream , str ( name ) , start = start , duration = duration ) , copy = False ) lalframe . FrStreamSeek ( stream , epoch ) return out
Read data from one or more GWF files using the LALFrame API