Skip to content

Commit

Permalink
UVVIS driver and tests (#546)
Browse files Browse the repository at this point in the history
* initial UVVIS Driver notebook and code commit

removing notebook, accidentally included

notebook changes

Fixes code.json for release

Adds 0.8.7 to main

initial driver tests, these still need working on.

adding test kernels

staging tests

typo in function

debugging

added additonal kernels and more debugging

changed label name

* review changes

changed label

import fix

test fixes

* fixed code.json resolves

* removing notebook files

* added the test ISD for clementine UVVIS driver

* adding missing pck kernel file

* remade ISD

* fixing ISD again

* actually fixing the ISD

* reverted code.json

* removing bloat files in test area

* removing more bloat
  • Loading branch information
antonhibl authored Aug 28, 2023
1 parent 5965330 commit 99d0ff0
Show file tree
Hide file tree
Showing 17 changed files with 7,931 additions and 1,419 deletions.
111 changes: 111 additions & 0 deletions ale/drivers/clementine_drivers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import os
import spiceypy as spice
import json
import numpy as np
import pvl

import ale
from ale.base import Driver
from ale.base.label_isis import IsisLabel
from ale.base.data_naif import NaifSpice
from ale.base.type_distortion import RadialDistortion, NoDistortion
from ale.base.type_sensor import Framer, LineScanner
from ale.util import generate_kernels_from_cube
from ale.base.type_sensor import Framer
from ale.base.type_distortion import NoDistortion

from ale import util


class ClementineUvvisIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, Driver):
"""
Driver for reading Ultra-violet Invisible Spectrum ISIS3 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. Therefor they are the same ID that Spice expects in bods2c
calls. Expect instrument_id to be defined in the IsisLabel mixin.
This should be a string of the form NEAR EARTH ASTEROID RENDEZVOUS
Returns
-------
: str
instrument id
"""
lookup_table = {
"UVVIS": "ULTRAVIOLET/VISIBLE CAMERA"
}
return lookup_table[super().instrument_id]

@property
def sensor_name(self):
"""
Returns the name of the instrument
Returns
-------
: str
instrument name
"""
filter = self.label["IsisCube"]['BandBin']['FilterName']
return "CLEM_" + super().instrument_id + "_" + filter

@property
def spacecraft_name(self):
"""
Returns the name of the spacecraft
Returns
-------
: str
spacecraft name
"""
return super().spacecraft_name.replace(" ", "_")

@property
def sensor_model_version(self):
"""
Returns ISIS sensor model version
Returns
-------
: int
ISIS sensor model version
"""
return 1

@property
def ephemeris_start_time(self):
return spice.utc2et(self.utc_start_time.strftime("%Y-%m-%d %H:%M:%S.%f"))

@property
def ephemeris_stop_time(self):
"""
Returns the sum of the starting ephemeris time and the exposure duration.
Expects ephemeris start time and exposure duration to be defined. These
should be double precision numbers containing the ephemeris start and
exposure duration of the image.
Returns
-------
: double
Ephemeris stop time for an image
"""
return self.ephemeris_start_time + self.exposure_duration

@property
def ikid(self):
"""
Overridden to grab the ikid from the Isis Cube since there is no way to
obtain this value with a spice bods2c call. Isis sets this value during
ingestion, based on the original fits file.
Returns
-------
: int
Naif ID used to for identifying the instrument in Spice kernels
"""
return self.label["IsisCube"]["Kernels"]["NaifFrameCode"]
Loading

0 comments on commit 99d0ff0

Please sign in to comment.