Skip to content

Error when specifying pad in TimeSeries.fetch

Created by: SeanDS

When running this script:

from gwpy.timeseries import TimeSeries
from matplotlib import pyplot as plt

data = TimeSeries.fetch(start="2018-10-24 00:00", end="2018-10-24 14:00", channel="G2:PEM-BASE_PART_300", host="pt-firefly", port=8088, pad=0.0)
plt.plot(data)
plt.show()

I get this error:

(ligo) sean@totoro ~/Workspace $ python plot_particles.py 
/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 88 from C header, got 96 from PyObject
  return f(*args, **kwds)
Traceback (most recent call last):
  File "plot_particles.py", line 5, in <module>
    data = TimeSeries.fetch(start="2018-10-24 00:00", end="2018-10-24 14:00", channel="G2:PEM-BASE_PART_300", host="pt-firefly", port=8088, pad=0.0)
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/gwpy/timeseries/core.py", line 335, in fetch
    allow_tape=allow_tape, type=type, dtype=dtype)[str(channel)]
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/gwpy/timeseries/core.py", line 1073, in fetch
    series_class=cls.EntryClass).crop(start, end)
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/gwpy/io/nds2.py", line 347, in wrapped_func
    return func(*args, **kwargs)
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/gwpy/timeseries/io/nds2.py", line 135, in fetch
    qsegs = _get_data_segments(ndschannels, start, end, connection) & span
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/gwpy/timeseries/io/nds2.py", line 170, in _get_data_segments
    connection=connection)
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/gwpy/io/nds2.py", line 347, in wrapped_func
    return func(*args, **kwargs)
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/gwpy/io/nds2.py", line 545, in get_availability
    result = connection.get_availability(names)
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/nds2.py", line 3684, in get_availability
    channel_names = _hack_for_python2_strings(channel_names)
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/nds2.py", line 3858, in _hack_for_python2_strings
    elif len(args) > 0:
TypeError: object of type 'map' has no len()

The error goes away if I remove pad=0.0 from the call to TimeSeries.fetch.

I am running the script within a fresh conda environment. I found that python-nds2-client was not installed by gwpy by default so I had to install that too. The install sequence is provided below.

There are two other potential causes for concern: the RuntimeWarning about Numpy at the top of the output above, and the SafetyError from installing sip below. Neither prevent the script working when I remove pad.

My client is Ubuntu 18.04.1, and I'm accessing an NDS1 server, if that makes any difference.

sean@totoro ~/Workspace $ conda create -n ligo                               
Solving environment: done

## Package Plan ##

  environment location: /home/sean/Workspace/anaconda/envs/ligo


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate ligo
#
# To deactivate an active environment, use
#
#     $ conda deactivate

sean@totoro ~/Workspace $ conda config --add channels conda-forge
sean@totoro ~/Workspace $ conda install -n ligo gwpy
Solving environment: done

## Package Plan ##

  environment location: /home/sean/Workspace/anaconda/envs/ligo

  added / updated specs: 
    - gwpy


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    tornado-5.1.1              |   py36h470a237_0         669 KB  conda-forge
    hdf5-1.10.3                |       hc401514_2         4.8 MB  conda-forge
    astropy-3.0.5              |   py36h470a237_0         9.6 MB  conda-forge
    gwpy-0.12.2                |        py36_1000         1.4 MB  conda-forge
    pytz-2018.6                |             py_0         228 KB  conda-forge
    glib-2.56.2                |       h464dc38_0         4.9 MB  conda-forge
    atomicwrites-1.2.1         |             py_0           9 KB  conda-forge
    pytest-3.9.2               |        py36_1000         334 KB  conda-forge
    py-1.7.0                   |             py_0          65 KB  conda-forge
    h5py-2.8.0                 |   py36h097b052_4         3.7 MB  conda-forge
    pluggy-0.8.0               |             py_0          17 KB  conda-forge
    gstreamer-1.12.5           |       h5856ed1_0         2.1 MB  conda-forge
    wheel-0.32.2               |           py36_0          34 KB  conda-forge
    tqdm-4.28.1                |             py_0          38 KB  conda-forge
    pyparsing-2.2.2            |             py_0          51 KB  conda-forge
    more-itertools-4.3.0       |        py36_1000          83 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        28.0 MB

