How to use the gwcs.geometry.FromDirectionCosines function in gwcs

To help you get started, we’ve selected a few gwcs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spacetelescope / gwcs / gwcs / tags / geometry_models.py View on Github external
def from_tree_transform(cls, node, ctx):
        transform_type = node['transform_type']
        if transform_type == 'to_direction_cosines':
            return ToDirectionCosines()
        elif transform_type == 'from_direction_cosines':
            return FromDirectionCosines()
        else:
            raise TypeError(f"Unknown model_type {transform_type}")
github spacetelescope / gwcs / gwcs / geometry.py View on Github external
def inverse(self):
        return FromDirectionCosines()
github spacetelescope / gwcs / gwcs / tags / geometry_models.py View on Github external
"""
ASDF tags for geometry related models.
"""
from asdf import yamlutil
from ..gwcs_types import GWCSTransformType
from .. geometry import (ToDirectionCosines, FromDirectionCosines,
                         SphericalToCartesian, CartesianToSpherical)


__all__ = ['DirectionCosinesType', 'SphericalCartesianType']


class DirectionCosinesType(GWCSTransformType):
    name = "direction_cosines"
    types = [ToDirectionCosines, FromDirectionCosines]
    version = "1.1.0"

    @classmethod
    def from_tree_transform(cls, node, ctx):
        transform_type = node['transform_type']
        if transform_type == 'to_direction_cosines':
            return ToDirectionCosines()
        elif transform_type == 'from_direction_cosines':
            return FromDirectionCosines()
        else:
            raise TypeError(f"Unknown model_type {transform_type}")

    @classmethod
    def to_tree_transform(cls, model, ctx):
        if isinstance(model, FromDirectionCosines):
            transform_type = 'from_direction_cosines'