Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kujaku11 committed Aug 14, 2024
1 parent b856438 commit 17666cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
9 changes: 6 additions & 3 deletions aurora/transfer_function/kernel_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,20 @@ def has_remote_mth5(self):
return False
else:
return self.remote_mth5_path.exists()

@property
def processing_id(self):
"""its difficult to come put with unique ids without crazy long names
so this is a generic id of local-remote, the station metadata
will have run information and the config parameters.
"""
if self.remote_station_id is not None:
return f"{self.local_station_id}-rr_{self.remote_station_id}"
return (
f"{self.local_station_id}-rr_{self.remote_station_id}_"
f"sr{int(self.sample_rate)}"
)
else:
return self.local_station_id
return f"{self.local_station_id}_sr{int(self.sample_rate)}"

@property
def input_channels(self):
Expand Down
19 changes: 11 additions & 8 deletions tests/transfer_function/test_kernel_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
from mth5.data.make_mth5_from_asc import MTH5_PATH, create_test12rr_h5

from aurora.transfer_function import KERNEL_DATASET_COLUMNS
from aurora.pipelines.run_summary import RunSummary

from aurora.transfer_function.kernel_dataset import intervals_overlap
from aurora.transfer_function.kernel_dataset import overlap
from aurora.transfer_function.kernel_dataset import KernelDataset
from aurora.pipelines.run_summary import RunSummary
from aurora.transfer_function.kernel_dataset import (
intervals_overlap,
overlap,
KernelDataset,
)

# =============================================================================

Expand Down Expand Up @@ -98,7 +100,7 @@ def test_local_df(self):
with self.subTest("shape"):
self.assertEqual(self.kd.local_df.shape, (1, 20))
with self.subTest("local station only length"):
self.assertEqual(len(self.kd.local_df.station.unqiue()), 1)
self.assertEqual(len(self.kd.local_df.station.unique()), 1)
with self.subTest("local station only"):
self.assertListEqual(
list(self.kd.local_df.station.unique()), ["test1"]
Expand All @@ -108,13 +110,14 @@ def test_remote_df(self):
with self.subTest("shape"):
self.assertEqual(self.kd.remote_df.shape, (1, 20))
with self.subTest("remote station only length"):
self.assertEqual(len(self.kd.remote_df.station.unqiue()), 1)
self.assertEqual(len(self.kd.remote_df.station.unique()), 1)
with self.subTest("remote station only"):
self.assertListEqual(
list(self.kd.remote_df.station.unique()), ["test1"]
list(self.kd.remote_df.station.unique()), ["test2"]
)

def test_processing_id(self):
self.assertEqual(self.kd.processing_id, "test1-rr_test2")
self.assertEqual(self.kd.processing_id, "test1-rr_test2_sr1")

# @classmethod
# def tearDownClass(self):
Expand Down

0 comments on commit 17666cd

Please sign in to comment.