Skip to content

Commit

Permalink
Add additional test for table filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Dec 2, 2023
1 parent 72007b7 commit 33e9066
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions stellarphot/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,15 @@ def test_base_enhanced_table_clean():


def a_table(masked=False):
test_table = Table([(1, 2, 3), (1, -1, -1)], names=('a', 'b'),
masked=masked)
test_table = BaseEnhancedTable(table_description={'a': None, 'b': None}, input_data=test_table)
test_table = Table(
[
(1, 2, 3),
(1, -1, -2)
],
names=('a', 'b'),
masked=masked)
test_table = BaseEnhancedTable(table_description={'a': None, 'b': None},
input_data=test_table)
return test_table


Expand All @@ -149,7 +155,7 @@ def test_bet_clean_criteria_none_removed():


@pytest.mark.parametrize("condition",
['>0', '=1', '!=-1', '>=1'])
['>0', '=1', '!=-1', '>=1', '<-1'])
def test_bet_clean_criteria_some_removed(condition):
"""
Try a few filters which remove the second row and check that it is
Expand Down Expand Up @@ -515,6 +521,26 @@ def test_tidy_vizier_catalog():
assert np.abs(just_one['mag_error'][0] - one_Vmag_error) < 1e-6


def test_tidy_vizier_catalog_several_mags():
# Test table conversion when there are several magnitude columns.
apass_input = Table.read(get_pkg_data_filename('data/test_apass_subset.ecsv'))

# Make sure the columns we exxpect in the teset data are there before proceeding
assert 'Vmag' in apass_input.colnames
assert 'i_mag' in apass_input.colnames
assert 'B-V' in apass_input.colnames

# Add a B magnitude column, and an r-i color. The values are nonsense.
apass_input['Bmag'] = apass_input['Vmag']
apass_input['r-i'] = apass_input['B-V']

result = CatalogData._tidy_vizier_catalog(apass_input,
r'^([a-zA-Z]+|[a-zA-Z]+-[a-zA-Z]+)_?mag$',
r'^([a-zA-Z]+-[a-zA-Z]+)$')

assert set(result['passband']) == {'V', 'B', 'i', 'r-i', 'B-V'}


def test_catalog_from_vizier_search_apass():
# Nothing special about this point...
sc = SkyCoord(ra=0, dec=0, unit='deg')
Expand Down

0 comments on commit 33e9066

Please sign in to comment.