Skip to content

Commit

Permalink
Merge pull request #49 from nden/add-polynomials
Browse files Browse the repository at this point in the history
add polynomial schemas
  • Loading branch information
mdboom committed Feb 25, 2015
2 parents 4822f6b + 300f652 commit b3ec772
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 0 deletions.
44 changes: 44 additions & 0 deletions schemas/stsci.edu/asdf/0.1.0/transform/polynomial.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/0.1.0/transform/polynomial"
tag: "tag:stsci.edu:asdf/0.1.0/transform/polynomial"
title: >
A Polynomial model.
description: |
A polynomial model represented by its coefficients stored in
an ndarray of shape ``(n+1,)`` for univariate polynomials or ``(n+1, n+1)``
for polynomials with 2 variables, where ``n`` is the highest total degree
of the polynomial.
:math:`P = \sum_{i, j=0}^{i+j=n}c_{ij} * x^{i} * y^{j}`
Invertability: This transform is not automatically invertible.
examples:
-
- :math:`P = 1.2 + 0.3 * x + 56.1 * x^{2}`
- |
!transform/polynomial
coefficients: !core/ndarray
[1.2, 0.3, 56.1]
-
- :math:`P = 1.2 + 0.3 * x + 3 * x * y + 2.1 * y^{2}`
- |
!transform/polynomial
coefficients: !core/ndarray
[[1.2, 0.0, 2.1],
[0.3, 3.0, 0.0],
[0.0, 0.0, 0.0]]
type: object
properties:
coefficients:
description: |
An array with coefficients.
anyOf:
- $ref: ../core/ndarray
- type: array
required: [coefficients]

16 changes: 16 additions & 0 deletions schemas/stsci.edu/asdf/0.1.0/transform/scale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/0.1.0/transform/scale"
tag: "tag:stsci.edu:asdf/0.1.0/transform/scale"
title: >
A Scale model.
description: >
Multiply the input by a factor.
type: object
properties:
factor:
type: number
description: Multiplication factor.
requiredProperties: [factor]
16 changes: 16 additions & 0 deletions schemas/stsci.edu/asdf/0.1.0/transform/shift.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/0.1.0/transform/shift"
tag: "tag:stsci.edu:asdf/0.1.0/transform/shift"
title: >
A Shift opeartion.
description: >
Apply an offset in one direction.
type: object
properties:
offset:
type: number
description: Offset in one direction.
requiredProperties: [offset]
1 change: 1 addition & 0 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
mathjax_path="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
extensions = ['sphinx.ext.mathjax', 'sphinx.ext.ifconfig', 'sphinxext.category']

# Add any paths that contain templates here, relative to this directory.
Expand Down
18 changes: 18 additions & 0 deletions source/schemas/transform.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ Arithmetic operations
stsci.edu/asdf/0.1.0/transform/divide.rst
stsci.edu/asdf/0.1.0/transform/power.rst

Simple Transforms
-----------------

.. toctree::
:maxdepth: 1

stsci.edu/asdf/0.1.0/transform/shift.rst
stsci.edu/asdf/0.1.0/transform/scale.rst

Projections
-----------

Expand All @@ -50,3 +59,12 @@ Projections
stsci.edu/asdf/0.1.0/transform/affine.rst
stsci.edu/asdf/0.1.0/transform/rotate2d.rst
stsci.edu/asdf/0.1.0/transform/tangent.rst

Polynomials
-----------

.. toctree::
:maxdepth: 1

stsci.edu/asdf/0.1.0/transform/polynomial.rst

0 comments on commit b3ec772

Please sign in to comment.