Skip to content

Commit

Permalink
further lintering
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdez committed Jan 15, 2025
1 parent ee22e6a commit 338931b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions docs/literate/intro/code_principles.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# # Code principles


# Here we will write about principles which we developed through our publication.
# Here we will write about principles which we developed through our [publication](https://apertureneuro.org/article/116386-the-art-of-brainwaves-a-survey-on-event-related-potential-visualization-practices):

# - Code should be clear and concise.
# - Variables inside the code should have meaningful names.
# - Every function exposed to the user should have documentation that specifies all parameters, types, input and output arguments.
# - Most people will not look at the defaults, so it is very important to nudge users to label important details of the plot.
# - Variables in the code should have meaningful names.
# - Every function exposed to the user should have documentation that specifies all parameters, types, and input and output arguments.
# - Most people will not look at the defaults, so it is very important to encourage users to label important details of the representation.
# - Function naming should be based on some theory and naming conventions.
# - You should avoid functions longer 50 lines.
# - You should avoid functions longer than 50 lines.
# - You should avoid putting more than 5 functions in a file.
# - You should avoid pull requests with more than 10 affected files.
10 changes: 5 additions & 5 deletions src/plot_topoplotseries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ function plot_topoplotseries!(
#uncertainty = false,
kwargs...,
)

data = _as_observable(data_inp)
data_cuts = @lift deepcopy($data)
positions = get_topo_positions(; positions = positions, labels = labels)

config = PlotConfig(:topoplotseries)
Expand All @@ -91,11 +89,12 @@ function plot_topoplotseries!(
"The length of `labels` differs from the length of `position`. Please make sure they are the same length.",
)
end

# resolve columns with data
config.mapping = resolve_mappings(to_value(data), config.mapping)
# check number of topoplots and group the data accordint to their location
data_row, xlabels, layout =
cutting_management(data, data_cuts, bin_width, bin_num, combinefun, nrows, config)
cutting_management(data, bin_width, bin_num, combinefun, nrows, config)

ftopo, axlist = eeg_topoplot_series!(
f[1, 1],
Expand All @@ -111,7 +110,7 @@ function plot_topoplotseries!(
positions,
labels,
)
cb_limits = (minimum(data_cuts.val.estimate), maximum(data_cuts.val.estimate)) # set limits for colorbar
cb_limits = (minimum(data.val.estimate), maximum(data.val.estimate)) # set limits for colorbar
cb_ticks = LinRange(cb_limits[1], cb_limits[2], 5) # set ticklables for colorbar
rounded_ticks = round.(cb_ticks, digits = 2)

Expand All @@ -136,7 +135,8 @@ function plot_topoplotseries!(
return f
end

function cutting_management(data, data_cuts, bin_width, bin_num, combinefun, nrows, config)
function cutting_management(data, bin_width, bin_num, combinefun, nrows, config)
data_cuts = @lift deepcopy($data)
cat_or_cont_columns =
@lift eltype($data[!, config.mapping.col]) <: Number ? "cont" : "cat"
chan_or_label = "label" names(to_value(data)) ? :channel : :label
Expand Down

0 comments on commit 338931b

Please sign in to comment.