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

RecipesPipeline: GroupBy: apply idxfilter to errorbars #4967

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,12 @@
"orcid": "0000-0002-1589-2916",
"type": "Other"
},
{
"affiliation": "Flatiron Institute",
"name": "Lukas Weber",
"orcid": "0000-0003-4949-5529",
"type": "Other"
},
{
"affiliation": "The Alan Turing Institute",
"name": "Penelope Yong",
Expand Down
2 changes: 1 addition & 1 deletion RecipesPipeline/src/group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ filter_data(v::AVec, idxfilter::AVec{Int}) = v[idxfilter]
filter_data(v, idxfilter) = v

function filter_data!(plotattributes::AKW, idxfilter)
for s in (:x, :y, :z)
for s in (:x, :y, :z, :xerror, :yerror, :zerror)
plotattributes[s] = filter_data(get(plotattributes, s, nothing), idxfilter)
end
end
Expand Down
12 changes: 12 additions & 0 deletions RecipesPipeline/test/test_group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,16 @@ lp = map(i -> "xx" * "$(i % 599)", 1:2_000)
RecipesPipeline.GroupBy
@test RecipesPipeline._extract_group_attributes(Dict(:A => [1], :B => [2])) isa
RecipesPipeline.GroupBy

@testset "_filter_input_data!" begin
filtered_keys = [:x, :y, :z, :xerror, :yerror, :zerror]
orig_akw = Dict{Symbol,Any}(k => rand(10) for k in filtered_keys)
orig_akw[:idxfilter] = [1,4,10]

akw = deepcopy(orig_akw)
RecipesPipeline._filter_input_data!(akw)
for k in filtered_keys
@test akw[k] == orig_akw[k][orig_akw[:idxfilter]]
end
end
end
Loading