diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8ae69f..7ed88e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,16 @@ jobs: strategy: matrix: include: + - name: Python 3.12 Schema validation tests + python-version: '3.12' + os: ubuntu-latest + toxenv: py312 + + - name: Python 3.11 Schema validation tests + python-version: '3.11' + os: ubuntu-latest + toxenv: py311 + - name: Python 3.10 Schema validation tests python-version: '3.10' os: ubuntu-latest @@ -28,11 +38,6 @@ jobs: os: ubuntu-latest toxenv: py39 - - name: Python 3.8 Schema validation tests - python-version: 3.8 - os: ubuntu-latest - toxenv: py38 - - name: Twine check python-version: 3.9 os: ubuntu-latest @@ -91,6 +96,8 @@ jobs: python-version: 3.9 - name: Install asdf-wcs-schemas run: cd asdf-wcs-schemas && pip install . + - name: Install older pytest + run: pip install "pytest<8.1" - name: Install gwcs run: cd gwcs && pip install -e .[test] - name: Pip Freeze diff --git a/CHANGES.rst b/CHANGES.rst index 4dbc41c..66dbf23 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,8 @@ +0.3.1 (unreleased) +------------------ + +- Update schemas for ASDF standard 1.6.0. [#59] + 0.3.0 (2023-11-28) ------------------ diff --git a/pyproject.toml b/pyproject.toml index 4e085a8..c32db1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,22 +2,22 @@ name = 'asdf_wcs_schemas' description = 'ASDF WCS schemas' readme = 'README.md' -requires-python = '>=3.8' +requires-python = '>=3.9' license = { file = 'LICENSE' } authors = [{ name = 'The ASDF Developers', email = 'help@stsci.edu' }] classifiers = [ 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Development Status :: 5 - Production/Stable', ] dependencies = [ - 'asdf-standard >= 1.0.1', - 'asdf-transform-schemas >= 0.3.0', - 'asdf-unit-schemas >= 0.1.0', - 'importlib_resources >= 3; python_version<"3.9"', + 'asdf-standard >= 1.1.0', + 'asdf-transform-schemas >= 0.5.0', + 'asdf-coordinates-schemas >= 0.3.0', ] dynamic = ['version'] @@ -43,7 +43,6 @@ docs = [ ] test = [ 'pytest >= 4.6.0', - 'pytest-openfiles >= 0.5.0', 'asdf >= 2.8.0', 'asdf-astropy', ] diff --git a/resources/manifests/gwcs-1.3.0.yaml b/resources/manifests/gwcs-1.3.0.yaml new file mode 100644 index 0000000..61f4b24 --- /dev/null +++ b/resources/manifests/gwcs-1.3.0.yaml @@ -0,0 +1,124 @@ +%YAML 1.1 +--- +id: asdf://asdf-format.org/astronomy/gwcs/manifests/gwcs-1.3.0 +extension_uri: asdf://asdf-format.org/astronomy/gwcs/extensions/gwcs-1.3.0 +title: gwcs extension 1.3.0 +description: |- + A set of tags for serializing STScI gwcs models. +asdf_standard_requirement: + gte: 1.6.0 +tags: +- tag_uri: tag:stsci.edu:gwcs/celestial_frame-1.1.0 + schema_uri: http://stsci.edu/schemas/gwcs/celestial_frame-1.1.0 + title: A celestial frame + description: |- + Represents a celestial frame +- tag_uri: tag:stsci.edu:gwcs/composite_frame-1.0.0 + schema_uri: http://stsci.edu/schemas/gwcs/composite_frame-1.0.0 + title: A set of frames + description: |- + Represents a set of frames +- tag_uri: "tag:stsci.edu:gwcs/direction_cosines-1.2.0" + schema_uri: "http://stsci.edu/schemas/gwcs/direction_cosines-1.2.0" + title: > + Convert coordinates between vector and direction cosine form. + description: | + This schema is for transforms which convert to and from direction cosines. +- tag_uri: "tag:stsci.edu:gwcs/frame2d-1.1.0" + schema_uri: "http://stsci.edu/schemas/gwcs/frame2d-1.1.0" + title: > + Represents a 2D frame. + description: | + Represents a 2D frame. +- tag_uri: "tag:stsci.edu:gwcs/frame-1.1.0" + schema_uri: "http://stsci.edu/schemas/gwcs/frame-1.1.0" + title: | + The base class of all coordinate frames. + description: | + These objects are designed to be nested in arbitrary ways to build up + transformation pipelines out of a number of low-level pieces. +- tag_uri: "tag:stsci.edu:gwcs/grating_equation-1.2.0" + schema_uri: "http://stsci.edu/schemas/gwcs/grating_equation-1.2.0" + title: > + A grating equation model. + description: | + Supports two models: + - Given incident angle and wavelength compute the refraction/difraction angle. + - Given an incident angle and a refraction angle compute the wavelength. +- tag_uri: "tag:stsci.edu:gwcs/label_mapper-1.2.0" + schema_uri: "http://stsci.edu/schemas/gwcs/label_mapper-1.2.0" + title: > + Represents a mapping from a coordinate value to a label. + description: | + A label mapper instance maps inputs to a label. It is used together + with + [regions_selector](ref:regions_selector-1.2.0). The + [label_mapper](ref:label_mapper-1.2.0) + returns the label corresponding to given inputs. The + [regions_selector](ref:regions_selector-1.2.0) + returns the transform corresponding to this label. This maps inputs + (e.g. pixels on a detector) to transforms uniquely. +- tag_uri: "tag:stsci.edu:gwcs/regions_selector-1.2.0" + schema_uri: "http://stsci.edu/schemas/gwcs/regions_selector-1.2.0" + title: > + Represents a discontinuous transform. + description: | + Maps regions to transgorms and evaluates the transforms with the corresponding inputs. +- tag_uri: "tag:stsci.edu:gwcs/sellmeier_glass-1.2.0" + schema_uri: "http://stsci.edu/schemas/gwcs/sellmeier_glass-1.2.0" + title: > + Sellmeier equation for glass + description: | + Sellmeier equation for glass. + + $$ n(\\lambda)^2 = 1 + \\frac{(B1 * \\lambda^2 )}{(\\lambda^2 - C1)} + + \\frac{(B2 * \\lambda^2 )}{(\\lambda^2 - C2)} + + \\frac{(B3 * \\lambda^2 )}{(\\lambda^2 - C3)} $$ +- tag_uri: "tag:stsci.edu:gwcs/sellmeier_zemax-1.2.0" + schema_uri: "http://stsci.edu/schemas/gwcs/sellmeier_zemax-1.2.0" + title: Sellmeier equation for glass used by Zemax + description: | + Sellmeier equation for glass used by Zemax +- tag_uri: "tag:stsci.edu:gwcs/snell3d-1.2.0" + schema_uri: "http://stsci.edu/schemas/gwcs/snell3d-1.2.0" + title: Snell Law in 3D space + description: | + Snell Law in 3D. + Inputs are index of refraction and direction cosines. + Outputs are direction cosines. +- tag_uri: "tag:stsci.edu:gwcs/spectral_frame-1.1.0" + schema_uri: "http://stsci.edu/schemas/gwcs/spectral_frame-1.1.0" + title: > + Represents a spectral frame. + description: > +- tag_uri: "tag:stsci.edu:gwcs/spherical_cartesian-1.2.0" + schema_uri: "http://stsci.edu/schemas/gwcs/spherical_cartesian-1.2.0" + title: > + Convert coordinates between spherical and Cartesian coordinates. + description: | + This schema is for transforms which convert between spherical coordinates + (on the unit sphere) and Cartesian coordinates. +- tag_uri: "tag:stsci.edu:gwcs/step-1.2.0" + schema_uri: "http://stsci.edu/schemas/gwcs/step-1.2.0" + title: > + Describes a single step of a WCS transform pipeline. + description: > +- tag_uri: "tag:stsci.edu:gwcs/stokes_frame-1.0.0" + schema_uri: "http://stsci.edu/schemas/gwcs/stokes_frame-1.0.0" + title: > + Represents a stokes frame + description: > +- tag_uri: "tag:stsci.edu:gwcs/temporal_frame-1.1.0" + schema_uri: "http://stsci.edu/schemas/gwcs/temporal_frame-1.1.0" + title: > + Represents a temporal frame. + description: > +- tag_uri: "tag:stsci.edu:gwcs/wcs-1.3.0" + schema_uri: "http://stsci.edu/schemas/gwcs/wcs-1.3.0" + title: > + A system for describing generalized world coordinate transformations. + description: > + ASDF WCS is a way of specifying transformations (usually from + detector space to world coordinate space and back) by using the + transformations in the `transform-schema` module. +... diff --git a/resources/schemas/stsci.edu/gwcs/celestial_frame-1.1.0.yaml b/resources/schemas/stsci.edu/gwcs/celestial_frame-1.1.0.yaml new file mode 100644 index 0000000..49d8878 --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/celestial_frame-1.1.0.yaml @@ -0,0 +1,25 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/celestial_frame-1.1.0" + +title: > + Represents a celestial frame. + +allOf: + - type: object + properties: + axes_names: + minItems: 2 + maxItems: 3 + + axes_order: + minItems: 2 + maxItems: 3 + + unit: + minItems: 2 + maxItems: 3 + + - $ref: frame-1.1.0 +... diff --git a/resources/schemas/stsci.edu/gwcs/direction_cosines-1.2.0.yaml b/resources/schemas/stsci.edu/gwcs/direction_cosines-1.2.0.yaml new file mode 100644 index 0000000..f108ad4 --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/direction_cosines-1.2.0.yaml @@ -0,0 +1,38 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/direction_cosines-1.2.0" + +title: > + Convert coordinates between vector and direction cosine form. + +description: | + This schema is for transforms which convert to and from direction cosines. + +examples: + - + - Convert direction cosines to vectors. + - asdf-standard-1.6.0 + - | + + ! + transform_type: from_direction_cosines + + - + - Convert vectors to directional cosines. + - asdf-standard-1.6.0 + - | + ! + transform_type: to_direction_cosines + +allOf: + - $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + - object: + properties: + transform_type: + description: | + The type of transform/class to initialize. + type: string + enum: [to_direction_cosines, from_direction_cosines] + required: [transform_type] +... diff --git a/resources/schemas/stsci.edu/gwcs/frame-1.1.0.yaml b/resources/schemas/stsci.edu/gwcs/frame-1.1.0.yaml new file mode 100644 index 0000000..10b0bcd --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/frame-1.1.0.yaml @@ -0,0 +1,85 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/frame-1.1.0" +title: | + The base class of all coordinate frames. + +description: | + These objects are designed to be nested in arbitrary ways to build up + transformation pipelines out of a number of low-level pieces. + +examples: + - + - | + A celestial frame in the ICRS reference frame. + - asdf-standard-1.6.0 + - | + ! + axes_names: [lon, lat] + name: CelestialFrame + reference_frame: ! + frame_attributes: {} + unit: [!unit/unit-1.0.0 deg, !unit/unit-1.0.0 deg] + + - + - | + A pixel frame in three dimensions + - asdf-standard-1.6.0 + - | + ! + axes_names: [raster position, slit position, wavelength] + axes_order: [0, 1, 2] + axes_type: [SPATIAL, SPATIAL, SPECTRAL] + name: pixel + naxes: 3 + unit: [!unit/unit-1.0.0 pixel, !unit/unit-1.0.0 pixel, !unit/unit-1.0.0 pixel] + +type: object +properties: + name: + description: | + A user-friendly name for the frame. + type: string + + axes_order: + description: | + The order of the axes. + type: array + items: + type: integer + + axes_names: + description: | + The name of each axis in this frame. + type: array + items: + anyOf: + - type: string + - type: 'null' + + reference_frame: + description: | + The reference frame. + $ref: "http://astropy.org/schemas/astropy/coordinates/frames/baseframe-1.1.0" + + unit: + description: | + Units for each axis. + type: array + items: + $ref: "http://stsci.edu/schemas/asdf/unit/unit-1.0.0" + + axis_physical_types: + description: | + An iterable of strings describing the physical type for each world axis. + These should be names from the VO UCD1+ controlled Vocabulary + (http://www.ivoa.net/documents/latest/UCDlist.html). + type: array + items: + type: + string + +required: [name] +additionalProperties: true +... diff --git a/resources/schemas/stsci.edu/gwcs/frame2d-1.1.0.yaml b/resources/schemas/stsci.edu/gwcs/frame2d-1.1.0.yaml new file mode 100644 index 0000000..5620a0f --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/frame2d-1.1.0.yaml @@ -0,0 +1,36 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/frame2d-1.1.0" + +title: > + Represents a 2D frame. + +examples: + - + - | + A two dimensional spatial frame + - | + ! + axes_names: [lon, lat] + name: Frame2D + unit: [!unit/unit-1.0.0 pixel, !unit/unit-1.0.0 pixel] + + +allOf: + - type: object + properties: + axes_names: + minItems: 2 + maxItems: 2 + + axes_order: + minItems: 2 + maxItems: 2 + + unit: + minItems: 2 + maxItems: 2 + + - $ref: frame-1.1.0 +... diff --git a/resources/schemas/stsci.edu/gwcs/grating_equation-1.2.0.yaml b/resources/schemas/stsci.edu/gwcs/grating_equation-1.2.0.yaml new file mode 100644 index 0000000..0586284 --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/grating_equation-1.2.0.yaml @@ -0,0 +1,52 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/grating_equation-1.2.0" + +title: > + A grating equation model. +description: | + Supports two models: + - Given incident angle and wavelength compute the refraction/difraction angle. + - Given an incident angle and a refraction angle compute the wavelength. + +examples: + - + - AnglesFromGratingEquation3D model. + - asdf-standard-1.6.0 + - | + ! + groove_density: 2700.0 + order: 2.0 + output: angle + + - + - WavelengthFromGratingEquation model. + - asdf-standard-1.6.0 + - | + ! + groove_density: 2700.0 + order: 2.0 + output: wavelength + +allOf: + - $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + - type: object + properties: + groove_density: + description: | + The groove density of the grating + anyOf: + - type: number + - $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.2.0" + order: + description: | + Spectral order + type: number + output: + type: string + description: | + indicates which quantity the grating equation is solved for. + enum: [wavelength, angle] + required: [groove_density, order, output] +... diff --git a/resources/schemas/stsci.edu/gwcs/label_mapper-1.0.0.yaml b/resources/schemas/stsci.edu/gwcs/label_mapper-1.0.0.yaml index ea19975..d34a2b3 100644 --- a/resources/schemas/stsci.edu/gwcs/label_mapper-1.0.0.yaml +++ b/resources/schemas/stsci.edu/gwcs/label_mapper-1.0.0.yaml @@ -17,7 +17,7 @@ description: | examples: - - Map array indices are to labels. - + - asdf-standard-1.5.0 - | ! mapper: !core/ndarray-1.0.0 diff --git a/resources/schemas/stsci.edu/gwcs/label_mapper-1.1.0.yaml b/resources/schemas/stsci.edu/gwcs/label_mapper-1.1.0.yaml index 92cc184..06b9ffd 100644 --- a/resources/schemas/stsci.edu/gwcs/label_mapper-1.1.0.yaml +++ b/resources/schemas/stsci.edu/gwcs/label_mapper-1.1.0.yaml @@ -17,7 +17,7 @@ description: | examples: - - Map array indices are to labels. - + - asdf-standard-1.5.0 - | ! mapper: !core/ndarray-1.0.0 diff --git a/resources/schemas/stsci.edu/gwcs/label_mapper-1.2.0.yaml b/resources/schemas/stsci.edu/gwcs/label_mapper-1.2.0.yaml new file mode 100644 index 0000000..6a69969 --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/label_mapper-1.2.0.yaml @@ -0,0 +1,129 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/label_mapper-1.2.0" +title: > + Represents a mapping from a coordinate value to a label. +description: | + A label mapper instance maps inputs to a label. It is used together + with + [regions_selector](ref:regions_selector-1.2.0). The + [label_mapper](ref:label_mapper-1.2.0) + returns the label corresponding to given inputs. The + [regions_selector](ref:regions_selector-1.2.0) + returns the transform corresponding to this label. This maps inputs + (e.g. pixels on a detector) to transforms uniquely. + +examples: + - + - Map array indices are to labels. + - asdf-standard-1.6.0 + - | + ! + mapper: !core/ndarray-1.1.0 + data: + - [1, 0, 2] + - [1, 0, 2] + - [1, 0, 2] + datatype: int64 + shape: [3, 3] + no_label: 0 + + - + - Map numbers dictionary to transforms which return labels. + - asdf-standard-1.6.0 + - | + ! + atol: 1.0e-08 + inputs: [x, y] + inputs_mapping: !transform/remap_axes-1.4.0 + mapping: [0] + n_inputs: 2 + mapper: !!omap + - !!omap + labels: [-1.67833272, -1.9580548, -1.118888] + - !!omap + models: + - !transform/shift-1.2.0 {offset: 6.0} + - !transform/shift-1.2.0 {offset: 2.0} + - !transform/shift-1.2.0 {offset: 4.0} + no_label: 0 + + - + - Map a number within a range of numbers to transforms which return labels. + - asdf-standard-1.6.0 + - | + ! + mapper: !!omap + - !!omap + labels: + - [3.2, 4.1] + - [2.67, 2.98] + - [1.95, 2.3] + - !!omap + models: + - !transform/shift-1.3.0 {offset: 6.0} + - !transform/shift-1.3.0 {offset: 2.0} + - !transform/shift-1.3.0 {offset: 4.0} + inputs: [x, y] + inputs_mapping: !transform/remap_axes-1.4.0 + mapping: [0] + n_inputs: 2 + +allOf: + - $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + - type: object + properties: + mapper: + description: | + A mapping of inputs to labels. + In the general case this is a `astropy.modeling.core.Model`. + + It could be a numpy array with the shape of the detector/observation. + Pixel values are of type integer or string and represent + region labels. Pixels which are not within any region have value ``no_label``. + + It could be a dictionary which maps tuples to labels or floating point numbers to labels. + + anyOf: + - $ref: "http://stsci.edu/schemas/asdf/core/ndarray-1.1.0" + - $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + - type: object + properties: + labels: + type: array + items: + anyOf: + - type: number + - type: array + items: + type: number + minLength: 2 + maxLength: 2 + models: + type: array + items: + $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + + inputs: + type: array + items: + type: string + description: | + Names of inputs. + inputs_mapping: + $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + description: | + [mapping](https://asdf-standard.readthedocs.io/en/latest/generated/stsci.edu/asdf/transform/remap_axes-1.4.0.html) + atol: + type: number + description: | + absolute tolerance to compare keys in mapper. + no_label: + description: | + Fill in value for missing output. + anyOf: + - type: number + - type: string + required: [mapper] +... diff --git a/resources/schemas/stsci.edu/gwcs/regions_selector-1.0.0.yaml b/resources/schemas/stsci.edu/gwcs/regions_selector-1.0.0.yaml index 211a697..242cd26 100644 --- a/resources/schemas/stsci.edu/gwcs/regions_selector-1.0.0.yaml +++ b/resources/schemas/stsci.edu/gwcs/regions_selector-1.0.0.yaml @@ -10,6 +10,7 @@ description: | examples: - - Create a regions_selector schema for 2 regions, labeled "1" and "2". + - asdf-standard-1.5.0 - | ! inputs: [x, y] diff --git a/resources/schemas/stsci.edu/gwcs/regions_selector-1.1.0.yaml b/resources/schemas/stsci.edu/gwcs/regions_selector-1.1.0.yaml index a0c3ed4..40e1745 100644 --- a/resources/schemas/stsci.edu/gwcs/regions_selector-1.1.0.yaml +++ b/resources/schemas/stsci.edu/gwcs/regions_selector-1.1.0.yaml @@ -10,6 +10,7 @@ description: | examples: - - Create a regions_selector schema for 2 regions, labeled "1" and "2". + - asdf-standard-1.5.0 - | ! inputs: [x, y] diff --git a/resources/schemas/stsci.edu/gwcs/regions_selector-1.2.0.yaml b/resources/schemas/stsci.edu/gwcs/regions_selector-1.2.0.yaml new file mode 100644 index 0000000..a282548 --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/regions_selector-1.2.0.yaml @@ -0,0 +1,105 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/regions_selector-1.2.0" +title: > + Represents a discontinuous transform. +description: | + Maps regions to transgorms and evaluates the transforms with the corresponding inputs. + +examples: + - + - Create a regions_selector schema for 2 regions, labeled "1" and "2". + - asdf-standard-1.6.0 + - | + ! + inputs: [x, y] + label_mapper: ! + mapper: !core/ndarray-1.1.0 + datatype: int8 + data: + - [0, 1, 1, 0, 2, 0] + - [0, 1, 1, 0, 2, 0] + - [0, 1, 1, 0, 2, 0] + - [0, 1, 1, 0, 2, 0] + - [0, 1, 1, 0, 2, 0] + datatype: int64 + shape: [5, 6] + no_label: 0 + outputs: [ra, dec, lam] + selector: !!omap + - !!omap + labels: [1, 2] + - !!omap + transforms: + - !transform/compose-1.3.0 + forward: + - !transform/remap_axes-1.4.0 + mapping: [0, 1, 1] + - !transform/concatenate-1.3.0 + forward: + - !transform/concatenate-1.3.0 + forward: + - !transform/shift-1.3.0 {offset: 1.0} + - !transform/shift-1.3.0 {offset: 2.0} + - !transform/shift-1.3.0 {offset: 3.0} + - !transform/compose-1.3.0 + forward: + - !transform/remap_axes-1.4.0 + mapping: [0, 1, 1] + - !transform/concatenate-1.3.0 + forward: + - !transform/concatenate-1.3.0 + forward: + - !transform/scale-1.3.0 {factor: 2.0} + - !transform/scale-1.3.0 {factor: 3.0} + - !transform/scale-1.3.0 {factor: 3.0} + undefined_transform_value: .nan + + +allOf: + - $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + - type: object + properties: + label_mapper: + description: | + An instance of + [label_mapper-1.1.0](ref:label_mapper-1.2.0) + $ref: "./label_mapper-1.2.0" + inputs: + description: | + Names of inputs. + type: array + items: + type: string + outputs: + description: | + Names of outputs. + type: array + items: + type: string + selector: + description: | + A mapping of regions to trransforms. + type: object + properties: + labels: + description: | + An array of unique region labels. + type: array + items: + type: + - integer + - string + transforms: + description: | + A transform for each region. The order should match the order of labels. + type: array + items: + $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + undefined_transform_value: + description: | + Value to be returned if there's no transform defined for the inputs. + type: number + required: [label_mapper, inputs, outputs, selector] +... diff --git a/resources/schemas/stsci.edu/gwcs/sellmeier_glass-1.2.0.yaml b/resources/schemas/stsci.edu/gwcs/sellmeier_glass-1.2.0.yaml new file mode 100644 index 0000000..c547799 --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/sellmeier_glass-1.2.0.yaml @@ -0,0 +1,38 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/sellmeier_glass-1.2.0" +title: Sellmeier equation for glass + +description: | + Sellmeier equation for glass. + + $$ n(\\lambda)^2 = 1 + \\frac{(B1 * \\lambda^2 )}{(\\lambda^2 - C1)} + + \\frac{(B2 * \\lambda^2 )}{(\\lambda^2 - C2)} + + \\frac{(B3 * \\lambda^2 )}{(\\lambda^2 - C3)} $$ + +allOf: + - $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + - type: object + properties: + B_coef: + description: | + B coefficients in Sellmeier equation. + anyOf: + - type: array + - $ref: "http://stsci.edu/schemas/asdf/core/ndarray-1.1.0" + items: + type: number + minItems: 3 + maxItems: 3 + C_coef: + description: | + C coefficients in Sellmeier equation. + anyOf: + - type: array + - $ref: "http://stsci.edu/schemas/asdf/core/ndarray-1.1.0" + items: + type: number + minItems: 3 + maxItems: 3 +... diff --git a/resources/schemas/stsci.edu/gwcs/sellmeier_zemax-1.2.0.yaml b/resources/schemas/stsci.edu/gwcs/sellmeier_zemax-1.2.0.yaml new file mode 100644 index 0000000..c670ad2 --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/sellmeier_zemax-1.2.0.yaml @@ -0,0 +1,72 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/sellmeier_zemax-1.2.0" +title: Sellmeier equation for glass used by Zemax + +description: | + Sellmeier equation for glass used by Zemax + +allOf: + - $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + - type: object + properties: + B_coef: + description: | + B coefficients in Sellmeier equation. + anyOf: + - type: array + - $ref: "http://stsci.edu/schemas/asdf/core/ndarray-1.1.0" + items: + type: number + minItems: 3 + maxItems: 3 + C_coef: + description: | + C coefficients in Sellmeier equation. + anyOf: + - type: array + - $ref: "http://stsci.edu/schemas/asdf/core/ndarray-1.1.0" + items: + type: number + minItems: 3 + maxItems: 3 + D_coef: + description: | + Thermal D coefficients of the glass. + anyOf: + - type: array + - $ref: "http://stsci.edu/schemas/asdf/core/ndarray-1.1.0" + items: + type: number + minItems: 3 + maxItems: 3 + E_coef: + description: | + Thermal E coefficients of the glass. + anyOf: + - type: array + - $ref: "http://stsci.edu/schemas/asdf/core/ndarray-1.1.0" + items: + type: number + minItems: 3 + maxItems: 3 + ref_temperature: + description: | + Reference temperature of the glass in Kelvin. + type: number + ref_pressure: + description: | + Reference pressure of the glass in ATM. + type: number + temperature: + description: | + System temperature in Kelvin. + type: number + pressure: + description: | + System pressure in ATM. + type: number + required: [B_coef, C_coef, D_coef, E_coef, ref_temperature, + ref_pressure, temperature, pressure] +... diff --git a/resources/schemas/stsci.edu/gwcs/snell3d-1.2.0.yaml b/resources/schemas/stsci.edu/gwcs/snell3d-1.2.0.yaml new file mode 100644 index 0000000..87be47a --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/snell3d-1.2.0.yaml @@ -0,0 +1,13 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/snell3d-1.2.0" +title: Snell Law in 3D space + +description: | + Snell Law in 3D. + Inputs are index of refraction and direction cosines. + Outputs are direction cosines. + +$ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" +... diff --git a/resources/schemas/stsci.edu/gwcs/spectral_frame-1.1.0.yaml b/resources/schemas/stsci.edu/gwcs/spectral_frame-1.1.0.yaml new file mode 100644 index 0000000..78a804b --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/spectral_frame-1.1.0.yaml @@ -0,0 +1,30 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/spectral_frame-1.1.0" + +title: > + Represents a spectral frame. +allOf: + - type: object + properties: + reference_position: + description: | + The position of the reference frame. + enum: [geocenter, barycenter, heliocenter] + default: geocenter + + axes_names: + minItems: 1 + maxItems: 1 + + axes_order: + minItems: 1 + maxItems: 1 + + unit: + minItems: 1 + maxItems: 1 + + - $ref: frame-1.1.0 +... diff --git a/resources/schemas/stsci.edu/gwcs/spherical_cartesian-1.0.0.yaml b/resources/schemas/stsci.edu/gwcs/spherical_cartesian-1.0.0.yaml index 7936238..ada2d64 100644 --- a/resources/schemas/stsci.edu/gwcs/spherical_cartesian-1.0.0.yaml +++ b/resources/schemas/stsci.edu/gwcs/spherical_cartesian-1.0.0.yaml @@ -13,15 +13,14 @@ description: | examples: - - Convert spherical coordinates to Cartesian coordinates. - + - asdf-standard-1.5.0 - | - ! transform_type: spherical_to_cartesian - - Convert Cartesian coordinates to spherical coordinates. - + - asdf-standard-1.5.0 - | ! transform_type: cartesian_to_spherical diff --git a/resources/schemas/stsci.edu/gwcs/spherical_cartesian-1.1.0.yaml b/resources/schemas/stsci.edu/gwcs/spherical_cartesian-1.1.0.yaml index a16b11c..6a1393a 100644 --- a/resources/schemas/stsci.edu/gwcs/spherical_cartesian-1.1.0.yaml +++ b/resources/schemas/stsci.edu/gwcs/spherical_cartesian-1.1.0.yaml @@ -13,7 +13,7 @@ description: | examples: - - Convert spherical coordinates to Cartesian coordinates. - + - asdf-standard-1.5.0 - | ! @@ -21,7 +21,7 @@ examples: - - Convert Cartesian coordinates to spherical coordinates. - + - asdf-standard-1.5.0 - | ! transform_type: cartesian_to_spherical diff --git a/resources/schemas/stsci.edu/gwcs/spherical_cartesian-1.2.0.yaml b/resources/schemas/stsci.edu/gwcs/spherical_cartesian-1.2.0.yaml new file mode 100644 index 0000000..dc9bb1d --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/spherical_cartesian-1.2.0.yaml @@ -0,0 +1,45 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/spherical_cartesian-1.2.0" + +title: > + Convert coordinates between spherical and Cartesian coordinates. + +description: | + This schema is for transforms which convert between spherical coordinates + (on the unit sphere) and Cartesian coordinates. + +examples: + - + - Convert spherical coordinates to Cartesian coordinates. + - asdf-standard-1.6.0 + - | + ! + transform_type: spherical_to_cartesian + wrap_lon_at: 360 + + - + - Convert Cartesian coordinates to spherical coordinates. + - asdf-standard-1.6.0 + - | + ! + transform_type: cartesian_to_spherical + wrap_lon_at: 360 + +allOf: + - $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + - object: + properties: + wrap_lon_at: + description: Angle at which to wrap the longitude angle. + type: integer + enum: [180, 360] + default: 360 + transform_type: + description: The type of transform/class to initialize. + type: string + enum: [spherical_to_cartesian, cartesian_to_spherical] + + required: [transform_type, wrap_lon_at] +... diff --git a/resources/schemas/stsci.edu/gwcs/step-1.2.0.yaml b/resources/schemas/stsci.edu/gwcs/step-1.2.0.yaml new file mode 100644 index 0000000..6dfc5cb --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/step-1.2.0.yaml @@ -0,0 +1,32 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/step-1.2.0" + +title: > + Describes a single step of a WCS transform pipeline. +description: > +examples: [] + +type: object +properties: + frame: + description: | + The frame of the inputs to the transform. + anyOf: + - type: string + - $ref: frame-1.1.0 + + transform: + description: | + The transform from this step to the next one. The + last step in a WCS should not have a transform, but + exists only to describe the frames and units of the + final output axes. + anyOf: + - $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.3.0" + - type: 'null' + default: null + +required: [frame] +... diff --git a/resources/schemas/stsci.edu/gwcs/temporal_frame-1.1.0.yaml b/resources/schemas/stsci.edu/gwcs/temporal_frame-1.1.0.yaml new file mode 100644 index 0000000..c0d1f36 --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/temporal_frame-1.1.0.yaml @@ -0,0 +1,56 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/temporal_frame-1.1.0" + +title: > + Represents a temporal frame. + + +type: object +properties: + name: + description: | + A user-friendly name for the frame. + type: string + + axes_order: + description: | + The order of the axes. + type: array + items: + type: integer + + axes_names: + description: | + The name of each axis in this frame. + type: array + items: + anyOf: + - type: string + - type: 'null' + + reference_frame: + description: | + The reference frame. + $ref: "http://stsci.edu/schemas/asdf/time/time-1.2.0" + + unit: + description: | + Units for each axis. + type: array + items: + $ref: "http://stsci.edu/schemas/asdf/unit/unit-1.0.0" + + axis_physical_types: + description: | + An iterable of strings describing the physical type for each world axis. + These should be names from the VO UCD1+ controlled Vocabulary + (http://www.ivoa.net/documents/latest/UCDlist.html). + type: array + items: + type: + string + +required: [name] +... diff --git a/resources/schemas/stsci.edu/gwcs/wcs-1.3.0.yaml b/resources/schemas/stsci.edu/gwcs/wcs-1.3.0.yaml new file mode 100644 index 0000000..61eb2ac --- /dev/null +++ b/resources/schemas/stsci.edu/gwcs/wcs-1.3.0.yaml @@ -0,0 +1,43 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://stsci.edu/schemas/gwcs/wcs-1.3.0" + +title: > + A system for describing generalized world coordinate transformations. +description: > + ASDF WCS is a way of specifying transformations (usually from + detector space to world coordinate space and back) by using the + transformations in the `transform-schema` module. +type: object +properties: + name: + description: | + A descriptive name for this WCS. + type: string + + pixel_shape: + description: | + The optional shape of the data that the WCS applies to as an array + in ``(x, y)`` order (where for an image, ``x`` is the horizontal + coordinate and ``y`` is the vertical coordinate) or ``None`` if not + defined for this WCS. + anyOf: + - type: 'null' + - type: array + + steps: + description: | + A list of steps in the forward transformation from detector to + world coordinates. + The inverse transformation is determined automatically by + reversing this list, and inverting each of the individual + transforms according to the rules described in + [inverse](https://asdf-standard.readthedocs.io/en/latest/generated/stsci.edu/asdf/transform/transform-1.2.0.html#inverse). + type: array + items: + $ref: step-1.2.0 + +required: [name, steps] +additionalProperties: true +... diff --git a/tox.ini b/tox.ini index 4c343ee..ce443e7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist= py38,twine,black,flake8,bandit +envlist= py39,py310,py311,py312,twine,black,flake8,bandit isolated_build = True [testenv]