Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LISA Instrument
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LISA Simulation
LISA Instrument
Commits
dc81c62b
Commit
dc81c62b
authored
4 years ago
by
Jean-Baptiste Bayle
Browse files
Options
Downloads
Patches
Plain Diff
Add basic noises
parent
d0bfffe3
No related branches found
No related tags found
1 merge request
!1
Resolve "Add some basic noise generators"
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lisainstrument/__init__.py
+6
-0
6 additions, 0 deletions
lisainstrument/__init__.py
lisainstrument/noises.py
+59
-0
59 additions, 0 deletions
lisainstrument/noises.py
tests/notebook_noises.ipynb
+426
-0
426 additions, 0 deletions
tests/notebook_noises.ipynb
with
491 additions
and
0 deletions
lisainstrument/__init__.py
+
6
−
0
View file @
dc81c62b
...
@@ -5,3 +5,9 @@
...
@@ -5,3 +5,9 @@
from
.meta
import
__version__
from
.meta
import
__version__
from
.meta
import
__author__
from
.meta
import
__author__
from
.meta
import
__email__
from
.meta
import
__email__
from
.noises
import
white
from
.noises
import
violet
from
.noises
import
pink
from
.noises
import
red
from
.noises
import
infrared
This diff is collapsed.
Click to expand it.
lisainstrument/noises.py
+
59
−
0
View file @
dc81c62b
...
@@ -3,6 +3,65 @@
...
@@ -3,6 +3,65 @@
"""
"""
Noises module.
Noises module.
Implements basic random noise generators, and use them to implement instrumental noises.
Authors:
Authors:
Jean-Baptiste Bayle <j2b.bayle@gmail.com>
Jean-Baptiste Bayle <j2b.bayle@gmail.com>
"""
"""
import
logging
import
numpy
import
pyplnoise
from
numpy
import
pi
,
sqrt
from
lisaconstants
import
c
def
white
(
fs
,
size
,
psd
):
"""
Generate a white
"""
logging
.
debug
(
"
Generating white noise (fs=%s Hz, size=%s, psd=%s)
"
,
fs
,
size
,
psd
)
if
not
psd
:
logging
.
debug
(
"
Vanishing power spectral density, bypassing noise generation
"
)
return
0
generator
=
pyplnoise
.
WhiteNoise
(
fs
,
psd
/
2
)
return
generator
.
get_series
(
size
)
def
violet
(
fs
,
size
,
psd
):
"""
Generate a violet noise in f^2.
"""
logging
.
debug
(
"
Generating violet noise (fs=%s Hz, size=%s, psd=%s)
"
,
fs
,
size
,
psd
)
if
not
psd
:
logging
.
debug
(
"
Vanishing power spectral density, bypassing noise generation
"
)
return
0
white_noise
=
white
(
fs
,
size
,
psd
)
return
numpy
.
gradient
(
white_noise
,
1
/
fs
)
/
(
2
*
pi
)
def
pink
(
fs
,
size
,
psd
):
"""
Generate a pink noise in f^(-1).
"""
logging
.
debug
(
"
Generating pink noise (fs=%s Hz, size=%s, psd=%s)
"
,
fs
,
size
,
psd
)
if
not
psd
:
logging
.
debug
(
"
Vanishing power spectral density, bypassing noise generation
"
)
return
0
generator
=
pyplnoise
.
PinkNoise
(
fs
,
1
/
size
,
fs
/
2
)
return
sqrt
(
psd
/
2
)
*
generator
.
get_series
(
size
)
def
red
(
fs
,
size
,
psd
):
"""
Generate a red noise (also Brownian or random walk) in f^(-2).
"""
logging
.
debug
(
"
Generating red noise (fs=%s Hz, size=%s, psd=%s)
"
,
fs
,
size
,
psd
)
if
not
psd
:
logging
.
debug
(
"
Vanishing power spectral density, bypassing noise generation
"
)
return
0
generator
=
pyplnoise
.
RedNoise
(
fs
,
1
/
size
)
return
sqrt
(
psd
/
2
)
*
generator
.
get_series
(
size
)
def
infrared
(
fs
,
size
,
psd
):
"""
Generate an infrared noise in f^(-4).
"""
logging
.
debug
(
"
Generating infrared noise (fs=%s Hz, size=%s, psd=%s)
"
,
fs
,
size
,
psd
)
if
not
psd
:
logging
.
debug
(
"
Vanishing power spectral density, bypassing noise generation
"
)
return
0
red_noise
=
red
(
fs
,
size
,
psd
)
return
numpy
.
cumsum
(
red_noise
)
*
(
2
*
pi
/
fs
)
This diff is collapsed.
Click to expand it.
tests/notebook_noises.ipynb
0 → 100644
+
426
−
0
View file @
dc81c62b
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment