transformation
— Python Frame Transformations¶
The ale.transformation
module
Added in version 0.1.0:
- class ale.transformation.FrameChain(incoming_graph_data=None, **attr)¶
This class is responsible for handling rotations between reference frames. Every node is the reference frame and every edge represents the rotation to between those two nodes. Each edge is directional, where the source –> destination is one rotation and destination –> source is the inverse of that rotation.
Attributes¶
- frame_changeslist
A list of tuples that represent the rotation from one frame to another. These tuples should all be NAIF codes for reference frames
- ephemeris_timelist
A of ephemeris times that need to be rotated for each set of frame rotations in the frame chain
- add_edge(rotation, **kwargs)¶
Add an edge between u and v.
The nodes u and v will be automatically added if they are not already in the graph.
Edge attributes can be specified with keywords or by directly accessing the edge’s attribute dictionary. See examples below.
Parameters¶
- u_of_edge, v_of_edgenodes
Nodes can be, for example, strings or numbers. Nodes must be hashable (and not None) Python objects.
- attrkeyword arguments, optional
Edge data (or labels or objects) can be assigned using keyword arguments.
See Also¶
add_edges_from : add a collection of edges
Notes¶
Adding an edge that already exists updates the edge data.
Many NetworkX algorithms designed for weighted graphs use an edge attribute (by default weight) to hold a numerical value.
Examples¶
The following all add the edge e=(1, 2) to graph G:
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc >>> e = (1, 2) >>> G.add_edge(1, 2) # explicit two-node form >>> G.add_edge(*e) # single edge as tuple of two nodes >>> G.add_edges_from([(1, 2)]) # add edges from iterable container
Associate data to edges using keywords:
>>> G.add_edge(1, 2, weight=3) >>> G.add_edge(1, 3, weight=7, capacity=15, length=342.7)
For non-string attribute keys, use subscript notation.
>>> G.add_edge(1, 2) >>> G[1][2].update({0: 5}) >>> G.edges[1, 2].update({0: 5})
- compute_rotation(source, destination)¶
Returns the rotation to another node. Returns the identity rotation if the other node is this node.
Parameters¶
- sourceint
Integer id for the source node to rotate from
- destinationint
Integer id for the node to rotate into from the source node
Returns¶
- rotationObject
Returns either a TimeDependentRotation object or ConstantRotation object depending on the number of rotations being multiplied together
- last_time_dependent_frame_between(source, destination)¶
Find the last time dependent frame between the source frame and the destination frame.
Parameters¶
- sourceint
Integer id of the source node
- destinationint
Integer of the destination node
Returns¶
- : tuple, None
Returns the source node id, destination node id, and edge dictionary which contains the rotation from source to destination.
- ale.transformation.create_rotations(rotation_table)¶
Convert an ISIS rotation table into rotation objects.
Parameters¶
- rotation_tabledict
The rotation ISIS table as a dictionary
Returns¶
- : list
A list of time dependent or constant rotation objects from the table. This list will always have either 1 or 2 elements. The first rotation will be time dependent and the second rotation will be constant. The rotations will be ordered such that the reference frame the first rotation rotates to is the reference frame the second rotation rotates from.