Skip to content
Snippets Groups Projects
Select Git revision
  • cd51f0143e8f6f8062fd087e806ea2fbabfbec2b
  • main default protected
  • Kelvinrr-patch-3
  • radius_update
  • revert-616-apollo_pan
  • vims
  • 0.10
  • Kelvinrr-patch-2
  • revert-563-minirf_fix
  • Kelvinrr-patch-1
  • 0.9
  • acpaquette-patch-3
  • acpaquette-patch-2
  • acpaquette-patch-1
  • spiceql
  • ci-coverage
  • 0.10.0
  • 0.9.1
  • 0.9.0
  • 0.8.7
  • 0.8.8
  • 0.8.6
  • 0.8.3
  • 0.8.4
  • 0.8.5
  • 0.8.2
  • 0.8.1
  • 0.8.0
  • 0.7.3
  • 0.7.2
  • 0.7.1
  • 0.7.0
  • 0.6.5
  • 0.6.4
  • 0.6.3
  • 0.6.2
36 results

test_lro_drivers.py

Blame
  • test_lro_drivers.py 2.07 KiB
    import pytest
    
    # 'Mock' the spice module where it is imported
    from conftest import SimpleSpice, get_mockkernels
    
    from collections import namedtuple
    
    import ale
    from ale.drivers import lro_drivers
    from ale.base import data_naif
    from ale.base import label_pds3
    
    from unittest.mock import PropertyMock, patch
    
    from ale import util
    
    from ale.drivers.lro_drivers import LroLrocPds3LabelNaifSpiceDriver
    
    
    simplespice = SimpleSpice()
    data_naif.spice = simplespice
    lro_drivers.spice = simplespice
    label_pds3.spice = simplespice
    
    LroLrocPds3LabelNaifSpiceDriver.metakernel = get_mockkernels
    
    @pytest.fixture
    def driver():
        return LroLrocPds3LabelNaifSpiceDriver("")
    
    
    @patch('ale.base.label_pds3.Pds3Label.instrument_id', 'LROC')
    def test_instrument_id_left(driver):
        with patch.dict(driver.label, {'FRAME_ID':'LEFT'}) as f:
            assert driver.instrument_id == 'LRO_LROCNACL'
    
    @patch('ale.base.label_pds3.Pds3Label.instrument_id', 'LROC')
    def test_instrument_id_right(driver):
        with patch.dict(driver.label, {'FRAME_ID':'RIGHT'}) as f:
            assert driver.instrument_id == 'LRO_LROCNACR'
    
    @patch('ale.base.label_pds3.Pds3Label.instrument_host_id', 'LRO')
    def test_spacecraft_name(driver):
        assert driver.spacecraft_name == 'LRO'
    
    def test_sensor_model_version(driver):
        assert driver.sensor_model_version == 2
    
    @patch('ale.base.data_naif.NaifSpice.ikid', 123)
    def test_odtk(driver):
        assert driver.odtk == [1.0]
    
    @patch('ale.base.data_naif.NaifSpice.ikid', 123)
    def test_usgscsm_distortion_model(driver):
        distortion_model = driver.usgscsm_distortion_model
        assert distortion_model['lrolrocnac']['coefficients'] == [1.0]
    
    @patch('ale.base.label_pds3.Pds3Label.instrument_host_id', 'LRO')
    @patch('ale.drivers.lro_drivers.LroLrocPds3LabelNaifSpiceDriver.exposure_duration', 1)
    def test_ephemeris_start_time(driver):
        with patch.dict(driver.label, {'LRO:SPACECRAFT_CLOCK_PREROLL_COUNT':'1'}) as f:
            assert driver.ephemeris_start_time == 1024.1
    
    @patch('ale.base.label_pds3.Pds3Label.exposure_duration', 1)
    def test_exposure_duration(driver):
        assert driver.exposure_duration == 1.0045