Skip to content

Commit

Permalink
Merge pull request #1287 from jlenain/fix_lc
Browse files Browse the repository at this point in the history
Fixed time handling in table filling in LightCurveEstimator
  • Loading branch information
cdeil committed Feb 7, 2018
2 parents 6099422 + fd192bf commit d01c1a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gammapy/time/lightcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ def light_curve(self, time_intervals, spectral_model, energy_range):
@staticmethod
def _make_lc_from_row_data(rows):
table = Table()
table['time_min'] = Time([_['time_min'].value for _ in rows], format='mjd')
table['time_max'] = Time([_['time_max'].value for _ in rows], format='mjd')
table['time_min'] = [_['time_min'].value for _ in rows]
table['time_max'] = [_['time_max'].value for _ in rows]

table['flux'] = [_['flux'].value for _ in rows] * u.Unit('1 / (s cm2)')
table['flux_err'] = [_['flux_err'].value for _ in rows] * u.Unit('1 / (s cm2)')
Expand Down
2 changes: 2 additions & 0 deletions gammapy/time/tests/test_lightcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def test_lightcurve_estimator():
)
table = lc.table

assert isinstance(lc.table['time_min'][0], type(intervals[0][0].value))

assert_quantity_allclose(len(table), 2)

# TODO:
Expand Down

0 comments on commit d01c1a7

Please sign in to comment.