diff --git a/asdf/tags/transform/__init__.py b/asdf/tags/transform/__init__.py index 8ae518f61..c1cfb0285 100644 --- a/asdf/tags/transform/__init__.py +++ b/asdf/tags/transform/__init__.py @@ -8,5 +8,6 @@ from .projections import * from .polynomial import * from .tabular import * +from .test_fail import * diff --git a/asdf/tags/transform/test_fail-1.1.0.yaml b/asdf/tags/transform/test_fail-1.1.0.yaml new file mode 100644 index 000000000..c9477960a --- /dev/null +++ b/asdf/tags/transform/test_fail-1.1.0.yaml @@ -0,0 +1,13 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/asdf/test_fail-1.1.0" +tag: "tag:stsci.edu:asdf/test_fail-1.1.0" +title: > + Test NRSZCoords + +type: object +properties: + model: + $ref: ../asdf/transform/shift-1.1.0 +required: [model] diff --git a/asdf/tags/transform/test_fail.py b/asdf/tags/transform/test_fail.py new file mode 100644 index 000000000..7be0fd5fc --- /dev/null +++ b/asdf/tags/transform/test_fail.py @@ -0,0 +1,42 @@ +from __future__ import absolute_import, division, unicode_literals, print_function + +from ... import yamlutil +from .basic import TransformType +from astropy.modeling.core import Model + +__all__ = ['TestFailType', 'TestFail'] + + +class TestFail(Model): + """ + Class to compute the z coordinate through the NIRSPEC grating wheel. + + """ + separable = False + + inputs = ("x",) + outputs = ("z",) + + def __init__(self, tab, **kwargs): + self.tab = tab + super(TestFail, self).__init__(**kwargs) + + def evaluate(self, x): + return self.tab(x) + + +class TestFailType(TransformType): + name = "transform/test_fail" + types = [TestFail] + version = "1.1.0" + + + @classmethod + def from_tree_transform(cls, node, ctx): + tab = node['model'] + return TestFail(tab) + + @classmethod + def to_tree_transform(cls, model, ctx): + node = {'model': model.tab} + return yamlutil.custom_tree_to_tagged_tree(node, ctx)