Skip to content

Commit

Permalink
initial version of module for computing times in different units/time…
Browse files Browse the repository at this point in the history
…zones
  • Loading branch information
emmanuelfonseca committed Jul 21, 2023
1 parent 579159a commit b4e5bc2
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions fitburst/routines/times.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""
Routines for Deriving Time-related Data
"""

from datetime import datetime, timedelta
import numpy as np
import pytz

def compute_arrival_times(parameters: dict, time0: float = 0.) -> list:
"""
Computes arrival times on a specified timescale.
Parameters
----------
parameters : dict
A dictionary that contains all burst-parameter data.
time0 : float, optional
A reference time against which the per-parameter arrival times are measured,
assumed to be in units of Unix time (i.e., seconds).
Returns
-------
"""



# extract data.
arrival_times = parameters["arrival_time"]
arrival_times_converted = []
dm = parameters["dm"][0]

# construct datetime object.
for current_timestamp in arrival_times:
dt_arrival = timedelta(seconds=current_timestamp)
dt_arrival += datetime.fromtimestamp(time0, tz=pytz.utc)
arrival_times_converted += [dt_arrival.strftime("%Y-%m-%d %H:%M:%S.%f")]

return arrival_times_converted

0 comments on commit b4e5bc2

Please sign in to comment.