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
11 changes: 7 additions & 4 deletions gutenTAG/anomalies/types/amplitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ def generate(self, anomaly_protocol: AnomalyProtocol) -> AnomalyProtocol:

length = anomaly_protocol.end - anomaly_protocol.start
if anomaly_protocol.creeping_length == 0:
transition_length = int(length * 0.2)
plateau = np.ones(int(length * 0.6))
transition_length = int(round(length * 0.2))
plateau_length = length - 2 * transition_length
plateau = np.ones(plateau_length)
start_transition = norm.pdf(
np.linspace(-3, 0, transition_length), scale=1.05
)
Expand All @@ -47,11 +48,13 @@ def generate(self, anomaly_protocol: AnomalyProtocol) -> AnomalyProtocol:
)
else:
anomaly_length = length - anomaly_protocol.creeping_length
creeping_length = int(round(anomaly_length * 0.8))
creeping = self.generate_creeping(
anomaly_protocol, custom_anomaly_length=int(anomaly_length * 0.8)
anomaly_protocol, custom_anomaly_length=creeping_length
)
end_transition_length = anomaly_length - creeping_length
end_transition = norm.pdf(
np.linspace(0, 3, int(anomaly_length * 0.2)), scale=1.05
np.linspace(0, 3, end_transition_length), scale=1.05
)
amplitude_bell = np.concatenate(
[creeping, end_transition / end_transition.max()]
Expand Down
6 changes: 6 additions & 0 deletions tests/configs/example-config-amplitude.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ timeseries:
kinds:
- kind: amplitude
amplitude_factor: 2.0
- position: end
length: 47
channel: 0
kinds:
- kind: amplitude
amplitude_factor: 2.0
Loading