Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Sylvia Biscoveanu
bilby
Commits
647aaae9
Commit
647aaae9
authored
5 years ago
by
Colm Talbot
Committed by
Moritz Huebner
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix calibration
parent
18211360
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+2
-1
2 additions, 1 deletion
CHANGELOG.md
bilby/gw/calibration.py
+16
-11
16 additions, 11 deletions
bilby/gw/calibration.py
with
18 additions
and
12 deletions
CHANGELOG.md
+
2
−
1
View file @
647aaae9
...
...
@@ -6,7 +6,8 @@
-
### Changed
-
-
Make calibration work, maybe with interp1d
-
### Removed
-
...
...
This diff is collapsed.
Click to expand it.
bilby/gw/calibration.py
+
16
−
11
View file @
647aaae9
...
...
@@ -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
)
...
...
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