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
1e6cb083
Commit
1e6cb083
authored
6 years ago
by
Isobel Marguarethe Romero-Shaw
Committed by
Gregory Ashton
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "Enable different query types to be passed to gw_data_find command line"
parent
9fba8be8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bilby/gw/utils.py
+37
-19
37 additions, 19 deletions
bilby/gw/utils.py
with
37 additions
and
19 deletions
bilby/gw/utils.py
+
37
−
19
View file @
1e6cb083
...
...
@@ -407,6 +407,7 @@ def read_frame_file(file_name, start_time, end_time, channel=None, buffer_time=1
"""
loaded
=
False
strain
=
None
if
channel
is
not
None
:
try
:
strain
=
TimeSeries
.
read
(
source
=
file_name
,
channel
=
channel
,
start
=
start_time
,
end
=
end_time
,
**
kwargs
)
...
...
@@ -414,17 +415,24 @@ def read_frame_file(file_name, start_time, end_time, channel=None, buffer_time=1
logger
.
info
(
'
Successfully loaded {}.
'
.
format
(
channel
))
except
RuntimeError
:
logger
.
warning
(
'
Channel {} not found. Trying preset channel names
'
.
format
(
channel
))
for
channel_type
in
[
'
GDS-CALIB_STRAIN
'
,
'
DCS-CALIB_STRAIN_C01
'
,
'
DCS-CALIB_STRAIN_C02
'
]:
for
ifo_name
in
[
'
H1
'
,
'
L1
'
]:
channel
=
'
{}:{}
'
.
format
(
ifo_name
,
channel_type
)
if
loaded
:
continue
try
:
strain
=
TimeSeries
.
read
(
source
=
file_name
,
channel
=
channel
,
start
=
start_time
,
end
=
end_time
,
**
kwargs
)
loaded
=
True
logger
.
info
(
'
Successfully loaded {}.
'
.
format
(
channel
))
except
RuntimeError
:
pass
while
not
loaded
:
ligo_channel_types
=
[
'
GDS-CALIB_STRAIN
'
,
'
DCS-CALIB_STRAIN_C01
'
,
'
DCS-CALIB_STRAIN_C02
'
,
'
DCH-CLEAN_STRAIN_C02
'
]
virgo_channel_types
=
[
'
Hrec_hoft_V1O2Repro2A_16384Hz
'
,
'
FAKE_h_16384Hz_4R
'
]
channel_types
=
dict
(
H1
=
ligo_channel_types
,
L1
=
ligo_channel_types
,
V1
=
virgo_channel_types
)
for
detector
in
channel_types
.
keys
():
for
channel_type
in
channel_types
[
detector
]:
if
loaded
:
break
channel
=
'
{}:{}
'
.
format
(
detector
,
channel_type
)
try
:
strain
=
TimeSeries
.
read
(
source
=
file_name
,
channel
=
channel
,
start
=
start_time
,
end
=
end_time
,
**
kwargs
)
loaded
=
True
logger
.
info
(
'
Successfully read strain data for channel {}.
'
.
format
(
channel
))
except
RuntimeError
:
pass
if
loaded
:
return
strain
...
...
@@ -433,15 +441,17 @@ def read_frame_file(file_name, start_time, end_time, channel=None, buffer_time=1
return
None
def
get_gracedb
(
gracedb
,
outdir
,
duration
,
calibration
,
detectors
):
def
get_gracedb
(
gracedb
,
outdir
,
duration
,
calibration
,
detectors
,
query_types
=
None
):
candidate
=
gracedb_to_json
(
gracedb
,
outdir
)
trigger_time
=
candidate
[
'
gpstime
'
]
gps_start_time
=
trigger_time
-
duration
cache_files
=
[]
for
det
in
detectors
:
if
query_types
is
None
:
query_types
=
[
None
]
*
len
(
detectors
)
for
i
,
det
in
enumerate
(
detectors
):
output_cache_file
=
gw_data_find
(
det
,
gps_start_time
,
duration
,
calibration
,
outdir
=
outdir
)
outdir
=
outdir
,
query_type
=
query_types
[
i
]
)
cache_files
.
append
(
output_cache_file
)
return
candidate
,
cache_files
...
...
@@ -487,7 +497,7 @@ def gracedb_to_json(gracedb, outdir=None):
def
gw_data_find
(
observatory
,
gps_start_time
,
duration
,
calibration
,
outdir
=
'
.
'
):
outdir
=
'
.
'
,
query_type
=
None
):
"""
Builds a gw_data_find call and process output
Parameters
...
...
@@ -502,6 +512,8 @@ def gw_data_find(observatory, gps_start_time, duration, calibration,
Use C01 or C02 calibration
outdir: string
A path to the directory where output is stored
query_type: string
The LDRDataFind query type
Returns
-------
...
...
@@ -514,11 +526,17 @@ def gw_data_find(observatory, gps_start_time, duration, calibration,
observatory_lookup
=
dict
(
H1
=
'
H
'
,
L1
=
'
L
'
,
V1
=
'
V
'
)
observatory_code
=
observatory_lookup
[
observatory
]
dtype
=
'
{}_HOFT_C0{}
'
.
format
(
observatory
,
calibration
)
logger
.
info
(
'
Using LDRDataFind query type {}
'
.
format
(
dtype
))
if
query_type
is
None
:
logger
.
warning
(
'
No query type provided. This may prevent data from being read.
'
)
if
observatory_code
is
'
V
'
:
query_type
=
'
V1Online
'
else
:
query_type
=
'
{}_HOFT_C0{}
'
.
format
(
observatory
,
calibration
)
logger
.
info
(
'
Using LDRDataFind query type {}
'
.
format
(
query_type
))
cache_file
=
'
{}-{}_CACHE-{}-{}.lcf
'
.
format
(
observatory
,
d
type
,
gps_start_time
,
duration
)
observatory
,
query_
type
,
gps_start_time
,
duration
)
output_cache_file
=
os
.
path
.
join
(
outdir
,
cache_file
)
gps_end_time
=
gps_start_time
+
duration
...
...
@@ -527,7 +545,7 @@ def gw_data_find(observatory, gps_start_time, duration, calibration,
cl_list
.
append
(
'
--observatory {}
'
.
format
(
observatory_code
))
cl_list
.
append
(
'
--gps-start-time {}
'
.
format
(
gps_start_time
))
cl_list
.
append
(
'
--gps-end-time {}
'
.
format
(
gps_end_time
))
cl_list
.
append
(
'
--type {}
'
.
format
(
d
type
))
cl_list
.
append
(
'
--type {}
'
.
format
(
query_
type
))
cl_list
.
append
(
'
--output {}
'
.
format
(
output_cache_file
))
cl_list
.
append
(
'
--url-type file
'
)
cl_list
.
append
(
'
--lal-cache
'
)
...
...
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