def test_oppositions_conjunctions(): ts = api.load.timescale() t0 = ts.utc(2019, 1, 1) t1 = ts.utc(2021, 1, 1) e = api.load('de421.bsp') f = almanac.oppositions_conjunctions(e, e['mars']) t, y = almanac.find_discrete(t0, t1, f) strings = t.utc_strftime('%Y-%m-%d %H:%M') assert strings == ['2019-09-02 10:42', '2020-10-13 23:26'] assert (y == (0, 1)).all()
def test_oppositions_conjunctions_of_moon(): ts = api.load.timescale() t0 = ts.utc(2019, 1, 1) t1 = ts.utc(2019, 2, 1) e = api.load('de421.bsp') f = almanac.oppositions_conjunctions(e, e['moon']) t, y = almanac.find_discrete(t0, t1, f) strings = t.utc_strftime('%Y-%m-%d %H:%M') assert strings == ['2019-01-06 01:28', '2019-01-21 05:16'] assert (y == (1, 0)).all()
def conjunction(self): result = [] t0 = ts.utc(self.t0) t1 = ts.utc(self.t1) f = almanac.oppositions_conjunctions(e, e['moon']) t, y = almanac.find_discrete(t0, t1, f) for ti, yi in zip(t, y): if(yi == 1): result.append(ti) else: pass return result
sun_alt = [] sun_az = [] jkt = timezone('Asia/Jakarta') ts = load.timescale() e = load('de421.bsp') moon = e['moon'] earth = e['earth'] obsUAD = Topos('7.83305556 S', '110.38305556 E') loc = earth + obsUAD t0 = ts.utc(2020) t1 = ts.utc(2021) f = almanac.oppositions_conjunctions(e, e['moon']) t, y = almanac.find_discrete(t0, t1, f) # print(t0.astimezone(jkt), t1.astimezone(jkt)) for ti, yi in zip(t, y): if (yi == 1): # t0 = ts.utc(ti.utc[0], ti.utc[1], ti.utc[2]) # t1 = ts.utc(ti.utc[0], ti.utc[1], ti.utc[2]+1) # t_rs, y_rs = almanac.find_discrete(t0, t1, almanac.sunrise_sunset(e, obsUAD)) # print(t0.astimezone(jkt), t1.astimezone(jkt)) # for t_sun, y_sun in zip(t_rs, y_rs): # global sunset # if (y_sun == False):