Skip to content

Fix stream.py buffer n memory = 0 problem

Alvin Li requested to merge fix-stream-py-buffer-problem into master

Changed line 370 of gstlal/python/stream.py from

if is_gap:

to

if is_gap or buf.n_memory() == 0

This is to fix a bug introduced to gstlal previously, which I believe it is when idq channel data was added into the pipeline as another stream. Especially, without this fix will cause errors when running gstlal_inspiral_calc_snr, which raises error

/usr/bin/gstlal_inspiral_calc_snr --mode 0 --reference-psd psd.xml.gz --track-psd  --gps-start-time 1381859994 --gps-end-time 1381860427 --start 1381860322 --end 1381860332 --psd-fft-length 32 --data-source frames --frame-cache frame.cache --coinc coinc.xml --outdir /home/alvin.li/Projects/gstlal_event_followup/testing/G447746 --svd-bank H1:/home/alvin.li/Projects/gstlal_event_followup/testing/G447746/H1-0917_GSTLAL_SVD_BANK-0-0.xml.gz,L1:/home/alvin.li/Projects/gstlal_event_followup/testing/G447746/L1-0917_GSTLAL_SVD_BANK-0-0.xml.gz --channel-name H1=GDS-CALIB_STRAIN_CLEAN --channel-name=L1=GDS-CALIB_STRAIN_CLEAN --verbose
reading '/home/alvin.li/Projects/gstlal_event_followup/testing/G447746/H1-0917_GSTLAL_SVD_BANK-0-0.xml.gz' ...                                              
writing '/tmp/tmpp18co4os.xml.gz' ...
writing '/tmp/tmplwdh8t19.xml.gz' ...
reading '/home/alvin.li/Projects/gstlal_event_followup/testing/G447746/L1-0917_GSTLAL_SVD_BANK-0-0.xml.gz' ...                                              
writing '/tmp/tmpdi7lckq0.xml.gz' ...
writing '/tmp/tmp95ybj558.xml.gz' ...
reading 'coinc.xml' ...
Building pipeline...
Calculating SNR...
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/gstlal/pipeparts/sink.py", line 424, in new_sample_handler                                                       
    return self.pull_buffers(elem)
  File "/usr/lib64/python3.6/site-packages/gstlal/pipeparts/sink.py", line 463, in pull_buffers                                                             
    self.appsink_new_buffer(elem_with_oldest)
  File "/usr/lib64/python3.6/site-packages/gstlal/stream.py", line 230, in sample_handler                                                                   
    buf = self._pull_buffer(elem, caps=caps)
  File "/usr/lib64/python3.6/site-packages/gstlal/stream.py", line 392, in _pull_buffer                                                                     
    data = pipeio.array_from_audio_sample(sample)
  File "/usr/lib64/python3.6/site-packages/gstlal/pipeio.py", line 176, in array_from_audio_sample                                                          
    a = numpy.frombuffer(mapinfo.data, dtype = numpy_dtype_from_caps(caps))
AttributeError: 'list' object has no attribute '__buffer__'

Merge request reports