Esempio n. 1
0
 def test_summary_table_is_always_masked(self, triage_setup):
     # First, try grabbing all of the keywords
     ic = ImageFileCollection(location=triage_setup.test_dir, keywords='*')
     assert ic.summary.masked
     # Now, try keywords that every file will have
     ic.keywords = ['bitpix']
     assert ic.summary.masked
     # What about keywords that include some that will surely be missing?
     ic.keywords = ['bitpix', 'dsafui']
     assert ic.summary.masked
Esempio n. 2
0
    def test_type_of_empty_collection(self, triage_setup):
        # Test for implementation of the suggestion in
        #
        #    https://github.com/astropy/ccdproc/issues/601
        #
        # in which an empty collection with no keys has but with files
        # returns a summary table with one column, but an empty collection
        # with no keys and no files returns None.

        # Make a dummy keyword that we then delete.
        with catch_warnings(AstropyUserWarning) as warning_lines:
            ic = ImageFileCollection(triage_setup.test_dir, keywords=['fafa'])
        assert "no FITS files in the collection."
        ic.keywords = []
        assert set(ic.summary.colnames) == set(['file'])

        # Remove all of the fits files
        path = Path(triage_setup.test_dir)
        for p in path.iterdir():
            p.unlink()

        # Now the summary should be none
        ic = ImageFileCollection(triage_setup.test_dir)
        assert ic.summary is None
        assert ic.keywords == []
Esempio n. 3
0
    def test_keyword_setting(self, new_keywords, collection_keys,
                             triage_setup):
        collection = ImageFileCollection(location=triage_setup.test_dir,
                                         keywords=collection_keys)
        tbl_orig = collection.summary
        collection.keywords = new_keywords
        tbl_new = collection.summary

        if set(new_keywords).issubset(collection_keys):
            # should just delete columns without rebuilding table
            assert(tbl_orig is tbl_new)
        else:
            # we need new keywords so must rebuild
            assert(tbl_orig is not tbl_new)

        for key in new_keywords:
            assert(key in tbl_new.keys())
        assert (tbl_orig['file'] == tbl_new['file']).all()
        assert (tbl_orig['imagetyp'] == tbl_new['imagetyp']).all()
        assert 'filter' not in tbl_new.keys()
        assert 'object' not in tbl_orig.keys()
Esempio n. 4
0
 def test_setting_keywords_to_none(self, triage_setup):
     ic = ImageFileCollection(triage_setup.test_dir, keywords=['imagetyp'])
     ic.keywords = None
     assert ic.summary == []
Esempio n. 5
0
 def test_keyword_setting_to_empty_list(self, triage_setup):
     ic = ImageFileCollection(triage_setup.test_dir)
     ic.keywords = []
     assert ['file'] == ic.keywords