Skip to content
Snippets Groups Projects
Commit c3dbfd46 authored by Jesse Mapel's avatar Jesse Mapel
Browse files

Added a quick start guide to the docs & restructured Pythong docs (#378)

* Added loads docs

* Added other base driver mix-ins

* Simple quick start guide

* minor clean up

* Added quick start and cleaned up

* Combined mix-in files

* Fixed label data name

* Restructured Python docs

* Added Python rotation docs

* PR review updates

* Updated label_data description
parent a2c93cf1
Branches
Tags
No related merge requests found
Showing
with 116 additions and 10 deletions
...@@ -9,6 +9,10 @@ from ale.rotation import TimeDependentRotation ...@@ -9,6 +9,10 @@ from ale.rotation import TimeDependentRotation
from ale import util from ale import util
class NaifSpice(): class NaifSpice():
"""
Mix-in for reading data from NAIF SPICE Kernels.
"""
def __enter__(self): def __enter__(self):
""" """
Called when the context is created. This is used Called when the context is created. This is used
...@@ -29,6 +33,30 @@ class NaifSpice(): ...@@ -29,6 +33,30 @@ class NaifSpice():
@property @property
def kernels(self): def kernels(self):
"""
Get the NAIF SPICE Kernels to furnish
There are two ways to specify which kernels a driver will use:
1. Passing the 'kernels' property into load(s) or at instantiation.
This can be either a straight iterable or a dictionary that specifies
the kernels in ISIS style ('TargetPosition', 'InstrumentPosition', etc).
2. Set the ALESPICEROOT environment variable. This variable should be
the path to a directory that contains directories whose naming
convention matches the PDS Kernel Archives format,
`shortMissionName-versionInfo`. The directory corresponding to the
driver's mission will be searched for the approriate meta kernel to
load.
See Also
--------
ale.util.get_kernels_from_isis_pvl : Function used to parse ISIS style dict
ale.util.get_metakernels : Function that searches ALESPICEROOT for meta kernels
ale.util.generate_kernels_from_cube : Helper function to get an ISIS style dict
from an ISIS cube that has been through
spiceinit
"""
if not hasattr(self, '_kernels'): if not hasattr(self, '_kernels'):
if 'kernels' in self._props.keys(): if 'kernels' in self._props.keys():
try: try:
......
import pvl import pvl
class IsisLabel(): class IsisLabel():
"""
Mix-in for parsing ISIS Cube labels.
"""
@property @property
def label(self): def label(self):
......
import pvl import pvl
class Pds3Label(): class Pds3Label():
"""
Mix-in for parsing PDS3 PVL labels.
"""
@property @property
def label(self): def label(self):
......
class RadialDistortion(): class RadialDistortion():
"""
Mix-in for sensors that use a radial distortion model.
"""
@property @property
def usgscsm_distortion_model(self): def usgscsm_distortion_model(self):
""" """
...@@ -18,6 +22,10 @@ class RadialDistortion(): ...@@ -18,6 +22,10 @@ class RadialDistortion():
class NoDistortion(): class NoDistortion():
"""
Mix-in for sensors and data sets that do not have a distortion model.
"""
@property @property
def usgscsm_distortion_model(self): def usgscsm_distortion_model(self):
""" """
......
import numpy as np import numpy as np
class LineScanner(): class LineScanner():
"""
Mix-in for line scan sensors.
"""
@property @property
def name_model(self): def name_model(self):
...@@ -70,6 +73,10 @@ class LineScanner(): ...@@ -70,6 +73,10 @@ class LineScanner():
return self.ephemeris_start_time + (self.image_lines * self.exposure_duration) return self.ephemeris_start_time + (self.image_lines * self.exposure_duration)
class Framer(): class Framer():
"""
Mix-in for framing sensors.
"""
@property @property
def name_model(self): def name_model(self):
""" """
...@@ -114,6 +121,10 @@ class Framer(): ...@@ -114,6 +121,10 @@ class Framer():
return self.ephemeris_start_time + self.exposure_duration return self.ephemeris_start_time + self.exposure_duration
class Radar(): class Radar():
"""
Mix-in for synthetic aperture radar sensors.
"""
@property @property
def name_model(self): def name_model(self):
""" """
......
...@@ -55,7 +55,12 @@ class AleJsonEncoder(json.JSONEncoder): ...@@ -55,7 +55,12 @@ class AleJsonEncoder(json.JSONEncoder):
def load(label, props={}, formatter='ale', verbose=False): def load(label, props={}, formatter='ale', verbose=False):
""" """
Attempt to load a given label from all possible drivers Attempt to load a given label from all possible drivers.
This function opens up the label file and attempts to produce an ISD in the
format specified using the supplied properties. Drivers are tried sequentially
until an ISD is successfully created. Drivers that use external ephemeris
data are tested before drivers that use attached epehemeris data.
Parameters Parameters
---------- ----------
...@@ -64,13 +69,23 @@ def load(label, props={}, formatter='ale', verbose=False): ...@@ -64,13 +69,23 @@ def load(label, props={}, formatter='ale', verbose=False):
props : dict props : dict
A dictionary of optional keywords/parameters for use in driver A dictionary of optional keywords/parameters for use in driver
loading loading. Each driver specifies its own set of properties to use.
For example, Drivers that use the NaifSpice mix-in use the 'kernels'
property to specify an explicit set of kernels and load order.
formatter : str formatter : {'ale', 'isis', 'usgscsm'}
Formatted output to expect from the driver Output format for the ISD. As of 0.8.0, it is recommended that
the `ale` formatter is used. The `isis` and `usgscsm` formatters
are retrained for backwards compatability.
verbose : bool verbose : bool
If True, displays error messages from driver loading If True, displays debug output specifying which drivers were
attempted and why they failed.
Returns
-------
dict
The ISD as a dictionary
""" """
if isinstance(formatter, str): if isinstance(formatter, str):
formatter = __formatters__[formatter] formatter = __formatters__[formatter]
...@@ -99,5 +114,19 @@ def load(label, props={}, formatter='ale', verbose=False): ...@@ -99,5 +114,19 @@ def load(label, props={}, formatter='ale', verbose=False):
raise Exception('No Such Driver for Label') raise Exception('No Such Driver for Label')
def loads(label, props='', formatter='ale', verbose=False): def loads(label, props='', formatter='ale', verbose=False):
"""
Attempt to load a given label from all possible drivers.
This function is the same as load, except it returns a JSON formatted string.
Returns
-------
str
The ISD as a JSON formatted string
See Also
--------
load
"""
res = load(label, props, formatter, verbose=verbose) res = load(label, props, formatter, verbose=verbose)
return json.dumps(res, cls=AleJsonEncoder) return json.dumps(res, cls=AleJsonEncoder)
...@@ -9,3 +9,4 @@ Ephemeris Abstraction Library ...@@ -9,3 +9,4 @@ Ephemeris Abstraction Library
:maxdepth: 3 :maxdepth: 3
library/index library/index
tutorials/index
:mod:`concrete-drivers` --- Concrete Sensor Driver
==================================================
The classes in these modules are the concrete drivers that are composed from
the base :py:class:`ale.base.base.Driver` class and various mix-ins classes.
.. toctree::
co_driver
dawn_driver
hayabusa2_driver
isis_ideal_driver
juno_driver
lro_driver
mess_driver
mex_driver
mro_driver
nh_driver
ody_driver
selene_driver
tgo_driver
viking_driver
voyager_driver
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment