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

Add keyword indexing + constructor #177

Merged
merged 7 commits into from
Feb 6, 2020
Merged

Conversation

mcabbott
Copy link
Contributor

@mcabbott mcabbott commented Jan 27, 2020

This adds the following behaviour:

A = AxisArray(rand(2,5), x=[:a, :b], y=11:15)
A[x=:a]
@btime A[x=:a, y=1] # 5 ns, 0 allocations

I think this was discussed somewhere.... only this comment perhaps?

Edit: this also closes #174, because you can write

A[x=:b, y=13..14]
A[x=:b, y=atvalue(13)]

@timholy
Copy link
Member

timholy commented Feb 2, 2020

This seems like a nice improvement in usability. Let's give folks a couple more days to express concerns, and then I'd favor merging.

@mcabbott
Copy link
Contributor Author

mcabbott commented Feb 2, 2020

Excellent. Should I have a go at updating the readme to use this?

@timholy
Copy link
Member

timholy commented Feb 4, 2020

Given the lack of expressed concerns, sure, that would be great! Note that in addition to the README itself there is a test/readme.jl file.

@mcabbott
Copy link
Contributor Author

mcabbott commented Feb 4, 2020

OK, have added the keyword indexing lines to test/readme.jl too. Have not touched docs/index.md.

I had a go at inserting a paragraph explaining that you can now use keywords, at the top of the readme. It's not great but see what you think?

@mcabbott
Copy link
Contributor Author

mcabbott commented Feb 4, 2020

Test failure was my fault, in that JuliaMath/IntervalSets.jl#57 causes .. to come from EllipsisNotation.jl, and that has a method for A[..]. Should be fixed, except on 1.0.

@timholy timholy merged commit c09954f into JuliaArrays:master Feb 6, 2020
@timholy
Copy link
Member

timholy commented Feb 6, 2020

Thanks for a lovely PR, @mcabbott!

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.

How to select a subset of an AxisArray by keyword?
2 participants