Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions ats/dataset_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,12 @@ def generate(self, n_series=9, time_span='60D',
random_applied_effects = rnd.sample(random_effects, rnd.randint(0, len(random_effects)))
applied_effects = list(set(effects + random_applied_effects))

try:
series = self._generate_series(sampling_interval=self.sampling_interval,
series = self._generate_series(sampling_interval=self.sampling_interval,
sub_time_span=sub_time_span,
anomalies=anomalies_for_group,
effects=applied_effects,
max_anomalies_per_series=max_anomalies_per_series)
except Exception as e:
logger.error(f"Error generating series {i+1}: {e}")
continue

logger.info(f"Generated dataset {len(dataset)+1} with effects: {applied_effects} and anomalies: {anomalies_for_group} ")
dataset.append(series)

Expand Down
14 changes: 14 additions & 0 deletions ats/tests/test_dataset_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ def test_generate_errors(self):
with self.assertRaises(ValueError):
generator.generate(effects=[],anomalies=['clouds'])
generator.generate(effects=['clouds'],anomalies=['clouds','spike_mv']) # Should not raise
with self.assertRaises(ValueError):
generator.generate(effects=['noise'],anomalies=['AAAAAA'])

def test_step_anomaly_error(self):
generator = HumiTempDatasetGenerator()
with self.assertRaises(NotImplementedError):
generator.generate(
n_series=5,
time_span='10D',
effects=['noise'],
anomalies=['step_uv'],
auto_repeat_anomalies=False,
anomalies_ratio=1.0
)

#def test_generate_random_effects(self):
# generator = HumiTempDatasetGenerator()
Expand Down