Skip to content

TimeSeries with channel but no name is written to GWF by LALFrame with an empty string name

Writing a TimeSeries to GWF with LALFrame when it has a populated channel but no name results in a FrProcData struct with a name matching the empty string, rather than using the channel name:

>>> from gwpy.timeseries import TimeSeries
>>> a = TimeSeries(range(10), channel="data")
>>> a.write("test.gwf", format="gwf.lalframe")
>>> print(TimeSeries.read("test.gwf", "data"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/duncan/git/gwpy/gwpy/timeseries/core.py", line 310, in read
    return timeseries_reader(cls, source, *args, **kwargs)
  File "/home/duncan/git/gwpy/gwpy/timeseries/io/core.py", line 50, in read
    return io_read_multi(joiner, cls, source, *args, **kwargs)
  File "/home/duncan/git/gwpy/gwpy/io/mp.py", line 92, in read_multi
    output = mp_utils.multiprocess_with_queues(
  File "/home/duncan/git/gwpy/gwpy/utils/mp.py", line 123, in multiprocess_with_queues
    return list(map(_inner, inputs))
  File "/home/duncan/git/gwpy/gwpy/utils/mp.py", line 118, in _inner
    return func(x)
  File "/home/duncan/git/gwpy/gwpy/io/mp.py", line 121, in _read_single_file
    return fobj, io_read(cls, fobj, *args, **kwargs)
  File "/home/duncan/opt/mambaforge/envs/py39/lib/python3.9/site-packages/astropy/io/registry.py", line 527, in read
    data = reader(*args, **kwargs)
  File "/home/duncan/git/gwpy/gwpy/timeseries/io/gwf/__init__.py", line 405, in read_
    return reader(*args, **kwargs)
  File "/home/duncan/git/gwpy/gwpy/timeseries/io/gwf/__init__.py", line 293, in read_timeseries
    return read_timeseriesdict(source, [channel], *args, **kwargs)[channel]
  File "/home/duncan/git/gwpy/gwpy/timeseries/io/gwf/__init__.py", line 272, in read_timeseriesdict
    out.append(libread_(src, channels, start=start, end=end,
  File "/home/duncan/git/gwpy/gwpy/timeseries/io/gwf/framecpp.py", line 115, in read
    out.append(read_gwf(file_, channels, start=start, end=end, ctype=ctype,
  File "/home/duncan/git/gwpy/gwpy/timeseries/io/gwf/framecpp.py", line 195, in read_gwf
    new = _read_channel(stream, this, str(channel),
  File "/home/duncan/git/gwpy/gwpy/timeseries/io/gwf/framecpp.py", line 226, in _read_channel
    data = _get_frdata(stream, num, name, ctype=ctype)
  File "/home/duncan/git/gwpy/gwpy/timeseries/io/gwf/framecpp.py", line 245, in _get_frdata
    raise ValueError("no Fr{{Adc,Proc,Sim}}Data structures with the "
ValueError: no Fr{Adc,Proc,Sim}Data structures with the name data