The following NEW packages will be INSTALLED:

    astropy:            3.0.5-py36h470a237_0  conda-forge
    atomicwrites:       1.2.1-py_0            conda-forge
    attrs:              18.2.0-py_0           conda-forge
    blas:               1.0-mkl                          
    ca-certificates:    2018.10.15-ha4d7672_0 conda-forge
    certifi:            2018.10.15-py36_1000  conda-forge
    cycler:             0.10.0-py_1           conda-forge
    dbus:               1.13.0-h3a4f0e9_0     conda-forge
    expat:              2.2.5-hfc679d8_2      conda-forge
    fontconfig:         2.13.1-h65d0f4c_0     conda-forge
    freetype:           2.9.1-h6debe1e_4      conda-forge
    gettext:            0.19.8.1-h5e8e0c9_1   conda-forge
    glib:               2.56.2-h464dc38_0     conda-forge
    gst-plugins-base:   1.12.5-hde13a9d_0     conda-forge
    gstreamer:          1.12.5-h5856ed1_0     conda-forge
    gwpy:               0.12.2-py36_1000      conda-forge
    h5py:               2.8.0-py36h097b052_4  conda-forge
    hdf5:               1.10.3-hc401514_2     conda-forge
    icu:                58.2-hfc679d8_0       conda-forge
    intel-openmp:       2019.0-118                       
    jpeg:               9c-h470a237_1         conda-forge
    kiwisolver:         1.0.1-py36h2d50403_2  conda-forge
    libffi:             3.2.1-hfc679d8_5      conda-forge
    libgcc-ng:          7.2.0-hdf63c60_3      conda-forge
    libgfortran:        3.0.0-1               conda-forge
    libgfortran-ng:     7.2.0-hdf63c60_3      conda-forge
    libiconv:           1.15-h470a237_3       conda-forge
    libpng:             1.6.35-ha92aebf_2     conda-forge
    libstdcxx-ng:       7.2.0-hdf63c60_3      conda-forge
    libuuid:            2.32.1-h470a237_2     conda-forge
    libxcb:             1.13-h470a237_2       conda-forge
    libxml2:            2.9.8-h422b904_5      conda-forge
    ligo-common:        1.0.3-py_0            conda-forge
    ligo-segments:      1.0.1-py36h470a237_0  conda-forge
    ligotimegps:        1.2.3-py_0            conda-forge
    matplotlib:         2.2.3-py36h8e2386c_0  conda-forge
    mkl:                2019.0-118                       
    mkl_fft:            1.0.6-py36_0          conda-forge
    mkl_random:         1.0.1-py36_0          conda-forge
    more-itertools:     4.3.0-py36_1000       conda-forge
    ncurses:            6.1-hfc679d8_1        conda-forge
    numpy:              1.15.0-py36h1b885b7_0            
    numpy-base:         1.15.0-py36h3dfced4_0            
    openssl:            1.0.2p-h470a237_1     conda-forge
    pcre:               8.41-hfc679d8_3       conda-forge
    pip:                18.1-py36_1000        conda-forge
    pluggy:             0.8.0-py_0            conda-forge
    psutil:             5.4.7-py36h470a237_1  conda-forge
    pthread-stubs:      0.4-h470a237_1        conda-forge
    py:                 1.7.0-py_0            conda-forge
    pyparsing:          2.2.2-py_0            conda-forge
    pyqt:               5.6.0-py36h8210e8a_7  conda-forge
    pytest:             3.9.2-py36_1000       conda-forge
    pytest-arraydiff:   0.2-py_0              conda-forge
    pytest-astropy:     0.4.0-py_0            conda-forge
    pytest-doctestplus: 0.1.3-py_0            conda-forge
    pytest-openfiles:   0.3.0-py_0            conda-forge
    pytest-remotedata:  0.3.0-py_0            conda-forge
    python:             3.6.6-h5001a0f_3      conda-forge
    python-dateutil:    2.7.3-py_0            conda-forge
    pytz:               2018.6-py_0           conda-forge
    qt:                 5.6.2-hf70d934_9      conda-forge
    readline:           7.0-haf1bffa_1        conda-forge
    scipy:              1.1.0-py36hc49cb51_0             
    setuptools:         40.4.3-py36_0         conda-forge
    sip:                4.18.1-py36hfc679d8_0 conda-forge
    six:                1.11.0-py36_1001      conda-forge
    sqlite:             3.25.2-hb1c47c0_0     conda-forge
    tk:                 8.6.8-ha92aebf_0      conda-forge
    tornado:            5.1.1-py36h470a237_0  conda-forge
    tqdm:               4.28.1-py_0           conda-forge
    wheel:              0.32.2-py36_0         conda-forge
    xorg-libxau:        1.0.8-h470a237_6      conda-forge
    xorg-libxdmcp:      1.1.2-h470a237_7      conda-forge
    xz:                 5.2.4-h470a237_1      conda-forge
    zlib:               1.2.11-h470a237_3     conda-forge

