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

OnsetFormulas, Sequences, and Component Functions - v0.4.0 #104

Open
wants to merge 59 commits into
base: main
Choose a base branch
from

Conversation

behinger
Copy link
Member

@behinger behinger commented Aug 9, 2024

New Features:

  • Onsets can now follow formulas based on the design
  • Components can now have arbitrary vector returning functions depending on the design instead of fixed arrays
  • new SequenceDesign which allows for fixed sequences e.g. Stimulus - Decision - Response, or Stim - Fix - Fix - Fix etc.
  • updated docs due to JOSS

@jschepers I think I added unittests for all new features + docstrings + tutorials


commit list

  • FormulaOnsets
  • initial sequence tryout
  • fix bug in predef_eeg
  • fix \beta missing
  • forgot the end
  • half way through to success for sequence designs or something
  • everythinig except sequencelength seems to be working now
  • added string sequence tests
  • small doc update
  • added jitter to the '_' trial divisor
  • generalized LinearModelComponent to arbitrary functions instead of vectors
  • bugfix with endless loop due to multiple dispatch
  • function component for multi-subject
  • forgot to define offset in LinearModelFunction
  • Improve documentation especially quickstart, home and power analysis
  • adapted the order of reference overviews and adapted titles
  • Updated quickstart page
  • minor changes
  • fixed docstrings for predef_eeg and predef_2x2
  • added draft of design types reference page
  • Update quickstart.jl
  • Add UnfoldSim logo to the documentation
  • Finished experimental design reference page
  • Replace logo file
  • Update logo file
  • Delete docs/src/assets/logo.svg
  • Add logo as png file
  • Added intro paragraph for Simulate ERP tutorial
  • Improved docstrings for single- and multi-subject design
  • Fixed simulate docstring
  • Added cross references in docstrings
  • Added intro sentences, matched titles and sidebar, reordered pages and added collapsible setup blocks
  • Update noise.jl
  • Update src/noise.jl
  • Update src/noise.jl
  • Update src/noise.jl
  • add empty line for formatting reasons
  • Update docs/literate/reference/noisetypes.jl
  • Update docs/literate/reference/overview.jl
  • Update docs/literate/reference/overview.jl
  • Update docs/literate/reference/noisetypes.jl
  • added docstring
  • renamed to have the formula at the end

xlims!(0, 500)
current_figure()

# As visible, the `R` response always follows the `S` response. Due to the "`_`" we have large breaks between the individual sequences.
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
# As visible, the `R` response always follows the `S` response. Due to the "`_`" we have large breaks between the individual sequences.
# As visible, the `R` response always follows the `S` response. Due to the "`_`" we have large breaks between the individual sequences.

axislegend(ax)
f

# Voila - the inter-onset intervals are `20` samples longer for condition `B`, exactly as specified.`
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
# Voila - the inter-onset intervals are `20` samples longer for condition `B`, exactly as specified.`
# Voila - the inter-onset intervals are `20` samples longer for condition `B`, exactly as specified.`

Copy link

codecov bot commented Aug 9, 2024

Codecov Report

Attention: Patch coverage is 45.17766% with 108 lines in your changes missing coverage. Please review.

Project coverage is 61.86%. Comparing base (3546e29) to head (04a1ed3).
Report is 7 commits behind head on main.

Files Patch % Lines
src/component.jl 45.16% 51 Missing ⚠️
src/onset.jl 12.00% 22 Missing ⚠️
src/design.jl 34.37% 21 Missing ⚠️
src/simulation.jl 50.00% 8 Missing ⚠️
src/sequence.jl 83.33% 5 Missing ⚠️
src/predefinedSimulations.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #104       +/-   ##
===========================================
- Coverage   72.70%   61.86%   -10.84%     
===========================================
  Files          10       11        +1     
  Lines         359      535      +176     
===========================================
+ Hits          261      331       +70     
- Misses         98      204      +106     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@behinger behinger requested a review from jschepers August 9, 2024 13:17
@behinger behinger marked this pull request as ready for review August 9, 2024 13:17
Comment on lines +210 to +211


Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

@behinger behinger changed the title v4.0 OnsetFormulas, Sequences, and Component Functions - v0.4.0 Aug 9, 2024
@@ -62,7 +67,8 @@ function basis_shiftduration(evts, maxlength)
end

# ## Simulate data with the new component type
erp = UnfoldSim.simulate(
erp = UnfoldSim.simulate_component(

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

@@ -40,7 +40,9 @@ design_single_shuffled = SingleSubjectDesign(;
:stimulus_type => ["natural", "artificial"],
:contrast_level => range(0, 1, length = 3),
),

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

event_order_function = shuffle,

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

@@ -46,11 +46,15 @@ makedocs(;
"Overview: Noise types" => "./generated/reference/noisetypes.md",
],
"HowTo" => [

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

"Get multiple trials with identical subject/item combinations" => "./generated/HowTo/repeatTrials.md",
"Define a new component (with variable duration and shift)" => "./generated/HowTo/newComponent.md",
"Generate multi channel data" => "./generated/HowTo/multichannel.md",
"Use existing experimental designs & onsets in the simulation" => "./generated/HowTo/predefinedData.md",
"Produce specific sequences of events" => "./generated/HowTo/sequence.md",

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

Comment on lines +281 to +282
SequenceDesign{T}(d, s, sl) where {T<:AbstractDesign} =
new(d, check_sequence(s), sl)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
SequenceDesign{T}(d, s, sl) where {T<:AbstractDesign} =
new(d, check_sequence(s), sl)
SequenceDesign{T}(d, s, sl) where {T<:AbstractDesign} = new(d, check_sequence(s), sl)

Comment on lines +285 to +286
SequenceDesign(design, sequence) =
SequenceDesign(design = design, sequence = sequence)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
SequenceDesign(design, sequence) =
SequenceDesign(design = design, sequence = sequence)
SequenceDesign(design, sequence) = SequenceDesign(design = design, sequence = sequence)

SequenceDesign(design, sequence) =
SequenceDesign(design = design, sequence = sequence)

generate_events(rng,design::SequenceDesign{MultiSubjectDesign}) = error("not yet implemented")
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
generate_events(rng,design::SequenceDesign{MultiSubjectDesign}) = error("not yet implemented")
generate_events(rng, design::SequenceDesign{MultiSubjectDesign}) =
error("not yet implemented")

function UnfoldSim.generate_events(rng::AbstractRNG, design::RepeatDesign)
df = map(x -> generate_events(rng, design.design), 1:design.repeat) |> x -> vcat(x...)

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

# No way to find out what size it is without actually generating first...
Base.size(
design::Union{<:SequenceDesign,<:SubselectDesign,<:RepeatDesign{<:SequenceDesign}},
) = size(generate_events(design), 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
) = size(generate_events(design), 1)
) = size(generate_events(design), 1)

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.

2 participants