Skip to content

Commit

Permalink
RecipesPipeline: GroupBy: apply idxfilter to errorbars (#4967)
Browse files Browse the repository at this point in the history
* RecipesPipeline: GroupBy: apply idxfilter to errorbars too

Fixes #4917

* modifiy .zenodo.json

---------

Co-authored-by: Simon Christ <[email protected]>
  • Loading branch information
lukas-weber and BeastyBlacksmith authored Oct 2, 2024
1 parent f000fc7 commit 17b6ca0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
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

0 comments on commit 17b6ca0

Please sign in to comment.