mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/SPATZ.git
synced 2025-09-28 21:17:33 +00:00
Added 40km simulation and some experiments with balloon data
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
from spatz.transforms.transform import Transform
|
||||
from spatz.transforms.noise import GaussianNoise
|
||||
from spatz.transforms.noise import GaussianNoise, ProportionalGaussian
|
||||
from spatz.transforms.failures import Downtime
|
@@ -7,7 +7,7 @@ from spatz.transforms import Transform
|
||||
|
||||
|
||||
class GaussianNoise(Transform):
|
||||
def __init__(self, mu: ArrayLike, sigma: ArrayLike) -> None:
|
||||
def __init__(self, mu: ArrayLike = None, sigma: ArrayLike = None) -> None:
|
||||
super().__init__()
|
||||
|
||||
self.__mu = mu
|
||||
@@ -15,7 +15,8 @@ class GaussianNoise(Transform):
|
||||
|
||||
def __call__(self, _: float, x: ArrayLike) -> ArrayLike:
|
||||
if np.isscalar(x):
|
||||
noise = np.random.normal(0, 1)
|
||||
noise = np.random.normal(0, 1)
|
||||
|
||||
x += self.__sigma * noise + self.__mu
|
||||
else:
|
||||
dim = len(x)
|
||||
@@ -36,6 +37,21 @@ class GaussianNoise(Transform):
|
||||
return x
|
||||
|
||||
|
||||
class ProportionalGaussian(Transform):
|
||||
def __init__(self, mu, sigma) -> None:
|
||||
super().__init__()
|
||||
|
||||
self.__mu = mu
|
||||
self.__sigma = sigma
|
||||
|
||||
def __call__(self, _: float, x: ArrayLike) -> ArrayLike:
|
||||
noise = np.random.normal(0, 1)
|
||||
|
||||
x += (self.__sigma * x) * noise + (self.__mu * x)
|
||||
|
||||
return x
|
||||
|
||||
|
||||
class PinkNoise(Transform):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
Reference in New Issue
Block a user