cohplot = coh.plot(figsize=(12, 8), vmin=0., vmax=1.) ax = cohplot.gca() ax.set_ylabel('Frequency [Hz]') ax.set_yscale('log') ax.set_title(latexrefchname + ' ' + latexchname) ax.grid(b=True, which='both', axis='y') ax.set_xlim(float(gpsstart), float(gpsend)) if fmin < 0: fmin = 0.8 / fft ax.set_ylim(fmin, fmax) cohplot.add_colorbar(cmap='YlGnBu_r', label='Coherence') if lflag: flag = mylib.GetDQFlag(gpsstart, gpsend, config=llabel, kamioka=kamioka) if flag == None: ldata = TimeSeries.read(sources, lchannel, format='gwf.lalframe', start=float(gpsstart), end=float(gpsend)) locked = ldata == lnumber flag = locked.to_dqflag(name='', label=llabel, round=True) cohplot.add_state_segments(flag) else: pass fname = outdir + '/' + refchannel + '_' + channel + '_coherence_' + gpsstart + '_' + gpsend + '_' + index + '.png' cohplot.savefig(fname, dpi=dpi)
ax = plot.gca() ax.set_ylabel('Frequency [Hz]') ax.set_yscale('log') ax.set_title(latexchname + " Q-transform") ax.grid(b=True, which='both', axis='y') ax.set_xlim(float(gpsstart), float(gpsend)) plot.add_colorbar(cmap='YlGnBu_r', label="Normalized energy", log=True, clim=[0.1, None]) fname = outdir + '/' + channel + '_qtransform_' + gpsstart + '_' + gpsend + '_' + index + '.png' if lflag: flag = mylib.GetDQFlag(float(gpsstart), float(gpsend), config=llabel, kamioka=kamioka) if flag == None: ldata = TimeSeries.read(sources, lchannel, format='gwf.lalframe', start=float(gpsstart), end=float(gpsend)) locked = ldata == lnumber flag = locked.to_dqflag(name='', label=llabel) plot.add_state_segments(flag) else: pass plot.savefig(fname, dpi=dpi)
# define variables args = parser.parse_args() outdir = args.outdir gpsstart = args.gpsstart gpsend = args.gpsend triggertime = args.triggertime duration = args.triggerduration index = args.index kamioka = args.kamioka #trigger = DataQualityFlag(name="Trigger",known=[(float(gpsstart),float(gpsend))],active=[(triggertime,triggertime+duration)]) #xarm = mylib.GetDQFlag(gpsstart,gpsend,config="xarm",kamioka=kamioka) #LSC = mylib.GetDQFlag(gpsstart,gpsend,config="LSC",kamioka=kamioka) #FPMI = mylib.GetDQFlag(gpsstart,gpsend,config="FPMI",kamioka=kamioka) Observation = mylib.GetDQFlag(gpsstart, gpsend, config="Observation", kamioka=kamioka) IFO = mylib.GetDQFlag(gpsstart, gpsend, config="IFO", kamioka=kamioka) IMC = mylib.GetDQFlag(gpsstart, gpsend, config="IMC", kamioka=kamioka) PMC = mylib.GetDQFlag(gpsstart, gpsend, config="PMC", kamioka=kamioka) FSS = mylib.GetDQFlag(gpsstart, gpsend, config="FSS", kamioka=kamioka) ISS = mylib.GetDQFlag(gpsstart, gpsend, config="ISS", kamioka=kamioka) #DAQ = mylib.GetDQFlag(gpsstart,gpsend,config="DAQ",kamioka=kamioka) #MICH = mylib.GetDQFlag(gpsstart,gpsend,config="MICH",kamioka=kamioka) trigger = DataQualityFlag(name="Trigger", known=IFO.known, active=[(triggertime, triggertime + duration)]) untriggered = ~trigger plot = untriggered.plot(figsize=(12, 8)) ax = plot.gca()
Triggered |= intTriggered tmpactive=Triggered.active # Get trigger channel. Assumed that 1 omicron file contains only 1 channel. #print(channel) # Get DQflag. #safety is contracting time. safety=1 #locked=mylib.GetDQFlag(tfile-safety, tfile+omicron_interval+safety, config="IMC",min_len=safety*3,kamioka=True) #nightly=mylib.GetDQFlag(tfile-safety*2, tfile+omicron_interval+safety*2, config="quiet",min_len=safety*3,kamioka=True) #locked=mylib.GetDQFlag(tfile-safety*2, tfile+omicron_interval+safety*2, config="IFO",min_len=safety*3,kamioka=True) locked=mylib.GetDQFlag(tfile-safety*2, tfile+omicron_interval+safety*2, config="Observation",min_len=safety*3,kamioka=kamioka) #locked = locked & nightly locked_contract=locked.copy() locked=locked.active locked_contract.active=locked_contract.active.shift(-0.5) locked_contract=locked_contract.contract(0.5) unlocked_contract=~locked_contract print("locked") print(locked) print("unlocked_contract") print(unlocked_contract) # Loop over active segments. for segment in tmpactive: tmpstart=segment.start