Skip to content
Snippets Groups Projects
Commit a6f96f6a authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Merge branch '494-don-t-set-the-matplotlib-backend' into 'master'

Resolve "Don't set the matplotlib backend"

Closes #494

See merge request !816
parents 514b1bd9 1dd2b7fd
No related branches found
No related tags found
1 merge request!816Resolve "Don't set the matplotlib backend"
Pipeline #141928 passed with warnings
......@@ -6,7 +6,6 @@ import os
import shutil
from math import fmod
import argparse
import traceback
import inspect
import functools
import types
......@@ -16,7 +15,6 @@ from importlib import import_module
import json
import warnings
from distutils.version import StrictVersion
import numpy as np
from scipy.interpolate import interp2d
from scipy.special import logsumexp
......@@ -972,28 +970,6 @@ command_line_args, command_line_parser = set_up_command_line_arguments()
# Instantiate the default logging
setup_logger(print_version=False, log_level=command_line_args.log_level)
if 'DISPLAY' in os.environ:
logger.debug("DISPLAY={} environment found".format(os.environ['DISPLAY']))
pass
else:
logger.debug('No $DISPLAY environment variable found, so importing \
matplotlib.pyplot with non-interactive "Agg" backend.')
import matplotlib
import matplotlib.pyplot as plt
non_gui_backends = matplotlib.rcsetup.non_interactive_bk
for backend in non_gui_backends:
try:
logger.debug("Trying backend {}".format(backend))
if StrictVersion(matplotlib.__version__) >= StrictVersion("3.1"):
matplotlib.use(backend)
else:
matplotlib.use(backend, warn=False)
plt.switch_backend(backend)
break
except Exception:
print(traceback.format_exc())
class BilbyJsonEncoder(json.JSONEncoder):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment