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
33f43f62
Commit
33f43f62
authored
6 years ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
refactoring
parent
dde95897
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!105
Time domain data
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tupak/gw/utils.py
+7
-7
7 additions, 7 deletions
tupak/gw/utils.py
with
7 additions
and
7 deletions
tupak/gw/utils.py
+
7
−
7
View file @
33f43f62
...
...
@@ -295,7 +295,7 @@ def get_event_time(event):
def
get_open_strain_data
(
name
,
t1
,
t2
,
outdir
,
cache
=
False
,
buffer_time
=
0
,
**
kwargs
):
name
,
start_time
,
end_time
,
outdir
,
cache
=
False
,
buffer_time
=
0
,
**
kwargs
):
"""
A function which accesses the open strain data
This uses `gwpy` to download the open data and then saves a cached copy for
...
...
@@ -305,7 +305,7 @@ def get_open_strain_data(
----------
name: str
The name of the detector to get data for
t1, t2
: float
start_time, end_time
: float
The GPS time of the start and end of the data
outdir: str
The output directory to place data in
...
...
@@ -321,20 +321,20 @@ def get_open_strain_data(
strain: gwpy.timeseries.TimeSeries
"""
filename
=
'
{}/{}_{}_{}.txt
'
.
format
(
outdir
,
name
,
t1
,
t2
)
filename
=
'
{}/{}_{}_{}.txt
'
.
format
(
outdir
,
name
,
start_time
,
end_time
)
if
buffer_time
<
0
:
raise
ValueError
(
"
buffer_time < 0
"
)
t1
=
t1
-
buffer_time
t2
=
t2
+
buffer_time
start_time
=
start_time
-
buffer_time
end_time
=
end_time
+
buffer_time
if
os
.
path
.
isfile
(
filename
)
and
cache
:
logger
.
info
(
'
Using cached data from {}
'
.
format
(
filename
))
strain
=
TimeSeries
.
read
(
filename
)
else
:
logger
.
info
(
'
Fetching open data from {} to {} with buffer time {}
'
.
format
(
t1
,
t2
,
buffer_time
))
strain
=
TimeSeries
.
fetch_open_data
(
name
,
t1
,
t2
,
**
kwargs
)
.
format
(
start_time
,
end_time
,
buffer_time
))
strain
=
TimeSeries
.
fetch_open_data
(
name
,
start_time
,
end_time
,
**
kwargs
)
logger
.
info
(
'
Saving data to {}
'
.
format
(
filename
))
strain
.
write
(
filename
)
return
strain
...
...
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