def get(self, user_id): log.info("Home.get") if not len(user_id): return self.text("/user_id") user = self.db.get("SELECT * FROM users WHERE id=%s", user_id) if user is None: return self.text("User not found") if not self.get_argument("partial", None): return self.render("page.html", user=user) log.info("--> generating partial") almanac = Almanac.build(self.db, user_id) # should be pulled from a cache if not almanac.current_point.moving: total_weight = sum( [weight for place, weight in almanac.current_point.place.connections.items()] ) # this goes in almanac somewhere weights = [] for place, weight in almanac.current_point.place.connections.items(): weights.append("%s (%f)" % (place.id, (weight / total_weight))) place = almanac.current_point.place if almanac.current_point.place is not None else None return self.render("content.html", place=place, weights=weights, user=user)
def __init__(self, link): super(AlmanacView, self).__init__() self.link = link self.alm = Almanac() self.python_console_cmds = {'alm': self.alm}
def __init__(self, link): super(AlmanacView, self).__init__() self.link = link self.alm = Almanac() #self.timer = BackgroundTimer(self.update_alamanc_view) self.python_console_cmds = {'alm': self.alm}
modTmp = [(t % 9) + 1 for t in tmp] print(modTmp) print(origList) print(nakshatrasEnum) def deg_min_sec(dec, aya=None): if aya is not None: dec = dec - aya deg = int(floor(dec)) minutes = dec % 1.0 * 60 secs = minutes % 1.0 * 60 return f'{deg}-{int(floor(minutes))}-{secs}' a = Almanac() a.compute(datetime.now(timezone.utc)) print(a.tithi) for t in tithi_list: print(f'requesting for {t.__str__()}') a.get_next_thiti(t) a.get_dates_on_day(VARAM.TUE, DateRange(date(2020, 4, 1), date(2020, 4, 30))) # from flatlib.datetime import Datetime # from flatlib.geopos import GeoPos # import flatlib.const as const # from flatlib.chart import Chart # now = Datetime('2009/07/15', '05:30') # pos = GeoPos(13.0827, 80.2707) # chennai now = swe.julday(2019, 8, 26, .5, swe.GREG_CAL)
from almanac import Almanac from params import nakshaktra_ignore_list, avoid_nakshaktras_on_day, avoid_thithi_on_days, avoid_thitis_list from params import avoid_table, marana_yoga_table from params import NAKSHATRAS import numpy as np user_nakshatra = NAKSHATRAS.MAGAM num_days = 90 mins_step = 30 a = Almanac() t0 = a.time_scale.utc(2020, 4, 1) t1 = a.time_scale.utc(2020, 4, 1, 0, 24 * 60 * 366) month_times, months = a._get_month_start_end(t0, t1) # sun_rise, sun_set = a._compute_sun_rise_sun_set(t0, t1) tframe = a.time_scale.utc(2020, 4, 1, 0, range(0, 24 * 60 * num_days, mins_step)) a.time = tframe a.compute_almanac() mask = np.ones(tframe.shape, dtype=np.bool) print(f'started with {mask.sum()}') for t in avoid_thitis_list: mask[(t == a.thithi.name)] = False print(f'after removing thithis {avoid_thitis_list} -- {mask.sum()}') for n in nakshaktra_ignore_list: mask[n == a.nakshaktra.name] = False print(f'after removing nakshaktras {nakshaktra_ignore_list} -- {mask.sum()}') for day, thithis in avoid_thithi_on_days.items(): cur_days = (a.vara == day) for t in thithis: mask[(t == a.thithi.name) & cur_days] = False
# center = -73.959486, 40.685193 # brooklyn # center = -72.723889, 43.173611 # vermont # no points! # center = -71.009755, 41.569593 # new bedford # center = -93.219539, 44.933524 # minneapolis # center = -77.059081, 38.948266 # dc # center = -104.890219, 39.698841 # denver # center = -83.961412, 35.935478 # knoxville # center = -73.490419, 41.908486 # berkshires # center = -74.035318, 41.498944 # hudson valley # center = 127.032687, 37.635063 # seoul # center = -71.221729, 42.306461 # boston # center = -68.700278, 45.658056 # millinocket # center = -118.334105, 34.045948 # LA # almanac = Almanac.build(data, time.mktime(util.parse_date('2011-05-25').timetuple()), time.mktime(util.parse_date('2012-05-27').timetuple()), center) almanac = Almanac.build(data, time.mktime(util.parse_date('2011-08-01').timetuple()), time.mktime(util.parse_date('2012-05-27').timetuple()), center) # almanac = Almanac.build(data, time.mktime(util.parse_date('2012-01-01').timetuple()), time.mktime(util.parse_date('2012-05-27').timetuple()), center) print print "POINTS" print np.array(almanac.points) print print "PATHS" for path in almanac.paths: print path print print "PLACES" for place in almanac.places: print place