parser.add_argument('run', help='run to list times of') # optional parser.add_argument('-s', dest='suppress', action='store_true', help='suppress all but bad output') # OK, done with arguments. args = parser.parse_args() run = args.run if not os.path.isfile(run + '.xml') or not os.path.isfile(run + '.dat'): print('One or both of', run + '.xml', 'and', run + '.dat', 'does not exist.') exit(1) tdat = ultracam.Rtime(run) first = True for nf, time in enumerate(tdat): if not args.suppress or (first and not time[0].good): print('Frame %d, mid-time = %s, GPS = %s, exposure = %7.4f, status = %s' % \ (nf+1,ultracam.mjd2str(time[0].mjd,True),ultracam.mjd2str(time[1]['gps'],True),\ time[0].expose, 'T' if time[0].good else 'F'), end=' ') if not time[0].good: print(', reason =', time[0].reason) else: print() first = False
sout, serr = subprocess.Popen(comm, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() output = sout.split('\n') nline = 0 for line in output: if not line.startswith('#') and nline < len(mjd) and not line.startswith('U'): nf,gp,mj,ok,expos,date = line.split('|') gp, mj, expos = float(gp), float(mj), float(expos) dgp = 1000*ultracam.DSEC*(gps[nline]-gp) dmj = 1000*ultracam.DSEC*(mjd[nline]-mj) dex = 1000*(expose[nline]-expos) if abs(expos) < 10000. and (abs(dgp) > args.diff or abs(dmj) > args.diff or abs(dex) > args.diff): # raise Exception('%-4d GPS=%12.6f %8.2f, MJD=%12.6f %8.2f, Exp=%6.3f %8.2f, GPS,MJD=%s, %s' % \ # (nline,gp,dgp,mj,dmj,expos,dex,dstr(gp),dstr(mj))) print 'format,which,mode,instrument,defTstamp,vclock_frame =',\ frmt,whichRun,rtime.mode,rtime.instrument,defTstamp,vclock_frame,res[nline] print '%-4d GPS=%12.6f %8.2f, MJD=%12.6f %8.2f, Exp=%6.3f %8.2f, GPS,MJD=%s, %s' % \ (nline+1,gps[nline],dgp,mjd[nline],dmj,expose[nline],dex, ultracam.mjd2str(gp,True),ultracam.mjd2str(mj,True)) exit(1) nline += 1 if args.max and nline == args.max: break except ultracam.PowerOnOffError, err: print '....... power on/off; ignoring' except Exception, err: print 'Encountered problem on',run traceback.print_exc(file=sys.stdout)
sout, serr = subprocess.Popen(comm, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() output = sout.split('\n') nline = 0 for line in output: if not line.startswith('#') and nline < len(mjd) and not line.startswith('U'): nf,gp,mj,ok,expos,date = line.split('|') gp, mj, expos = float(gp), float(mj), float(expos) dgp = 1000*ultracam.DSEC*(gps[nline]-gp) dmj = 1000*ultracam.DSEC*(mjd[nline]-mj) dex = 1000*(expose[nline]-expos) if abs(expos) < 10000. and (abs(dgp) > args.diff or abs(dmj) > args.diff or abs(dex) > args.diff): # raise Exception('%-4d GPS=%12.6f %8.2f, MJD=%12.6f %8.2f, Exp=%6.3f %8.2f, GPS,MJD=%s, %s' % \ # (nline,gp,dgp,mj,dmj,expos,dex,dstr(gp),dstr(mj))) print('format,which,mode,instrument,defTstamp,vclock_frame =',\ frmt,whichRun,rtime.mode,rtime.instrument,defTstamp,vclock_frame,res[nline]) print('%-4d GPS=%12.6f %8.2f, MJD=%12.6f %8.2f, Exp=%6.3f %8.2f, GPS,MJD=%s, %s' % \ (nline+1,gps[nline],dgp,mjd[nline],dmj,expose[nline],dex, ultracam.mjd2str(gp,True),ultracam.mjd2str(mj,True))) exit(1) nline += 1 if args.max and nline == args.max: break except ultracam.PowerOnOffError as err: print('....... power on/off; ignoring') except Exception as err: print('Encountered problem on',run) traceback.print_exc(file=sys.stdout)
else: plot = False if plot: # trim CCDs for ccd in mccd: for nw, win in enumerate(ccd): if nw % 2 == 0: win.trim(ncol,0,nrow,0) else: win.trim(0,ncol,nrow,0) # determine plot ranges prange = mccd.plot(plo,phi,close=False) print fname,', frame ' + str(nf) + ' / ' + str(nframe) + \ ', time = ' + ultracam.mjd2str(mccd[0].time.mjd) + ', exp = ' + \ str(mccd[0].time.expose) + ', ranges:',prange else: print 'Final frame not displayed.' else: if nf + mccd.head.value('Run.ntmin') >= nnext: rdat.time(nf) # close plot pgclos() # blank line print # print out contextual info with the target name, filters from logs
parser = argparse.ArgumentParser(description=usage) # positional parser.add_argument('run', help='run to list times of') # optional parser.add_argument('-s', dest='suppress', action='store_true', help='suppress all but bad output') # OK, done with arguments. args = parser.parse_args() run = args.run if not os.path.isfile(run + '.xml') or not os.path.isfile(run + '.dat'): print('One or both of',run+'.xml','and',run+'.dat','does not exist.') exit(1) tdat = ultracam.Rtime(run) first = True for nf, time in enumerate(tdat): if not args.suppress or (first and not time[0].good): print('Frame %d, mid-time = %s, GPS = %s, exposure = %7.4f, status = %s' % \ (nf+1,ultracam.mjd2str(time[0].mjd,True),ultracam.mjd2str(time[1]['gps'],True),\ time[0].expose, 'T' if time[0].good else 'F'), end=' ') if not time[0].good: print(', reason =',time[0].reason) else: print() first = False
else: plot = False if plot: # trim CCDs for ccd in mccd: for nw, win in enumerate(ccd): if nw % 2 == 0: win.trim(ncol, 0, nrow, 0) else: win.trim(0, ncol, nrow, 0) # determine plot ranges prange = mccd.plot(plo, phi, close=False) print(fname,', frame ' + str(nf) + ' / ' + str(nframe) + \ ', time = ' + ultracam.mjd2str(mccd[0].time.mjd) + ', exp = ' + \ str(mccd[0].time.expose) + ', ranges:',prange) else: print('Final frame not displayed.') else: if nf + mccd.head.value('Run.ntmin') >= nnext: rdat.time(nf) # close plot pgclos() # blank line print() # print out contextual info with the target name, filters from logs