Repository navigation
Generalize selector classes - #18
Conversation
|
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? |
There was a problem hiding this comment.
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.
|
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. |
|
@mdboom I updated asdf-format/asdf-standard#77 to match the changes in this PR. |
|
@nden Is there a good time we can meet next week to discuss this design? |
The
RegionsSelectorclass maps region labels to transforms. One of its parameters is a model which maps inputs to region labels and hands the labels toRegionsSelector. This model (previously calledSelectorMask) 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.
LabelMapperDictis 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
LabelMapperRangeis 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.