def cancel_obs(name): '''Cancels the observations associated with the transient 'name'. ''' # set the settings settings = { 'username': username, # RTML_username 'rtmlpass': rtmlpass, # RTML_password 'proposal': proposal, # RTML_proposal name 'prefix': 'NA', # Prefix to Group UID 'LT_HOST': LT_HOST, # IP used to connect to the LT 'LT_PORT': LT_PORT, # Port used to connect to the LT 'DEBUG': False, # Store all RTML responses for debugging, [True, False] 'PKLFILE': 'LT_obs', # Name of pickle file for storing observations } # Create observation object obs = ltrtml.LTObs(settings) uid_list = obs.get_uids() # Cancel an observation for uid in uid_list: if name in uid: error = obs.cancel_group(uid) if error: print(error) else: print( f'Successfully deleted observation {uid}, adding # to obj_list.txt ' ) # update obj_list obs_list = np.loadtxt('./obj_list.txt', dtype='str') index_to_delete = [] for idx, row in enumerate(obs_list): if name in row[0]: index_to_delete = idx obs_list = np.delete(obs_list, index_to_delete, axis=0) np.savetxt('./obj_list.txt', obs_list, delimiter='\t', fmt="%s")
def get_obs(pickle='LT_obs'): ''' Gets all the uids in the LT_obs pickle file. Returns list of uids. ''' settings = { 'username': username, # RTML_username 'rtmlpass': rtmlpass, # RTML_password 'proposal': proposal, # RTML_proposal name 'prefix': 'NA', # Prefix to Group UID 'LT_HOST': LT_HOST, # IP used to connect to the LT 'LT_PORT': LT_PORT, # Port used to connect to the LT 'DEBUG': False, # Store all RTML responses for debugging, [True, False] 'PKLFILE': pickle, # Name of pickle file for storing observations } obs = ltrtml.LTObs(settings) uid = obs.get_uids() return uid
} # FRODOspec example observation with target1 observationFrodo = { 'target': target1, 'instrument': 'Frodo', 'exp_time_Blue': '120.0', # Image exposure time for blue arm 'exp_count_Blue': '3', # Number of exposures for blue arm 'res_Blue': 'high', # Blue Spectral Resolution, ['high', 'low'] 'exp_time_Red': '120.0', # Image exposure time for red arm 'exp_count_Red': '3', # Number of exposures for red arm 'res_Red': 'high', # Red Spectral Resolution, ['high', 'low'] } # Create observation object obs = ltrtml.LTObs(settings) # Send observations to telescope, getting uid and error back. # Shown is a group with a single IOO observation. uid, error = obs.submit_group([observationIOO], constraints) if error: print(error) else: print(uid, ' sucessfully sent to telescope') # List current uids which have been submitted to the telescope print(obs.get_uids()) # Cancel all observations in the proposal that have been sent via ltrtml for uid in obs.get_uids(): obs.cancel_group(uid)
def set_sprat_obs(name, ra, dec, texp, start_date, end_date, exp_count=1): ''' Sets the LT observations using SPRAT for the target 'name'. ''' # get the TNs details including ra/dec ra_, dec_, classification = get_transient_details(name) # cancel the obs is the transient is classified if classification != None: if exists(name): print( f'{name} already classified as {classification}, cancelling observations' ) cancel_obs(name) else: print( f'{name} already classified as {classification}, there is no uid by this name.' ) return None # If observations for the group already exists, skip. if exists(name): print(f'An observing group for {name} already exists, skipping') return None # if user defined ra is not '-' if '-' in ra: ra, dec = ra_, dec_ print(name, ra, dec, texp, start_date, end_date) # set the settings settings = { 'username': username, # RTML_username 'rtmlpass': rtmlpass, # RTML_password 'proposal': proposal, # RTML_proposal name 'prefix': name, # Prefix to Group UID 'LT_HOST': LT_HOST, # IP used to connect to the LT 'LT_PORT': LT_PORT, # Port used to connect to the LT 'DEBUG': False, # Store all RTML responses for debugging, [True, False] 'PKLFILE': 'LT_obs', # Name of pickle file for storing observations } # Create observation object obs = ltrtml.LTObs(settings) # set the target target1 = { 'name': name, # Target name 'RA': ra, # Target ra 'HH:MM:SS.SS' 'DEC': dec, # Target dec '+/-DD:MM:SS.SS' } # set the constraints constraints = { 'air_mass': '3', # Maximum allowable Airmass Range 1 --> 3 'sky_bright': '4.0', # Maximum allowable Sky Brightness, Dark + X magnitudes 'seeing': '2', # Maximum allowable FWHM seeing in arcsec 'photometric': 'no', # Photometric conditions, ['yes', 'no'] 'start_date': start_date, # Start Date 'YYYY-MM-DD' 'start_time': '18:00:00.00', # Start Time 'HH:MM:SS.SS' 'end_date': end_date, # End Date 'YYYY-MM-DD' 'end_time': '10:00:00.00', # End Time 'HH:MM:SS.SS' } # set SPRAT observationSprat = { 'target': target1, 'instrument': 'Sprat', 'exp_time': str(texp), # Image exposure time for target 'exp_count': str(exp_count), # Number of target images needed 'grating': 'red', # Grating colour ['blue','red'] } # submit the observations and return the uid uid, error = obs.submit_group([observationSprat], constraints) if error: print(error) else: print(f'{name} with {uid} sucessfully sent to telescope')