Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Keitel
PyFstat
Commits
9b6d34b7
Commit
9b6d34b7
authored
Aug 26, 2017
by
Gregory Ashton
Browse files
Fixes command line options for verbose/quite
parent
1cb3e05d
Changes
2
Hide whitespace changes
Inline
Side-by-side
pyfstat/core.py
View file @
9b6d34b7
...
...
@@ -869,12 +869,7 @@ class SemiCoherentSearch(BaseSearchClass, ComputeFstat):
self
.
whatToCompute
=
lalpulsar
.
FSTATQ_2F
+
lalpulsar
.
FSTATQ_ATOMS_PER_DET
self
.
tboundaries
=
np
.
linspace
(
self
.
minStartTime
,
self
.
maxStartTime
,
self
.
nsegs
+
1
)
def
run_semi_coherent_computefstatistic_single_point
(
self
,
F0
,
F1
,
F2
,
Alpha
,
Delta
,
asini
=
None
,
period
=
None
,
ecc
=
None
,
tp
=
None
,
argp
=
None
,
record_segments
=
False
):
""" Returns twoF or ln(BSGL) semi-coherently at a single point """
self
.
Tcoh
=
self
.
tboundaries
[
1
]
-
self
.
tboundaries
[
0
]
if
hasattr
(
self
,
'SFT_timestamps'
):
if
self
.
tboundaries
[
0
]
<
self
.
SFT_timestamps
[
0
]:
...
...
@@ -886,6 +881,12 @@ class SemiCoherentSearch(BaseSearchClass, ComputeFstat):
'Semi-coherent end time {} after last SFT timestamp {}'
.
format
(
self
.
tboundaries
[
-
1
],
self
.
SFT_timestamps
[
-
1
]))
def
run_semi_coherent_computefstatistic_single_point
(
self
,
F0
,
F1
,
F2
,
Alpha
,
Delta
,
asini
=
None
,
period
=
None
,
ecc
=
None
,
tp
=
None
,
argp
=
None
,
record_segments
=
False
):
""" Returns twoF or ln(BSGL) semi-coherently at a single point """
self
.
PulsarDopplerParams
.
fkdot
=
np
.
array
([
F0
,
F1
,
F2
,
0
,
0
,
0
,
0
])
self
.
PulsarDopplerParams
.
Alpha
=
Alpha
self
.
PulsarDopplerParams
.
Delta
=
Delta
...
...
pyfstat/helper_functions.py
View file @
9b6d34b7
...
...
@@ -35,15 +35,12 @@ def set_up_matplotlib_defaults():
def
set_up_command_line_arguments
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"-q"
,
"--quite"
,
help
=
"Decrease output verbosity"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-v"
,
"--verbose"
,
help
=
"Increase output verbosity"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-l"
,
"--set-log-level"
,
default
=
None
,
choices
=
[
'NOTSET'
,
'DEBUG'
,
'INFO'
,
'WARNING'
,
'ERROR'
,
'CRITICAL'
],
help
=
(
"Set log level, see https://docs.python.org/2/"
"library/logging.html#levels, overides -q/v"
))
parser
.
add_argument
(
"-v"
,
"--verbose"
,
action
=
"store_true"
,
help
=
"Increase output verbosity [logging.DEBUG]"
)
parser
.
add_argument
(
"-q"
,
"--quite"
,
action
=
"store_true"
,
help
=
"Decrease output verbosity [logging.WARNGING]"
)
parser
.
add_argument
(
"-vq"
,
"--very_quite"
,
action
=
"store_true"
,
help
=
"Increase output verbosity [logging.ERROR]"
)
parser
.
add_argument
(
"--no-interactive"
,
help
=
"Don't use interactive"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-c"
,
"--clean"
,
help
=
"Don't use cached data"
,
...
...
@@ -57,24 +54,28 @@ def set_up_command_line_arguments():
parser
.
add_argument
(
'unittest_args'
,
nargs
=
'*'
)
args
,
unknown
=
parser
.
parse_known_args
()
sys
.
argv
[
1
:]
=
args
.
unittest_args
if
args
.
quite
or
args
.
no_interactive
:
def
tqdm
(
x
,
*
args
,
**
kwargs
):
return
x
else
:
tqdm
=
set_up_optional_tqdm
()
logger
=
logging
.
getLogger
()
logger
.
setLevel
(
logging
.
INFO
)
stream_handler
=
logging
.
StreamHandler
()
stream_handler
.
setFormatter
(
logging
.
Formatter
(
'%(asctime)s %(levelname)-8s: %(message)s'
,
datefmt
=
'%H:%M'
))
if
args
.
quite
:
logger
.
setLevel
(
logging
.
WARNING
)
stream_handler
.
setLevel
(
logging
.
WARNING
)
elif
args
.
verbose
:
logger
.
setLevel
(
logging
.
DEBUG
)
stream_handler
.
setLevel
(
logging
.
DEBUG
)
else
:
logger
.
setLevel
(
logging
.
INFO
)
stream_handler
.
setLevel
(
logging
.
INFO
)
if
args
.
set_log_level
:
stream_handler
.
setLevel
(
getattr
(
logging
,
args
.
set_log_level
))
stream_handler
.
setFormatter
(
logging
.
Formatter
(
'%(asctime)s %(levelname)-8s: %(message)s'
,
datefmt
=
'%H:%M'
))
logger
.
addHandler
(
stream_handler
)
return
args
,
tqdm
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment