def in_FOR(self,date,ngc_1,ngc_2): #ngc_1 & ngc_2 are ra & dec in radians (sun_1,sun_2) = self.sun_pos(date) d = astro_func.dist(ngc_1,ngc_2,sun_1,sun_2) #sun pitch is always equal or greater than sun angle (V1 to sun) if (d<MIN_SUN_ANGLE or d>MAX_SUN_ANGLE): return False return True
def bisect_by_FOR(self,in_date,out_date,ngc_1,ngc_2):#in and out of FOR, assumes only one "root" in interval delta_days = 200. mid_date = (in_date+out_date)/2. while delta_days > 0.000001: (sun_1,sun_2) = self.sun_pos(mid_date) d = astro_func.dist(ngc_1,ngc_2,sun_1,sun_2) if (d>MAX_SUN_ANGLE or d<MIN_SUN_ANGLE): out_date = mid_date else: in_date = mid_date mid_date = (in_date+out_date)/2. delta_days = abs(in_date-out_date)/2. #print "UU", mid_date if in_date>out_date:# ensure returned date always in FOR mid_date = mid_date + 0.000001 else: mid_date = mid_date - 0.000001 return mid_date
def is_valid(self, date, ngc_1, ngc_2, V3pa): """Indicates whether an attitude is valid at a given date.""" #First check that the date is within the time interval of the ephemeris. if ((date < self.amin) or (date > self.amax)): return False (sun_1, sun_2) = self.sun_pos(date) d = astro_func.dist(ngc_1, ngc_2, sun_1, sun_2) vehicle_pitch = pi / 2 - d #see JI memo from May 2006 #sun pitch is always equal or greater than sun angle (V1 to sun) if (d < MIN_SUN_ANGLE or d > MAX_SUN_ANGLE): return False # now checking the roll and pitch angle combination pa = astro_func.pa(ngc_1, ngc_2, sun_1, sun_2) + pi roll = acos(cos(V3pa - pa)) sun_roll = asin(sin(roll) * cos(vehicle_pitch)) if (abs(sun_roll) <= 5.2 * D2R): sun_pitch = atan2(tan(vehicle_pitch), cos(roll)) if (sun_pitch <= 5.2 * D2R and sun_pitch >= -45. * D2R): return True return False