Skip to content

Commit

Permalink
fix pep8 phase analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz-Alexander-Kern committed Apr 26, 2024
1 parent cca7bae commit 24389c9
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions elephant/test/test_phase_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ def setUpClass(cls):
for filename, checksum in cls.files_to_download_real:
# files will be downloaded to ELEPHANT_TMP_DIR
cls.tmp_path[filename] = {
'filename':filename,
'path':download_datasets(
f"{real_data_path}/{filename}", checksum=checksum)}
'filename': filename,
'path': download_datasets(
f"{real_data_path}/{filename}", checksum=checksum)}
# ARTIFICIAL DATA
artificial_data_path = "unittest/phase_analysis/" \
"weighted_phase_lag_index/data/wpli_specific_artificial_dataset"
Expand All @@ -413,12 +413,12 @@ def setUpClass(cls):
for filename, checksum in cls.files_to_download_artificial:
# files will be downloaded to ELEPHANT_TMP_DIR
cls.tmp_path[filename] = {
'filename':filename,
'path':download_datasets(
f"{artificial_data_path}/{filename}", checksum=checksum)}
'filename': filename,
'path': download_datasets(
f"{artificial_data_path}/{filename}", checksum=checksum)}
# GROUND TRUTH DATA
ground_truth_data_path = "unittest/phase_analysis/" \
"weighted_phase_lag_index/data/wpli_ground_truth"
"weighted_phase_lag_index/data/wpli_ground_truth"
cls.files_to_download_ground_truth = (
("ground_truth_WPLI_from_ft_connectivity_wpli_"
"with_real_LFPs_R2G.csv", "4d9a7b7afab7d107023956077ab11fef"),
Expand All @@ -428,9 +428,9 @@ def setUpClass(cls):
for filename, checksum in cls.files_to_download_ground_truth:
# files will be downloaded into ELEPHANT_TMP_DIR
cls.tmp_path[filename] = {
'filename':filename,
'path':download_datasets(
f"{ground_truth_data_path}/{filename}", checksum=checksum)}
'filename': filename,
'path': download_datasets(
f"{ground_truth_data_path}/{filename}", checksum=checksum)}

def setUp(self):
self.tolerance = 1e-15
Expand All @@ -456,10 +456,12 @@ def setUp(self):
signal=self.lfps2_real, sampling_rate=self.sf2_real)

# artificial LFP-dataset
dataset1_artificial = scipy.io.loadmat(
f"{self.tmp_path[self.files_to_download_artificial[0][0]]['path']}", squeeze_me=True)
dataset2_artificial = scipy.io.loadmat(
f"{self.tmp_path[self.files_to_download_artificial[1][0]]['path']}", squeeze_me=True)
dataset1_path = \
f"{self.tmp_path[self.files_to_download_artificial[0][0]]['path']}"
dataset1_artificial = scipy.io.loadmat(dataset1_path, squeeze_me=True)
dataset2_path = \
f"{self.tmp_path[self.files_to_download_artificial[1][0]]['path']}"
dataset2_artificial = scipy.io.loadmat(dataset2_path, squeeze_me=True)
# get relevant values
self.lfps1_artificial = dataset1_artificial['lfp_matrix'] * pq.uV
self.sf1_artificial = dataset1_artificial['sf'] * pq.Hz
Expand All @@ -474,10 +476,10 @@ def setUp(self):
# load ground-truth reference calculated by:
# Matlab package 'FieldTrip': ft_connectivity_wpli()
self.wpli_ground_truth_ft_connectivity_wpli_real = np.loadtxt(
f"{self.tmp_path[self.files_to_download_ground_truth[0][0]]['path']}",
f"{self.tmp_path[self.files_to_download_ground_truth[0][0]]['path']}", # noqa
delimiter=',', dtype=np.float64)
self.wpli_ground_truth_ft_connectivity_artificial = np.loadtxt(
f"{self.tmp_path[self.files_to_download_ground_truth[1][0]]['path']}",
f"{self.tmp_path[self.files_to_download_ground_truth[1][0]]['path']}", # noqa
delimiter=',', dtype=np.float64)

def test_WPLI_ground_truth_consistency_real_LFP_dataset(self):
Expand Down

0 comments on commit 24389c9

Please sign in to comment.