@@ -0,0 +1,2242 @@
+#!/usr/bin/env python%0A# (c) Stefan Countryman 2017%0A%0Aimport matplotlib%0Amatplotlib.use('Agg')%0Aimport gwpy.timeseries%0A%0AGPS = 1172486067%0AMAX_SIMULTANEOUS_CHANS = 5%0AHTML_TOP = %22%22%22%0A%3C!DOCTYPE html%3E%0A%3Chtml%3E%0A    %3Chead%3E%0A        %3Cmeta charset=%22UTF-8%22%3E%0A        %3Ctitle%3EPlots around %7B%7D%3C/title%3E%0A        %3Cstyle type=%22text/css%22%3E%0A            img, p %7B%7B%0A                max-width: 400px;%0A            %7D%7D%0A            div %7B%7B%0A                display: inline%0A            %7D%7D%0A        %3C/style%3E%0A    %3C/head%3E%0A    %3Cbody%3E%0A%0A%22%22%22.format(GPS)%0AHTML_BOTTOM = %22%22%22%0A%0A    %3C/body%3E%0A%3C/html%3E%0A%22%22%22%0A%0Adef channel_fname(GPS, chan):%0A    return '%7B%7D_%7B%7D.png'.format(GPS, chan.replace(':', '..'))%0A%0Adef image_link_html(GPS, chan):%0A    %22%22%22return an HTML string for an image element for this plot%22%22%22%0A    return ('%3Cdiv%3E%5Cn'%0A            '    %3Cp%3E%7B%7D%3C/p%3E%5Cn'%0A            '    %3Cbr%3E%5Cn'%0A            '    %3Cimg src=%22./%7B%7D%22%3E%5Cn'%0A            '%3C/div%3E%5Cn').format(chan, channel_fname(GPS, chan))%0A%0A# read channel list%0Awith open('diag_channels.txt', 'r') as f:%0A    chans = list(set(f.read().split('%5Cn')) - %7B''%7D)%0A    print('channels to plot: %7B%7D'.format(chans))%0A%0A# make a preview html page%0Awith open('index.html', 'w') as f:%0A    f.write(HTML_TOP)%0A    f.write('%5Cn')%0A    for chan in chans:%0A        f.write(image_link_html(GPS, chan))%0A    f.write(HTML_BOTTOM)%0A%0A%22%22%22%0A# fetch and plot channels%0Afor i in range(0, len(chans), MAX_SIMULTANEOUS_CHANS):%0A    print('plotting %7B%7D through %7B%7D of %7B%7D'.format(i, i+MAX_SIMULTANEOUS_CHANS,%0A                                                len(chans)))%0A    chans_sublist = chans%5Bi:i+MAX_SIMULTANEOUS_CHANS%5D%0A    try:%0A        bufs = gwpy.timeseries.TimeSeriesDict.fetch(chans_sublist, GPS-5, GPS+5,%0A                                                    verbose=True)%0A    except RuntimeError:%0A        print('Could not fetch all at once:%5Cn%7B%7D'.format(chans_sublist))%0A        bufs = %7B%7D%0A        for chan in chans_sublist:%0A            try:%0A                buf = gwpy.timeseries.TimeSeries.fetch(chan, GPS-5, GPS+5,%0A                                                       verbose=True)%0A                bufs%5Bchan%5D = buf%0A            except RuntimeError:%0A                print('Bad channel: %7B%7D'.format(chan))%0A    for chan in bufs:%0A        buf = bufs%5Bchan%5D%0A        buf.plot().savefig(channel_fname(GPS, chan))%0A%22%22%22%0A

add diagnostic plot and webpage generating script