target = Target.from_name( target_json['name'], observatory, target_json['type'], target_json.get('ra_offset'), target_json.get('dec_offset')) logger.debug(target.toString().replace('\n', '; ')) # build image stacks stacks = [] for stack_json in stacks_json: stack = Stack(float(stack_json['exposure']), stack_json['filters'], int( stack_json['binning']), int(stack_json['count']), stack_json['do_pinpoint'] if 'do_pinpoint' in stack_json else True) logger.debug(stack.toString().replace('\n', '; ')) stacks.append(stack) # build sequence sequence = Sequence(stacks, int( sequence_json['repeat']), sequence_json['do_pinpoint'] if 'do_pinpoint' in sequence_json else True) logger.debug(sequence.toString().replace('\n', '; ')) # build main observations asteroid_main_observation = Observation( observatory, target, sequence, min_obs_alt, user) # get min, max, and max alt obs times asteroid_main_observation.getTimes() logger.debug(asteroid_main_observation.toString().replace('\n', '; ')) # build calibration asteroid/star observations sequence_json = observation_json['sequences']['calibration'] stacks_json = sequence_json['stacks'] # build image stacks stacks = [] for stack_json in stacks_json: stack = Stack(float(stack_json['exposure']), stack_json['filters'], int( stack_json['binning']), int(stack_json['count']), stack_json['do_pinpoint'] if 'do_pinpoint' in stack_json else True) logger.debug(stack.toString().replace('\n', '; ')) stacks.append(stack) # build sequence
elif len(objects) > 1: print 'Error. Found multiple matching objects for %s.' % name else: num_targets += 1 target = Target(objects[0]['name'], objects[0]['RA'], objects[0]['DEC']) stacks = [] for i in range(0, count): for filter in filters: filter = filter.strip() # skip the darks for now if filter.lower() != 'dark': stacks.append( Stack(float(exposure), filter, int(binning), 1)) observations.append( Observation(observatory, target, Sequence(stacks, 1), min_obs_alt, user)) print 'Successfully identified %d of %d targets.' % (num_targets, len(inputs)) telescope.slackdebug('Starting observerizer...') # add observations scheduler.addObservations(observations) # loop through the observations next_observation = scheduler.whatsNext() # for obs in observations: # print obs.toString() if next_observation:
##define the target #target = Target('5358', '07 38 46.48', '+36 07 12.2') ##build image stack #stack = Stack(120, 'clear', 2, 1) ##build image (stack) sequence #sequence = Sequence([stack], Sequence.CONTINUOUS) ##minimum altitude to observe this target #min_obs_alt = 30.0 ##add this observations to the list #observations.append(Observation(observatory, target, sequence, min_obs_alt, user)) min_obs_alt = 30.0 target = Target('maxgoldberg.M104', '12 39 59.299', '-11 37 21.000') stack = Stack(240, 'clear', 2, 1) sequence = Sequence([stack], 1) observations.append(Observation(observatory, target, sequence, min_obs_alt, user)) target = Target('maxgoldberg.M104', '12 39 59.299', '-11 37 21.000') stack = Stack(300, 'clear', 2, 1) sequence = Sequence([stack], 1) observations.append(Observation(observatory, target, sequence, min_obs_alt, user)) target = Target('shelstrom.M104', '12 39 59.299', '-11 37 21.000') sequence = Sequence([Stack(60, 'clear', 2, 2), Stack(40, 'r-band', 2, 2), Stack(60, 'g-band', 2, 2)], 1) observations.append(Observation(observatory, target, sequence, min_obs_alt, user)) target = Target('rich.oddjob.Jupiter', '17 29 06', '-22 37 07') stack = Stack(0.1, 'z-band', 2, 1) sequence = Sequence([stack], 1) observations.append(Observation(observatory, target, sequence, min_obs_alt, user))
# build target target = Target.from_name(target_json['name'], observatory, target_json['type']) logger.debug(target.toString().replace('\n', '; ')) # build image stacks stacks = [] for stack_json in stacks_json: stack = Stack(float(stack_json['exposure']), stack_json['filters'], int(stack_json['binning']), int(stack_json['count'])) logger.debug(stack.toString().replace('\n', '; ')) stacks.append(stack) # build sequence sequence = Sequence(stacks, int(sequence_json['repeat'])) logger.debug(sequence.toString().replace('\n', '; ')) # build main observation star_main_observation = Observation(observatory, target, sequence, min_obs_alt, user) # get min, max, and max alt obs times star_main_observation.getTimes() logger.debug(star_main_observation.toString().replace('\n', '; ')) # start observations telescope.slackdebug('Starting aavso...') # wait for sun to set telescope.checkSun(True) # wait for target to be available while Time.now() < star_main_observation.min_obs_time: time_left_s = (star_main_observation.min_obs_time - Time.now()).sec telescope.slackdebug( 'The observation (%s) will start in %d min (at %s)...' %
with open(ref_stars_fname) as f: ref_stars = f.readlines() ref_stars = [x.strip() for x in ref_stars if not x.startswith('#')] # create a list of observations from the reference stars stack = Stack(exposure, filter, binning, 1) stacks = [stack] sequence = Sequence(stacks, 1) for ref_star in ref_stars: ref_star_data = ref_star.split() name = ref_star_data[0] ra = ref_star_data[1] dec = ref_star_data[2] target = Target(name, ra, dec) observations.append( Observation(observatory, target, sequence, min_obs_alt, user)) telescope.slackdebug('Starting hocusfocus...') # wait for sun to set telescope.checkSun(True) # find the best target (currently highest in the sky) # this is overly complicated, but I know it works ;) # start up the scheduler scheduler = Scheduler(observatory, observations) telescope.slackdebug('Identifying calibration star...') target_observation = scheduler.whatsHighest() if target_observation: logger.debug(target_observation.toString())