Skip to content
Snippets Groups Projects
Commit 372d756d authored by Kelvin's avatar Kelvin
Browse files

got ale drivers to match csm implementation for ISDs

parent fff07b9c
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ __driver_modules__ = [importlib.import_module('.'+m, package='ale.drivers') for ...@@ -19,6 +19,7 @@ __driver_modules__ = [importlib.import_module('.'+m, package='ale.drivers') for
drivers = dict(chain.from_iterable(inspect.getmembers(dmod, lambda x: inspect.isclass(x) and "_driver" in x.__module__) for dmod in __driver_modules__)) drivers = dict(chain.from_iterable(inspect.getmembers(dmod, lambda x: inspect.isclass(x) and "_driver" in x.__module__) for dmod in __driver_modules__))
def load(label): def load(label):
""" """
Attempt to load a given label from all possible drivers Attempt to load a given label from all possible drivers
...@@ -29,14 +30,15 @@ def load(label): ...@@ -29,14 +30,15 @@ def load(label):
String path to the given label file String path to the given label file
""" """
for name, driver in drivers.items(): for name, driver in drivers.items():
try: print("Trying:", name)
print("TRYING:", driver)
res = driver(label) res = driver(label)
if res.is_valid(): if res.is_valid():
with res as r: with res as r:
print("sdl;fkasdkfl;as")
try:
return res return res
except Exception as e: except Exception as e:
import traceback import traceback
print("Driver Failed:", e)
traceback.print_exc() traceback.print_exc()
raise Exception('No Such Driver for Label') raise Exception('No Such Driver for Label')
This diff is collapsed.
...@@ -6,11 +6,10 @@ import spiceypy as spice ...@@ -6,11 +6,10 @@ import spiceypy as spice
import numpy as np import numpy as np
from ale import config from ale import config
from ale.drivers.base import Framer from ale.drivers.base import Framer, RadialDistortion, Driver
from ale.drivers import keys
class CassiniISS(Framer): class CassiniISS(Driver, Framer, RadialDistortion):
""" """
Cassini mixin class for defining snowflake Spice calls. Cassini mixin class for defining snowflake Spice calls.
""" """
...@@ -19,8 +18,6 @@ class CassiniISS(Framer): ...@@ -19,8 +18,6 @@ class CassiniISS(Framer):
"ISSWA" : "CASSINI_ISS_WAC" "ISSWA" : "CASSINI_ISS_WAC"
} }
required_keys = keys.base | keys.framer | keys.radial_distortion
@property @property
def metakernel(self): def metakernel(self):
""" """
......
from glob import glob
import os
import struct
import re
import pvl
import numpy as np
import quaternion
from ale import config
from ale.drivers.base import Driver, Isis3
def read_table_data(table_label, cube):
"""
Helper function to read all of the binary table data
Parameters
----------
table_label : PVLModule
The ISIS table label
cube : file
The ISIS cube file
Returns
-------
bytes :
The binary portion of the table data
"""
cube.seek(label['StartByte']-1) # This -1 is straight out of ISIS
return cube.read(label['Bytes'])
def field_size(field_label):
"""
Helper function to determine the size of a binary
table field
Parameters
----------
field_label : PVLModule
The field label
Returns
-------
int :
The size of the one entry in bytes
"""
data_sizes = {
'Integer' : 4,
'Double' : 8,
'Real' : 4,
'Text' : 1
}
return data_sizes[field_label['Type']] * field_label['Size']
def field_format(field_label):
"""
Helper function to get the format string for a
single entry in a table field
Parameters
----------
field_label : PVLModule
The field label
Returns
-------
str :
The format string for the entry binary
"""
data_formats = {
'Integer' : 'i',
'Double' : 'd',
'Real' : 'f'
}
return data_formats[field_label['Type']] * field_label['Size']
def parse_field(field_label, data, encoding='latin_1'):
"""
Parses a binary table field entry and converts it into
an in memory data type
Parameters
----------
field_label : PVLModule
The field label
data : bytes
The binary data for the field entry
Returns
-------
Union[int, float, str, list] :
The table field entry converted to a native python
type
"""
if field_label['Type'] == 'Text':
field_data = data[:field_label['Size']].decode(encoding=encoding)
else:
data_format = field_format(field_label)
field_data = struct.unpack_from(data_format, data)
if len(field_data) == 1:
field_data = field_data[0]
return field_data
def parse_table_data(table_label, data):
"""
Parses an ISIS table into a dict where the keys are the
field names and the values are lists of entries.
Parameters
----------
table_label : PVLModule
The table label
data : bytes
The binary data for the entire table
Returns
-------
dict :
The table as a dict
"""
fields = table_label.getlist('Field')
results = {field['Name']:[] for field in fields}
offset = 0
for record in range(table_label['Records']):
for field in fields:
field_data = parse_field(field, data[offset:])
results[field['Name']].append(field_data)
offset += field_size(field)
return results
def parse_rotation_table(label, field_data):
"""
Parses ISIS rotation table data.
Parameters
----------
table_label : PVLModule
The table label
field_data : dict
The table data as a dict with field names
as keys and lists of entries as values
Returns
-------
dict :
The rotation data
"""
results = {}
if all (key in field_data for key in ('J2000Q0','J2000Q1','J2000Q2','J2000Q3')):
results['Rotations'] = quaternion.as_quat_array( [ [q0, q1, q2, q3] for q0, q1, q2, q3 in zip(field_data['J2000Q0'],field_data['J2000Q1'],field_data['J2000Q2'],field_data['J2000Q3']) ] )
if all (key in field_data for key in ('AV1','AV2','AV3')):
results['AngularVelocities'] = np.array( [ [av1, av2, av3] for av1, av2, av3 in zip(field_data['AV1'],field_data['AV2'],field_data['AV3']) ] )
if 'ET' in field_data:
results['Times'] = np.array(field_data['ET'])
if all (key in field_data for key in ('J2000Ang1','J2000Ang2','J2000Ang3')):
results['EulerCoefficients'] = np.array([field_data['J2000Ang1'],field_data['J2000Ang2'],field_data['J2000Ang3']])
results['BaseTime'] = field_data['J2000Ang1'][-1]
results['TimeScale'] = field_data['J2000Ang2'][-1]
if 'TimeDependentFrames' in label:
results['TimeDependentFrames'] = np.array(label['TimeDependentFrames'])
if all (key in label for key in ('ConstantRotation','ConstantFrames')):
const_rotation_mat = np.array(label['ConstantRotation'])
results['ConstantRotation'] = quaternion.from_rotation_matrix(np.reshape(const_rotation_mat, (3, 3)))
results['ConstantFrames'] = np.array(label['ConstantFrames'])
if all (key in label for key in ('PoleRa','PoleDec','PrimeMeridian')):
results['BodyRotationCoefficients'] = np.array( [label['PoleRa'],label['PoleDec'],label['PrimeMeridian']] )
if all (key in label for key in ('PoleRaNutPrec','PoleDecNutPrec','PmNutPrec','SysNutPrec0','SysNutPrec1')):
results['SatelliteNutationPrecessionCoefficients'] = np.array( [label['PoleRaNutPrec'],label['PoleDecNutPrec'],label['PmNutPrec']] )
results['PlanetNutationPrecessionAngleCoefficients'] = np.array( [label['SysNutPrec0'],label['SysNutPrec1']] )
return results
def parse_position_table(field_data):
"""
Parses ISIS position table data.
Parameters
----------
table_label : PVLModule
The table label
field_data : dict
The table data as a dict with field names as keys
and lists of entries as values
Returns
-------
dict :
The position data
"""
results = {}
if all (key in field_data for key in ('J2000X','J2000Y','J2000Z')):
results['Positions'] = np.array( [ [x, y, z] for x, y, z in zip(field_data['J2000X'],field_data['J2000Y'],field_data['J2000Z']) ] )
if 'ET' in field_data:
results['Times'] = np.array(field_data['ET'])
if all (key in field_data for key in ('J2000XV','J2000YV','J2000ZV')):
results['Velocities'] = np.array( [ [x, y, z] for x, y, z in zip(field_data['J2000XV'],field_data['J2000YV'],field_data['J2000ZV']) ] )
if all (key in field_data for key in ('J2000SVX','J2000SVY','J2000SVZ')):
results['PositionCoefficients'] = np.array( [field_data['J2000SVX'][:-1],field_data['J2000SVY'][:-1],field_data['J2000SVZ'][:-1]] )
results['BaseTime'] = field_data['J2000SVX'][-1]
results['TimeScale'] = field_data['J2000SVY'][-1]
return results
class IsisSpice(Isis3):
"""Mixin class for reading from an ISIS cube that has been spiceinit'd
Attributes
----------
_label : PVLModule
Dict-like object with PVL keys
_inst_pointing_table : dict
Dictionary that contains information about the
rotation from J2000 to the sensor reference frame.
All of the values for each property, such as angular
velocity, are stored in a list or numpy array where
each entry is the property at a different time.
_body_orientation_table : dict
Dictionary that contains information about the
rotation from J2000 to the body fixed reference
frame. All of the values for each property, such
as angular velocity, are stored in a list or
numpy array where each entry is the property at a
different time.
_inst_position_table : dict
Dictionary that contains information about the
location of the sensor relative to the center of the
target body. All of the values for each property,
such as velocity, are stored in a list or numpy
array where each entry is the property at a
different time.
_sun_position_table : dict
Dictionary that contains information about the
location of the sun relative to the center of the
target body. All of the values for each property,
such as velocity, are stored in a list or numpy
array where each entry is the property at a
different time.
"""
@property
def label(self):
"""
Loads a PVL from from the _file attribute and
parses the binary table data.
Returns
-------
PVLModule :
Dict-like object with PVL keys
"""
if not hasattr(self, "_label"):
try:
self._label = pvl.load(self._file)
except:
raise ValueError("{} is not a valid label".format(self._file))
for table in self._label.getlist('Table'):
binary_data = read_table_data(table, self._file)
field_data = parse_table_data(table, binary_data)
if table['Name'] == 'InstrumentPointing':
self._inst_pointing_table = parse_rotation_table(table, field_data)
elif table['Name'] == 'BodyRotation':
self._body_orientation_table = parse_rotation_table(table, field_data)
elif table['Name'] == 'InstrumentPosition':
self._inst_position_table = parse_position_table(field_data)
elif table['Name'] == 'SunPosition':
self._sun_position_table = parse_position_table(field_data)
return self._label
def __enter__(self):
"""
Stub method to conform with how other driver mixins
are used.
"""
return self
def __exit__(self, exc_type, exc_val, exc_tb):
"""
Stub method to conform with how other driver mixins
are used.
"""
pass
@property
def number_of_quaternions(self):
"""
The number of instrument rotation quaternions
Returns
-------
int :
The number of quaternions
"""
return len(self.sensor_orientation)
@property
def number_of_ephemerides(self):
"""
The number of instrument position states. These may
be just positions or positions and vbelocities.
Returns
-------
int :
The number of states
"""
return len(self.sensor_position)
@property
def _sclock_hex_string(self):
"""
The hex encoded image start time computed from the
spacecraft clock count
Returns
-------
str :
The hex string representation of the image
start time as a double
"""
for key in self.naif_keywords:
if re.match('CLOCK_ET_.*_COMPUTED', key[0]):
# If the hex string is only numbers and contains leading 0s,
# the PVL library strips them off (ie. 0000000000002040 becomes
# 2040). Pad to 16 in case this happens.
return str(key[1]).zfill(16)
raise ValueError("No computed spacecraft clock time found in NaifKeywords.")
@property
def starting_ephemeris_time(self):
"""
The image start time in ephemeris time
Returns
-------
float :
The image start ephemeris time
"""
return struct.unpack('d', bytes.fromhex(self._sclock_hex_string))[0]
@property
def detector_center(self):
"""
The center of the CCD in detector pixels
Returns
-------
list :
The center of the CCD formatted as line, sample
"""
return [
self.naif_keywords.get('INS{}_BORESIGHT_LINE'.format(self.ikid), None),
self.naif_keywords.get('INS{}_BORESIGHT_SAMPLE'.format(self.ikid), None)
]
@property
def _cube_label(self):
"""
The ISIS cube label portion of the file label
Returns
-------
PVLModule :
The ISIS cube label
"""
if 'IsisCube' not in self.label:
raise ValueError("Could not find ISIS cube label.")
return self.label['IsisCube']
@property
def _kernels_group(self):
"""
The Kernels group from the ISIS cube label.
This is where the original SPICE kernels are listed.
Returns
-------
PVLModule :
The kernels group
"""
if 'Kernels' not in self._cube_label:
raise ValueError("Could not find Kernels group in ISIS cube label.")
return self._cube_label['Kernels']
@property
def ikid(self):
"""
The NAIF id for the instrument
Returns
-------
int :
The instrument id
"""
if 'NaifIkCode' not in self._kernels_group:
raise ValueError("Could not find Instrument NAIF ID in Kernels group.")
return self._kernels_group['NaifIkCode']
@property
def focal2pixel_lines(self):
"""
The line component of the affine transformation
from focal plane coordinates to centered ccd pixels
Returns
-------
list :
The coefficients of the affine transformation
formatted as constant, x, y
"""
return self.naif_keywords.get('INS{}_ITRANSL'.format(self.ikid), None)
@property
def focal2pixel_samples(self):
"""
The sample component of the affine transformation
from focal plane coordinates to centered ccd pixels
Returns
-------
list :
The coefficients of the affine transformation
formatted as constant, x, y
"""
return self.naif_keywords.get('INS{}_ITRANSS'.format(self.ikid), None)
@property
def focal_length(self):
"""
The focal length of the instrument
Returns
-------
float :
The focal length in millimeters
"""
return self.naif_keywords.get('INS{}_FOCAL_LENGTH'.format(self.ikid), None)
@property
def body_radii(self):
"""
The triaxial radii of the target body
Returns
-------
list :
The body radii in kilometers. For most bodies,
this is formatted as semimajor, semimajor,
semiminor
"""
for key in self.naif_keywords:
if re.match('BODY-?\d*_RADII', key[0]):
return self.naif_keywords[key[0]]
@property
def semimajor(self):
"""
The radius of the target body at its widest
diameter
Returns
-------
float :
The radius in kilometers
"""
return self.body_radii[0]
@property
def semiminor(self):
"""
The radius of the target body perpendicular to its
widest diameter
Returns
-------
float :
The radius in kilometers
"""
return self.body_radii[2]
@property
def _body_time_dependent_frames(self):
"""
List of time dependent reference frames between the
target body reference frame and the J2000 frame.
Returns
-------
list :
The list of frames starting with the body
reference frame and ending with the final time
dependent frame.
"""
if not hasattr(self, "_body_orientation_table"):
self.label
if 'TimeDependentFrames' not in self._body_orientation_table:
raise ValueError("Could not find body time dependent frames.")
return self._body_orientation_table['TimeDependentFrames']
@property
def reference_frame(self):
"""
The NAIF ID for the target body reference frame
Returns
-------
int :
The frame ID
"""
return self._body_time_dependent_frames[0]
@property
def sun_position(self):
"""
The sun position
Returns
-------
array :
The sun position vectors relative to the center
of the target body in the J2000 reference frame
as a 2d numpy array
"""
if not hasattr(self, "_sun_position_table"):
self.label
return self._sun_position_table.get('Positions', 'None')
@property
def sun_velocity(self):
"""
The sun velocity
Returns
-------
array :
The sun velocity vectors in the J2000 reference
frame as a 2d numpy array
"""
if not hasattr(self, "_sun_position_table"):
self.label
return self._sun_position_table.get('Velocities', None)
@property
def sensor_position(self):
"""
The sensor position
Returns
-------
array :
The sensor position vectors relative to the
center of the target body in the J2000
reference frame as a 2d numpy array
"""
if not hasattr(self, "_inst_position_table"):
self.label
return self._inst_position_table.get('Positions', None)
@property
def sensor_velocity(self):
"""
The sensor velocity
Returns
-------
array :
The sensor velocity vectors in the J2000
reference frame as a 2d numpy array
"""
if not hasattr(self, "_inst_position_table"):
self.label
return self._inst_position_table.get('Velocities', None)
@property
def sensor_orientation(self):
"""
The rotation from J2000 to the sensor reference
frame
Returns
-------
array :
The sensor rotation quaternions as a numpy
quaternion array
"""
if not hasattr(self, "_inst_pointing_table"):
self.label
return self._inst_pointing_table.get('Rotations', None)
@property
def body_orientation(self):
"""
The rotation from J2000 to the target body
reference frame
Returns
-------
array :
The body rotation quaternions as a numpy
quaternion array
"""
if not hasattr(self, "_body_orientation_table"):
self.label
return self._body_orientation_table.get('Rotations', None)
@property
def naif_keywords(self):
"""
The NaifKeywords group from the file label that
contains stored values from the original SPICE
kernels
Returns
-------
PVLModule :
The stored NAIF keyword values
"""
if 'NaifKeywords' not in self.label:
raise ValueError("Could not find NaifKeywords in label.")
return self.label['NaifKeywords']
base = {
'name_model',
'center_ephemeris_time',
'detector_center',
'detector_line_summing',
'detector_sample_summing',
'ending_ephemeris_time',
'exposure_duration',
'focal2pixel_lines',
'focal2pixel_samples',
'focal_epsilon',
'focal_length',
'ikid',
'image_lines',
'image_samples',
'instrument_id',
'interpolation_method',
'reference_frame',
'reference_height',
'semimajor',
'semiminor',
'sensor_orientation',
'sensor_position',
'sensor_velocity',
'spacecraft_clock_stop_count',
'spacecraft_id',
'spacecraft_name',
'start_time',
'starting_detector_line',
'starting_detector_sample',
'starting_ephemeris_time',
'sun_position',
'sun_velocity',
'target_name',
'number_of_ephemerides',
'number_of_ephemerides'
}
filter = {
'fikid'
}
transverse_distortion = {
'odtk',
'odtx'
}
radial_distortion = {
'odty'
}
framer = {
'filter_number',
}
temp_dep_focal_legth = {
'focal_plane_tempature'
}
linescanner = {
'line_exposure_duration',
'line_scan_rate',
't0_ephemeris',
't0_quaternion',
'dt_ephemeris',
'dt_quaternion',
}
...@@ -6,15 +6,13 @@ import pvl ...@@ -6,15 +6,13 @@ import pvl
import spiceypy as spice import spiceypy as spice
from ale.util import get_metakernels from ale.util import get_metakernels
from ale.drivers.base import LineScanner, Spice, PDS3, Isis3 from ale.drivers.base import LineScanner, Spice, PDS3, Isis3, Driver
from ale.drivers import keys
class LrocSpice(Spice, LineScanner): class LrocSpice(Driver, Spice, LineScanner):
""" """
Lroc mixin class for defining snowflake Spice calls. Lroc mixin class for defining snowflake Spice calls.
""" """
required_keys = keys.base | keys.linescanner
@property @property
def metakernel(self): def metakernel(self):
......
...@@ -6,11 +6,10 @@ import spiceypy as spice ...@@ -6,11 +6,10 @@ import spiceypy as spice
import numpy as np import numpy as np
from ale import config from ale import config
from ale.drivers.base import Framer, Spice, PDS3, Isis3 from ale.drivers.base import Framer, Spice, PDS3, Isis3, Driver
from ale.drivers import keys
class MdisSpice(Spice, Framer): class MdisSpice(Driver, Spice, Framer):
""" """
MDIS mixin class for defining snowflake Spice calls. Since MDIS has unique MDIS mixin class for defining snowflake Spice calls. Since MDIS has unique
Spice keys, those are defined here as an intermediate mixin for MDIS drivers Spice keys, those are defined here as an intermediate mixin for MDIS drivers
...@@ -24,7 +23,6 @@ class MdisSpice(Spice, Framer): ...@@ -24,7 +23,6 @@ class MdisSpice(Spice, Framer):
'MERCURY DUAL IMAGING SYSTEM WIDE ANGLE CAMERA':'MSGR_MDIS_WAC' 'MERCURY DUAL IMAGING SYSTEM WIDE ANGLE CAMERA':'MSGR_MDIS_WAC'
} }
required_keys = keys.base | keys.framer | keys.filter | keys.transverse_distortion | keys.temp_dep_focal_legth
@property @property
def metakernel(self): def metakernel(self):
...@@ -45,7 +43,7 @@ class MdisSpice(Spice, Framer): ...@@ -45,7 +43,7 @@ class MdisSpice(Spice, Framer):
return self._metakernel return self._metakernel
@property @property
def focal_length(self): def _focal_length(self):
""" """
Computes Focal Length from Kernels Computes Focal Length from Kernels
...@@ -65,7 +63,7 @@ class MdisSpice(Spice, Framer): ...@@ -65,7 +63,7 @@ class MdisSpice(Spice, Framer):
f_t = np.poly1d(coeffs[::-1]) f_t = np.poly1d(coeffs[::-1])
# eval at the focal_plane_tempature # eval at the focal_plane_tempature
return f_t(self.focal_plane_tempature) return f_t(self._focal_plane_tempature)
@property @property
def starting_detector_sample(self): def starting_detector_sample(self):
......
...@@ -6,11 +6,38 @@ import pvl ...@@ -6,11 +6,38 @@ import pvl
import spiceypy as spice import spiceypy as spice
from ale import config from ale import config
from ale.drivers.base import LineScanner, Spice, PDS3, Isis3 from ale.drivers.base import LineScanner, Spice, PDS3, Isis3, IsisSpice, Driver, RadialDistortion
from ale.drivers import keys
class CtxIsisSpice(Driver, IsisSpice, LineScanner, RadialDistortion):
class CtxSpice(Spice, LineScanner): @property
def instrument_id(self):
"""
Returns an instrument id for uniquely identifying the instrument, but often
also used to be piped into Spice Kernels to acquire IKIDs. Therefore they
the same ID the Spice expects in bods2c calls.
Returns
-------
: str
instrument id
"""
return "N/A"
@property
def spacecraft_id(self):
return "N/A"
@property
def ikid(self):
return int(self.label["IsisCube"]["Kernels"]["NaifFrameCode"])
@property
def line_exposure_duration(self):
return self.label["IsisCube"]["Instrument"]["LineExposureDuration"].value * 0.001 # Scale to seconds
class CtxSpice(Driver, Spice, LineScanner, RadialDistortion):
""" """
Spice mixins that defines MRO CTX specific snowflake Spice calls. Spice mixins that defines MRO CTX specific snowflake Spice calls.
""" """
...@@ -18,8 +45,6 @@ class CtxSpice(Spice, LineScanner): ...@@ -18,8 +45,6 @@ class CtxSpice(Spice, LineScanner):
'CONTEXT CAMERA':'MRO_CTX' 'CONTEXT CAMERA':'MRO_CTX'
} }
required_keys = keys.base | keys.linescanner | keys.radial_distortion
@property @property
def metakernel(self): def metakernel(self):
""" """
......
...@@ -3,8 +3,7 @@ from collections import namedtuple ...@@ -3,8 +3,7 @@ from collections import namedtuple
import pytest import pytest
import ale import ale
from ale.drivers import isis_spice_driver from ale.drivers import base
from ale.drivers.isis_spice_driver import IsisSpice
from ale import util from ale import util
import pvl import pvl
...@@ -431,14 +430,14 @@ End ...@@ -431,14 +430,14 @@ End
count = table_label['Records'] * len(table_label.getlist('Field')) count = table_label['Records'] * len(table_label.getlist('Field'))
doubles = list(range(count)) doubles = list(range(count))
return struct.pack('d' * count, *doubles) return struct.pack('d' * count, *doubles)
monkeypatch.setattr(isis_spice_driver, 'read_table_data', test_table_data) monkeypatch.setattr(base, 'read_table_data', test_table_data)
def test_label(file): def test_label(file):
return pvl.loads(label) return pvl.loads(label)
monkeypatch.setattr(pvl, 'load', test_label) monkeypatch.setattr(pvl, 'load', test_label)
test_image = IsisSpice() test_image = type('TestCubeDriver', (base.Driver, base.IsisSpice), {})(label)
test_image._file = 'testfile.cub' # test_image._file = 'testfile.cub'
return test_image return test_image
def test_read(test_cube): def test_read(test_cube):
...@@ -454,7 +453,7 @@ def test_starting_ephemeris_time(test_cube): ...@@ -454,7 +453,7 @@ def test_starting_ephemeris_time(test_cube):
assert test_cube.starting_ephemeris_time == 8.0 assert test_cube.starting_ephemeris_time == 8.0
def test_detector_center(test_cube): def test_detector_center(test_cube):
assert test_cube.detector_center == [512.5, 512.5] assert [test_cube._detector_center_line, test_cube._detector_center_sample] == [512.5, 512.5]
def test_ikid(test_cube): def test_ikid(test_cube):
assert test_cube.ikid == -236820 assert test_cube.ikid == -236820
...@@ -466,37 +465,37 @@ def test_focal2pixel_samples(test_cube): ...@@ -466,37 +465,37 @@ def test_focal2pixel_samples(test_cube):
assert test_cube.focal2pixel_samples == [0.0, 71.42857143, 0.0] assert test_cube.focal2pixel_samples == [0.0, 71.42857143, 0.0]
def test_focal_length(test_cube): def test_focal_length(test_cube):
assert test_cube.focal_length == 549.11781953727 assert test_cube._focal_length == 549.11781953727
def test_body_radii(test_cube): def test_body_radii(test_cube):
assert test_cube.body_radii == [6051.8, 6051.8, 6051.8] assert test_cube._body_radii == [6051.8, 6051.8, 6051.8]
def test_semimajor(test_cube): def test_semimajor(test_cube):
assert test_cube.semimajor == 6051.8 assert test_cube._semimajor == 6051.8
def test_semiminor(test_cube): def test_semiminor(test_cube):
assert test_cube.semiminor == 6051.8 assert test_cube._semiminor == 6051.8
def test_reference_frame(test_cube): def test_reference_frame(test_cube):
assert test_cube.reference_frame == 10012 assert test_cube.reference_frame == 10012
def test_sun_position(test_cube): def test_sun_position(test_cube):
assert np.array_equal(test_cube.sun_position, np.array([[0, 1, 2]])) assert np.array_equal(test_cube._sun_position, np.array([[0, 1, 2]]))
def test_sun_velocity(test_cube): def test_sun_velocity(test_cube):
assert np.array_equal(test_cube.sun_velocity, np.array([[3, 4, 5]])) assert np.array_equal(test_cube._sun_velocity, np.array([[3, 4, 5]]))
def test_sensor_position(test_cube): def test_sensor_position(test_cube):
assert np.array_equal(test_cube.sensor_position, np.array([[0, 1, 2]])) assert np.array_equal(test_cube._sensor_position, np.array([[0, 1, 2]]))
def test_sensor_velocity(test_cube): def test_sensor_velocity(test_cube):
assert np.array_equal(test_cube.sensor_velocity, np.array([[3, 4, 5]])) assert np.array_equal(test_cube._sensor_velocity, np.array([[3, 4, 5]]))
def test_sensor_orientation(test_cube): def test_sensor_orientation(test_cube):
assert np.array_equal(test_cube.sensor_orientation, quaternion.as_quat_array([[0, 1, 2, 3]])) assert np.array_equal(test_cube._sensor_orientation, np.asarray([[0, 1, 2, 3]]))
def test_body_orientation(test_cube): def test_body_orientation(test_cube):
assert np.array_equal(test_cube.body_orientation, quaternion.as_quat_array([[0, 1, 2, 3]])) assert np.array_equal(test_cube.body_orientation, np.asarray([[0, 1, 2, 3]]))
def test_naif_keywords(test_cube): def test_naif_keywords(test_cube):
assert isinstance(test_cube.naif_keywords, pvl.PVLObject) assert isinstance(test_cube.naif_keywords, pvl.PVLObject)
...@@ -115,4 +115,3 @@ def test_lro_creation(lro_lroclabel): ...@@ -115,4 +115,3 @@ def test_lro_creation(lro_lroclabel):
with LrocPds3Driver(lro_lroclabel) as m: with LrocPds3Driver(lro_lroclabel) as m:
d = m.to_dict() d = m.to_dict()
assert isinstance(d, dict) assert isinstance(d, dict)
assert(set(d.keys()) == m.required_keys)
...@@ -247,4 +247,3 @@ def test_mdis_creation(mdislabel): ...@@ -247,4 +247,3 @@ def test_mdis_creation(mdislabel):
with MdisPDS3Driver(mdislabel) as m: with MdisPDS3Driver(mdislabel) as m:
d = m.to_dict() d = m.to_dict()
assert isinstance(d, dict) assert isinstance(d, dict)
assert(set(d.keys()) == m.required_keys)
...@@ -66,4 +66,3 @@ def test_ctx_creation(mroctx_label): ...@@ -66,4 +66,3 @@ def test_ctx_creation(mroctx_label):
with CtxPds3Driver(mroctx_label) as m: with CtxPds3Driver(mroctx_label) as m:
d = m.to_dict() d = m.to_dict()
assert isinstance(d, dict) assert isinstance(d, dict)
assert(set(d.keys()) == m.required_keys)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment