Skip to content

Commit

Permalink
Fix bug when adding HK products which use full SCET time. (#360)
Browse files Browse the repository at this point in the history
* Fix bug when adding HK products which use full SCET time.

* When adding two producst one of the time arrays comes from TM so has full SCET timestamp, the otehr comes from the fits file which has been converted to a relative time and rounded. Thus when compared they appear different and the merge keeps both. This commit rounds the time from TM in simlar manner to when written to fits.

* Fix order of operations
  • Loading branch information
samaloney authored Nov 14, 2023
1 parent f16a02d commit 8a87576
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions stixcore/products/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,9 @@ def __add__(self, other):

logger.debug('len stacked %d', len(data))

# Not sure where the rounding issue is arising need to investigate
data['time_float'] = np.around(data['time'].as_float().value, 2)
# Fits write we do np.around(time - start_time).as_float().to(u.cs)).astype("uint32"))
# So need to do something similar here to avoid comparing un-rounded value to rounded values
data['time_float'] = np.around((data['time'] - data['time'].min()).as_float().to('cs'))

# remove dublicate data based on time bin and sort the data
data = unique(data, keys=['time_float'])
Expand Down

0 comments on commit 8a87576

Please sign in to comment.