Skip to content

Commit

Permalink
Fixed function to calculate T90
Browse files Browse the repository at this point in the history
  • Loading branch information
mickolaua authored Oct 7, 2023
1 parent 9c17d61 commit 7abf2ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pygrb_lc/light_curves/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def calculate_t_90(times: np.array, intergal_curve: np.array, left_interval, rig
left_interval = left_interval if is_iterable(left_interval) else (times[0],left_interval)
right_interval = right_interval if is_iterable(right_interval) else (right_interval,times[-1])

mask = [(times >= left_interval[0]) & (times <= left_interval[1])]
mask = (times >= left_interval[0]) & (times <= left_interval[1])
level_low = np.polyfit(times[mask],intergal_curve[mask],0)[0]
d_low = np.sqrt(np.var(intergal_curve[mask] - level_low))

mask = [(times >= right_interval[0]) & (times <= right_interval[1])]
mask = (times >= right_interval[0]) & (times <= right_interval[1])
level_high = np.polyfit(times[mask],intergal_curve[mask],0)[0]
d_high = np.sqrt(np.var(intergal_curve[mask] - level_high))

Expand Down Expand Up @@ -94,4 +94,4 @@ def calculate_t_90(times: np.array, intergal_curve: np.array, left_interval, rig
plt.axvline(t_95_low)
plt.axvline(t_95_high)

return t_90, (-negative_err, positive_err)
return t_90, (-negative_err, positive_err)

0 comments on commit 7abf2ee

Please sign in to comment.