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
895dd2a6
Commit
895dd2a6
authored
6 years ago
by
MoritzThomasHuebner
Browse files
Options
Downloads
Patches
Plain Diff
Continued refactoring
parent
6257ce9d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!124
Simplify wg redundant code
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tupak/gw/waveform_generator.py
+40
-38
40 additions, 38 deletions
tupak/gw/waveform_generator.py
with
40 additions
and
38 deletions
tupak/gw/waveform_generator.py
+
40
−
38
View file @
895dd2a6
...
...
@@ -78,29 +78,30 @@ class WaveformGenerator(object):
RuntimeError: If no source model is given
"""
model_strain
=
None
added_keys
=
self
.
_setup_conversion
()
preferred_model
=
self
.
frequency_domain_source_model
preferred_model_data_points
=
self
.
frequency_array
alternative_model
=
self
.
time_domain_source_model
alternative_model_data_points
=
self
.
time_array
model
=
self
.
frequency_domain_source_model
model_data_points
=
self
.
frequency_array
transformed_model
=
self
.
time_domain_source_model
transformed_model_data_points
=
self
.
time_array
transformation_function
=
utils
.
nfft
added_keys
=
self
.
_setup_conversion
()
if
preferred_model
is
not
None
:
model_strain
=
None
if
model
is
not
None
:
self
.
__full_source_model_keyword_arguments
.
update
(
self
.
parameters
)
model_strain
=
preferred_
model
(
preferred_
model_data_points
,
model_strain
=
model
(
model_data_points
,
**
self
.
__full_source_model_keyword_arguments
)
elif
alternative
_model
is
not
None
:
elif
transformed
_model
is
not
None
:
model_strain
=
dict
()
self
.
__full_source_model_keyword_arguments
.
update
(
self
.
parameters
)
t
ime_domain_strain
=
alternative
_model
(
alternative
_model_data_points
,
**
self
.
__full_source_model_keyword_arguments
)
if
isinstance
(
t
ime_domain
_strain
,
np
.
ndarray
):
return
utils
.
nfft
(
time_domain
_strain
,
self
.
sampling_frequency
)
for
key
in
t
ime_domain
_strain
:
model_strain
[
key
],
self
.
frequency_array
=
utils
.
nfft
(
time_domain
_strain
[
key
],
self
.
sampling_frequency
)
t
ransformed_model_strain
=
transformed
_model
(
transformed
_model_data_points
,
**
self
.
__full_source_model_keyword_arguments
)
if
isinstance
(
t
ransformed_model
_strain
,
np
.
ndarray
):
return
transformation_function
(
transformed_model
_strain
,
self
.
sampling_frequency
)
for
key
in
t
ransformed_model
_strain
:
model_strain
[
key
],
self
.
frequency_array
=
transformation_function
(
transformed_model
_strain
[
key
],
self
.
sampling_frequency
)
else
:
raise
RuntimeError
(
"
No source model given
"
)
...
...
@@ -131,27 +132,28 @@ class WaveformGenerator(object):
RuntimeError: If no source model is given
"""
model_strain
=
None
added_keys
=
self
.
_setup_conversion
()
preferred_model
=
self
.
time_domain_source_model
preferred_model_data_points
=
self
.
time_array
alternative_model
=
self
.
frequency_domain_source_model
alternative_model_data_points
=
self
.
frequency_array
model
=
self
.
time_domain_source_model
model_data_points
=
self
.
time_array
transformed_model
=
self
.
frequency_domain_source_model
transformed_model_data_points
=
self
.
frequency_array
transformation_function
=
utils
.
infft
added_keys
=
self
.
_setup_conversion
()
if
preferred_model
is
not
None
:
model_strain
=
None
if
model
is
not
None
:
self
.
__full_source_model_keyword_arguments
.
update
(
self
.
parameters
)
model_strain
=
preferred_
model
(
preferred_
model_data_points
,
**
self
.
__full_source_model_keyword_arguments
)
elif
alternative
_model
is
not
None
:
model_strain
=
model
(
model_data_points
,
**
self
.
__full_source_model_keyword_arguments
)
elif
transformed
_model
is
not
None
:
model_strain
=
dict
()
self
.
__full_source_model_keyword_arguments
.
update
(
self
.
parameters
)
frequency_domain_strain
=
alternative
_model
(
alternative
_model_data_points
,
**
self
.
__full_source_model_keyword_arguments
)
if
isinstance
(
frequency_domain
_strain
,
np
.
ndarray
):
return
utils
.
infft
(
frequency_domain
_strain
,
self
.
sampling_frequency
)
for
key
in
frequency_domain
_strain
:
model_strain
[
key
]
=
utils
.
infft
(
frequency_domain
_strain
[
key
],
self
.
sampling_frequency
)
transformed_model_strain
=
transformed
_model
(
transformed
_model_data_points
,
**
self
.
__full_source_model_keyword_arguments
)
if
isinstance
(
transformed_model
_strain
,
np
.
ndarray
):
return
transformation_function
(
transformed_model
_strain
,
self
.
sampling_frequency
)
for
key
in
transformed_model
_strain
:
model_strain
[
key
]
=
transformation_function
(
transformed_model
_strain
[
key
],
self
.
sampling_frequency
)
else
:
raise
RuntimeError
(
"
No source model given
"
)
...
...
@@ -169,8 +171,8 @@ class WaveformGenerator(object):
"""
if
self
.
__frequency_array_updated
is
False
:
self
.
frequency_array
=
utils
.
create_frequency_series
(
self
.
sampling_frequency
,
self
.
duration
)
self
.
sampling_frequency
,
self
.
duration
)
return
self
.
__frequency_array
@frequency_array.setter
...
...
@@ -189,9 +191,9 @@ class WaveformGenerator(object):
if
self
.
__time_array_updated
is
False
:
self
.
__time_array
=
utils
.
create_time_series
(
self
.
sampling_frequency
,
self
.
duration
,
self
.
start_time
)
self
.
sampling_frequency
,
self
.
duration
,
self
.
start_time
)
self
.
__time_array_updated
=
True
return
self
.
__time_array
...
...
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