Skip to content

Spectrogram.crop_frequencies method looking for .span_y instead of .yspan attributes

Created by: mikelovskij

When trying to use the Spectrogram.crop_frequencies method, I get this error:

AttributeError                            Traceback (most recent call last)
/usr/local/lib/python2.7/dist-packages/gwpy_dataviewer-0.0.0.dev0-py2.7.egg/dataviewer/bnsrange.pyc in <module>()
----> 1 spec.crop_frequencies(self.flow, self.fhigh)

/home/mikelovskij/.local/lib/python2.7/site-packages/gwpy/spectrogram/core.pyc in crop_frequencies(self, low, high, copy)
    471                           'frequency crop will have no effect.')
    472         # check high frequency
--> 473         if high is not None and high == self.span_y[1]:
    474             high = None
    475         elif high is not None and high > self.span_y[1]:

/usr/local/lib/python2.7/dist-packages/astropy/units/quantity.pyc in __getattr__(self, attr)
    701                 "'{0}' object has no '{1}' member".format(
    702                     self.__class__.__name__,
--> 703                     attr))
    704
    705         def get_virtual_unit_attribute():

AttributeError: 'Spectrogram' object has no 'span_y' member 

From the traceback it seems that the crop method looks for the span_y attribute, while on the documentation and in /gwpy/data/array2d.py only the yspan attribute is defined.

The issue seems to happen on any spectrogram object, i. e. the one created in this example code :

from gwpy.timeseries import TimeSeries
gwdata = TimeSeries.fetch(
    'H1:LDAS-STRAIN,rds', 'September 16 2010 06:40', 'September 16 2010 06:50')
specgram = gwdata.spectrogram(5, fftlength=2, overlap=1) ** (1/2.)
specgram.crop_frequencies(1, 1000)