Skip to content
Snippets Groups Projects
Unverified Commit 92c1cf15 authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

HiRISE IsisLabel NaifSpice Driver (#471)

* Added initial working mro hirise driver

* Fixed error messaging in frame trace

* Added mro hirise tests
parent 3c1bb737
Branches
Tags
No related merge requests found
Showing
with 118562 additions and 23 deletions
......@@ -8,6 +8,8 @@ from ale.base.label_isis import IsisLabel
from ale.base.type_distortion import RadialDistortion
from ale.base.type_sensor import LineScanner
from ale import util
class MroCtxIsisLabelIsisSpiceDriver(LineScanner, IsisLabel, IsisSpice, RadialDistortion, Driver):
......@@ -255,3 +257,145 @@ class MroCtxPds3LabelNaifSpiceDriver(LineScanner, Pds3Label, NaifSpice, RadialDi
platform name
"""
return self.label['SPACECRAFT_NAME']
hirise_ccd_lookup = {
0: 0,
1: 1,
2: 2,
3: 3,
4: 12,
5: 4,
6: 10,
7: 11,
8: 5,
9: 13,
10: 6,
11: 7,
12: 8,
13: 9
}
class MroHiRiseIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialDistortion, Driver):
"""
Driver for reading HiRise ISIS labels.
"""
@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.
Expects instrument_id to be defined in the IsisLabel mixin. This should be
a string of the form 'CTX'
Returns
-------
: str
instrument id
"""
id_lookup = {
"HIRISE" : "MRO_HIRISE"
}
return id_lookup[super().instrument_id]
@property
def sensor_name(self):
"""
ISIS doesn't propergate this to the ingested cube label, so hard-code it.
"""
return "HIRISE CAMERA"
@property
def un_binned_rate(self):
if not hasattr(self, "_un_binned_rate"):
delta_line_timer_count = self.label["IsisCube"]["Instrument"]["DeltaLineTimerCount"]
self._un_binned_rate = (74.0 + (delta_line_timer_count / 16.0)) / 1000000.0
return self._un_binned_rate
@property
def ephemeris_start_time(self):
if not hasattr(self, "_ephemeris_start_time"):
tdi_mode = self.label["IsisCube"]["Instrument"]["Tdi"]
bin_mode = self.label["IsisCube"]["Instrument"]["Summing"]
# Code replicated from the ISIS HiRise Camera Model
# The -74999 is the code to select the transformation from
# high-precision MRO SCLK to ET
start_time = spice.scs2e(-74999, self.spacecraft_clock_start_count)
# Adjust the start time so that it is the effective time for
# the first line in the image file. Note that on 2006-03-29, this
# time is now subtracted as opposed to adding it. The computed start
# time in the EDR is at the first serial line.
start_time -= self.un_binned_rate * ((tdi_mode / 2.0) - 0.5);
# Effective observation
# time for all the TDI lines used for the
# first line before doing binning
start_time += self.un_binned_rate * ((bin_mode / 2.0) - 0.5);
self._ephemeris_start_time = start_time
return self._ephemeris_start_time
@property
def exposure_duration(self):
if not hasattr(self, "_exposure_duration"):
self._exposure_duration = self.un_binned_rate * self.label["IsisCube"]["Instrument"]["Summing"]
return self._exposure_duration
@property
def ccd_ikid(self):
ccd_number = hirise_ccd_lookup[self.label["IsisCube"]["Instrument"]["CpmmNumber"]]
return spice.bods2c("MRO_HIRISE_CCD{}".format(ccd_number))
@property
def sensor_frame_id(self):
return -74690
@property
def detector_center_sample(self):
"""
Returns the center detector sample. Expects ikid to be defined. This should
be an integer cont?aining the Naif Id code of the instrument.
Returns
-------
: float
Detector sample of the principal point
"""
return 0
@property
def detector_center_line(self):
"""
Returns the center detector line. Expects ikid to be defined. This should
be an integer containing the Naif Id code of the instrument.
Returns
-------
: float
Detector line of the principal point
"""
return 0
@property
def naif_keywords(self):
"""
Updated set of naif keywords containing the NaifIkCode for the specific
Juno filter used when taking the image.
Returns
-------
: dict
Dictionary of keywords and values that ISIS creates and attaches to the label
"""
return {**super().naif_keywords, **util.query_kernel_pool(f"*{self.ccd_ikid}*")}
@property
def sensor_model_version(self):
"""
Returns
-------
: int
ISIS sensor model version
"""
return 1
......@@ -161,22 +161,22 @@ class FrameChain(nx.DiGraph):
try:
matrix, frame_code = spice.ckfrot(frame_type_id, ephemeris_time)
except:
raise Exception(f"The ck rotation from frame {frame_codes[-1]} can not \
be found due to no pointing available at requested time \
or a problem with the frame")
raise Exception(f"The ck rotation from frame {frame_codes[-1]} can not " +
f"be found due to no pointing available at requested time {ephemeris_time} " +
"or a problem with the frame")
elif frame_type == 4:
try:
matrix, frame_code = spice.tkfram(frame_type_id)
except:
raise Exception(f"The tk rotation from frame {frame_codes[-1]} can not \
be found")
raise Exception(f"The tk rotation from frame {frame_codes[-1]} can not " +
"be found")
elif frame_type == 5:
matrix, frame_code = spice.zzdynrot(frame_type_id, center, ephemeris_time)
else:
raise Exception(f"The frame {frame_codes[-1]} has a type {frame_type_id} \
not supported by your version of Naif Spicelib. \
You need to update.")
raise Exception(f"The frame {frame_codes[-1]} has a type {frame_type_id} " +
"not supported by your version of Naif Spicelib. " +
"You need to update.")
frame_codes.append(frame_code)
frame_types.append(frame_type)
......
This diff is collapsed.
This diff is collapsed.
Object = IsisCube
Object = Core
StartByte = 65537
Format = Tile
TileSamples = 256
TileLines = 1000
Group = Dimensions
Samples = 256
Lines = 5000
Bands = 1
End_Group
Group = Pixels
Type = SignedWord
ByteOrder = Lsb
Base = 0.0
Multiplier = 1.0
End_Group
End_Object
Group = Instrument
SpacecraftName = "MARS RECONNAISSANCE ORBITER"
InstrumentId = HIRISE
TargetName = Mars
StartTime = 2006-11-17T03:27:53.118
StopTime = 2006-11-17T03:27:54.792
ObservationStartCount = 848201291:54379
SpacecraftClockStartCount = 848201291:62546
SpacecraftClockStopCount = 848201293:41165
ReadoutStartCount = 848201300:53057
CalibrationStartTime = 2006-11-17T03:27:53.104
CalibrationStartCount = 848201291:61647
AnalogPowerStartTime = -9999
AnalogPowerStartCount = -9999
MissionPhaseName = "PRIMARY SCIENCE PHASE"
LineExposureDuration = 334.7500 <MICROSECONDS>
ScanExposureDuration = 83.6875 <MICROSECONDS>
DeltaLineTimerCount = 155
Summing = 4
Tdi = 64
FocusPositionCount = 2020
PoweredCpmmFlag = (On, On, On, On, On, On, On, On, On, On, On,
On, On, On)
CpmmNumber = 4
CcdId = BG12
ChannelNumber = 0
LookupTableType = Stored
LookupTableNumber = 10
LookupTableMinimum = -9998
LookupTableMaximum = -9998
LookupTableMedian = -9998
LookupTableKValue = -9998
StimulationLampFlag = (Off, Off, Off)
HeaterControlFlag = (On, On, On, On, On, On, On, On, On, On, On,
On, On, On)
OptBnchFlexureTemperature = 20.455 <C>
OptBnchMirrorTemperature = 20.1949 <C>
OptBnchFoldFlatTemperature = 20.5417 <C>
OptBnchFpaTemperature = 19.8482 <C>
OptBnchFpeTemperature = 19.5881 <C>
OptBnchLivingRmTemperature = 20.1949 <C>
OptBnchBoxBeamTemperature = 20.455 <C>
OptBnchCoverTemperature = 20.1082 <C>
FieldStopTemperature = 18.375 <C>
FpaPositiveYTemperature = 19.1548 <C>
FpaNegativeYTemperature = 19.0681 <C>
FpeTemperature = 17.9418 <C>
PrimaryMirrorMntTemperature = 20.0215 <C>
PrimaryMirrorTemperature = 20.3683 <C>
PrimaryMirrorBafTemperature = 0.414005 <C>
MsTrussLeg0ATemperature = 20.3683 <C>
MsTrussLeg0BTemperature = 20.5417 <C>
MsTrussLeg120ATemperature = 19.5881 <C>
MsTrussLeg120BTemperature = 20.2816 <C>
MsTrussLeg240ATemperature = 19.6748 <C>
MsTrussLeg240BTemperature = 19.9348 <C>
BarrelBaffleTemperature = -21.006 <C>
SunShadeTemperature = -28.7562 <C>
SpiderLeg30Temperature = 17.7686 <C>
SpiderLeg150Temperature = 18.2883 <C>
SpiderLeg270Temperature = 17.1623 <C>
SecMirrorMtrRngTemperature = 19.5881 <C>
SecMirrorTemperature = 20.7151 <C>
SecMirrorBaffleTemperature = -18.7871 <C>
IeaTemperature = 25.8353 <C>
FocusMotorTemperature = 21.4088 <C>
IePwsBoardTemperature = 17.7363 <C>
CpmmPwsBoardTemperature = 18.078 <C>
MechTlmBoardTemperature = 35.0546 <C>
InstContBoardTemperature = 34.6875 <C>
DllLockedFlag = (YES, YES)
DllResetCount = 0
DllLockedOnceFlag = (YES, YES)
DllFrequenceCorrectCount = 4
ADCTimingSetting = (5, 4)
Unlutted = TRUE
End_Group
Group = Archive
DataSetId = MRO-M-HIRISE-2-EDR-V1.0
ProducerId = UA
ObservationId = PSP_001446_1790
ProductId = PSP_001446_1790_BG12_0
ProductVersionId = 1.0
EdrProductCreationTime = 2006-11-17T05:03:31
RationaleDescription = Null
OrbitNumber = 1446
SoftwareName = "HiRISE_Observation v2.9 (2.43 2006/10/01
05:41:12)"
ObservationStartTime = 2006-11-17T03:27:52.993
ReadoutStartTime = 2006-11-17T03:28:01.973
TrimLines = 607
FelicsCompressionFlag = YES
IdFlightSoftwareName = IE_FSW_V4
End_Group
Group = BandBin
Name = BlueGreen
Center = 500 <NANOMETERS>
Width = 200 <NANOMETERS>
End_Group
Group = Kernels
NaifIkCode = -74699
End_Group
End_Object
Object = Label
Bytes = 65536
End_Object
Object = Table
Name = "HiRISE Calibration Ancillary"
StartByte = 2626071
Bytes = 4920
Records = 41
ByteOrder = Lsb
Group = Field
Name = GapFlag
Type = Integer
Size = 1
End_Group
Group = Field
Name = LineNumber
Type = Integer
Size = 1
End_Group
Group = Field
Name = BufferPixels
Type = Integer
Size = 12
End_Group
Group = Field
Name = DarkPixels
Type = Integer
Size = 16
End_Group
End_Object
Object = Table
Name = "HiRISE Calibration Image"
StartByte = 2630991
Bytes = 41984
Records = 41
ByteOrder = Lsb
Group = Field
Name = Calibration
Type = Integer
Size = 256
End_Group
End_Object
Object = Table
Name = "HiRISE Ancillary"
StartByte = 2672975
Bytes = 600000
Records = 5000
ByteOrder = Lsb
Association = Lines
Group = Field
Name = GapFlag
Type = Integer
Size = 1
End_Group
Group = Field
Name = LineNumber
Type = Integer
Size = 1
End_Group
Group = Field
Name = BufferPixels
Type = Integer
Size = 12
End_Group
Group = Field
Name = DarkPixels
Type = Integer
Size = 16
End_Group
End_Object
Object = History
Name = IsisCube
StartByte = 2625537
Bytes = 534
End_Object
Object = OriginalLabel
Name = IsisCube
StartByte = 3272975
Bytes = 25216
End_Object
End
HiRISE Instrument Kernel
=============================================================
This instrument kernel (I-kernel) contains parameters that
describe the Mars Reconnaissance Orbiter HiRISE (High Resolution
Imaging Science Experiment) instrument.
Version and Date
-------------------------------------------------------------
Version 1.0 -- February 16, 2005 -- Jim Torson, U.S. Geological Survey,
Flagstaff, AZ
Initial version.
Version 1.1 -- April 5, 2006 -- Kris Becker USGS.
Added entries so NADIR pointing can be utilized. These entries are
indentified with prefixes of INS-74699. They can be any CCD
measurement but this one so happens to CCD #0.
Version 1.2 -- May 10, 2006 -- Kris Becker USGS
Update focal length from 12056.0189 to 11994.9988 per Randy's email
of 2006/04/26.
Version 1.3 -- July 17, 2009 -- Steven Lambright USGS
Update to exclude data now provided in the ik
Version 1.4 -- January 12, 2010 -- Debbie A. Cook USGS
Update to include CK_FRAME_ID and CK_REFERENCE_ID
Version 1.6 -- Mar 12, 2010 -- Debbie A. Cook USGS
Update to include CK_FRAME_ID and CK_REFERENCE_ID
-------------------------------------------------------------
The following are the parameters for computing focal plane
coords from CCD coords. The last two characters of the
parameter names are the HiRISE detector number (00 to 13).
For a given detector number, these allow computation of
focal plane coordinates (in millimeters) from "centered"
detector coordinates in pixels (0,0 is the center of the
detector array) as described in Randy Kirk's December 21,
2004 email (ISIS3 sensor models, take 2), i.e.,
x = transx[0] + transx[1]*ccdSample_c + transx[2]*ccdLine_c
y = transy[0] + transy[1]*ccdSample_c + transy[2]*ccdLine_c
The parameter values come from the spreadsheet attached to
Randy Kirk's December 22, 2004 email (HiRISE pixel to
focal plane).
The INS-74699_TRANS[XY] is new and needed to support Nadir
pointing CK simulations now supported in ISIS.
\begindata
INS-74699_TRANSX=( -96.3935, -0.000057, 0.012000)
INS-74699_TRANSY=( 107.9956, -0.012000, -0.000057)
INS-74600_TRANSX=( -96.3935, -0.000057, 0.012000)
INS-74600_TRANSY=( 107.9956, -0.012000, -0.000057)
INS-74601_TRANSX=( -89.4914, -0.000042, 0.012000)
INS-74601_TRANSY=( 83.9950, -0.012000, -0.000042)
INS-74602_TRANSX=( -96.9459, -0.000034, 0.012000)
INS-74602_TRANSY=( 60.0469, -0.012000, -0.000034)
INS-74603_TRANSX=( -89.4927, -0.000018, 0.012000)
INS-74603_TRANSY=( 36.0380, -0.012000, -0.000018)
INS-74604_TRANSX=( -96.4998, 0.000002, 0.012000)
INS-74604_TRANSY=( 11.9992, -0.012000, 0.000002)
INS-74605_TRANSX=( -89.4960, -0.000001, 0.012000)
INS-74605_TRANSY=( -12.0010, -0.012000, -0.000001)
INS-74606_TRANSX=( -96.6811, 0.000019, 0.012000)
INS-74606_TRANSY=( -35.9996, -0.012000, 0.000019)
INS-74607_TRANSX=( -89.4935, 0.000031, 0.012000)
INS-74607_TRANSY=( -60.0034, -0.012000, 0.000031)
INS-74608_TRANSX=( -96.3954, 0.000049, 0.012000)
INS-74608_TRANSY=( -83.9990, -0.012000, 0.000049)
INS-74609_TRANSX=( -89.1039, 0.000056, 0.012000)
INS-74609_TRANSY=( -107.9997, -0.012000, 0.000056)
INS-74610_TRANSX=( -110.9610, 0.000000, 0.012000)
INS-74610_TRANSY=( 11.9991, -0.012000, 0.000000)
INS-74611_TRANSX=( -103.6857, -0.000001, 0.012000)
INS-74611_TRANSY=( -12.0010, -0.012000, -0.000001)
INS-74612_TRANSX=( -82.2033, 0.000002, 0.012000)
INS-74612_TRANSY=( 11.9993, -0.012000, 0.000002)
INS-74613_TRANSX=( -74.9334, 0.000003, 0.012000)
INS-74613_TRANSY=( -12.0007, -0.012000, 0.000003)
\begintext
Parameters for computing CCD coords from focal plane coords.
The INS-74699_ITRANS[SL] is new and needed to support Nadir
pointing CK simulations now supported in ISIS.
\begindata
INS-74699_ITRANSS=( 8961.49, -0.3947, -83.3324)
INS-74699_ITRANSL=( 8075.32, 83.3324, -0.3947)
INS-74600_ITRANSS=( 8961.49, -0.3947, -83.3324)
INS-74600_ITRANSL=( 8075.32, 83.3324, -0.3947)
INS-74601_ITRANSS=( 6973.17, -0.2947, -83.3328)
INS-74601_ITRANSL=( 7482.32, 83.3328, -0.2947)
INS-74602_ITRANSS=( 4981.07, -0.2353, -83.3330)
INS-74602_ITRANSL=( 8092.92, 83.3330, -0.2353)
INS-74603_ITRANSS=( 2991.85, -0.1263, -83.3332)
INS-74603_ITRANSL=( 7462.27, 83.3332, -0.1263)
INS-74604_ITRANSS=( 1001.06, 0.0117, -83.3333)
INS-74604_ITRANSL=( 8041.51, 83.3333, 0.0117)
INS-74605_ITRANSS=( -1000.86, -0.0087, -83.3333)
INS-74605_ITRANSL=( 7457.90, 83.3333, -0.0087)
INS-74606_ITRANSS=( -2987.14, 0.1327, -83.3332)
INS-74606_ITRANSL=( 8061.52, 83.3332, 0.1327)
INS-74607_ITRANSS=( -4981.11, 0.2140, -83.3331)
INS-74607_ITRANSL=( 7470.61, 83.3331, 0.2140)
INS-74608_ITRANSS=( -6966.96, 0.3413, -83.3326)
INS-74608_ITRANSL=( 8061.56, 83.3326, 0.3413)
INS-74609_ITRANSS=( -8965.39, 0.3870, -83.3324)
INS-74609_ITRANSL=( 7467.04, 83.3324, 0.3870)
INS-74610_ITRANSS=( 999.93, 0.0000, -83.3333)
INS-74610_ITRANSL=( 9246.75, 83.3333, 0.0000)
INS-74611_ITRANSS=( -1001.12, -0.0100, -83.3333)
INS-74611_ITRANSL=( 8640.36, 83.3333, -0.0100)
INS-74612_ITRANSS=( 1001.28, 0.0163, -83.3333)
INS-74612_ITRANSL=( 6850.08, 83.3333, 0.0163)
INS-74613_ITRANSS=( -998.61, 0.0193, -83.3333)
INS-74613_ITRANSL=( 6244.68, 83.3333, 0.0193)
\begintext
These are the parameters for writing c-kernels. Isis will create ck
with the same frame endpoints as the mission ck. For Hirise the ck
instrument frame is MRO_SPACECRAFT (-74000) and the ck reference frame
is MRO_MME_OF_DATE (-74900).
\begindata
INS-74699_CK_FRAME_ID=-74000
INS-74699_CK_REFERENCE_ID=-74900
This diff is collapsed.
This diff is collapsed.
KPL/LSK
LEAPSECONDS KERNEL FILE
===========================================================================
Modifications:
--------------
2016, Jul. 14 NJB Modified file to account for the leapsecond that
will occur on December 31, 2016.
2015, Jan. 5 NJB Modified file to account for the leapsecond that
will occur on June 30, 2015.
2012, Jan. 5 NJB Modified file to account for the leapsecond that
will occur on June 30, 2012.
2008, Jul. 7 NJB Modified file to account for the leapsecond that
will occur on December 31, 2008.
2005, Aug. 3 NJB Modified file to account for the leapsecond that
will occur on December 31, 2005.
1998, Jul 17 WLT Modified file to account for the leapsecond that
will occur on December 31, 1998.
1997, Feb 22 WLT Modified file to account for the leapsecond that
will occur on June 30, 1997.
1995, Dec 14 KSZ Corrected date of last leapsecond from 1-1-95
to 1-1-96.
1995, Oct 25 WLT Modified file to account for the leapsecond that
will occur on Dec 31, 1995.
1994, Jun 16 WLT Modified file to account for the leapsecond on
June 30, 1994.
1993, Feb. 22 CHA Modified file to account for the leapsecond on
June 30, 1993.
1992, Mar. 6 HAN Modified file to account for the leapsecond on
June 30, 1992.
1990, Oct. 8 HAN Modified file to account for the leapsecond on
Dec. 31, 1990.
Explanation:
------------
The contents of this file are used by the routine DELTET to compute the
time difference
[1] DELTA_ET = ET - UTC
the increment to be applied to UTC to give ET.
The difference between UTC and TAI,
[2] DELTA_AT = TAI - UTC
is always an integral number of seconds. The value of DELTA_AT was 10
seconds in January 1972, and increases by one each time a leap second
is declared. Combining [1] and [2] gives
[3] DELTA_ET = ET - (TAI - DELTA_AT)
= (ET - TAI) + DELTA_AT
The difference (ET - TAI) is periodic, and is given by
[4] ET - TAI = DELTA_T_A + K sin E
where DELTA_T_A and K are constant, and E is the eccentric anomaly of the
heliocentric orbit of the Earth-Moon barycenter. Equation [4], which ignores
small-period fluctuations, is accurate to about 0.000030 seconds.
The eccentric anomaly E is given by
[5] E = M + EB sin M
where M is the mean anomaly, which in turn is given by
[6] M = M + M t
0 1
where t is the number of ephemeris seconds past J2000.
Thus, in order to compute DELTA_ET, the following items are necessary.
DELTA_TA
K
EB
M0
M1
DELTA_AT after each leap second.
The numbers, and the formulation, are taken from the following sources.
1) Moyer, T.D., Transformation from Proper Time on Earth to
Coordinate Time in Solar System Barycentric Space-Time Frame
of Reference, Parts 1 and 2, Celestial Mechanics 23 (1981),
33-56 and 57-68.
2) Moyer, T.D., Effects of Conversion to the J2000 Astronomical
Reference System on Algorithms for Computing Time Differences
and Clock Rates, JPL IOM 314.5--942, 1 October 1985.
The variable names used above are consistent with those used in the
Astronomical Almanac.
\begindata
DELTET/DELTA_T_A = 32.184
DELTET/K = 1.657D-3
DELTET/EB = 1.671D-2
DELTET/M = ( 6.239996D0 1.99096871D-7 )
DELTET/DELTA_AT = ( 10, @1972-JAN-1
11, @1972-JUL-1
12, @1973-JAN-1
13, @1974-JAN-1
14, @1975-JAN-1
15, @1976-JAN-1
16, @1977-JAN-1
17, @1978-JAN-1
18, @1979-JAN-1
19, @1980-JAN-1
20, @1981-JUL-1
21, @1982-JUL-1
22, @1983-JUL-1
23, @1985-JUL-1
24, @1988-JAN-1
25, @1990-JAN-1
26, @1991-JAN-1
27, @1992-JUL-1
28, @1993-JUL-1
29, @1994-JUL-1
30, @1996-JAN-1
31, @1997-JUL-1
32, @1999-JAN-1
33, @2006-JAN-1
34, @2009-JAN-1
35, @2012-JUL-1
36, @2015-JUL-1
37, @2017-JAN-1 )
\begintext
This diff is collapsed.
This diff is collapsed.
......@@ -8,23 +8,28 @@ import numpy as np
import spiceypy as spice
import ale
from ale.drivers.mro_drivers import MroCtxPds3LabelNaifSpiceDriver, MroCtxIsisLabelNaifSpiceDriver, MroCtxIsisLabelIsisSpiceDriver
from ale.drivers.mro_drivers import MroCtxPds3LabelNaifSpiceDriver, MroCtxIsisLabelNaifSpiceDriver, MroCtxIsisLabelIsisSpiceDriver, MroHiRiseIsisLabelNaifSpiceDriver
from conftest import get_image, get_image_kernels, get_isd, convert_kernels, get_image_label, compare_dicts
#@pytest.fixture
# def ctx_isf
@pytest.fixture(scope='module')
def test_kernels():
def test_ctx_kernels():
kernels = get_image_kernels('B10_013341_1010_XN_79S172W')
updated_kernels, binary_kernels = convert_kernels(kernels)
yield updated_kernels
for kern in binary_kernels:
os.remove(kern)
@pytest.fixture(scope='module')
def test_hirise_kernels():
kernels = get_image_kernels('PSP_001446_1790_BG12_0')
updated_kernels, binary_kernels = convert_kernels(kernels)
yield updated_kernels
for kern in binary_kernels:
os.remove(kern)
@pytest.mark.parametrize("label_type, kernel_type", [('pds3', 'naif'), ('isis3', 'naif'), ('isis3', 'isis')])
def test_mro_load(test_kernels, label_type, kernel_type):
def test_mro_ctx_load(test_ctx_kernels, label_type, kernel_type):
label_file = get_image_label('B10_013341_1010_XN_79S172W', label_type)
if label_type == 'isis3' and kernel_type == 'isis':
......@@ -32,7 +37,7 @@ def test_mro_load(test_kernels, label_type, kernel_type):
isd_str = ale.loads(label_file)
compare_isd = get_isd('ctx_isis')
else:
isd_str = ale.loads(label_file, props={'kernels': test_kernels})
isd_str = ale.loads(label_file, props={'kernels': test_ctx_kernels})
compare_isd = get_isd('ctx')
isd_obj = json.loads(isd_str)
......@@ -42,8 +47,20 @@ def test_mro_load(test_kernels, label_type, kernel_type):
assert compare_dicts(isd_obj, compare_isd) == []
# ========= Test isislabel and isisspice driver =========
class test_isis_isis(unittest.TestCase):
@pytest.mark.parametrize("label_type, kernel_type", [('isis3', 'naif')])
def test_mro_hirise_load(test_hirise_kernels, label_type, kernel_type):
label_file = get_image_label("PSP_001446_1790_BG12_0", label_type)
isd_str = ale.loads(label_file, props={'kernels': test_hirise_kernels})
compare_isd = get_isd('hirise')
isd_obj = json.loads(isd_str)
comparison = compare_dicts(isd_obj, compare_isd)
print(comparison)
assert comparison == []
# ========= Test ctx isislabel and isisspice driver =========
class test_ctx_isis_isis(unittest.TestCase):
def setUp(self):
label = get_image_label("B10_013341_1010_XN_79S172W", "isis3")
......@@ -61,8 +78,8 @@ class test_isis_isis(unittest.TestCase):
def test_detector_center_sample(self):
assert self.driver.detector_center_sample == 2542.96099
# ========= Test isislabel and naifspice driver =========
class test_isis_naif(unittest.TestCase):
# ========= Test ctx isislabel and naifspice driver =========
class test_ctx_isis_naif(unittest.TestCase):
def setUp(self):
label = get_image_label("B10_013341_1010_XN_79S172W", "isis3")
......@@ -99,8 +116,8 @@ class test_isis_naif(unittest.TestCase):
def test_sensor_model_version(self):
assert self.driver.sensor_model_version == 1
# ========= Test pds3label and naifspice driver =========
class test_pds_naif(unittest.TestCase):
# ========= Test ctx pds3label and naifspice driver =========
class test_ctx_pds_naif(unittest.TestCase):
def setUp(self):
label = get_image_label("B10_013341_1010_XN_79S172W", "pds3")
......@@ -126,3 +143,45 @@ class test_pds_naif(unittest.TestCase):
def test_platform_name(self):
assert self.driver.platform_name == "MARS_RECONNAISSANCE_ORBITER"
# ========= Test hirise isislabel and naifspice driver =========
class test_hirise_isis_naif(unittest.TestCase):
def setUp(self):
label = get_image_label("PSP_001446_1790_BG12_0", "isis3")
self.driver = MroHiRiseIsisLabelNaifSpiceDriver(label)
def test_instrument_id(self):
assert self.driver.instrument_id == "MRO_HIRISE"
def test_sensor_name(self):
assert self.driver.sensor_name == "HIRISE CAMERA"
def test_un_binned_rate(self):
assert self.driver.un_binned_rate == 0.0000836875
def test_ephemeris_start_time(self):
with patch('ale.drivers.mro_drivers.spice.scs2e', return_value=12345) as scs2e:
assert self.driver.ephemeris_start_time == 12344.997489375
scs2e.assert_called_with(-74999, '848201291:62546')
def test_exposure_duration(self):
assert self.driver.exposure_duration == 0.00033475
def test_ccd_ikid(self):
with patch('ale.drivers.mro_drivers.spice.bods2c', return_value=12345) as bods2c:
assert self.driver.ccd_ikid == 12345
bods2c.assert_called_with('MRO_HIRISE_CCD12')
def test_sensor_frame_id(self):
assert self.driver.sensor_frame_id == -74690
def test_detector_center_sample(self):
assert self.driver.detector_center_sample == 0
def test_detector_center_line(self):
assert self.driver.detector_center_sample == 0
def test_sensor_model_version(self):
assert self.driver.sensor_model_version == 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment