Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional model schemas #225

Merged
merged 9 commits into from
Mar 27, 2020

Conversation

cshanahan1
Copy link
Contributor

Added schemas for all of the functional models except the few which are already done under polynomial (linear, multiply, shift, scale). If this is merged, #224 can be closed because this also includes the gaussians.

@cshanahan1 cshanahan1 force-pushed the functional_model_schemas branch 2 times, most recently from f25d7ec to 7fc0b39 Compare March 4, 2020 06:07
Copy link
Contributor

@eslavich eslavich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add examples to these new schemas as well -- the asdf pytest plugin uses them to construct test instances and asserts that they validate under the schema and round-trip successfully.

Can you also add a version_map-1.5.0.yaml? It should be a copy of version_map-1.4.0.yaml with your new schemas added. One of the tests enforces that the list be in alphabetical order, so watch out for that.

- $ref: "../unit/quantity-1.1.0"
- type: number
description: Effective (half-light) radius.
n:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nden @perrygreenfield do you have an opinion on matching the modeling package parameter names vs using a name that is more descriptive? If someone were to inspect an asdf file written under this schema, they'd just see n and the schema description wouldn't be readily available. We could name it sersic_index, for example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good practice for the ASDF representation to be more descriptive. Nothing requires it to use the same name that the modeling package uses.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this particular case i personally think the parameter n is widely understood to be the sersic index, but there are certainly other cases where this issue would apply

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think names which are widely accepted should be used both in modeling and asdf.
For models which have definitions in the VO standard I think we should try to use the same names. I was going to suggest checking all names against the VO definitions when moving the transforms out of the standard.

@cshanahan1
Copy link
Contributor Author

yep, I'll add tests and make a new version map. speaking of - i'm trying to figure out why the tests are failing for #224 and I thought it was because the new schemas weren't in the map so I added them but the tests are still failing. even though that can be closed once this PR is good to go, i'd like to get those tests passing there now so I know exactly what I need to do for this one.

@eslavich
Copy link
Contributor

eslavich commented Mar 5, 2020

yep, I'll add tests and make a new version map. speaking of - i'm trying to figure out why the tests are failing for #224 and I thought it was because the new schemas weren't in the map so I added them but the tests are still failing. even though that can be closed once this PR is good to go, i'd like to get those tests passing there now so I know exactly what I need to do for this one.

This turned out to be an issue with the schema testing code -- it couldn't handle schemas whose Type classes don't exist yet. I opened a PR (asdf-format/asdf#771) to fix the problem.

Copy link
Contributor

@eslavich eslavich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are looking great, I just have a few more take-it-or-leave-it comments

- |
!transform/box1d-1.0.0
amplitude: 10.0
bounding_box: [-0.5, 3.5]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since bounding_box isn't part of transform-1.2.0, should we wait until transform-1.3.0 to include it in the examples?

Or, maybe we should go ahead and create transform-1.3.0 now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I go ahead make 1.3.0 and then have just the new models use this version? also, why is 1.1.0 the exact same as 1.0.0 (similarly, when does it make sense to make a new version of transform?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nden what do you think? I'm inclined to say yes, just so we don't have to release the standard again right away.

I don't know why 1.1.0 was created with no changes -- it could be that at the time we assumed that the schema versions had to stay identical to the standard version.

- type: object
properties:
amplitude:
anyOf:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tangential to this PR, but at some point we should consider creating a schema for a quantity-or-number type, since that gets used all over the place.

schemas/stsci.edu/asdf/transform/airydisk2d-1.0.0.yaml Outdated Show resolved Hide resolved
@nden
Copy link
Contributor

nden commented Mar 13, 2020

This looks good! One thing I noticed is a transform schema is not added to versionmap-1.5.0.

@eslavich Does it make sense to add a check in the tester that a version of every schema is included in versionmap files?

@eslavich
Copy link
Contributor

This looks good! One thing I noticed is a transform schema is not added to versionmap-1.5.0.

@eslavich Does it make sense to add a check in the tester that a version of every schema is included in versionmap files?

There is a check, here, but I removed schema fragments (such as transform) from the version map in my refactor, since they don't have a tag field and aren't intended to be directly serializable.

@cshanahan1
Copy link
Contributor Author

In my latest commit I added some new non-functional-model schemas in here too.

@nden by a transform schema is not added to versionmap-1.5.0, do you mean that transform/transform-1.x.x all be in there too? If thats the case, that's not happening in the old version maps either. Also, should I create 1.3.0 and include the bounding box?

@nden
Copy link
Contributor

nden commented Mar 13, 2020

@shannnnnyyy Ed clarified he deliberately removed schema fragments, like transform-1... from versionmap files.

I am not sure what the best way to deal with bounding_box is. It is currently handled in the tag code as an optional attribute and is validated in modeling at some level. Does it belong in the standard or is it a Python specific implementation detail? Also is it going to change in the future? Perhaps this needs more discussion.

@cshanahan1
Copy link
Contributor Author

oh sorry i missed that comment! i'll leave the 1.3.0 thing alone then, and just keep adding new schemas here as I write them.

Copy link
Contributor

@nden nden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me and I am going to approve it but if you want to add more schemas here - feel free to do so.

@nden nden requested a review from eslavich March 26, 2020 13:53
Copy link
Contributor

@eslavich eslavich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, you're a schema machine!

@nden nden merged commit fb7abd7 into asdf-format:master Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants