-
Notifications
You must be signed in to change notification settings - Fork 14
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
How should dimnames -> axes names work? #86
Comments
I think that when last I tried, making For point 2. the problem this aims to solve is the creation of new arrays which carry some of the same names? You may enjoy some experiments in NamedPlus.jl which do this for
|
I hadn't even thought of size returning names. The main reason I'm interested in this is because it's used a lot in ImageCore.jl there's a whole packages, ImageAxes that built on this feature of AxisArrays. |
I see, but this is about AxisArrays's nontrivial "axes", not |
To be clear, I'm not saying there shouldn't be a comparable functionality for My personal preference would be that |
Sure. My point with the |
I really like the idea of approaching it from point 2, but then what does NamedDims.jl offer that couldn't be more conveniently incorporated into NamedIndices.jl? Just use a struct that wraps an array and it's accompanying axes like NamedIndices is trying to do. This would avoid rewriting all of the array interface again. |
I forgot about this issue. I was at a conference. Note: all the following also apply to
AxisArrays and Base both defining slightly different semantics for different functions call One fairly easy solution would be for NamedDims.jl to define
(That should nest happily with IndexedDims overloading Then if a package is transitioning from the use of |
I have no idea what this comment is talking about sorry. In general NamedDims takes care of everything to do with the names. |
I implemented some glue code very similar to this elsewhere https://github.com/JuliaImages/ImageCore.jl/blob/master/src/traits.jl#L42. I think it's probably the right solution, but at some point we need to figure out how our names will by compatible with the keys of a |
To my mind when people end up in circumstances like that, it is a sign that they should have resolved all wildcards first -- since if they want to access something by name, they had better know what that name is before they do so. With your trait based approach, could detect the duplicate named and if so say that it doesn't have names. |
Sorry, I meant IndexDims. It's a fair point though that this functions could be simpler to implement separately.
I think that logically makes sense, but it would change how we do some things with images right now. Maybe I should make a PR and see if I can figure out how to connect all the dots on paper. |
I've mentioned this in a more rambly post here, but I thought it would be good to specifically address how to propagate names to axes. Specifically, how should one get the axes (e.g.,
axes(NamedDimsArray)
) and access the names in a concise and meaningful way?As I see it there are 3 possible ways for this to happen:
NamedTuple
Tuple
returned byaxes
.NamedTuple
that permits repeated names.The first one would only work if each name is completely unique, so there would have to be defaults for wild card names. We'd also have to address a lot of the instances in base where indexing is accomplished by iterating through a tuple (e.g.
to_indices
).The second one would require making a novel type for a named index.
The third is what is currently happening and would mean we do nothing for this particular issue, but is pretty obnoxious.
The text was updated successfully, but these errors were encountered: