Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pygwinc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
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
gwinc
pygwinc
Commits
242245d1
Commit
242245d1
authored
4 years ago
by
Jameson Rollins
Browse files
Options
Downloads
Patches
Plain Diff
main: auto BNS range calculation if inspiral_range package available
parent
c51f8f48
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
gwinc/__main__.py
+21
-7
21 additions, 7 deletions
gwinc/__main__.py
with
21 additions
and
7 deletions
gwinc/__main__.py
+
21
−
7
View file @
242245d1
...
@@ -7,8 +7,8 @@ import numpy as np
...
@@ -7,8 +7,8 @@ import numpy as np
from
.
import
IFOS
,
load_budget
,
plot_noise
,
logger
from
.
import
IFOS
,
load_budget
,
plot_noise
,
logger
logger
.
setLevel
(
os
.
getenv
(
'
LOG_LEVEL
'
,
logging
.
WARNING
))
logger
.
setLevel
(
os
.
getenv
(
'
LOG_LEVEL
'
,
'
WARNING
'
).
upper
(
))
formatter
=
logging
.
Formatter
(
'
%(message)s
'
)
formatter
=
logging
.
Formatter
(
'
%(name)s:
%(message)s
'
)
handler
=
logging
.
StreamHandler
()
handler
=
logging
.
StreamHandler
()
handler
.
setFormatter
(
formatter
)
handler
.
setFormatter
(
formatter
)
logger
.
addHandler
(
handler
)
logger
.
addHandler
(
handler
)
...
@@ -40,7 +40,7 @@ file (without display) (various file formats are supported, indicated
...
@@ -40,7 +40,7 @@ file (without display) (various file formats are supported, indicated
by file extension). If the requested extension is
'
hdf5
'
or
'
h5
'
then
by file extension). If the requested extension is
'
hdf5
'
or
'
h5
'
then
the noise traces and IFO parameters will be saved to an HDF5 file.
the noise traces and IFO parameters will be saved to an HDF5 file.
If the inspiral_range package is
instal
le
d
, various figures of merit
If the inspiral_range package is
availab
le, various figures of merit
can be calculated for the resultant spectrum with the --fom option,
can be calculated for the resultant spectrum with the --fom option,
e.g.:
e.g.:
...
@@ -52,6 +52,7 @@ See the inspiral_range package documentation for details.
...
@@ -52,6 +52,7 @@ See the inspiral_range package documentation for details.
IFO
=
'
aLIGO
'
IFO
=
'
aLIGO
'
FREQ
=
'
5:3000:6000
'
FREQ
=
'
5:3000:6000
'
FOM
=
'
range:m1=1.4,m2=1.4
'
DATA_SAVE_FORMATS
=
[
'
.hdf5
'
,
'
.h5
'
]
DATA_SAVE_FORMATS
=
[
'
.hdf5
'
,
'
.h5
'
]
parser
=
argparse
.
ArgumentParser
(
parser
=
argparse
.
ArgumentParser
(
...
@@ -199,8 +200,19 @@ def main():
...
@@ -199,8 +200,19 @@ def main():
logger
.
warning
(
"
no display, plotting disabled.
"
)
logger
.
warning
(
"
no display, plotting disabled.
"
)
args
.
plot
=
False
args
.
plot
=
False
if
args
.
fom
:
try
:
import
inspiral_range
import
inspiral_range
logger_ir
=
logging
.
getLogger
(
'
inspiral_range
'
)
logger_ir
.
setLevel
(
logger
.
getEffectiveLevel
())
logger_ir
.
removeHandler
(
logger_ir
.
handlers
[
0
])
logger_ir
.
addHandler
(
logger
.
handlers
[
0
])
if
not
args
.
fom
:
args
.
fom
=
FOM
except
ModuleNotFoundError
:
if
args
.
fom
:
raise
logger
.
warning
(
"
inspiral_range package not available, figure of merit will not be calculated...
"
)
if
args
.
fom
:
try
:
try
:
range_func
,
fargs
=
args
.
fom
.
split
(
'
:
'
)
range_func
,
fargs
=
args
.
fom
.
split
(
'
:
'
)
except
ValueError
:
except
ValueError
:
...
@@ -210,11 +222,13 @@ def main():
...
@@ -210,11 +222,13 @@ def main():
for
param
in
fargs
.
split
(
'
,
'
):
for
param
in
fargs
.
split
(
'
,
'
):
if
not
param
:
if
not
param
:
continue
continue
p
,
v
=
param
.
split
(
'
=
'
)
p
,
v
=
param
.
split
(
'
=
'
)
if
not
v
:
if
not
v
:
raise
ValueError
(
'
missing parameter value
"
{}
"'
.
format
(
p
))
raise
ValueError
(
'
missing parameter value
"
{}
"'
.
format
(
p
))
if
p
!=
'
approximant
'
:
try
:
v
=
float
(
v
)
v
=
float
(
v
)
except
ValueError
:
pass
range_params
[
p
]
=
v
range_params
[
p
]
=
v
##########
##########
...
@@ -244,7 +258,7 @@ def main():
...
@@ -244,7 +258,7 @@ def main():
logger
.
debug
(
"
params: {}
"
.
format
(
H
.
params
))
logger
.
debug
(
"
params: {}
"
.
format
(
H
.
params
))
fom
=
eval
(
'
inspiral_range.{}
'
.
format
(
range_func
))(
freq
,
traces
[
'
Total
'
][
0
],
H
=
H
)
fom
=
eval
(
'
inspiral_range.{}
'
.
format
(
range_func
))(
freq
,
traces
[
'
Total
'
][
0
],
H
=
H
)
logger
.
info
(
"
{}({}) = {:.2f} Mpc
"
.
format
(
range_func
,
fargs
,
fom
))
logger
.
info
(
"
{}({}) = {:.2f} Mpc
"
.
format
(
range_func
,
fargs
,
fom
))
fom_title
=
'
{func} {m1}/{m2}
Msol
: {fom:.2f} Mpc
'
.
format
(
fom_title
=
'
{func} {m1}/{m2}
$\mathrm{{M}}_\odot$
: {fom:.2f} Mpc
'
.
format
(
func
=
range_func
,
func
=
range_func
,
m1
=
H
.
params
[
'
m1
'
],
m1
=
H
.
params
[
'
m1
'
],
m2
=
H
.
params
[
'
m2
'
],
m2
=
H
.
params
[
'
m2
'
],
...
...
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