function findalsglitch(gpsstart,gpsstop)
% FINDALSGLITCH - identify glitches in the ALS servo
%
% Ed Daw, 30th March 2015

%buffer=conn.fetch(1111785900,1111786100,{'H1:ALS-Y_REFL_ERR_OUT_DQ'});
conn=nds2.connection('nds.ligo-wa.caltech.edu',31200);
buffer=conn.fetch(gpsstart,gpsstop,{'H1:ALS-Y_REFL_ERR_OUT_DQ'});
mydata=buffer(1).getData();
index=1;
while(index<length(mydata)-501)
    if(mydata(index)>20000)
        if(min(mydata(index:index+500))<-20000)
            starttime=gpsstart+index/16384;
            mystring=sprintf('%9.0f',starttime);
            disp(mystring);
            index=index+500;
        else
            index=index+1;
        end
    else
        index=index+1;
    end
end

        
