Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
Update function signatures
  • Loading branch information
Rosejoycrocker committed Nov 4, 2024
1 parent d2f4772 commit 409bfba
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
32 changes: 31 additions & 1 deletion ext/AvizExt/viz/location_selection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,34 @@ function ADRIA.viz.ranks_to_frequencies(
return f
end

"""
ADRIA.viz.selection_criteria_map(rs::Union{Domain,ResultSet}, decision_matrix::YAXArray, scores::Vector{Float64};
criteria::Vector{Symbol}=Array(decision_matrix.criteria), opts::OPT_TYPE=DEFAULT_OPT_TYPE(), fig_opts::OPT_TYPE=set_figure_defaults(DEFAULT_OPT_TYPE()),
axis_opts::OPT_TYPE=set_axis_defaults(DEFAULT_OPT_TYPE()))
ADRIA.viz.selection_criteria_map!(g::Union{GridLayout,GridPosition}, rs::Union{Domain,ResultSet}, decision_matrix::YAXArray,
scores::Vector{Float64}; criteria::Vector{Symbol}=Array(decision_matrix.criteria), opts::OPT_TYPE=DEFAULT_OPT_TYPE(),
axis_opts::OPT_TYPE=set_axis_defaults(DEFAULT_OPT_TYPE()))
Plot several spatial maps showing spatial distribution of location selection criteria, with the final map being the
aggregate location selection score.
# Arguments
- `g` : Figure GridPosition or GridLayout.
- `rs` : Result set or Domain.
- `decision_matrix` : Decision matrix of size (n_locs*n_criteria)
- `scores` : Aggregate criteria scores calculated from `decision_matrix`.
- `criteria` : Names of criteria used, default uses decision matrix YAXArray dimension names.
- `opts` : Aviz options
- `colorbar_label`, label for colorbar. Defaults to "Relative Cover".
- `color_map`, preferred colormap for plotting heatmaps.
- `axis_opts` : Additional options to pass to adjust Axis attributes
See: https://docs.makie.org/v0.19/api/index.html#Axis
- `fig_opts` : Additional options to pass to adjust Figure creation
See: https://docs.makie.org/v0.19/api/index.html#Figure
# Returns
Figure
"""
function ADRIA.viz.selection_criteria_map(

Check warning on line 161 in ext/AvizExt/viz/location_selection.jl

View check run for this annotation

Codecov / codecov/patch

ext/AvizExt/viz/location_selection.jl#L161

Added line #L161 was not covered by tests
rs::Union{Domain,ResultSet},
decision_matrix::YAXArray,
Expand All @@ -141,7 +169,9 @@ function ADRIA.viz.selection_criteria_map(
)
f = Figure(; fig_opts...)
g = f[1, 1] = GridLayout()
ADRIA.viz.selection_criteria_map!(g, rs, decision_matrix, scores; criteria=criteria, opts=opts, axis_opts=axis_opts)
ADRIA.viz.selection_criteria_map!(

Check warning on line 172 in ext/AvizExt/viz/location_selection.jl

View check run for this annotation

Codecov / codecov/patch

ext/AvizExt/viz/location_selection.jl#L170-L172

Added lines #L170 - L172 were not covered by tests
g, rs, decision_matrix, scores; criteria=criteria, opts=opts, axis_opts=axis_opts
)
return f

Check warning on line 175 in ext/AvizExt/viz/location_selection.jl

View check run for this annotation

Codecov / codecov/patch

ext/AvizExt/viz/location_selection.jl#L175

Added line #L175 was not covered by tests
end
function ADRIA.viz.selection_criteria_map!(

Check warning on line 177 in ext/AvizExt/viz/location_selection.jl

View check run for this annotation

Codecov / codecov/patch

ext/AvizExt/viz/location_selection.jl#L177

Added line #L177 was not covered by tests
Expand Down
6 changes: 4 additions & 2 deletions ext/AvizExt/viz/spatial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,18 @@ function ADRIA.viz.map!(
end

"""
ADRIA.viz.map(rs::Union{Domain,ResultSet}, outputs_matrix::Matrix, map_titles::Vector{String};opts::OPT_TYPE=DEFAULT_OPT_TYPE(),
ADRIA.viz.map(rs::Union{Domain,ResultSet}, outputs_matrix::Matrix, map_titles::Vector{String}; opts::OPT_TYPE=DEFAULT_OPT_TYPE(),
fig_opts::OPT_TYPE=set_figure_defaults(DEFAULT_OPT_TYPE()), axis_opts::OPT_TYPE=set_axis_defaults(DEFAULT_OPT_TYPE()))
ADRIA.viz.map!(g::Union{GridLayout,GridPosition}, rs::Union{Domain,ResultSet}, outputs_matrix::Matrix, map_titles::Vector{String};
opts::OPT_TYPE=DEFAULT_OPT_TYPE(), axis_opts::OPT_TYPE=set_axis_defaults(DEFAULT_OPT_TYPE()))
Plot a series of maps from an arbitrary (n_locs*n_maps) matrix of outputs.
# Arguments
- `rs` : ResultSet
- `outputs_matrix` : Matrix of outputs where n_locs is the numberof locations and n_maps is the number of different
maps to plot.
- `map_titles` : Title for each map to be plotted.
- `map_titles` : Titles for each map to be plotted.
- `opts` : Aviz options
- `colorbar_label`, label for colorbar. Defaults to "Relative Cover"
- `color_map`, preferred colormap for plotting heatmaps
Expand Down
6 changes: 3 additions & 3 deletions src/decision/Criteria/DecisionPreferences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ Index of locations ordered by their rank
function rank_by_index(
dp::T, dm::YAXArray, method::Union{Function,DataType}
)::Vector{Int64} where {T<:DecisionPreference}
res = criteria_aggregated_scores(dp, dm, method)
is_maximal = res.bestIndex == argmax(res.scores)
return sortperm(res.scores; rev=is_maximal)
decision_results = criteria_aggregated_scores(dp, dm, method)
is_maximal = decision_results.bestIndex == argmax(decision_results.scores)
return sortperm(decision_results.scores; rev=is_maximal)
end

"""
Expand Down

0 comments on commit 409bfba

Please sign in to comment.