Skip to content

Commit

Permalink
Adds band time offset
Browse files Browse the repository at this point in the history
  • Loading branch information
amystamile-usgs committed Mar 7, 2024
1 parent 3e92e2d commit ec981ac
Show file tree
Hide file tree
Showing 4 changed files with 294 additions and 238 deletions.
2 changes: 1 addition & 1 deletion ale/base/type_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def ephemeris_stop_time(self):
: double
Center ephemeris time for an image
"""
return self.ephemeris_start_time + (self.interframe_delay) * (self.num_frames - 1) + self.exposure_duration
return self.ephemeris_start_time + (self.interframe_delay * self.num_frames)



Expand Down
54 changes: 42 additions & 12 deletions ale/drivers/ody_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def ikid(self):
return self.label['IsisCube']['Kernels']['NaifFrameCode']

@property
def ephemeris_start_time(self):
def start_time(self):
"""
The starting ephemeris time, in seconds
Expand All @@ -214,7 +214,7 @@ def ephemeris_start_time(self):
: double
Starting ephemeris time in seconds
"""
og_start_time = super().ephemeris_start_time
og_start_time = spice.str2et(self.utc_start_time.strftime("%Y-%m-%d %H:%M:%S.%f"))

offset = self.label["IsisCube"]["Instrument"]["SpacecraftClockOffset"]
if isinstance(offset, pvl.collections.Quantity):
Expand All @@ -225,7 +225,21 @@ def ephemeris_start_time(self):
# if not milliseconds, the units are probably seconds
offset = offset.value

return og_start_time + offset - ((self.exposure_duration / 1000) / 2)
return og_start_time + offset - (self.exposure_duration / 2)

@property
def ephemeris_start_time(self):
"""
Returns the ephemeris start time of the image.
Expects spacecraft_id to be defined. This should be the integer
Naif ID code for the spacecraft.
Returns
-------
: float
ephemeris start time of the image
"""
return self.band_times[0]

@property
def focal_length(self):
Expand Down Expand Up @@ -264,13 +278,29 @@ def sampling_factor(self):
return self.label['IsisCube']['Instrument']['SpatialSumming']

@property
def filter_number(self):
"""
Return the filter number from the cube label
def interframe_delay(self):
return self.label['IsisCube']['Instrument']['InterframeDelay']

@property
def band_times(self):
self._num_bands = self.label["IsisCube"]["Core"]["Dimensions"]["Bands"]
times = []

Returns
-------
: int
The filter number
"""
return self.label['IsisCube']['BandBin']['FilterNumber']
org_bands = self.label["IsisCube"]["BandBin"]["FilterNumber"]

for vband in range(self._num_bands):
if isinstance(org_bands, (list, tuple)):
timeband = org_bands[vband]
else:
timeband = org_bands

if 'ReferenceBand' in self.label['IsisCube']['Instrument']:
ref_band = self.label['IsisCube']['Instrument']['ReferenceBand']
wavelength_to_timeband = [2, 5, 3, 4, 1]
timeband = wavelength_to_timeband[ref_band - 1]

band_offset = ((timeband - 1) * self.interframe_delay) - (self.exposure_duration / 2.0)

time = self.start_time + band_offset
times.append(time)
return times
Loading

0 comments on commit ec981ac

Please sign in to comment.