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

Erpgrid #92

Merged
merged 36 commits into from
Nov 10, 2023
Merged

Erpgrid #92

merged 36 commits into from
Nov 10, 2023

Conversation

vladdez
Copy link
Collaborator

@vladdez vladdez commented Nov 9, 2023

No description provided.

@vladdez
Copy link
Collaborator Author

vladdez commented Nov 9, 2023

Could you please look what's happened here - here was a huge merge conflict, I resolved it as i could, but not sure that it was correct (I didn't know about bunch of changes)

@vladdez vladdez closed this Nov 9, 2023
@vladdez
Copy link
Collaborator Author

vladdez commented Nov 9, 2023

everything until "small test" was mine

@behinger behinger reopened this Nov 10, 2023
Copy link
Member

@behinger behinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice start! I have some comments for you :)

f::Union{GridPosition,Figure},
plotData::Matrix{<:Real},
pos;
chanNum = 30,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need chanNum? we can always do size(plotData,1)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to restrict the channels to be plotted, you'd rather expect a range/vector of channels to be used, else you can only restrict up to chanNum. I would remove this functionality and let the user subset channels / positions themselves


function plot_erpgrid!(
f::Union{GridPosition,Figure},
plotData::Matrix{<:Real},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some functions work right now on dataframes, some on Matrix.
We should unify this. Unfold.jl by default returns DataFrames (via coeftable) which are basically linearized Matrices (e.g. plotData[:]). Not 100% sure how to best handle it, but it is always annoying to need to convert to the other format :)

plot_erpgrid!(Figure(), plotData, pos; kwargs...)

function plot_erpgrid!(
f::Union{GridPosition,Figure},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is outside of this PR, but a new one:
Here the method signatures are defined, and we are not defining them correctly ^^
https://docs.makie.org/stable/explanations/plot_method_signatures/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean exactly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think plot_erpgrid(GridPosition ...) is what Makie writes in the docs should be defined, and plot_erpgrid!(axis) - so modifying only if you omdify the axis.

also returntype is very different for us, e.g. docs say:
The mutating methods always just return a plot object. If no figure is passed, the current_figure() is used, if no axis or scene is given, the current_axis() is used.

pos = hcat([[p[1], p[2]] for p in pos]...)

pos = pos[:, 1:chanNum]
minmaxrange = (maximum(pos, dims = 2) - minimum(pos, dims = 2))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should move this standardization to an extra function. We need it in other places as well

# todo: 0.1 should go into plot config
ax = Axis(
f[1, 1],
width = Relative(0.2),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the 0.2 should be a configurable quantitiy in the "visual" category

if drawLabels
text!(
ax,
rel_zeropoint + 0.1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the distance of the label should be configurable imho - in general all of these settings should be configurable, we can achieve this by either using a PlotConfig category, or by an argument::NamedTuple and then merging our defaults wiht the provided defaults

push!(axlist, ax)
end
# todo: make optional + be able to specify the linewidth + color
hlines!.(axlist, Ref([0.0]), color = :gray, linewidth = 0.5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, but you already have a todo there :)

hidedecorations!.(axlist)
hidespines!.(axlist)

f
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe return not only f, but also the axlist?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we do the same in eeg_topolotseries - or whatever the function is called

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should look at all input + output-types and check what makes sense. a FigureAxisPlot object is on the table as well, but related to the mutating/non-mutating discussion

@codecov-commenter
Copy link

Codecov Report

Merging #92 (e0eb9f9) into main (6d01554) will decrease coverage by 2.18%.
The diff coverage is 20.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main      #92      +/-   ##
==========================================
- Coverage   69.44%   67.27%   -2.18%     
==========================================
  Files          17       18       +1     
  Lines         635      660      +25     
==========================================
+ Hits          441      444       +3     
- Misses        194      216      +22     
Files Coverage Δ
src/UnfoldMakie.jl 100.00% <ø> (ø)
src/eeg_series.jl 81.96% <100.00%> (+5.69%) ⬆️
src/plot_topoplotseries.jl 100.00% <100.00%> (ø)
src/plot_erpimage.jl 88.46% <0.00%> (ø)
src/plot_erp.jl 68.08% <0.00%> (ø)
src/plot_erpgrid.jl 0.00% <0.00%> (ø)

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@vladdez
Copy link
Collaborator Author

vladdez commented Nov 10, 2023

okay let's include this changes for now
there a lot do with every function, the number of bugs is just insane

@vladdez vladdez closed this Nov 10, 2023
@vladdez vladdez reopened this Nov 10, 2023
@vladdez vladdez merged commit cc42f28 into main Nov 10, 2023
4 checks passed
@behinger behinger deleted the erpgrid branch November 28, 2023 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants