regions_selector-1.1.0

Represents a discontinuous transform.

Description

Maps regions to transgorms and evaluates the transforms with the corresponding inputs.

Outline

Schema Definitions

This node must validate against all of the following:

  • This type is an object with the following properties:

    • label_mapper

      ./label_mapper-1.1.0Required

      An instance of label_mapper-1.1.0

    • inputs

      arrayRequired

      Names of inputs.

      No length restriction

      Items in the array are restricted to the following types:

      string

      No length restriction
    • outputs

      arrayRequired

      Names of outputs.

      No length restriction

      Items in the array are restricted to the following types:

      string

      No length restriction
    • selector

      objectRequired

      A mapping of regions to trransforms.

      This type is an object with the following properties:

      • labels

        array

        An array of unique region labels.

        No length restriction

        Items in the array are restricted to the following types:

        [‘integer’, ‘string’]

      • transforms

        array

        A transform for each region. The order should match the order of labels.

        No length restriction

        Items in the array are restricted to the following types:

    • undefined_transform_value

      number

      Value to be returned if there’s no transform defined for the inputs.

Examples

Create a regions_selector schema for 2 regions, labeled “1” and “2”.:

!<tag:stsci.edu:gwcs/regions_selector-1.1.0>
  inputs: [x, y]
  label_mapper: !<tag:stsci.edu:gwcs/label_mapper-1.1.0>
    mapper: !core/ndarray-1.0.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.2.0
      forward:
      - !transform/remap_axes-1.3.0
        mapping: [0, 1, 1]
      - !transform/concatenate-1.2.0
        forward:
        - !transform/concatenate-1.2.0
          forward:
          - !transform/shift-1.2.0 {offset: 1.0}
          - !transform/shift-1.2.0 {offset: 2.0}
        - !transform/shift-1.2.0 {offset: 3.0}
    - !transform/compose-1.2.0
      forward:
      - !transform/remap_axes-1.3.0
        mapping: [0, 1, 1]
      - !transform/concatenate-1.2.0
        forward:
        - !transform/concatenate-1.2.0
          forward:
          - !transform/scale-1.2.0 {factor: 2.0}
          - !transform/scale-1.2.0 {factor: 3.0}
        - !transform/scale-1.2.0 {factor: 3.0}
  undefined_transform_value: .nan

Original Schema

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/gwcs/regions_selector-1.1.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.5.0
    - |
        !<tag:stsci.edu:gwcs/regions_selector-1.1.0>
          inputs: [x, y]
          label_mapper: !<tag:stsci.edu:gwcs/label_mapper-1.1.0>
            mapper: !core/ndarray-1.0.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.2.0
              forward:
              - !transform/remap_axes-1.3.0
                mapping: [0, 1, 1]
              - !transform/concatenate-1.2.0
                forward:
                - !transform/concatenate-1.2.0
                  forward:
                  - !transform/shift-1.2.0 {offset: 1.0}
                  - !transform/shift-1.2.0 {offset: 2.0}
                - !transform/shift-1.2.0 {offset: 3.0}
            - !transform/compose-1.2.0
              forward:
              - !transform/remap_axes-1.3.0
                mapping: [0, 1, 1]
              - !transform/concatenate-1.2.0
                forward:
                - !transform/concatenate-1.2.0
                  forward:
                  - !transform/scale-1.2.0 {factor: 2.0}
                  - !transform/scale-1.2.0 {factor: 3.0}
                - !transform/scale-1.2.0 {factor: 3.0}
          undefined_transform_value: .nan


allOf:
  - $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.2.0"
  - type: object
    properties:
      label_mapper:
        description: |
          An instance of
          [label_mapper-1.1.0](ref:label_mapper-1.1.0)
        $ref: "./label_mapper-1.1.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.2.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]
...