Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: fix handling of nan input for Time properties #463

Merged
merged 3 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

- Fixed TapResults to inherit session. [#447]

- Fix handling of nan values for Time properties in SIA2 records. [#463]


1.4.1 (2023-03-07)
==================

Expand Down
27 changes: 19 additions & 8 deletions pyvo/dal/sia2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

import warnings
import numpy as np

from astropy import units as u
from astropy.time import Time
Expand Down Expand Up @@ -880,20 +881,30 @@ def t_ref_pos(self):
@property
def t_min(self):
"""
The start time of the observation specified in MJD. In case of data
products result of the combination of multiple frames, min time must
be the minimum of the start times
The start time of the observation specified in MJD as an
`~astropy.time.Time` instance. In case of data products result of the
combination of multiple frames, min time must be the minimum of the
start times. ``None`` is used for NaN response values.
"""
return Time(self.get('t_min'), format='mjd')
t_min = self.get('t_min')
if np.isfinite(t_min):
return Time(t_min, format='mjd')
else:
return None

@property
def t_max(self):
"""
The stop time of the observation specified in MJD. In case of data
products result of the combination of multiple frames, t_max must
be the maximum of the stop times
The stop time of the observation specified in MJD as an
`~astropy.time.Time` instance. In case of data products result of the
combination of multiple frames, t_max must be the maximum of the
stop times. ``None`` is used for NaN response values.
"""
return Time(self.get('t_min'), format='mjd')
t_max = self.get('t_max')
if np.isfinite(t_max):
return Time(t_max, format='mjd')
else:
return None

@property
def t_exptime(self):
Expand Down