Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added and updated docstrings #610

Merged
merged 7 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 124 additions & 11 deletions ale/base/base.py

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion ale/base/data_isis.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def rotate_state(table, rotation):
return rotated_pos, rotated_vel, ephemeris_times

class IsisSpice():
"""Mixin class for reading from an ISIS cube that has been spiceinit'd
"""
Mixin class for reading from an ISIS cube that has been spiceinit'd

Attributes
----------
Expand Down Expand Up @@ -602,6 +603,15 @@ def odtk(self):

@property
def sensor_frame_id(self):
"""
Returns the Naif ID code for the sensor reference frame.

Returns
-------
: int
NAIF ID associated with the sensor frame

"""
if 'ConstantFrames' in self.inst_pointing_table:
return self.inst_pointing_table['ConstantFrames'][0]
else:
Expand All @@ -610,6 +620,14 @@ def sensor_frame_id(self):

@property
def target_frame_id(self):
"""
The NAIF ID associated with the target body.

Returns
-------
: int
NAIF ID associated with the target body
"""
if 'ConstantFrames' in self.body_orientation_table:
return self.body_orientation_table['ConstantFrames'][0]
else:
Expand Down
9 changes: 9 additions & 0 deletions ale/base/data_naif.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,15 @@ def sensor_position(self):

@property
def frame_chain(self):
"""
Return the root node of the rotation frame tree/chain.

Returns
-------
FrameNode
The root node of the frame tree. This will always be the J2000 reference frame.
"""

if not hasattr(self, '_frame_chain'):
nadir = self._props.get('nadir', False)
exact_ck_times = self._props.get('exact_ck_times', True)
Expand Down
15 changes: 14 additions & 1 deletion ale/base/label_isis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ class IsisLabel():

@property
def label(self):
"""
Return the cube label.

Returns
-------
pvl.PVLModule
The cube label as a PVLModule object.

Raises
------
ValueError
Raised when an invalid label is provided.
"""
if not hasattr(self, "_label"):
if isinstance(self._file, pvl.PVLModule):
self._label = self._file
Expand Down Expand Up @@ -137,7 +150,7 @@ def sample_summing(self):
@property
def line_summing(self):
"""
the number of detector lines summed to produce each image sample
The number of detector lines summed to produce each image sample

Returns
-------
Expand Down
33 changes: 28 additions & 5 deletions ale/base/label_pds3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ class Pds3Label():

@property
def label(self):
"""
Return the PDS3 label.

Returns
-------
pvl.PVLModule
The cube label as a PVLModule object.

Raises
------
ValueError
Raised when an invalid label is provided.
"""
if not hasattr(self, "_label"):
if isinstance(self._file, pvl.PVLModule):
self._label = self._file
Expand Down Expand Up @@ -78,7 +91,7 @@ def instrument_host_name(self):
"""
Returns the full name of the instrument host

Returns
Returns
-------
: str
Full name of the instrument host
Expand All @@ -104,7 +117,7 @@ def spacecraft_name(self):
"""
Returns the name of the spacecraft

Returns
Returns
-------
: str
Full name of the spacecraft
Expand All @@ -117,7 +130,7 @@ def utc_start_time(self):
"""
Returns the start time of the image as a UTC string

Returns
Returns
-------
: str
Start time of the image in UTC YYYY-MM-DDThh:mm:ss[.fff]
Expand All @@ -130,7 +143,7 @@ def utc_stop_time(self):
"""
Returns the stop time of the image as a UTC string

Returns
Returns
-------
: str
Stop time of the image in UTC YYYY-MM-DDThh:mm:ss[.fff]
Expand All @@ -141,7 +154,9 @@ def utc_stop_time(self):
@property
def image_lines(self):
"""
Returns
Returns the number of lines in the image.

Returns
-------
: int
Number of lines in the image
Expand All @@ -152,6 +167,8 @@ def image_lines(self):
@property
def image_samples(self):
"""
Returns the number of samples in the image.

Returns
-------
: int
Expand Down Expand Up @@ -251,6 +268,9 @@ def crosstrack_summing(self):
@property
def spacecraft_clock_start_count(self):
"""
The spacecraft clock start count, frequently used to determine the start time
of the image.

Returns
-------
: str
Expand All @@ -262,6 +282,9 @@ def spacecraft_clock_start_count(self):
@property
def spacecraft_clock_stop_count(self):
"""
The spacecraft clock stop count, frequently used to determine the stop time
of the image.

Returns
-------
: str
Expand Down
23 changes: 23 additions & 0 deletions ale/base/type_distortion.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ def usgscsm_distortion_model(self):
class ChandrayaanMrffrDistortion():
@property
def usgscsm_distortion_model(self):
"""
Returns the specification for ChandrayaanMrffr distortion in usgscsm.
AustinSanders marked this conversation as resolved.
Show resolved Hide resolved

Returns
-------
: dict
Dictionary containing the usgscsm specification for ChandrayaanMrffr distortion.
"""

transx = [-1* self.scaled_pixel_height, self.scaled_pixel_height, 0.0]
transy = [0,0,0]
transs = [1.0, 1.0 / self.scaled_pixel_height, 0.0]
Expand All @@ -172,7 +181,14 @@ def usgscsm_distortion_model(self):
class LoDistortion():
@property
def usgscsm_distortion_model(self):
"""
Returns the specification for Lo distortion in usgscsm.

Returns
-------
: dict
Dictionary containing the usgscsm specification for Lo distortion.
"""
# From ISIS LoHighDistortionMap::SetDistortion()
# Get the perspective correction factors for x and y and the distortion
# center (point of symmetry of distortion)
Expand All @@ -197,7 +213,14 @@ def usgscsm_distortion_model(self):
class ThemisIrDistortion():
@property
def usgscsm_distortion_model(self):
"""
Returns the specification for ThemisIR distortion in usgscsm.

Returns
-------
: dict
Dictionary containing the usgscsm specification for ThemisIR distortion.
"""
return {
"themisir":{
"p_alpha1" : 0.00447623,
Expand Down
33 changes: 33 additions & 0 deletions ale/base/type_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,54 @@ def ephemeris_time(self):

@property
def framelet_height(self):
"""
Return the number of lines in a framelet.

Returns
-------
int
The number of lines in each framelet.
"""
return 1


@property
def framelet_order_reversed(self):
"""
Return a boolean indicating if the framelets are reversed.

Returns
-------
Bool
A boolean indicating if the framelets are reversed.
"""
return False


@property
def framelets_flipped(self):
"""
Return a boolean indicating if the framelets are flipped.

Returns
-------
Bool
A boolean indicating if the framelets are flipped.
"""

return False


@property
def num_frames(self):
"""
Return the number of frames in the image.

Returns
-------
int
The number of frames in the image.
"""
return int(self.image_lines // self.framelet_height)

@property
Expand Down
Loading
Loading