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
Merge requests
!413
Fix calibration
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Fix calibration
fix-calibration
into
master
Overview
0
Commits
16
Pipelines
3
Changes
2
Merged
Colm Talbot
requested to merge
fix-calibration
into
master
6 years ago
Overview
0
Commits
16
Pipelines
3
Changes
2
Expand
Change from the
UnivariateSpline
to
interp1d
.
0
0
Merge request reports
Compare
master
version 2
ba14c2b6
6 years ago
version 1
55376c68
6 years ago
master (base)
and
latest version
latest version
e65b0ea1
16 commits,
6 years ago
version 2
ba14c2b6
15 commits,
6 years ago
version 1
55376c68
12 commits,
6 years ago
2 files
+
18
−
12
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
bilby/gw/calibration.py
+
16
−
11
Options
@@ -2,7 +2,7 @@
"""
import
numpy
as
np
from
scipy.interpolate
import
UnivariateSpline
from
scipy.interpolate
import
interp1d
class
Recalibrate
(
object
):
@@ -83,11 +83,12 @@ class CubicSpline(Recalibrate):
self
.
n_points
=
n_points
self
.
minimum_frequency
=
minimum_frequency
self
.
maximum_frequency
=
maximum_frequency
self
.
__spline_points
=
np
.
logspace
(
np
.
log10
(
minimum_frequency
),
np
.
log10
(
maximum_frequency
),
n_points
)
self
.
_log_spline_points
=
np
.
linspace
(
np
.
log10
(
minimum_frequency
),
np
.
log10
(
maximum_frequency
),
n_points
)
@property
def
spline_points
(
self
):
return
self
.
__spline_points
def
log_
spline_points
(
self
):
return
self
.
_
log
_spline_points
def
__repr__
(
self
):
return
self
.
__class__
.
__name__
+
'
(prefix=
\'
{}
\'
, minimum_frequency={}, maximum_frequency={}, n_points={})
'
\
@@ -112,13 +113,17 @@ class CubicSpline(Recalibrate):
The factor to multiply the strain by.
"""
self
.
set_calibration_parameters
(
**
params
)
amplitude_parameters
=
[
self
.
params
[
'
amplitude_{}
'
.
format
(
ii
)]
for
ii
in
range
(
self
.
n_points
)]
amplitude_spline
=
UnivariateSpline
(
self
.
spline_points
,
amplitude_parameters
)
delta_amplitude
=
amplitude_spline
(
frequency_array
)
phase_parameters
=
[
self
.
params
[
'
phase_{}
'
.
format
(
ii
)]
for
ii
in
range
(
self
.
n_points
)]
phase_spline
=
UnivariateSpline
(
self
.
spline_points
,
phase_parameters
)
delta_phase
=
phase_spline
(
frequency_array
)
amplitude_parameters
=
[
self
.
params
[
'
amplitude_{}
'
.
format
(
ii
)]
for
ii
in
range
(
self
.
n_points
)]
delta_amplitude
=
interp1d
(
self
.
log_spline_points
,
amplitude_parameters
,
kind
=
'
cubic
'
,
bounds_error
=
False
,
fill_value
=
0
)(
np
.
log10
(
frequency_array
))
phase_parameters
=
[
self
.
params
[
'
phase_{}
'
.
format
(
ii
)]
for
ii
in
range
(
self
.
n_points
)]
delta_phase
=
interp1d
(
self
.
log_spline_points
,
phase_parameters
,
kind
=
'
cubic
'
,
bounds_error
=
False
,
fill_value
=
0
)(
np
.
log10
(
frequency_array
))
calibration_factor
=
(
1
+
delta_amplitude
)
*
(
2
+
1j
*
delta_phase
)
/
(
2
-
1j
*
delta_phase
)
Loading