def in_rise_set_format(self): if hasattr(self, 'proper_motion_ra') and hasattr(self, 'proper_motion_dec'): # if we have proper_motion, then convert the units of proper motion to arcsec/year prop_mot_ra, prop_mot_dec = convert_proper_motion(self.proper_motion_ra, self.proper_motion_dec, self.dec.in_degrees()) # then set the target_dict with the target with proper motion target_dict = make_ra_dec_target(self.ra, self.dec, ra_proper_motion=ProperMotion( Angle(degrees=(prop_mot_ra / 3600.0), units='arc'), time='year'), dec_proper_motion=ProperMotion( Angle(degrees=(prop_mot_dec / 3600.0), units='arc'), time='year')) else: target_dict = make_ra_dec_target(self.ra, self.dec) return target_dict
def setup(self): self.target_1 = make_ra_dec_target(ra=Angle(degrees=148.925583), dec=Angle(degrees=69.673889)) self.target_2 = make_ra_dec_target(ra=Angle(degrees=68.9791666667), dec=Angle(degrees=16.5)) self.target_3 = make_ra_dec_target( ra=Angle(degrees=5.392944), dec=Angle(degrees=-69.756111), ra_proper_motion=ProperMotion(Angle(degrees=0.005519960155599643 / 3600.0, units='arc'), time='year'), dec_proper_motion=ProperMotion(Angle(degrees=0.000229 / 3600.0, units='arc'), time='year')) self.ogg_latitude = Angle(degrees=20.7069444444) self.ogg_longitude = Angle(degrees=-156.258055556) self.ogg_height = 3065.0 # meters self.cpt_latitude = Angle(degrees=-32.3805542) self.cpt_longitude = Angle(degrees=20.8101815) self.cpt_height = 1804.0 # meters
def get_rise_set_target(target_dict): if target_dict['type'] == 'SIDEREAL': pmra = (target_dict['proper_motion_ra'] / 1000.0 / cos(radians(target_dict['dec']))) / 3600.0 pmdec = (target_dict['proper_motion_dec'] / 1000.0) / 3600.0 return make_ra_dec_target(ra=Angle(degrees=target_dict['ra']), dec=Angle(degrees=target_dict['dec']), ra_proper_motion=ProperMotion(Angle(degrees=pmra, units='arc'), time='year'), dec_proper_motion=ProperMotion(Angle(degrees=pmdec, units='arc'), time='year'), parallax=target_dict['parallax'], rad_vel=0.0, epoch=target_dict['epoch']) elif target_dict['type'] == 'SATELLITE': return make_satellite_target(alt=target_dict['altitude'], az=target_dict['azimuth'], diff_alt_rate=target_dict['diff_pitch_rate'], diff_az_rate=target_dict['diff_roll_rate'], diff_alt_accel=target_dict['diff_pitch_acceleration'], diff_az_accel=target_dict['diff_roll_acceleration'], diff_epoch_rate=target_dict['diff_epoch_rate']) elif target_dict['type'] == 'NON_SIDEREAL': if target_dict['scheme'] == 'MPC_MINOR_PLANET': return make_minor_planet_target(target_type=target_dict['scheme'], epoch=target_dict['epochofel'], inclination=target_dict['orbinc'], long_node=target_dict['longascnode'], arg_perihelion=target_dict['argofperih'], semi_axis=target_dict['meandist'], eccentricity=target_dict['eccentricity'], mean_anomaly=target_dict['meananom'] ) else: return make_comet_target(target_type=target_dict['scheme'], epoch=target_dict['epochofel'], epochofperih=target_dict['epochofperih'], inclination=target_dict['orbinc'], long_node=target_dict['longascnode'], arg_perihelion=target_dict['argofperih'], perihdist=target_dict['perihdist'], eccentricity=target_dict['eccentricity'], )
HOURS_PER_DEGREES = 15.0 # Maui telescope location details site = { 'latitude': Angle(degrees=20.7069444444), 'longitude': Angle(degrees=-156.258055556), 'horizon': Angle(degrees=25.0), 'ha_limit_neg': Angle(degrees=-4.533333 * HOURS_PER_DEGREES), 'ha_limit_pos': Angle(degrees=4.4666667 * HOURS_PER_DEGREES) } # m23 target details target = make_ra_dec_target( ra=Angle(degrees=269.267), dec=Angle(degrees=-18.985), ra_proper_motion=ProperMotion(Angle(degrees=0.000000328, units='arc')), dec_proper_motion=ProperMotion(Angle(degrees=-0.000000386, units='arc')), parallax=1.354, epoch=2000) # Extra data needed for computing visibility airmass_limit = 1.6 moon_distance_limit = Angle(degrees=30.0) start_date = datetime(2020, 6, 1) end_date = datetime(2020, 6, 3, 23, 22, 0) # Create a visibility object with the site parameters and a date range visibility = Visibility(site, start_date, end_date, site['horizon'].in_degrees(),
def get_rise_set_target(target_dict): # This is a hack to protect against poorly formatted or empty targets that are submitted directly. # TODO: Remove this check when target models are updated to handle when there is no target if ('type' not in target_dict or target_dict['type'].upper() not in TARGET_TYPE_HELPER_MAP or not TARGET_TYPE_HELPER_MAP[target_dict['type'].upper()] (target_dict).is_valid()): return make_hour_angle_target( hour_angle=Angle(degrees=0), dec=Angle(degrees=0), ) if target_dict['type'] in ['ICRS', 'HOUR_ANGLE']: pm = get_proper_motion(target_dict) if target_dict['type'] == 'ICRS': return make_ra_dec_target(ra=Angle(degrees=target_dict['ra']), dec=Angle(degrees=target_dict['dec']), ra_proper_motion=pm['pmra'], dec_proper_motion=pm['pmdec'], parallax=target_dict['parallax'], rad_vel=0.0, epoch=target_dict['epoch']) elif target_dict['type'] == 'HOUR_ANGLE': return make_hour_angle_target( hour_angle=Angle(degrees=target_dict['hour_angle']), dec=Angle(degrees=target_dict['dec']), ra_proper_motion=pm['pmra'], dec_proper_motion=pm['pmdec'], parallax=target_dict['parallax'], epoch=target_dict['epoch']) elif target_dict['type'] == 'SATELLITE': return make_satellite_target( alt=target_dict['altitude'], az=target_dict['azimuth'], diff_alt_rate=target_dict['diff_altitude_rate'], diff_az_rate=target_dict['diff_azimuth_rate'], diff_alt_accel=target_dict['diff_altitude_acceleration'], diff_az_accel=target_dict['diff_azimuth_acceleration'], diff_epoch_rate=target_dict['diff_epoch']) elif target_dict['type'] == 'ORBITAL_ELEMENTS': if target_dict['scheme'] == 'MPC_MINOR_PLANET': return make_minor_planet_target( target_type=target_dict['scheme'], epoch=target_dict['epochofel'], inclination=target_dict['orbinc'], long_node=target_dict['longascnode'], arg_perihelion=target_dict['argofperih'], semi_axis=target_dict['meandist'], eccentricity=target_dict['eccentricity'], mean_anomaly=target_dict['meananom']) elif target_dict['scheme'] == 'MPC_COMET': return make_comet_target( target_type=target_dict['scheme'], epoch=target_dict['epochofel'], epochofperih=target_dict['epochofperih'], inclination=target_dict['orbinc'], long_node=target_dict['longascnode'], arg_perihelion=target_dict['argofperih'], perihdist=target_dict['perihdist'], eccentricity=target_dict['eccentricity'], ) elif target_dict['scheme'] == 'JPL_MAJOR_PLANET': return make_major_planet_target( target_type=target_dict['scheme'], epochofel=target_dict['epochofel'], inclination=target_dict['orbinc'], long_node=target_dict['longascnode'], arg_perihelion=target_dict['argofperih'], semi_axis=target_dict['meandist'], eccentricity=target_dict['eccentricity'], mean_anomaly=target_dict['meananom'], dailymot=target_dict['dailymot']) else: raise TypeError('Invalid scheme ' + target_dict['scheme']) else: raise TypeError('Invalid target type' + target_dict['type'])