Skip to content
Snippets Groups Projects
Commit 71f428e9 authored by Jean-Baptiste Bayle's avatar Jean-Baptiste Bayle
Browse files

Merge branch '122-clock-jitter-noise-should-saturate-below-around-1e-4-hz-2' into 'master'

Resolve "Clock jitter noise should saturate below around 1E- 4 Hz"

Closes #122

See merge request !155
parents 31a86f77 17ec54f2
No related branches found
No related tags found
1 merge request!155Resolve "Clock jitter noise should saturate below around 1E- 4 Hz"
Pipeline #233715 passed
...@@ -80,7 +80,8 @@ def violet(fs, size, asd): ...@@ -80,7 +80,8 @@ def violet(fs, size, asd):
Args: Args:
fs: sampling frequency [Hz] fs: sampling frequency [Hz]
size: number of samples [samples] size: number of samples [samples]
asd: amplitude spectral density [/sqrt(Hz)]""" asd: amplitude spectral density [/sqrt(Hz)]
"""
logger.debug("Generating violet noise (fs=%s Hz, size=%s, asd=%s)", fs, size, asd) logger.debug("Generating violet noise (fs=%s Hz, size=%s, asd=%s)", fs, size, asd)
if not asd: if not asd:
logger.debug("Vanishing power spectral density, bypassing noise generation") logger.debug("Vanishing power spectral density, bypassing noise generation")
...@@ -89,18 +90,20 @@ def violet(fs, size, asd): ...@@ -89,18 +90,20 @@ def violet(fs, size, asd):
return np.gradient(white_noise, 1 / fs) / (2 * pi) return np.gradient(white_noise, 1 / fs) / (2 * pi)
def pink(fs, size, asd): def pink(fs, size, asd, fmin=None):
"""Generate a pink noise in f^(-1/2) in amplitude. """Generate a pink noise in f^(-1/2) in amplitude.
Args: Args:
fs: sampling frequency [Hz] fs: sampling frequency [Hz]
size: number of samples [samples] size: number of samples [samples]
asd: amplitude spectral density [/sqrt(Hz)]""" asd: amplitude spectral density [/sqrt(Hz)]
fmin: saturation frequency (default to fs / size) [Hz]
"""
logger.debug("Generating pink noise (fs=%s Hz, size=%s, asd=%s)", fs, size, asd) logger.debug("Generating pink noise (fs=%s Hz, size=%s, asd=%s)", fs, size, asd)
if not asd: if not asd:
logger.debug("Vanishing power spectral density, bypassing noise generation") logger.debug("Vanishing power spectral density, bypassing noise generation")
return 0 return 0
generator = pyplnoise.PinkNoise(fs, fs / size, fs / 2) generator = pyplnoise.PinkNoise(fs, fmin or fs / size, fs / 2)
return asd / sqrt(2) * generator.get_series(size) return asd / sqrt(2) * generator.get_series(size)
...@@ -110,7 +113,8 @@ def red(fs, size, asd): ...@@ -110,7 +113,8 @@ def red(fs, size, asd):
Args: Args:
fs: sampling frequency [Hz] fs: sampling frequency [Hz]
size: number of samples [samples] size: number of samples [samples]
asd: amplitude spectral density [/sqrt(Hz)]""" asd: amplitude spectral density [/sqrt(Hz)]
"""
logger.debug("Generating red noise (fs=%s Hz, size=%s, asd=%s)", fs, size, asd) logger.debug("Generating red noise (fs=%s Hz, size=%s, asd=%s)", fs, size, asd)
if not asd: if not asd:
logger.debug("Vanishing power spectral density, bypassing noise generation") logger.debug("Vanishing power spectral density, bypassing noise generation")
...@@ -125,7 +129,8 @@ def infrared(fs, size, asd): ...@@ -125,7 +129,8 @@ def infrared(fs, size, asd):
Args: Args:
fs: sampling frequency [Hz] fs: sampling frequency [Hz]
size: number of samples [samples] size: number of samples [samples]
asd: amplitude spectral density [/sqrt(Hz)]""" asd: amplitude spectral density [/sqrt(Hz)]
"""
logger.debug("Generating infrared noise (fs=%s Hz, size=%s, asd=%s)", fs, size, asd) logger.debug("Generating infrared noise (fs=%s Hz, size=%s, asd=%s)", fs, size, asd)
if not asd: if not asd:
logger.debug("Vanishing power spectral density, bypassing noise generation") logger.debug("Vanishing power spectral density, bypassing noise generation")
...@@ -173,11 +178,14 @@ def clock(fs, size, asd): ...@@ -173,11 +178,14 @@ def clock(fs, size, asd):
S_q(f) [ffd] = (asd)^2 f^(-1) S_q(f) [ffd] = (asd)^2 f^(-1)
Clock noise saturates below 1E-5 Hz, as the low-frequency part is modeled by
deterministing clock drifts.
Args: Args:
asd: amplitude spectral density [/sqrt(Hz)] asd: amplitude spectral density [/sqrt(Hz)]
""" """
logger.debug("Generating clock noise fluctuations (fs=%s Hz, size=%s, asd=%s /sqrt(Hz))", fs, size, asd) logger.debug("Generating clock noise fluctuations (fs=%s Hz, size=%s, asd=%s /sqrt(Hz))", fs, size, asd)
return pink(fs, size, asd) return pink(fs, size, asd, fmin=1E-5)
def modulation(fs, size, asd): def modulation(fs, size, asd):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment