Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not set matplotlib's backend in internal modules #4592

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bin/pycbc_make_skymap
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import logging
import subprocess
import tempfile
import shutil

# we will make plots on a likely headless machine, so make sure matplotlib's
# backend is set appropriately
from matplotlib import use as mpl_use_backend
mpl_use_backend('agg')

import numpy as np
import h5py
import pycbc
Expand Down
15 changes: 12 additions & 3 deletions bin/pycbc_optimize_snr
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,29 @@
"""Followup utility to optimize the SNR of a PyCBC Live trigger."""

import os
import argparse, numpy, h5py
import argparse
import logging

# we will make plots on a likely headless machine, so make sure matplotlib's
# backend is set appropriately
from matplotlib import use as mpl_use_backend
mpl_use_backend('agg')

import numpy
import h5py
import pycbc
from pycbc import (
fft, scheme, version
)
from pycbc.types import MultiDetOptionAction, load_frequencyseries
import pycbc.conversions as cv
from pycbc.io import live
from pycbc.io.live import CandidateForGraceDB
from pycbc.io.hdf import load_hdf5_to_dict
from pycbc.detector import Detector
from pycbc.psd import interpolate
from pycbc.live import snr_optimizer


parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--version', action='version',
version=version.git_verbose_msg)
Expand Down Expand Up @@ -325,7 +334,7 @@ if 'p_terr' in fp:
kwargs['p_terr'] = fp['p_terr'][()]

# Treat all ifos as having triggers
doc = live.CandidateForGraceDB(
doc = CandidateForGraceDB(
ifos,
ifos,
coinc_results,
Expand Down
2 changes: 0 additions & 2 deletions pycbc/io/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ def upload(self, fname, gracedb_server=None, testing=True,
labels: list
Optional list of labels to tag the new event with.
"""
import matplotlib
matplotlib.use('Agg')
import pylab as pl

if fname.endswith('.xml.gz'):
Expand Down
Loading