Coverage for tests/test_readFitsCatalog.py : 92%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # LSST Data Management System # # Copyright 2008-2016 AURA/LSST. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <https://www.lsstcorp.org/LegalNotices/>. #
# If you want to update the FITS table used for this test: # - modify makeFitsTable to create the table as you want it # - set SaveFitsTable = True # - sun the test once to create the new file # - set SaveFitsTable = False again
"""Create a fits file containing two tables"""
# table for HDU 1 fits.Column(name='name', format='10A', array=["object 1", "object 2"]), fits.Column(name='ra', format='E', array=[10, 5]), fits.Column(name='dec', format='E', array=[-5, 45]), fits.Column(name='counts', format='J', array=[1000, 2000]), fits.Column(name='flux', format='D', array=[1.1, 2.2]), fits.Column(name='resolved', format='L', array=[True, False]), ]
# table for HDU 2, fits.Column(name='name', format='10A', array=["object 3", "object 4"]), fits.Column(name='ra', format='E', array=[16, 3]), fits.Column(name='dec', format='E', array=[75, -34]), fits.Column(name='resolved', format='L', array=[False, True]), fits.Column(name='flux', format='D', array=[10.1, 20.2]), fits.Column(name='counts', format='J', array=[15000, 22000]), fits.Column(name='other', format='D', array=[11, 12]), ]
# add an image HDU to test that these are not treated as tables
print("Warning: writing a new FITS file; to stop this set SaveFitsTable = False") fitsTable = makeFitsTable() fitsTable.writeto(FitsPath, clobber=True)
"""Test ReadFitsCatalogTask, a reader used by IngestIndexedReferenceTask"""
"""Test the data in HDU 1, loading all columns without renaming """
"""Test the data in HDU 1 with some column renaming
All columns should be in the same order; those that are renamed should have their new name, and the rest should have their original name. """ "name": "source", "ra": "ra_deg", "dec": "dec_deg", }
"""Test reading HDU 2 with original order"""
"""Test that an invalid path causes an error"""
"""Test that non-existent columns in column_map cause an error""" ["name", "ra", "dec", "counts", "flux", "resolved", "other"], # "other" only in hdu 2 ["name", "ra", "dec", "counts", "flux", "invalidname"], ["invalid1"], ):
"""Test that non-existent HDUs cause an error"""
lsst.utils.tests.init() unittest.main() |