Fix computational issues across analyses, stats, prep and utils#252
Open
deep-introspection wants to merge 2 commits intomasterfrom
Open
Fix computational issues across analyses, stats, prep and utils#252deep-introspection wants to merge 2 commits intomasterfrom
deep-introspection wants to merge 2 commits intomasterfrom
Conversation
analyses.py: - compute_conn_mvar: counter += counter -> counter += 1 (was always 0) - compute_nmPLV: use phase exponentiation for n:m PLV instead of scalar multiplication which doesn't change phase angles - compute_nmPLV: remove **filter_options passed to compute_single_freq which doesn't accept them stats.py: - statscluster: fix undefined variable 'args' -> 'arg' in f_mway_rm call - statscluster: compute proper t/F critical values as cluster thresholds instead of using alpha (a p-value) as a test statistic threshold - statscluster: use alpha parameter instead of hardcoded 0.05 in f_threshold_mway_rm - statscondCluster: use alpha instead of alpha/2 for F-test threshold - statsCond: use boolean mask from fdr_correction instead of fragile float equality comparison on p-values prep.py: - AR_local: fix clean_epochs_subj[subject_id].info to clean_epochs_subj.info (was indexing epoch not subject) utils.py: - generate_virtual_epoch: use n_chan//2 instead of n_chan/2 to avoid TypeError from float index
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Systematic audit and correction of computational issues across the codebase.
WTC mode in
xwt()(analyses.py)|W1×W2*|/(|W1|×|W2|)trivially 1.0WTC = |S(W1×W2*)|² / (S(|W1|²) × S(|W2|²))n:m PLV in
compute_nmPLV()(analyses.py)k * exp(iφ)) which changes magnitude, not phaseexp(iφ)^n = exp(inφ)) for correct n:m phase coupling**filter_optionspassed tocompute_single_freq()which doesn't accept themCluster statistics (stats.py)
statscluster: threshold was set toalpha(e.g. 0.05), a p-value, but MNE expects a test statistic (e.g. t≈2.02). This made nearly all values form one cluster.statscluster:args→argtypo causedNameErroronf multiplewaypathstatscluster: hardcodedpvalue=0.05→ usesalphaparameterstatscondCluster: F-threshold usedalpha/2(too conservative for one-tailed F-test) → usesalphastatsCond: replaced fragile float equality on p-values with boolean mask fromfdr_correctionOther fixes
compute_conn_mvar(analyses.py):counter += counter→counter += 1(was always 0, making retry logic dead code)AR_local(prep.py):clean_epochs_subj[subject_id].info→clean_epochs_subj.info(was indexing into epochs, not subjects)generate_virtual_epoch(utils.py):n_chan/2→n_chan//2(float division causedTypeError)Impact on existing pipelines
statscondClusterandstatsclusterwere overly conservative or broken; may detect previously missed effectscompute_nmPLVoutput changes fundamentally — previous results were not measuring n:m phase couplingTest plan