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

Squashed branch continuous_source_model into a single commit (READ ACCOMPANYING MESSAGE BEFORE MERGING) #107

Conversation

SeSodesa
Copy link
Collaborator

The commit messages of the individual updates are listed below, and the
original branch without the squashed_ prefix still exists in the repo.

DO NOT MERGE IF WORKING ON ANOTHER BRANCH AND NOT PREPARED TO DEAL WITH
THE RESULTING CONFLICTS!


ZefSourceModel: added continuous variants to the enumeration

… and updated the static from-method to handle integers from 4–6. The mapping
is 4 ↦ ContinuousWhitney, 5 ↦ ContinuousHdiv and 6 ↦ ContinuousStVenant.

lead_field_matrix: added a helper function fore generating source- and source space decomposition indices

The source space decomposition indices should be empty, if a discrete source
model (as in a coarsely generated gray matter mesh) is used.

Lead field routines and lead_field_matrix: pass source_decomposition_inds as input

lead_field_matrix: removed unnecessary semicolons and improved a section comment

zef_decompose_dof_space: updated documentation (still TODO)

lead_field_eeg_fem: pass source_decomposition_inds generated by zef_decompose_dof_space to interpolation functions

The indices do nothing at this point.

lead_field_matrix: renamed variable aux_vec → brain_activity_ind

lead_field_matrix: dot not remove (now) non-existent field aux_vec from zef

Also removed reference to zef from helper function, as the struct does not
exist in its namespace.

lead_field_matrix: pass brain_activity_inds and source_tetra_inds to lead field routines instead of brain_ind and source_ind

Also added a few intrepretive comments, which may or may not be correct.

zef_lead_field_interpolation: dispatch on continuous source models

The function now calls zef_{whitney,hdiv,st_venant}_interpolation with the
entire active brain layer as intended source inds in the case of
ZefSourceModel.Continuous{Whitney,Hdiv,StVenant}. Continuous variants of the
interpolation functions will be needed to make this faster.

zef_lead_field_interpolation: remove _continuous from function name (for now)

zef_decompose_dof_space: improved variables names and documentation

lead field interpolation routines: renamed parameter p_{decomposition_inds → nearest_neighbour_inds}

Now the parameter name actually delivers its purpose. At least somewhat.

lead_field_matrix: renamed zef.{source_decomposition_inds → nearest_neighbour_inds}

lead_field_matrix: renamed zef.{nearest_neighbour_inds → nearest_source_neighbour_inds}

lead field routines: changed parameter {source_decomposition_inds → p_nearest_neighbour_inds}

lead_field_matrix: updated comment

lead_field_matrix: changed default peeling depth to zef.mesh_resolution

zef_lead_field_interpolation: updated documentation to cover the argument p_nearest_neighbour_inds

interpolation routines: started working on continous source model implementation

interpolation routines: added proper documentation

interpolation_routines: removed unnecessary and incomplete TODO comments

interpolation functions: index arguments must be positive, not just non-negative

zef_lead_field_interpolation: both the discrete and continuous models dispatch to the same function

lead_field_matrix: set zef.source_ind again and use it in lead field routines

lead_field_matrix: generate the nearest neighbour indices of all brain indices here

… instead of leaving this responsibility the the interpolation functions
called by the lead field routines.

zef_decompose_dof_space: updated variable names again to match prior changes

zef_decompose_dof_space: removed unused lines of code and set precedence with (⋅) instead of [⋅]

lead_field_matrix: pass nearest_source_neighbour_inds to lead field routines

… again.

zef_hdiv_interpolation: added logic to handle continuous source models

This might not be correct, as with 10 000 sources the RDM results with the Ary
model are much worse than with a discrete model.

zef_decompose_dof_space: clarified what local lattice_index_fn does

Also added an 's' after nearest_neighbour_ind to accentuate the fact that it
contains multiple indices, not just one.

zef_decompose_dof_space: fix typo in comment

zef_decompose_dof_space: improved local lattice_index_fn documentation again.

zef_decompose_dof_space: renamed lattice_index_fn variables to better match documentation

zef_hdiv_interpolation: continuous indexing now seems to produce something sensible with 10 k samples

zef_hdiv_interpolation: rename aux-variable

Variable names should at least try to be descriptive…

zef_whitney_interpolation: added the handling of the continuous source model, just like in zef_hdiv_interpolation

Also removed the 4 neighbour condition. This has a negative effect on
ZefSourceModel.Whitney, but a positive one on
ZefSourceModel.ContinuousWhitney.

Added new function zef_pbo_system

… to be used in the interpolation functions related to lead field generation.

lead_field_matrix: feed zef.brain_ind to lead field routines, but at the same time limit position of sources into the peeled zef.brain_ind or zef.brain_activity_inds

zef_{whitney,hdiv}_interpolation: use zef_pbo_system to form the interpolation coefficient matrices

Added function zef_mpo_system.m

Still untested. Might be dysfunctional.

zef_mpo_system: fixed typos in documentation

zef_pbo_system: fixed typos in documentation

zef_mpo_system: word interpolation → optimization in documentation

zef_mpo_system: fixed name of function in the file

zef_mpo_system: fixed variable names, transposes and matrix sizes

zef_mpo_system included as a part of EEG routine

The interpolation functions now take an additional parameter called
optimization_system_type, which tells Whitney and H(div) routines whether to
use PBO or MPO for optimization.

lead_field_matrix: add documentation and change default source depth to 0 mm

ZefSourceModel: added a variants-method.

ZefSourceModel: fixed a typo and added a to_string method

forward_and_inverse_options: source model variants now set based on static method ZefSourceModel.variants

