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
Pep Covas Vidal
PyFstat
Commits
2a2e469a
Commit
2a2e469a
authored
Nov 05, 2019
by
David Keitel
Browse files
black style fixes to preceding set of ephem-handling commits
parent
0e9d656b
Changes
2
Hide whitespace changes
Inline
Side-by-side
pyfstat/helper_functions.py
View file @
2a2e469a
...
...
@@ -147,14 +147,22 @@ def get_ephemeris_files():
sun_ephem
=
None
elif
env_var
in
list
(
os
.
environ
.
keys
()):
ephem_version
=
"DE405"
earth_ephem
=
os
.
path
.
join
(
os
.
environ
[
env_var
],
"earth00-40-{:s}.dat.gz"
.
format
(
ephem_version
))
sun_ephem
=
os
.
path
.
join
(
os
.
environ
[
env_var
],
"sun00-40-{:s}.dat.gz"
.
format
(
ephem_version
))
earth_ephem
=
os
.
path
.
join
(
os
.
environ
[
env_var
],
"earth00-40-{:s}.dat.gz"
.
format
(
ephem_version
)
)
sun_ephem
=
os
.
path
.
join
(
os
.
environ
[
env_var
],
"sun00-40-{:s}.dat.gz"
.
format
(
ephem_version
)
)
if
not
(
os
.
path
.
isfile
(
earth_ephem
)
and
os
.
path
.
isfile
(
sun_ephem
)):
earth_ephem
=
os
.
path
.
join
(
os
.
environ
[
env_var
],
"earth00-19-{:s}.dat.gz"
.
format
(
ephem_version
))
sun_ephem
=
os
.
path
.
join
(
os
.
environ
[
env_var
],
"sun00-19-{:s}.dat.gz"
.
format
(
ephem_version
))
earth_ephem
=
os
.
path
.
join
(
os
.
environ
[
env_var
],
"earth00-19-{:s}.dat.gz"
.
format
(
ephem_version
)
)
sun_ephem
=
os
.
path
.
join
(
os
.
environ
[
env_var
],
"sun00-19-{:s}.dat.gz"
.
format
(
ephem_version
)
)
if
not
(
os
.
path
.
isfile
(
earth_ephem
)
and
os
.
path
.
isfile
(
sun_ephem
)):
logging
.
warning
(
"Default [earth/sun]00-[19/40]-"
+
ephem_version
+
" ephemerides "
"Default [earth/sun]00-[19/40]-"
+
ephem_version
+
" ephemerides "
"not found in the "
+
os
.
environ
[
env_var
]
+
" directory. "
+
please
)
earth_ephem
=
None
...
...
@@ -380,5 +388,5 @@ def match_commandlines(cl1, cl2, be_strict_about_full_executable_path=False):
if
not
be_strict_about_full_executable_path
:
cl1s
[
0
]
=
os
.
path
.
basename
(
cl1s
[
0
])
cl2s
[
0
]
=
os
.
path
.
basename
(
cl2s
[
0
])
unmatched
=
np
.
setxor1d
(
cl1s
,
cl2s
)
return
len
(
unmatched
)
==
0
unmatched
=
np
.
setxor1d
(
cl1s
,
cl2s
)
return
len
(
unmatched
)
==
0
pyfstat/make_sfts.py
View file @
2a2e469a
...
...
@@ -263,14 +263,18 @@ transientTau = {:10.0f}\n"""
logging
.
info
(
"Checking if cached data good to reuse..."
)
if
os
.
path
.
isfile
(
self
.
sftfilepath
)
is
False
:
logging
.
info
(
"No SFT file matching {} found. {}"
.
format
(
self
.
sftfilepath
,
need_new
))
logging
.
info
(
"No SFT file matching {} found. {}"
.
format
(
self
.
sftfilepath
,
need_new
)
)
return
False
else
:
logging
.
info
(
"OK: Matching SFT file found."
)
if
"injectionSources"
in
cl_mfd
:
if
os
.
path
.
isfile
(
self
.
config_file_name
):
if
os
.
path
.
getmtime
(
self
.
sftfilepath
)
<
os
.
path
.
getmtime
(
self
.
config_file_name
):
if
os
.
path
.
getmtime
(
self
.
sftfilepath
)
<
os
.
path
.
getmtime
(
self
.
config_file_name
):
logging
.
info
(
(
"The config file {} has been modified since the SFT file {} "
...
...
@@ -281,24 +285,34 @@ transientTau = {:10.0f}\n"""
else
:
logging
.
info
(
"OK: The config file {} is older than the SFT file {}"
.
format
(
self
.
config_file_name
,
self
.
sftfilepath
)
self
.
config_file_name
,
self
.
sftfilepath
)
)
# NOTE: at this point we assume it's safe to re-use, since
# check_if_cff_file_needs_rewritting()
# should have already been called before
)
else
:
raise
RuntimeError
(
"Commandline requires file '{}' but it is missing."
.
format
(
self
.
config_file_name
))
raise
RuntimeError
(
"Commandline requires file '{}' but it is missing."
.
format
(
self
.
config_file_name
)
)
logging
.
info
(
"Checking new commandline against existing SFT header..."
)
cl_dump
=
"lalapps_SFTdumpheader {} | head -n 20"
.
format
(
self
.
sftfilepath
)
output
=
helper_functions
.
run_commandline
(
cl_dump
)
header_lines_lalapps
=
[
line
for
line
in
output
.
split
(
"
\n
"
)
if
"lalapps"
in
line
]
if
len
(
header_lines_lalapps
)
==
0
:
logging
.
info
(
"Could not obtain comparison commandline from old SFT header. "
+
need_new
)
header_lines_lalapps
=
[
line
for
line
in
output
.
split
(
"
\n
"
)
if
"lalapps"
in
line
]
if
len
(
header_lines_lalapps
)
==
0
:
logging
.
info
(
"Could not obtain comparison commandline from old SFT header. "
+
need_new
)
return
False
cl_old
=
header_lines_lalapps
[
0
]
if
not
helper_functions
.
match_commandlines
(
cl_old
,
cl_mfd
):
logging
.
info
(
"Commandlines unmatched. "
+
need_new
)
if
not
helper_functions
.
match_commandlines
(
cl_old
,
cl_mfd
):
logging
.
info
(
"Commandlines unmatched. "
+
need_new
)
return
False
else
:
logging
.
info
(
"OK: Commandline matched with old SFT header."
)
...
...
@@ -329,7 +343,9 @@ transientTau = {:10.0f}\n"""
return
False
else
:
logging
.
info
(
"File contents unmatched, updating {}."
.
format
(
self
.
config_file_name
)
"File contents unmatched, updating {}."
.
format
(
self
.
config_file_name
)
)
return
True
...
...
@@ -392,7 +408,7 @@ transientTau = {:10.0f}\n"""
self
.
sqrtSX
,
tempory_filename
=
"{}.tmp"
.
format
(
self
.
label
),
earth_ephem
=
self
.
earth_ephem
,
sun_ephem
=
self
.
sun_ephem
sun_ephem
=
self
.
sun_ephem
,
)
# detectors OR IFO?
return
twoF_expected
...
...
Write
Preview
Supports
Markdown
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