Added 40km simulation and some experiments with balloon data

This commit is contained in:
dario
2024-04-22 20:00:14 +02:00
parent cadfb29272
commit 8cc7150526
9 changed files with 7038 additions and 1906 deletions

View File

@@ -4,7 +4,7 @@ from numpy.typing import ArrayLike
from spatz.sensors import PressureSensor
from spatz.dataset import Dataset, Phase
from spatz.logger import Logger
from spatz.transforms import GaussianNoise, Transform
from spatz.transforms import GaussianNoise, Transform, ProportionalGaussian
class MS5611_01BA03(PressureSensor):
@@ -12,8 +12,9 @@ class MS5611_01BA03(PressureSensor):
super().__init__(dataset, logger, transforms, ts_effects)
# Noise model obtained by a test flight using this sensor.
self.__pad_noise = GaussianNoise(0, 0.03)
self.__flight_noise = GaussianNoise(0, 1.5)
# self.__pad_noise = GaussianNoise(0, 0.03)
# self.__flight_noise = GaussianNoise(0, 1.5)
self.__noise = ProportionalGaussian(0, 0.0015)
def _get_name(self) -> AnyStr:
return 'MS5611_01BA03'
@@ -24,7 +25,7 @@ class MS5611_01BA03(PressureSensor):
# Transform from Pa to hPa
x /= 1e2
noisy = self.__pad_noise(t, x) if self._dataset.get_phase() == Phase.ONPAD else self.__flight_noise(t, x)
noisy = self.__noise(t, x) # self.__pad_noise(t, x) if self._dataset.get_phase() == Phase.ONPAD else self.__flight_noise(t, x)
# Log the noise added to the pressure measurements.
self._logger.write('noise', noisy - x, domain=self._get_name())

View File

@@ -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

View File

@@ -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__()