@SeSodesa SeSodesa force-pushed the squashed_continuous_source_model branch 3 times, most recently from a3111f5 to d6f4c9e Compare August 25, 2022 09:59
The commit messages of the individual updates are listed below, and the
original branch without the squashed_ prefix still exists in the repo.

--------------------------------

ZefSourceModel: added continous variants to the enumeration

… and updated the static from-method to handle integers from 4–6. The mapping
is 4 ↦ ContinuousWhitney, 5 ↦ ContinuousHdiv and 6 ↦ ContinuousStVenant.

lead_field_matrix: added a helper function fore generating source- and source space decomposition indices

The source space decomposition indices should be empty, if a discrete source
model (as in a coarsely generated gray matter mesh) is used.

Lead field routines and lead_field_matrix: pass source_decomposition_inds as input

lead_field_matrix: removed unnecessary semicolons and improved a section comment

zef_decompose_dof_space: updated documentation (still TODO)

lead_field_eeg_fem: pass source_decomposition_inds generated by zef_decompose_dof_space to interpolation functions

The indices do nothing at this point.

lead_field_matrix: renamed variable aux_vec → brain_activity_ind

lead_field_matrix: dot not remove (now) non-existent field aux_vec from zef

Also removed reference to zef from helper function, as the struct does not
exist in its namespace.

lead_field_matrix: pass brain_activity_inds and source_tetra_inds to lead field routines instead of brain_ind and source_ind

Also added a few intrepretive comments, which may or may not be correct.

zef_lead_field_interpolation: dispatch on continuous source models

The function now calls zef_{whitney,hdiv,st_venant}_interpolation with the
entire active brain layer as intended source inds in the case of
ZefSourceModel.Continuous{Whitney,Hdiv,StVenant}. Continuous variants of the
interpolation functions will be needed to make this faster.

zef_lead_field_interpolation: remove _continuous from function name (for now)

zef_decompose_dof_space: improved variables names and documentation

lead field interpolation routines: renamed parameter p_{decomposition_inds → nearest_neighbour_inds}

Now the parameter name actually delivers its purpose. At least somewhat.

lead_field_matrix: renamed zef.{source_decomposition_inds → nearest_neighbour_inds}

lead_field_matrix: renamed zef.{nearest_neighbour_inds → nearest_source_neighbour_inds}

lead field routines: changed parameter {source_decomposition_inds → p_nearest_neighbour_inds}

lead_field_matrix: updated comment

lead_field_matrix: changed default peeling depth to zef.mesh_resolution

zef_lead_field_interpolation: updated documentation to cover the argument p_nearest_neighbour_inds

interpolation routines: started working on continous source model implementation

interpolation routines: added proper documentation

interpolation_routines: removed unnecessary and incomplete TODO comments

interpolation functions: index arguments must be positive, not just non-negative

zef_lead_field_interpolation: both the discrete and continuous models dispatch to the same function

lead_field_matrix: set zef.source_ind again and use it in lead field routines

lead_field_matrix: generate the nearest neighbour indices of all brain indices here

… instead of leaving this responsibility the the interpolation functions
called by the lead field routines.

zef_decompose_dof_space: updated variable names again to match prior changes

zef_decompose_dof_space: removed unused lines of code and set precedence with (⋅) instead of [⋅]

lead_field_matrix: pass nearest_source_neighbour_inds to lead field routines

… again.

zef_hdiv_interpolation: added logic to handle continuous source models

This might not be correct, as with 10 000 sources the RDM results with the Ary
model are much worse than with a discrete model.

zef_decompose_dof_space: clarified what local lattice_index_fn does

Also added an 's' after nearest_neighbour_ind to accentuate the fact that it
contains multiple indices, not just one.

zef_decompose_dof_space: fix typo in comment

zef_decompose_dof_space: improved local lattice_index_fn documentation again.

zef_decompose_dof_space: renamed lattice_index_fn variables to better match documentation

zef_hdiv_interpolation: continuous indexing now seems to produce something sensible with 10 k samples

zef_hdiv_interpolation: rename aux-variable

Variable names should at least try to be descriptive…

zef_whitney_interpolation: added the handling of the continuous source model, just like in zef_hdiv_interpolation

Also removed the 4 neighbour condition. This has a negative effect on
ZefSourceModel.Whitney, but a positive one on
ZefSourceModel.ContinuousWhitney.

Added new function zef_pbo_system

… to be used in the interpolation functions related to lead field generation.

lead_field_matrix: feed zef.brain_ind to lead field routines, but at the same time limit position of sources into the peeled zef.brain_ind or zef.brain_activity_inds

zef_{whitney,hdiv}_interpolation: use zef_pbo_system to form the interpolation coefficient matrices

Added function zef_mpo_system.m

Still untested. Might be dysfunctional.

zef_mpo_system: fixed typos in documentation

zef_pbo_system: fixed typos in documentation

zef_mpo_system: word interpolation → optimization in documentation

zef_mpo_system: fixed name of function in the file

zef_mpo_system: fixed variable names, transposes and matrix sizes

zef_mpo_system included as a part of EEG routine

The interpolation functions now take an additional parameter called
optimization_system_type, which tells Whitney and H(div) routines whether to
use PBO or MPO for optimization.

lead_field_matrix: add documentation and change default source depth to 0 mm

ZefSourceModel: added a variants-method.

ZefSourceModel: fixed a typo and added a to_string method

forward_and_inverse_options: source model variants now set based on static method ZefSourceModel.variants

zef_lead_field_matrix: added missing prefixes "zef_" to lead field function calls
@SeSodesa SeSodesa force-pushed the squashed_continuous_source_model branch from d6f4c9e to effa901 Compare August 25, 2022 12:04
@sampsapursiainen sampsapursiainen merged commit e240b70 into sampsapursiainen:main_development_branch Aug 25, 2022
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.

None yet

2 participants