Skip to content

[Bug] Testing issue: py-elephant (JUSUF, Galileo100) #569

@Moritz-Alexander-Kern

Description

@Moritz-Alexander-Kern

Describe the bug
The ebrains TC team have notified me about the following issue when testing Elephant on JUSUF and Galileo100.

When trying to install elephant on JUSUF, two tests fail: (on Galileo100 only the WLPI ground truth test fails)

elephant/test/test_phase_analysis.py::WeightedPhaseLagIndexTestCase::test_WPLI_ground_truth_consistency_real_LFP_dataset
elephant/test/test_spectral.py::MultitaperCoherenceTestCase::test_multitaper_cohere_perfect_cohere

To Reproduce

  1. $ spack spack install --test root py-elephant

Expected behavior
No error should be raised when running the unit tests.

Environment
$ spack debug report

  • Spack: 0.18.1 (57226fd1f4c6bc8c55fe0bfde9450a326e957f0d)
  • Python: 3.9.12
  • Platform: linux-centos8-cascadelake
  • Concretizer: clingo
  • tqdm-4.62.3
  • statsmodels-0.13.1
  • scikit-learn-1.1.1
  • pytest-6.2.5
  • pandas-1.4.2
  • six-1.16.0
  • neo-0.12.0
  • scipy-1.8.1
  • quantities-0.14.1
  • numpy-1.21.6
  • jinja2-3.0.3

Error

=================================== FAILURES ===================================
_ WeightedPhaseLagIndexTestCase.test_WPLI_ground_truth_consistency_real_LFP_dataset _

self = <elephant.test.test_phase_analysis.WeightedPhaseLagIndexTestCase testMethod=test_WPLI_ground_truth_consistency_real_LFP_dataset>

    def test_WPLI_ground_truth_consistency_real_LFP_dataset(self):
        """
        Test if the WPLI is consistent with the reference implementation
        ft_connectivity_wpli() of the MATLAB-package FieldTrip using
        LFP-dataset cuttings from the multielectrode-grasp  G-Node GIN
        repository, which can be found here:
        https://doi.gin.g-node.org/10.12751/g-node.f83565/
        The cutting was performed with this python-script:
        multielectrode_grasp_i140703-001_cutting_script_TS_ON_to_GO_ON.py
        which is available on https://gin.g-node.org/INM-6/elephant-data
        in folder validation/phase_analysis/weighted_phase_lag_index/scripts,
        where also the MATLAB-script for ground-truth generation is located.
        """
        # Quantity-input
        with self.subTest(msg="Quantity input"):
            freq, wpli = elephant.phase_analysis.weighted_phase_lag_index(
                self.lfps1_real, self.lfps2_real, self.sf1_real)
>           np.testing.assert_allclose(
                wpli, self.wpli_ground_truth_ft_connectivity_wpli_real,
                atol=self.tolerance, rtol=self.tolerance, equal_nan=True)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-15, atol=1e-15
E           
E           Mismatched elements: 138 / 1051 (13.1%)
E           Max absolute difference: 1.33781874e-14
E           Max relative difference: 1.19137161e-11
E            x: array([     nan, 0.470965, 0.566099, ..., 0.108376, 0.069116,      nan])
E            y: array([     nan, 0.470965, 0.566099, ..., 0.108376, 0.069116,      nan])

elephant/test/test_phase_analysis.py:497: AssertionError
______ MultitaperCoherenceTestCase.test_multitaper_cohere_perfect_cohere _______

self = <elephant.test.test_spectral.MultitaperCoherenceTestCase testMethod=test_multitaper_cohere_perfect_cohere>

    def test_multitaper_cohere_perfect_cohere(self):
        # Generate dummy data
        data_length = 10000
        sampling_period = 0.001
        signal_freq = 100.0
        noise = np.random.normal(size=(1, data_length))
        time_points = np.arange(0, data_length * sampling_period,
                                sampling_period)
        signal = np.cos(2 * np.pi * signal_freq * time_points) + noise
    
        # Estimate coherence and phase lag with the multitaper method
        freq1, coh, phase_lag = elephant.spectral.multitaper_coherence(
            signal,
            signal,
            fs=1/sampling_period,
            n_segments=16)
    
        self.assertTrue((coh == np.ones(coh.size)).all())
>       self.assertTrue((phase_lag == np.zeros(phase_lag.size)).all())
E       AssertionError: False is not true

elephant/test/test_spectral.py:867: AssertionError

Metadata

Metadata

Labels

bugIndicates an unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions