def telescope(command, data, group, cdata): """ Adds telescope information to slots. Interactive usage:: telescope slots telescope observatory longitude latitude height Arguments:: slots : string slot, slot range or group which will be processed. telescope : string telescope name. Enter ?? for by-number interactive selection from pre-stored data observatory : string observatory name longitude : float geodetic longitude, degrees. latitude : float geodetic latitude, degrees height : float height above sea level, metres """ # generate arguments inpt = inp.Input(DINT_ENV, DINT_DEF, inp.clist(command)) # register parameters inpt.register('slots', inp.Input.LOCAL, inp.Input.PROMPT) inpt.register('telescope', inp.Input.LOCAL, inp.Input.PROMPT) inpt.register('observatory', inp.Input.LOCAL, inp.Input.PROMPT) inpt.register('longitude', inp.Input.LOCAL, inp.Input.PROMPT) inpt.register('latitude', inp.Input.LOCAL, inp.Input.PROMPT) inpt.register('height', inp.Input.LOCAL, inp.Input.PROMPT) # get inputs slots = inpt.get_value('slots', 'slots to mask', '1-1000') slist = interp_slots(slots, True, data, group) telescope = inpt.get_value('telescope', 'name of telescope, ?? for a list', '??') if telescope == '??': try: telescope,observatory,longitude,latitude,height = subs.observatory() except subs.SubsError, err: raise DintError('no observatory data set, ' + str(err)) inpt.set_default('telescope', telescope) inpt.set_default('observatory', observatory) inpt.set_default('longitude', longitude) inpt.set_default('latitude', latitude) inpt.set_default('height', height)
type=argparse.FileType('r'), help= 'observational info: "name | start phase | end phase | exp time (secs) | window (mins) | start date | end date" for each star.' ) # optional parser.add_argument('-t', dest='telescope', default='LT', help='Telescope name, e.g. WHT, VLT. Default = LT') # parse them args = parser.parse_args() # Get observatory parameters tel, obs, longit, latit, height = subs.observatory(args.telescope) # Load position and ephemeris data peinfo = {} count = 0 nline = 0 name = None for line in args.stardata: nline += 1 try: if not line.startswith('#') and not line.isspace(): count += 1 if count == 1: name = line.strip() elif count == 2: ra, dec, system = subs.str2radec(line.strip())
# add run name targ.head['ULOG'] = (args.ulog, 'Name of ULTRACAM/ULTRASPEC log file') title = args.name + ', ' + args.ulog # add filter (if specified) if args.filter is not None: targ.head['FILTER'] = (args.filter, 'Filter used') title += ', ' + args.filter # add title for plots targ.head['TITLE'] = (title, 'Title for plots') # add positional data targ.setpos(args.name, args.ra, args.dec) # add observatory data telescope,observatory,longitude,latitude,height = subs.observatory(args.tel) targ.settel(telescope, observatory, longitude, latitude, height) # convert times targ.utc2tdb() # save head = fits.Header() head['comment'] = 'File generated from ULTRACAM log file by ulog2lc.py' fout = args.output if args.output.endswith('.fits') else args.output + '.fits' dnl.io.wfits(fout, targ, head, args.append, args.clobber)
parser.add_argument('-p', dest='prefix', type=argparse.FileType('r'), default=None, help='target name prefixes. These are placed before the left-hand list of target names to allow one to add e.g. priorities.') parser.add_argument('-s', dest='switch', type=argparse.FileType('r'), default=None, help='switch targets data file. Each line should have the format:\nstar name | start switch time (e.g. 12:34) | dead time\nwhere the dead time is the time taken (in minutes) to make the switch. The line will be split on the pipe | characters which must therefore not appear in the star name. Use a star name = None as the final switch to terminate early. The times should increase monotonically, so use times > 24 if necessary.') # parse them args = parser.parse_args() # Interpret date year,month,day = subs.date2dmy(args.date) # Get observatory parameters tel,obs,longit,latit,height = subs.observatory(args.telescope) # Load position and ephemeris data peinfo = {} count = 0 nline = 0 name = None for line in args.stardata: nline += 1 try: if not line.startswith('#') and not line.isspace(): count += 1 if count == 1: arr = line.split('|') name = arr[0].strip() lw = 1 if len(arr) == 1 else int(arr[1])
""" import numpy as np import matplotlib.pyplot as plt import pyfits from scipy.optimize import leastsq, fmin from trm import subs, sla # Names of runs (names assumed to be of form 'run123.fits' -- you provide the numbers) runs = (11, 12, 13, 15, 19) # Star position ra,dec,syst = subs.str2radec('06 30 32.79 +29 40 20.3') # Observatory tel,obs,longit,latit,height = subs.observatory('WHT') # Target aperture to use nap = 2 # Bin width in minutes deltat = 1. # Rejection threshold, RMS thresh = 2.5 def linfit(p, x): return p[0]+p[1]*x def chisq(p, x, y): return ((y-linfit(p,x))**2).sum()