ObsTests

class lsst.obs.base.tests.ObsTests

Bases: lsst.obs.base.butler_tests.ButlerGetTests, lsst.obs.base.mapper_tests.MapperTests, lsst.obs.base.camera_tests.CameraTests

Aggregator class for all of the obs_* test classes.

Inherit from this class, then lsst.utils.tests.TestCase, in that order.

Example subclass:

class TestObs(lsst.obs.base.tests.ObsTests, lsst.utils.tests.TestCase):
    def setUp(self):
        self.setUp_tests(...)
        self.setUp_butler_get(...)
        self.setUp_mapper(...)
        self.setUp_camera(...)

Notes

The intention is for each obs package to have a single test class that inherits from this collector class, thus “automatically” getting all new tests. If those tests require setup that isn’t defined in a given obs package, that obs package will be broken until updated. This is intentional, as a way to prevent obs packages from falling behind out of neglect.

Methods Summary

setUp_butler_get([ccdExposureId_bits, …]) Set up the necessary variables for butlerGet tests.
setUp_camera([camera_name, n_detectors, …]) Set up the necessary variables for camera tests.
setUp_mapper([output, path_to_raw, keys, …]) Set up the necessary variables for mapper tests.
setUp_tests(butler, mapper, dataIds) Set up the necessary shared variables used by multiple tests.
tearDown()
test_bias()
test_camera_butler() Check that the butler returns the right type of camera.
test_can_standardize()
test_dark()
test_exposureId_bits()
test_flat()
test_get_dataset_types()
test_get_default_level()
test_get_keys_raw()
test_get_linearizer() Test that we can get a linearizer for good detectorIds.
test_get_linearizer_bad_detectorIds() Do bad detectorIds raise?
test_iterable() Simplest camera test: can we get a Camera instance, and does iterating return Detectors?
test_keys()
test_map()
test_map_config_data()
test_map_metadata_data()
test_plate_scale() Check the plate scale at center of focal plane
test_query_metadata() Test expansion of incomplete information of the available data in this obs package’s testdata repo.
test_raw()
test_raw_header_wcs() Test that raw_header_wcs returns the unmodified raw image header.
test_raw_sub_bbox()
test_subset_raw()
test_validate()

Methods Documentation

setUp_butler_get(ccdExposureId_bits=None, exposureIds=None, filters=None, exptimes=None, detectorIds=None, detector_names=None, detector_serials=None, dimensions=None, sky_origin=None, raw_subsets=None, good_detectorIds=None, bad_detectorIds=None, linearizer_type=None, raw_header_wcs=None)

Set up the necessary variables for butlerGet tests.

All “exposure name” entries below should correspond to an entry in self.dataIds.

Parameters:
ccdExposureId_bits : int

expected value of ccdExposureId_bits

exposureIds : dict

dict of exposure name : ccdExposureId (the number as returned by the butler)

filters : dict

dict of exposure name : filter name

exptimes : dict

dict of exposure name : exposure time

detector_names : dict

dict of exposure name : detector name

detectorIds : dict

dict of exposure name : detectorId

detector_serials : dict

dict of exposure name : detector serial

dimensions : dict

dict of exposure name : dimensions (as a geom.Extent2I)

sky_origin : tuple of float

Longitude, Latitude of ‘raw’ exposure

raw_subsets : tuple of (kwargs, int)

keyword args and expected number of subsets for butler.subset('raw', **kwargs)

good_detectorIds : list of int

list of valid ccd numbers

bad_detectorIds : list of int

list of invalid ccd numbers

linearizer_type : dict

dict of detectorId (usually int): LinearizerType (e.g. lsst.ip.isr.LinearizeLookupTable.LinearityType), or unittest.SkipTest to skip all linearizer tests.

raw_header_wcs : lsst.afw.geom.SkyWcs

The SkyWcs object that should be returned by butler.get("raw_header_wcs", dataId=self.dataIds["raw"])

setUp_camera(camera_name=None, n_detectors=None, first_detector_name=None, plate_scale=None)

Set up the necessary variables for camera tests.

Parameters:
camera_name : str

name of this camera

n_detectors : int

number of detectors in this camera

first_detector_name : str

name of the first detector in this camera

plate_scale : lsst.geom.Angle

plate scale at center of focal plane, as angle-on-sky/mm

setUp_mapper(output=None, path_to_raw=None, keys=None, query_format=None, queryMetadata=None, metadata_output_path=None, map_python_type=None, map_python_std_type=None, map_cpp_type=None, map_storage_name=None, raw_filename=None, default_level=None, raw_levels=None, test_config_metadata=True)

Set up the necessary variables for mapper tests.

Parameters:
output : str

full path to output repository (can be the same as data_dir input repository)

path_to_raw : str

full path to the raw file referenced by dataIds[‘raw’]

keys : set

dictionary keys that this mapper should contain

query_format : list

format list for the results portion of queryMetadata

queryMetadata : tuple of (dict, tuple)

dataIds and the results of calling them in queryMetadata

metadata_output_path : str

path to metadata output associated with dataIds[‘raw’]

map_python_type : type

full python type specification returned by the mapper for dataIds[‘raw’]

map_python_std_type : type

full python type specification returned by the mapper for dataIds[‘raw’] after standardization

map_cpp_type : str

C++ type specification returned by the mapper for dataIds[‘raw’]

map_storage_name : str

butler name for the storage type dataIds[‘raw’]

raw_filename : str

Name of the raw files returned by the mapper for dataIds[‘raw’]

default_level : str

value returned from mapper.getDefaultLevel

raw_levels : tuple of (str, set of str)

(level, expect) level and expected mapper return for mapper.getKeys(‘raw’, level)

test_config_metadata : bool

Test persisted config and metadata? These tests may not be appropriate for test stand data. Defaults to True.

setUp_tests(butler, mapper, dataIds)

Set up the necessary shared variables used by multiple tests.

Parameters:
butler: lsst.daf.persistence.Butler

A butler object, instantiated on the testdata repository for the obs package being tested.

mapper: lsst.obs.CameraMapper

A CameraMapper object for your camera, instantiated on the testdata repository the obs package being tested.

dataIds: dict

dictionary of (exposure name): (dataId of that exposure in the testdata repository), with unittest.SkipTest as the value for any exposures you do not have/do not want to test. It must contain a valid ‘raw’ dataId, in addition to ‘bias’,’flat’,’dark’, which may be set to SkipTest. For example:

self.dataIds = {'raw': {'visit': 1, 'filter': 'g'},
                'bias': {'visit': 1},
                'flat': {'visit': 1},
                'dark': unittest.SkipTest
               }
tearDown()
test_bias()
test_camera_butler()

Check that the butler returns the right type of camera.

test_can_standardize()
test_dark()
test_exposureId_bits()
test_flat()
test_get_dataset_types()
test_get_default_level()
test_get_keys_raw()
test_get_linearizer()

Test that we can get a linearizer for good detectorIds.

test_get_linearizer_bad_detectorIds()

Do bad detectorIds raise?

test_iterable()

Simplest camera test: can we get a Camera instance, and does iterating return Detectors?

test_keys()
test_map()
test_map_config_data()
test_map_metadata_data()
test_plate_scale()

Check the plate scale at center of focal plane

Check plate_scale using the FOCAL_PLANE to FIELD_ANGLE transform from the camera.

test_query_metadata()

Test expansion of incomplete information of the available data in this obs package’s testdata repo.

test_raw()
test_raw_header_wcs()

Test that raw_header_wcs returns the unmodified raw image header.

test_raw_sub_bbox()
test_subset_raw()
test_validate()