Пример #1
0
    # more imports
    import time, copy, tempfile
    import numpy as np
    from astropy.io import fits
    from trm import ultracam

    # Load bias
    if args.bias:
        # load bias frame, if any
        bias = ultracam.MCCD.rucm(args.bias)

    # Load data
    if ucm:
        mccd = ultracam.MCCD.rucm(run)
    else:
        rdat = ultracam.Rdata(run, nframe, server=args.ucam)
        mccd = rdat()

    # Subtract bias
    if args.bias:
        mccd = mccd - bias

    # Subtract background
    if args.back:
        ccd.rback()

    # Determine indices of CCDs to plot
    if mccd.head.value('Instrument.instrument') == 'ULTRACAM':
        if args.nccd:
            nccds = [
                nccd,
Пример #2
0
            p95ls = []  # LH 95%-iles
            p95rs = []  # RH 95%-iles
            p99ls = []  # LH 99%-iles
            p99rs = []  # RH 99%-iles
            p999ls = []  # LH 99.9%-iles
            p999rs = []  # RH 99.9%-iles
            models = []  # LH modal values
            nmodels = []  # LH numbers of occurrences of modes
            moders = []  # RH modal values
            nmoders = []  # RH numbers of occurrences of modes
            tims = []  # MJD times
            exps = []  # Exposure times
            flags = []  # timing flags

            try:
                rdat = ultracam.Rdata(run, flt=False)
                nframe = rdat.ntotal()
                nskip = nframe // args.max + 1
                numMidnight = 0
                numFrameErrors = 0

                # we go through every frame, but if nskip > 1, we only read the data
                # 1 in every nskip files. We read all times to ensure that we get good
                # times in drift and other modes that require them.
                for nf in range(1, nframe):
                    if (nf - 1) % nskip == 0:
                        mccd = rdat(nf)
                    else:
                        rdat.time(nf)
                        continue
Пример #3
0
# more imports
import os
import numpy as np
try:
    import astropy.io.fits as fits
except:
    import pyfits as fits
from trm import ultracam

if args.bias:
    bias = ultracam.MCCD.rucm(args.bias)

# Now do something
fnum = args.first
first = True
rdat = ultracam.Rdata(run, args.first, server=args.ucam)

nccd = args.nccd
if nccd < 0:
    print('ERROR: nccd must be >= 0')
    exit(1)
elif nccd > rdat.nccd:
    print('ERROR: the data contains only', rdat.nccd, 'CCDs.')
    exit(1)
nccd -= 1

if nccd == -1:
    ccds = list(range(rdat.nccd))
else:
    ccds = [nccd]
Пример #4
0
            # Check whether the number of frames has changed
            nframe = ultracam.get_nframe_from_server(currentRun)
            newframe = newrun or nframe != lastNframe
            lastNframe = nframe

            # Update last time anything was new
            lastNew = tstamp if newframe else lastNew

            # Issue alert if nothing seems to be happening
            if tstamp - lastNew >= 60 * args.tmax:
                print(uttime + ': >>>>>>> WARNING: Nothing has changed for ' + \
                    str(int((tstamp-lastNew)/ 60.)) + ' minutes! <<<<<<<<')

            # update the Rdata object if the run has changed
            if newrun:
                rdat = ultracam.Rdata(currentRun, flt=False, server=True)

            # Read the last frame if it has changed and there is one
            if newframe and nframe:
                mccd = rdat(nframe)

                # check it
                r, g, b = mccd.checkData()
                if r[0] or g[0] or b[0]:
                    print(uttime, '>>>>>>> WARNING:', end=' ')
                    if r[0]: print(' red: ' + r[1] + '.', end=' ')
                    if g[0]: print(' green: ' + g[1] + '.', end=' ')
                    if b[0]: print(' blue: ' + b[1] + '.', end=' ')
                    print(' <<<<<<<<')
                else:
                    print(uttime + ': all nominal. Currently on', currentRun,
Пример #5
0
        run = runs[nr]
        runNumber = int(run[3:])
        if (args.run is not None
                and run != args.run) or runNumber < args.first:
            nr += 1
            continue

        # generate file name
        fname = os.path.join(night, run)

        if oneLiners[nr]['ok']:
            # the usual case
            reply = input('<cr> to display ' + fname + ', q(uit): ')
            if reply == 'q': break

            rdat = ultracam.Rdata(fname, server=args.server)
            nframe = rdat.ntotal()
            nskip = nframe // args.max + 1

            # default bias levels
            if args.back:
                def_bias = None
                print('Will not apply default bias levels.')
            else:
                def_bias = ultracam.blevs(mjd_bias, rdat.gainSpeed)
                if def_bias is None:
                    print('Failed to determine the default bias levels for night =',\
                        night,'readout speed =',rdat.gainSpeed)
                    print('Please report to trm')
                    reply = input(
                        '<cr> to continue without bias correction, q(uit)')
Пример #6
0
# Check arguments
run = args.run
if not os.path.exists(run + '.xml'):
    print('ERROR: could not find', run + '.xml')
    exit(1)
if not os.path.exists(run + '.dat'):
    print('ERROR: could not find', run + '.dat')
    exit(1)

first = args.first
if first < 0:
    print('ERROR: first frame must be >= 0')
    exit(1)

# more imports
from trm import ultracam

fnum = args.first
rdat = ultracam.Rdata(run, args.first, False)

for mccd in rdat:
    red, green, blue = mccd.checkData()
    mess = ''
    if red[0]: mess += ' r: ' + red[1] + '.'
    if green[0]: mess += ' g: ' + green[1] + '.'
    if blue[0]: mess += ' b: ' + blue[1] + '.'
    if red[0] or green[0] or blue[0]:
        print('Frame', fnum, 'has possible problems.' + mess)
    fnum += 1