Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lscsoft
bilby
Commits
87454beb
Commit
87454beb
authored
5 years ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
add psd caching
parent
f65c3654
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!483
add psd caching
Pipeline
#60743
failed
5 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bilby/gw/detector/interferometer.py
+8
-3
8 additions, 3 deletions
bilby/gw/detector/interferometer.py
bilby/gw/detector/psd.py
+19
-0
19 additions, 0 deletions
bilby/gw/detector/psd.py
with
27 additions
and
3 deletions
bilby/gw/detector/interferometer.py
+
8
−
3
View file @
87454beb
...
...
@@ -619,7 +619,10 @@ class Interferometer(object):
array_like: An array representation of the ASD
"""
return
self
.
power_spectral_density_array
**
0.5
return
(
self
.
power_spectral_density
.
get_amplitude_spectral_density_array
(
frequency_array
=
self
.
frequency_array
)
*
self
.
strain_data
.
window_factor
**
0.5
)
@property
def
power_spectral_density_array
(
self
):
...
...
@@ -632,8 +635,10 @@ class Interferometer(object):
array_like: An array representation of the PSD
"""
return
(
self
.
power_spectral_density
.
power_spectral_density_interpolated
(
self
.
frequency_array
)
*
self
.
strain_data
.
window_factor
)
return
(
self
.
power_spectral_density
.
get_power_spectral_density_array
(
frequency_array
=
self
.
frequency_array
)
*
self
.
strain_data
.
window_factor
)
@property
def
frequency_array
(
self
):
...
...
This diff is collapsed.
Click to expand it.
bilby/gw/detector/psd.py
+
19
−
0
View file @
87454beb
...
...
@@ -47,6 +47,15 @@ class PowerSpectralDensity(object):
self
.
asd_array
=
asd_array
self
.
psd_file
=
psd_file
self
.
asd_file
=
asd_file
self
.
_cache
=
dict
(
frequency_array
=
np
.
array
([]),
psd_array
=
None
,
asd_array
=
None
)
self
.
_update_cache
(
self
.
frequency_array
)
def
_update_cache
(
self
,
frequency_array
):
psd_array
=
self
.
power_spectral_density_interpolated
(
frequency_array
)
self
.
_cache
[
'
psd_array
'
]
=
psd_array
self
.
_cache
[
'
asd_array
'
]
=
psd_array
**
0.5
self
.
_cache
[
'
frequency_array
'
]
=
frequency_array
def
__eq__
(
self
,
other
):
if
self
.
psd_file
==
other
.
psd_file
\
...
...
@@ -183,6 +192,16 @@ class PowerSpectralDensity(object):
bounds_error
=
False
,
fill_value
=
np
.
inf
)
def
get_power_spectral_density_array
(
self
,
frequency_array
):
if
not
np
.
array_equal
(
frequency_array
,
self
.
_cache
[
'
frequency_array
'
]):
self
.
_update_cache
(
frequency_array
=
frequency_array
)
return
self
.
_cache
[
'
psd_array
'
]
def
get_amplitude_spectral_density_array
(
self
,
frequency_array
):
if
not
np
.
array_equal
(
frequency_array
,
self
.
_cache
[
'
frequency_array
'
]):
self
.
_update_cache
(
frequency_array
=
frequency_array
)
return
self
.
_cache
[
'
asd_array
'
]
@property
def
power_spectral_density_interpolated
(
self
):
return
self
.
__power_spectral_density_interpolated
...
...
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