Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyFstat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
Gregory Ashton
PyFstat
Commits
42739af1
Commit
42739af1
authored
7 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Adds log_level option to run_commandline and minor PEP8 change
parent
48d1f278
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyfstat/helper_functions.py
+16
-4
16 additions, 4 deletions
pyfstat/helper_functions.py
with
16 additions
and
4 deletions
pyfstat/helper_functions.py
+
16
−
4
View file @
42739af1
...
...
@@ -12,6 +12,7 @@ import peakutils
from
functools
import
wraps
from
scipy.stats.distributions
import
ncx2
import
lal
import
lalpulsar
import
matplotlib.pyplot
as
plt
import
numpy
as
np
...
...
@@ -187,10 +188,20 @@ def compute_pstar(twoFcheck_obs, twoFstarcheck_obs, m0, plot=False):
return
2
*
np
.
min
([
pstar_l
,
1
-
pstar_l
])
def
run_commandline
(
cl
):
"""
Run a string c
ommandline
as a subprocess, check for errors and return output.
"""
def
run_commandline
(
cl
,
log_level
=
20
):
"""
Run a string c
md
as a subprocess, check for errors and return output.
logging
.
info
(
'
Now executing:
'
+
cl
)
Parameters
----------
cl: str
Command to run
log_level: int
See https://docs.python.org/2/library/logging.html#logging-levels,
default is
'
20
'
(INFO)
"""
logging
.
log
(
log_level
,
'
Now executing:
'
+
cl
)
try
:
out
=
subprocess
.
check_output
(
cl
,
# what to run
stderr
=
subprocess
.
STDOUT
,
# catch errors
...
...
@@ -205,6 +216,7 @@ def run_commandline (cl):
return
(
out
)
def
convert_array_to_gsl_matrix
(
array
):
gsl_matrix
=
lal
.
gsl_matrix
(
*
array
.
shape
)
gsl_matrix
.
data
=
array
...
...
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