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

Define a getindex method for retrieving only a certain collection from a StructArray of Stars? #23

Closed
islent opened this issue Oct 28, 2021 · 1 comment
Labels
discussion enhancement New feature or request

Comments

@islent
Copy link
Member

islent commented Oct 28, 2021

Hello @elehcim, I have the same problem when plotting a certain collection of particles in AstroPlot.jl. For example, I manually filter the collection in https://github.com/JuliaAstroSim/AstroPlot.jl/blob/5cda583666557c88049eb54e99b5e1a6be2c13c5/src/snapshots/positions.jl#L21:

function plot_positionslice!(scene, data, collection::Collection, u::Union{Nothing, Unitful.FreeUnits} = nothing; kw...)
    d = filter(p->p.Collection == collection, data)
    if isempty(d)
        @warn "No $collection particle found."
        return scene
    else
        plot_positionslice!(scene, d, u; kw...)
    end
end

During simulation, particles are transmited between processors. I can't figure out a way to avoid filtering :(

(As metioned in JuliaAstroSim/AstroIO.jl#8)

@islent islent added enhancement New feature or request discussion labels Oct 28, 2021
@islent
Copy link
Member Author

islent commented Oct 28, 2021

Oh, I did not notice #22
Close.
Many thanks!

@islent islent closed this as completed Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant