Skip to content
Snippets Groups Projects
Commit 71b5ec92 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 2f892d97
No related branches found
No related tags found
No related merge requests found
......@@ -32,40 +32,6 @@ def moon_phase(dt_obj_s, phs_deg=50):
return (phase.degrees > phs_deg) & (phase.degrees < 360-phs_deg)
# dt_str_0: start datetime string in format YYYY-MM-DD_HH:MM
# num_steps with increment of days, hours, minutes or seconds
# return num_steps+1 lists of datetime strings and timestamps for the times eries
def make_times(dt_str_0, num_steps, days=None, hours=None, minutes=None, seconds=None):
if days is not None:
inc = 86400*days
elif hours is not None:
inc = 3600*hours
elif minutes is not None:
inc = 60*minutes
else:
inc = seconds
dt_obj_s = []
ts_s = []
dto_0 = datetime.datetime.strptime(dt_str_0, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc)
ts_0 = dto_0.timestamp()
dt_obj_s.append(dto_0)
ts_s.append(ts_0)
dto_last = dto_0
for k in range(num_steps):
dt_obj = dto_last + datetime.timedelta(seconds=inc)
dt_obj_s.append(dt_obj)
ts_s.append(dt_obj.timestamp())
dto_last = dt_obj
return dt_obj_s, ts_s
def make_hist(ts_s, edges):
h = np.histogram(ts_s, bins=edges)
return h
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment