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 get_proper_motion(target_dict): # The proper motion fields are sometimes not present in HOUR_ANGLE targets pm = {'pmra': None, 'pmdec': None} if 'proper_motion_ra' in target_dict and target_dict[ 'proper_motion_ra'] is not None: pm['pmra'] = ProperMotion(Angle( degrees=(target_dict['proper_motion_ra'] / 1000.0 / cos(radians(target_dict['dec']))) / 3600.0, units='arc'), time='year') if 'proper_motion_dec' in target_dict and target_dict[ 'proper_motion_dec'] is not None: pm['pmdec'] = ProperMotion(Angle( degrees=(target_dict['proper_motion_dec'] / 1000.0) / 3600.0, units='arc'), time='year') return pm
def make_ra_dec_target(ra, dec, ra_proper_motion=None, dec_proper_motion=None, parallax=None, rad_vel=None, epoch=None): """ Creates a rise-set target with an ra and dec Creates a dictionary rise-set formatted target that must at least have an ra/dec, but can optionally have ra/dec proper motion, radial velocity, parallax, and epoch. Args: ra (Angle): A rise-set Angle for the target ra dec (Angle): A rise-set Angle for the target dec ra_proper_motion (ProperMotion): ra proper motion for the target dec_proper_motion (ProperMotion): dec proper motion for the target parallax (float): target parallax value rad_vel (float): target radial velocity value epoch (float): target coordinates epoch (2000 default) Returns: dict: A dictionary of target details to use as input to other rise-set functions """ target = { 'ra': ra, 'dec': dec, 'ra_proper_motion': ra_proper_motion or ProperMotion(RightAscension(0), time='year'), 'dec_proper_motion': dec_proper_motion or ProperMotion(Declination(0), time='year'), 'parallax': parallax or 0.0, 'rad_vel': rad_vel or 0.0, 'epoch': epoch or 2000, } return target
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'], )
def test_in_radians_per_year_ra_deg_arc(self): ra = RightAscension(degrees=90) proper_motion = ProperMotion(ra) assert_equal(proper_motion.in_radians_per_year(), pi / 2)
def test_in_radians_per_year_dec_deg_arc(self): dec = Declination(degrees=90) proper_motion = ProperMotion(dec) assert_equal(proper_motion.in_radians_per_year(), pi / 2)
def test_in_degrees_per_century_from_year_dec_radians(self): dec = Declination(radians=pi / 4) proper_motion = ProperMotion(dec) assert_equal(proper_motion.in_degrees_per_century(), 45 * 100)
def test_in_degrees_per_century_ra_radians(self): ra = RightAscension(radians=pi / 2) proper_motion = ProperMotion(ra, time='century') assert_equal(proper_motion.in_degrees_per_century(), 90)
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 test_in_degrees_per_century_from_year_ra_deg_arc(self): ra = RightAscension(degrees=90) proper_motion = ProperMotion(ra) assert_equal(proper_motion.in_degrees_per_century(), 90 * 100)
def test_in_degrees_per_century_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra, time='century') assert_equal(proper_motion.in_degrees_per_century(), 180)
def test_in_radians_per_century_dec_time(self): dec = Declination(degrees=6, units='time') proper_motion = ProperMotion(dec, time='century') assert_equal(proper_motion.in_radians_per_century(), pi / 2)
def test_in_degrees_per_year_from_century_dec_time(self): dec = Declination(degrees=6, units='time') proper_motion = ProperMotion(dec, time='century') assert_equal(proper_motion.in_degrees_per_year(), 90 / 100)
def test_in_degrees_per_century_from_year_dec_deg_arc(self): dec = Declination(degrees=90) proper_motion = ProperMotion(dec) assert_equal(proper_motion.in_degrees_per_century(), 90 * 100)
def test_in_radians_per_year_dec_time(self): dec = Declination(degrees=6, units='time') proper_motion = ProperMotion(dec) assert_equal(proper_motion.in_radians_per_year(), pi / 2)
def test_in_radians_per_year_from_century_dec_deg_arc(self): dec = Declination(degrees=90) proper_motion = ProperMotion(dec, time='century') assert_equal(proper_motion.in_radians_per_year(), pi / 2 / 100)
def test_in_degrees_per_century_dec_deg_arc(self): dec = Declination(degrees=90) proper_motion = ProperMotion(dec, time='century') assert_equal(proper_motion.in_degrees_per_century(), 90)
def test_configuration(self): ra = RightAscension(degrees=90) proper_motion = ProperMotion(ra, time='millennia')
def test_in_radians_per_century_ra_deg_arc(self): ra = RightAscension(degrees=90) proper_motion = ProperMotion(ra, time='century') assert_equal(proper_motion.in_radians_per_century(), pi / 2)
def test_in_degrees_per_year_ra_deg_milliarcseconds(self): ra = RightAscension(degrees='0 0 0.001') proper_motion = ProperMotion(ra) assert_almost_equal(proper_motion.in_degrees_per_year(), 2.77778e-07, 5)
def test_in_degrees_per_year_from_century_ra_deg_arc(self): ra = RightAscension(degrees=90) proper_motion = ProperMotion(ra, time='century') assert_equal(proper_motion.in_degrees_per_year(), 90 / 100)
def test_in_degrees_per_century_from_year_dec_time(self): dec = Declination(degrees=6, units='time') proper_motion = ProperMotion(dec) assert_equal(proper_motion.in_degrees_per_century(), 90 * 100)
def test_in_degrees_per_year_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra) assert_equal(proper_motion.in_degrees_per_year(), 180)
def test_in_radians_per_century_from_year_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra) assert_equal(proper_motion.in_radians_per_century(), pi * 100)
def test_in_radians_per_year_from_century_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra, time='century') assert_equal(proper_motion.in_radians_per_year(), pi / 100)
def test_in_radians_per_century_dec_radians(self): dec = Declination(radians=pi / 4) proper_motion = ProperMotion(dec, time='century') assert_equal(proper_motion.in_radians_per_century(), pi / 4)
def test_in_radians_per_year_ra_radians(self): ra = RightAscension(radians=pi / 2) proper_motion = ProperMotion(ra) assert_equal(proper_motion.in_radians_per_year(), pi / 2)
def test_in_degrees_per_year_from_century_dec_radians(self): dec = Declination(radians=pi / 4) proper_motion = ProperMotion(dec, time='century') assert_equal(proper_motion.in_degrees_per_year(), 45 / 100)
def test_in_radians_per_year_dec_radians(self): dec = Declination(radians=pi / 4) proper_motion = ProperMotion(dec) assert_equal(proper_motion.in_radians_per_year(), pi / 4)
def test_in_degrees_per_century_from_year_ra_radians(self): ra = RightAscension(radians=pi / 2) proper_motion = ProperMotion(ra) assert_equal(proper_motion.in_degrees_per_century(), 90 * 100)