Skip to content

Generalize selector classes - #18

Merged
nden merged 7 commits into
spacetelescope:masterfrom
nden:generalize-selector
Aug 20, 2015
Merged

nden merged 7 commits into
spacetelescope:masterfrom
nden:generalize-selector

Conversation

@nden

@nden nden commented Aug 14, 2015

Copy link
Copy Markdown
Collaborator

The RegionsSelector class maps region labels to transforms. One of its parameters is a model which maps inputs to region labels and hands the labels to RegionsSelector. This model (previously called SelectorMask) worked only with arrays.

The old name was not very descriptive. This model takes the same inputs as RegionsSelector and returns matching labels so I changed the name to LabelMapperArray (I'm open to other suggestions).

Two other common cases are implemented here.
LabelMapperDict is represented by a dict with {number: transform} pairs. The model takes the same inputs as RegionsSelector and uses one of the inputs to match a key in the dictionary. It returns the result of evaluating the transform which must be a label.

Similarly LabelMapperRange is represented by a dict {(a_min, a_max) : transform} pairs where each key represents a range of numbers. The model takes the same inputs as RegionsSelector and uses one of the inputs to find the range it falls into. It evaluates the corresponding transform and returns a label. The keys must represent non-overlapping ranges.

Any comments? @perrygreenfield @mdboom @embray

I will include the corresponding schema and readers/writers in a separate PR.

@embray

embray commented Aug 18, 2015

Copy link
Copy Markdown

I'm not really sure I understand this yet, but I haven't been following the gwcs development at all. Could you provide a little more background for how this is used (in person is fine too) so I can comment usefully?

Comment thread gwcs/selector.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I wonder if it wouldn't be useful to define a dtype for vertices and make this formally an array of vertices (naturally, an array of pairs like this could be directly viewed as an array of vertices). It would just enforce the data format more clearly I think.

@nden

nden commented Aug 20, 2015

Copy link
Copy Markdown
Collaborator Author

I am going to merge this soon (to meet a deadline) and will refactor later. I am still interested in comments about the approach and implementation.

@nden

nden commented Aug 20, 2015

Copy link
Copy Markdown
Collaborator Author

@mdboom I updated asdf-format/asdf-standard#77 to match the changes in this PR.

nden added a commit that referenced this pull request Aug 20, 2015
@nden
nden merged commit e698b5f into spacetelescope:master Aug 20, 2015
@embray

embray commented Aug 21, 2015

Copy link
Copy Markdown

@nden Is there a good time we can meet next week to discuss this design?

@nden
nden deleted the generalize-selector branch November 6, 2017 14:06
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.

2 participants