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 slicing to ContResult #189

Merged
merged 7 commits into from
Nov 27, 2024
Merged

Add slicing to ContResult #189

merged 7 commits into from
Nov 27, 2024

Conversation

twildi
Copy link

@twildi twildi commented Nov 15, 2024

As one can index into ContResult, it would probably make some sense to be able to slice into it as well.

@twildi twildi marked this pull request as draft November 15, 2024 09:24
@rveltz
Copy link
Member

rveltz commented Nov 15, 2024

Hi,

Thank you for the PR!
How did you come to this, do you find it useful?

Can you add some test to ensure the coverage please?

@twildi
Copy link
Author

twildi commented Nov 18, 2024

I wanted to plot only a subset of the continuation results while still benefiting from the syntactic sugar of the built-in plot methods. Something like

plot(br1[40:60], br2[5:end], vars=(:x, :y))

instead of

plot(br1.x[40:60], br1.y[40:60])
plot!(br2.x[5:end], br2.y[5:end])
scatter!([br1[sp.idx].x for sp in br1.specialpoint if sp.step in 40:60], 
    [br1[sp.idx].y for sp in br1.specialpoint if sp.step in 40:60])
...

If this is of interest, I'll play around with it some more and add some tests.

@rveltz
Copy link
Member

rveltz commented Nov 18, 2024

Yes, it is a cool idea! If you add a test, Ill merge your PR.

@twildi twildi marked this pull request as ready for review November 19, 2024 13:54
@twildi
Copy link
Author

twildi commented Nov 19, 2024

Okay, I think it's ready to merge.

I also fixed a bug in Base.getindex(br::ContResult, k::Int) where in the case of save_eig_every_step >= 2 indexing into the ContResult would return the eigenvalues/eigenvectors for the wrong step.

@rveltz
Copy link
Member

rveltz commented Nov 27, 2024

Great for solving the bug I did not see. Thank you for all this !!!

@rveltz rveltz merged commit 85d4273 into bifurcationkit:master Nov 27, 2024
1 check passed
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