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

Fix issue in vectorized get_dark_cal_id #274

Merged
merged 2 commits into from
Jul 8, 2022
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
6 changes: 5 additions & 1 deletion mica/archive/aca_dark/dark_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ def get_dark_cal_id(date, select='before'):

:returns: dark cal id string (YYYYDOY)
"""
return _get_dark_cal_id_vector(date, select=select)
dark_id = _get_dark_cal_id_vector(date, select=select)
if not dark_id.shape:
# returning an instance of the type, not a numpy array
return dark_id.tolist()
return dark_id


def _get_dark_cal_id_scalar(date, select='before'):
Expand Down
6 changes: 6 additions & 0 deletions mica/archive/tests/test_aca_dark_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ def test_get_dark_cal_props_table_mixed():
'n_ccd_img', 'datestart', 'datestop', 'filename']


@pytest.mark.skipif('not HAS_DARK_ARCHIVE', reason='Test requires dark archive')
def test_scalar():
dark_cal_id = dark_cal.get_dark_cal_id('2022:100')
assert dark_cal_id[:4] == '2022' and dark_cal_id[4:] == '069'


@pytest.mark.skipif('not HAS_DARK_ARCHIVE', reason='Test requires dark archive')
def test_vectorized():
dark_id_ref = ['2022100', '2022105', '2022127']
Expand Down