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

[Fix] Use default tolerances for np.testing.allclose() in WPLI ground truth test #572

Merged

Conversation

Moritz-Alexander-Kern
Copy link
Member

This PR addresses an issue when testing Elephant on JUSUF and Galileo100, see #569 .

For the ground truth test in WPLI, see:

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)
# np.array-input
with self.subTest(msg="np.array input"):
freq, wpli = elephant.phase_analysis.weighted_phase_lag_index(
self.lfps1_real.magnitude, self.lfps2_real.magnitude,
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)
# neo.AnalogSignal-input
with self.subTest(msg="neo.AnalogSignal input"):
freq, wpli = elephant.phase_analysis.weighted_phase_lag_index(
self.lfps1_real_AnalogSignal, self.lfps2_real_AnalogSignal)
np.testing.assert_allclose(
wpli, self.wpli_ground_truth_ft_connectivity_wpli_real,
atol=self.tolerance, rtol=self.tolerance, equal_nan=True)

The default tolerance values were used for np.testing.allclose to prevent test failures in cases where the deviations very small and therefore negligible.

@Moritz-Alexander-Kern Moritz-Alexander-Kern added the bugfix Fix for an indentified bug. label Jun 2, 2023
@Moritz-Alexander-Kern Moritz-Alexander-Kern changed the title [Fix] use default tolerances for np.testing.allclose() in WPLI ground truth test [Fix] Use default tolerances for np.testing.allclose() in WPLI ground truth test Jun 2, 2023
@coveralls
Copy link
Collaborator

coveralls commented Jun 2, 2023

Coverage Status

coverage: 86.97%. remained the same when pulling de0d108 on INM-6:fix/WPLI_unit_test_tolerance into 844eb82 on NeuralEnsemble:master.

@Moritz-Alexander-Kern Moritz-Alexander-Kern added this to the v0.13.0 milestone Jul 10, 2023
Copy link
Member Author

@Moritz-Alexander-Kern Moritz-Alexander-Kern left a comment

Choose a reason for hiding this comment

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

build wheels

@Moritz-Alexander-Kern Moritz-Alexander-Kern merged commit af4a0a4 into NeuralEnsemble:master Jul 12, 2023
@Moritz-Alexander-Kern
Copy link
Member Author

Note: Review was done by @ojoenlanuca .

@Moritz-Alexander-Kern Moritz-Alexander-Kern deleted the fix/WPLI_unit_test_tolerance branch July 21, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fix for an indentified bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants