label_mapper-1.1.0¶
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. The label_mapper returns the label corresponding to given inputs. The regions_selector returns the transform corresponding to this label. This maps inputs (e.g. pixels on a detector) to transforms uniquely.
Outline
Schema Definitions ¶
This node must validate against all of the following:
This type is an object with the following properties:
mapper
object Required 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.
This node must validate against any of the following:
This type is an object with the following properties:
labels
No length restrictionarray Items in the array must be any of the following types:
number
- No length restriction
array
Items in the array are restricted to the following types:
number
models
No length restrictionarray Items in the array are restricted to the following types:
inputs
array No length restrictionNames of inputs.
Items in the array are restricted to the following types:
No length restrictionstring
inputs_mapping
transform-1.1.0 atol
number absolute tolerance to compare keys in mapper.
no_label
object Fill in value for missing output.
This node must validate against any of the following:
number
- No length restriction
string
Examples ¶
Map array indices are to labels.:
!transform/label_mapper-1.1.0
mapper: !core/ndarray-1.0.0
[[1, 0, 2],
[1, 0, 2],
[1, 0, 2]]
Map numbers dictionary to transforms which return labels.:
!transform/label_mapper-1.1.0
mapper: !!omap
- !!omap
labels: [-1.67833272, -1.9580548, -1.118888]
- !!omap
models:
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 6.0}
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 2.0}
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 4.0}
inputs: [x, y]
inputs_mapping: !transform/remap_axes-1.1.0
mapping: [0]
n_inputs: 2
Map a number within a range of numbers to transforms which return labels.:
!transform/label_mapper-1.1.0
mapper: !!omap
- !!omap
labels:
- [3.2, 4.1]
- [2.67, 2.98]
- [1.95, 2.3]
- !!omap
models:
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 6.0}
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 2.0}
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 4.0}
inputs: [x, y]
inputs_mapping: !transform/remap_axes-1.1.0
mapping: [0]
n_inputs: 2
Original Schema ¶
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/transform/label_mapper-1.1.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:schemas/regions_selector-1.1.0). The
[label_mapper](ref:schemas/label_mapper-1.1.0)
returns the label corresponding to given inputs. The
[regions_selector](ref:schemas/regions_selector-1.1.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.
- |
!transform/label_mapper-1.1.0
mapper: !core/ndarray-1.0.0
[[1, 0, 2],
[1, 0, 2],
[1, 0, 2]]
-
- Map numbers dictionary to transforms which return labels.
- |
!transform/label_mapper-1.1.0
mapper: !!omap
- !!omap
labels: [-1.67833272, -1.9580548, -1.118888]
- !!omap
models:
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 6.0}
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 2.0}
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 4.0}
inputs: [x, y]
inputs_mapping: !transform/remap_axes-1.1.0
mapping: [0]
n_inputs: 2
-
- Map a number within a range of numbers to transforms which return labels.
- |
!transform/label_mapper-1.1.0
mapper: !!omap
- !!omap
labels:
- [3.2, 4.1]
- [2.67, 2.98]
- [1.95, 2.3]
- !!omap
models:
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 6.0}
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 2.0}
- !transform/compose-1.1.0
forward:
- !transform/remap_axes-1.1.0
mapping: [1]
- !transform/shift-1.1.0 {offset: 4.0}
inputs: [x, y]
inputs_mapping: !transform/remap_axes-1.1.0
mapping: [0]
n_inputs: 2
allOf:
- $ref: "transform-1.1.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: "../core/ndarray-1.0.0"
- $ref: "transform-1.1.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: "transform-1.1.0"
inputs:
type: array
items:
type: string
description: |
Names of inputs.
inputs_mapping:
$ref: "transform-1.1.0"
description: |
[mapping](ref:schemas/remap_axes-1.1.0)
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]
...