Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lalsuite-archive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Oliver Behnke
lalsuite-archive
Commits
47290e58
Commit
47290e58
authored
7 years ago
by
Leo Singer
Browse files
Options
Downloads
Patches
Plain Diff
Add metadata to image output
parent
68cd695e
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
lalinference/python/lalinference/bayestar/command.py
+16
-3
16 additions, 3 deletions
lalinference/python/lalinference/bayestar/command.py
with
16 additions
and
3 deletions
lalinference/python/lalinference/bayestar/command.py
+
16
−
3
View file @
47290e58
...
...
@@ -54,6 +54,11 @@ import distutils.version
mpl_version
=
distutils
.
version
.
LooseVersion
(
matplotlib
.
__version__
)
def
get_version
():
from
..
import
InferenceVCSInfo
as
vcs_info
return
vcs_info
.
name
+
'
'
+
vcs_info
.
version
@contextlib.contextmanager
def
TemporaryDirectory
(
suffix
=
''
,
prefix
=
'
tmp
'
,
dir
=
None
,
delete
=
True
):
try
:
...
...
@@ -169,7 +174,16 @@ class MatplotlibFigureType(argparse.FileType):
def
__save
(
self
):
from
matplotlib
import
pyplot
as
plt
return
plt
.
savefig
(
self
.
string
)
_
,
ext
=
os
.
path
.
splitext
(
self
.
string
)
ext
=
ext
.
lower
()
program
,
_
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
sys
.
argv
[
0
]))
cmdline
=
'
'
.
join
([
program
]
+
sys
.
argv
[
1
:])
metadata
=
{
'
Title
'
:
cmdline
}
if
ext
==
'
.png
'
:
metadata
[
'
Software
'
]
=
get_version
()
elif
ext
in
{
'
.pdf
'
,
'
.ps
'
,
'
.eps
'
}:
metadata
[
'
Creator
'
]
=
get_version
()
return
plt
.
savefig
(
self
.
string
,
metadata
=
metadata
)
def
__call__
(
self
,
string
):
from
matplotlib
import
pyplot
as
plt
...
...
@@ -284,8 +298,7 @@ del group
# Defer loading SWIG bindings until version string is needed.
class
VersionAction
(
argparse
.
_VersionAction
):
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
from
..
import
InferenceVCSInfo
self
.
version
=
'
LALInference
'
+
InferenceVCSInfo
.
version
self
.
version
=
get_version
()
super
(
VersionAction
,
self
).
__call__
(
parser
,
namespace
,
values
,
option_string
)
...
...
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