Proceed ([y]/n)? y


Downloading and Extracting Packages
tornado-5.1.1        | 669 KB    | ######################################################################################################################### | 100% 
hdf5-1.10.3          | 4.8 MB    | ######################################################################################################################### | 100% 
astropy-3.0.5        | 9.6 MB    | ######################################################################################################################### | 100% 
gwpy-0.12.2          | 1.4 MB    | ######################################################################################################################### | 100% 
pytz-2018.6          | 228 KB    | ######################################################################################################################### | 100% 
glib-2.56.2          | 4.9 MB    | ######################################################################################################################### | 100% 
atomicwrites-1.2.1   | 9 KB      | ######################################################################################################################### | 100% 
pytest-3.9.2         | 334 KB    | ######################################################################################################################### | 100% 
py-1.7.0             | 65 KB     | ######################################################################################################################### | 100% 
h5py-2.8.0           | 3.7 MB    | ######################################################################################################################### | 100% 
pluggy-0.8.0         | 17 KB     | ######################################################################################################################### | 100% 
gstreamer-1.12.5     | 2.1 MB    | ######################################################################################################################### | 100% 
wheel-0.32.2         | 34 KB     | ######################################################################################################################### | 100% 
tqdm-4.28.1          | 38 KB     | ######################################################################################################################### | 100% 
pyparsing-2.2.2      | 51 KB     | ######################################################################################################################### | 100% 
more-itertools-4.3.0 | 83 KB     | ######################################################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: / 
SafetyError: The package for sip located at /home/sean/Workspace/anaconda/pkgs/sip-4.18.1-py36hfc679d8_0
appears to be corrupted. The path 'bin/sip'
has a sha256 mismatch.
  reported sha256: 660de583bfb72b513b209f94fa2eeddd77e37b446c436d2a9f894cdb7d860a75
  actual sha256: 28c774abd99feec762bb1d589d226171d6029d3d2624c26731fd9d4ef94e35ac

SafetyError: The package for sip located at /home/sean/Workspace/anaconda/pkgs/sip-4.18.1-py36hfc679d8_0
appears to be corrupted. The path 'include/python3.6m/sip.h'
has a sha256 mismatch.
  reported sha256: 4bb5b5668ccb46db3285977936a0cce3c35971308a0cc771eec423077a2bb617
  actual sha256: a1993a4e3de79cc5ab948cba7b4197a24600f361a6b69e63e89e9c25933f1cec



done
Executing transaction: done
sean@totoro ~/Workspace $ source activate ligo
(ligo) sean@totoro ~/Workspace $ python plot_particles.py 
/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 88 from C header, got 96 from PyObject
  return f(*args, **kwds)
Traceback (most recent call last):
  File "plot_particles.py", line 5, in <module>
    data = TimeSeries.fetch(start="2018-10-24 00:00", end="2018-10-24 14:00", channel="G2:PEM-BASE_PART_300", host="pt-firefly", port=8088, pad=0.0)
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/gwpy/timeseries/core.py", line 335, in fetch
    allow_tape=allow_tape, type=type, dtype=dtype)[str(channel)]
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/gwpy/timeseries/core.py", line 1018, in fetch
    connection = io_nds2.auth_connect(host, port)
  File "/home/sean/Workspace/anaconda/envs/ligo/lib/python3.6/site-packages/gwpy/io/nds2.py", line 317, in auth_connect
    raise ImportError("No module named nds2")
ImportError: No module named nds2
(ligo) sean@totoro ~/Workspace $ conda install -n ligo python-nds2-client
Solving environment: done

## Package Plan ##

  environment location: /home/sean/Workspace/anaconda/envs/ligo

  added / updated specs: 
    - python-nds2-client


The following NEW packages will be INSTALLED:

    cyrus-sasl:         2.1.26-h20670df_3                   
    krb5:               1.16.1-hbb41f41_0        conda-forge
    libcurl:            7.61.1-hbdb9355_2        conda-forge
    libedit:            3.1.20170329-haf1bffa_1  conda-forge
    libntlm:            1.4-h470a237_1           conda-forge
    libssh2:            1.8.0-h5b517e9_2         conda-forge
    nds2-client:        0.16.0-hfc679d8_2        conda-forge
    python-nds2-client: 0.16.1-py36h24bf2e0_1001 conda-forge

Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done