Maplet

giant.utilities.stereophotoclinometry:

class giant.utilities.stereophotoclinometry.Maplet(file_name=None, name=None, size=None, scale=None, position_objmap=None, rotation_maplet2body=None, hscale=None, heights=None, albedos=None)[source]

This class is used to read and write from SPC Maplet files.

The Maplet files specify local terrain and albedo data for a landmark.

When creating an instance of this class you can enter the file_name argument and the data will automatically be read from that file. Alternatively you can specify individual components of the object through key word arguments. If you provide both key word arguments and a file name then the key word arguments you specified will overwrite anything read from the file.

Parameters:
  • file_name (Path | str | None) – The name of the Maplet file

  • name (str | None) – the name of the Maplet

  • size (int | None) – half the size of the maplet

  • scale (Real | None) – The ground sample distance of the maplet in units of km

  • position_objmap (Sequence | ndarray | None) – the body-fixed center of the maplet (Landmark)

  • rotation_maplet2body (Sequence | ndarray | None) – The rotation from the local maplet frame to the body fixed frame

  • hscale (Real | None) – The scaling term used to convert maplet heights between a float in units of scale and an integer for file storage.

  • heights (Sequence | ndarray | None) – The height data for the maplet expressed in the local maplet frame as a 2*size+1 by 2*size+1 2D numpy array

  • albedos (Sequence | ndarray | None) – the relative albedo data for the maplet expressed in the local maplet frame as a 2*size+1 by 2*size+1 2D numpy array

file_name: Path | str | None

The name of the landmark file

name: str

The name of the Maplet.

This should be a 6 character string, typically alpha-numeric.

This corresponds to the name of the maplet file, not including the the extension. It is provided for convenience and is not used in either reading or writing.

size: int

Half the number of grid cells on a side for the Maplet minus 1.

This is computed as to size=(n_rows - 1)/2 where n_rows is the number of rows in the Maplet (or number of columns since Maplets are always square).

This corresponds to the 16bit unsigned integer in the 11th and 12th bytes of the maplet file.

scale: float | None

The ground sample distance of each grid cell for the Maplet in units of KM.

This corresponds to the 32bit float in the 7th through 10th bytes of the maplet file.

position_objmap: ndarray

The body-fixed landmark vector in units of km as a length 3 numpy array of floats

This corresponds to the 3 32bit floats in the 16th through 28th bytes of the maplet file.

rotation_maplet2body: ndarray

The rotation matrix from the Maplet local frame to the body-fixed frame as a 3x3 numpy array of floats.

This corresponds to the 9 32bit floats in the 29th-55th bytes of the maplet file..

hscale: Real | None

The scale used to convert heights from a float to a 16byte signed integer in the maplet file.

This corresponds to the 32bit float in the 56th byte of the maplet file.

heights: ndarray

The height profile for the maplet as a 2*size+1 by 2*size+1 2D numpy array

This corresponds to the 16bit signed integers in the remaining data in the maplet file, but have been converted to floats using hscale.

albedos: ndarray

The relative albedo profile for the maplet as a 2*size+1 by 2*size+1 2D numpy array.

this corresponds to the 8 bit unsigned integers in the remaining data in the maplet file, but have been converted to floats

Summary of Methods

get_triangles

This method returns GIANT triangle objects from the maplet data to be used in the GIANT ray tracer

read

This method reads data from a SPC Maplet file (normally MAPFILES/*MAPLETNAME*.MAP) and populates the attributes of this class with that data.

write

This function writes the data contained in the current instance of the class into the specified file