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
198f8b73
Commit
198f8b73
authored
4 years ago
by
Jameson Rollins
Browse files
Options
Downloads
Plain Diff
Merge branch 'cli-improvements' into 'master'
Cli improvements Closes
#19
See merge request
!68
parents
0c79878c
242c3e53
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!68
Cli improvements
Pipeline
#120738
passed with warnings
4 years ago
Stage: dist
Stage: test
Stage: docs
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+6
-0
6 additions, 0 deletions
README.md
gwinc/__main__.py
+66
-31
66 additions, 31 deletions
gwinc/__main__.py
with
72 additions
and
31 deletions
README.md
+
6
−
0
View file @
198f8b73
...
...
@@ -68,6 +68,12 @@ Materials.Coating.Philown 5e-05 3e-05
$
python3
-m
gwinc my_aLIGO.yaml
```
You can also use the
`--ifo`
option to change parameters from the
command line:
```
shell
$
python3
-m
gwinc aLIGO
--ifo
Optics.SRM.Tunephase
=
3.14
```
Stand-alone YAML files will always assume the nominal
[
'aLIGO' budget
description
](
gwinc/ifo/aLIGO
)
.
...
...
This diff is collapsed.
Click to expand it.
gwinc/__main__.py
+
66
−
31
View file @
198f8b73
...
...
@@ -34,8 +34,12 @@ input file (IFO) can be an HDF5 file saved from a previous call, in
which case all noise traces and IFO parameters will be loaded from
that file.
Individual IFO parameters can be overriden with the --ifo option:
gwinc --ifo Optics.SRM.Tunephase=3.14 ...
If the inspiral_range package is installed, various figures of merit
can be calculated for the resultant spectrum with the --fom
argument
,
can be calculated for the resultant spectrum with the --fom
option
,
e.g.:
gwinc --fom horizon ...
...
...
@@ -46,39 +50,59 @@ See documentation for inspiral_range package for details.
"""
IFO
=
'
aLIGO
'
FLO
=
5
FHI
=
6000
NPOINTS
=
3000
FREQ
=
'
5:3000:6000
'
parser
=
argparse
.
ArgumentParser
(
prog
=
'
gwinc
'
,
description
=
description
,
formatter_class
=
argparse
.
RawDescriptionHelpFormatter
)
parser
.
add_argument
(
'
--flo
'
,
'
-fl
'
,
default
=
FLO
,
type
=
float
,
help
=
"
lower frequency bound in Hz [{}]
"
.
format
(
FLO
))
parser
.
add_argument
(
'
--fhi
'
,
'
--fh
'
,
default
=
FHI
,
type
=
float
,
help
=
"
upper frequency bound in Hz [{}]
"
.
format
(
FHI
))
parser
.
add_argument
(
'
--npoints
'
,
'
-n
'
,
default
=
NPOINTS
,
help
=
"
number of frequency points [{}]
"
.
format
(
NPOINTS
))
parser
.
add_argument
(
'
--title
'
,
'
-t
'
,
help
=
"
plot title
"
)
parser
.
add_argument
(
'
--fom
'
,
help
=
"
calculate inspiral range for resultant spectrum (
'
func[:param=val,param=val]
'
)
"
)
parser
.
add_argument
(
'
--freq
'
,
'
-f
'
,
metavar
=
'
FSPEC
'
,
help
=
"
frequency array specification in Hz, either as
'
flo:fhi
'
or
'
flo:npoints:fhi
'
[{}]
"
.
format
(
FREQ
))
parser
.
add_argument
(
'
--ifo
'
,
'
-o
'
,
#nargs='+', action='extend',
action
=
'
append
'
,
help
=
"
override budget IFO parameter (may be specified multiple times)
"
)
parser
.
add_argument
(
'
--title
'
,
'
-t
'
,
help
=
"
plot title
"
)
parser
.
add_argument
(
'
--fom
'
,
help
=
"
calculate inspiral range for resultant spectrum (
'
func[:param=val,param=val]
'
)
"
)
group
=
parser
.
add_mutually_exclusive_group
()
group
.
add_argument
(
'
--interactive
'
,
'
-i
'
,
action
=
'
store_true
'
,
help
=
"
interactive plot with interactive shell
"
)
group
.
add_argument
(
'
--save
'
,
'
-s
'
,
help
=
"
save budget traces (.hdf5/.h5) or plot (.pdf/.png/.svg) to file
"
)
group
.
add_argument
(
'
--yaml
'
,
'
-y
'
,
action
=
'
store_true
'
,
help
=
"
print IFO as yaml to stdout and exit
"
)
group
.
add_argument
(
'
--text
'
,
'
-x
'
,
action
=
'
store_true
'
,
help
=
"
print IFO as text table to stdout and exit
"
)
group
.
add_argument
(
'
--diff
'
,
'
-d
'
,
metavar
=
'
IFO
'
,
help
=
"
show differences table between another IFO description
"
)
group
.
add_argument
(
'
--no-plot
'
,
'
-np
'
,
action
=
'
store_false
'
,
dest
=
'
plot
'
,
help
=
"
supress plotting
"
)
parser
.
add_argument
(
'
IFO
'
,
help
=
"
IFO name, description file path (.yaml, .mat, .m), budget module (.py), or HDF5 data file (.hdf5, .h5)
"
)
group
.
add_argument
(
'
--interactive
'
,
'
-i
'
,
action
=
'
store_true
'
,
help
=
"
interactive plot with interactive shell
"
)
group
.
add_argument
(
'
--save
'
,
'
-s
'
,
help
=
"
save budget traces (.hdf5/.h5) or plot (.pdf/.png/.svg) to file
"
)
group
.
add_argument
(
'
--yaml
'
,
'
-y
'
,
action
=
'
store_true
'
,
help
=
"
print IFO as yaml to stdout and exit
"
)
group
.
add_argument
(
'
--text
'
,
'
-x
'
,
action
=
'
store_true
'
,
help
=
"
print IFO as text table to stdout and exit
"
)
group
.
add_argument
(
'
--diff
'
,
'
-d
'
,
metavar
=
'
IFO
'
,
help
=
"
show differences table between another IFO description
"
)
group
.
add_argument
(
'
--no-plot
'
,
'
-np
'
,
action
=
'
store_false
'
,
dest
=
'
plot
'
,
help
=
"
supress plotting
"
)
parser
.
add_argument
(
'
IFO
'
,
help
=
"
IFO name, description file path (.yaml, .mat, .m), budget module (.py), or HDF5 data file (.hdf5, .h5)
"
)
def
freq_from_spec
(
spec
):
fspec
=
spec
.
split
(
'
:
'
)
if
len
(
fspec
)
==
2
:
fspec
=
fspec
[
0
],
FREQ
.
split
(
'
:
'
)[
1
],
fspec
[
1
]
return
np
.
logspace
(
np
.
log10
(
float
(
fspec
[
0
])),
np
.
log10
(
float
(
fspec
[
2
])),
int
(
fspec
[
1
]),
)
def
main
():
...
...
@@ -95,16 +119,27 @@ def main():
freq
,
traces
,
attrs
=
load_hdf5
(
args
.
IFO
)
ifo
=
getattr
(
attrs
,
'
IFO
'
,
None
)
plot_style
=
attrs
if
args
.
freq
:
logging
.
warning
(
"
ignoring frequency specification for frequencies defined in HDF5...
"
)
else
:
Budget
=
load_budget
(
args
.
IFO
)
ifo
=
Budget
.
ifo
# FIXME: this should be done only if specified, to allow for
# using any FREQ specified in the Budget
freq
=
np
.
logspace
(
np
.
log10
(
args
.
flo
),
np
.
log10
(
args
.
fhi
),
args
.
npoints
)
if
args
.
freq
:
try
:
freq
=
freq_from_spec
(
args
.
freq
)
except
IndexError
:
parser
.
error
(
"
improper frequency specification
'
{}
'"
.
format
(
args
.
freq
))
else
:
freq
=
getattr
(
Budget
,
'
freq
'
,
freq_from_spec
(
FREQ
))
plot_style
=
getattr
(
Budget
,
'
plot_style
'
,
{})
traces
=
None
if
args
.
ifo
:
for
paramval
in
args
.
ifo
:
param
,
val
=
paramval
.
split
(
'
=
'
,
1
)
ifo
[
param
]
=
float
(
val
)
if
args
.
yaml
:
if
not
ifo
:
parser
.
exit
(
2
,
"
no IFO structure available.
"
)
...
...
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