From 92318a2ac057f196d3c86cd9cd7325384810b89c Mon Sep 17 00:00:00 2001 From: Duncan Macleod Date: Thu, 7 Feb 2019 12:31:28 +0000 Subject: [PATCH] gw_summary: cleaned up imports --- bin/gw_summary | 54 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/bin/gw_summary b/bin/gw_summary index 90386360..d5e123b2 100644 --- a/bin/gw_summary +++ b/bin/gw_summary @@ -39,17 +39,18 @@ from glue.lal import LIGOTimeGPS time.LIGOTimeGPS = LIGOTimeGPS _tconvert.LIGOTimeGPS = LIGOTimeGPS -import os -import datetime import argparse import calendar +import datetime import getpass +import os +import re import warnings -import httplib -import importlib - from collections import OrderedDict -from urlparse import urlparse +try: + from urllib.parse import urlparse +except ImportError: # python < 3 + from urlparse import urlparse from dateutil.relativedelta import relativedelta @@ -59,25 +60,36 @@ use('Agg') from glue.lal import Cache -try: - from lal import lal -except ImportError: - HASLAL = False -else: - HASLAL = True - -from gwpy.detector import Channel from gwpy.segments import (Segment, SegmentList) from gwpy.signal.fft import lal as fft_lal from gwpy.time import (tconvert, to_gps, Time) -from gwsumm import (globalv, mode, __version__) -from gwsumm.config import * -from gwsumm.channels import get_channels +from gwsumm import ( + __version__, + archive, + globalv, + mode, +) +from gwsumm.config import ( + DEFAULTSECT, + GWSummConfigParser, + NoOptionError, + NoSectionError, +) from gwsumm.segments import get_segments -from gwsumm.tabs import (TabList, get_tab) -from gwsumm.utils import * -from gwsumm.state import * +from gwsumm.state import ( + ALLSTATE +) +from gwsumm.tabs import ( + TabList, + get_tab, +) +from gwsumm.utils import ( + get_default_ifo, + mkdir, + re_flagdiv, + vprint, +) from gwsumm.data import get_timeseries_dict __author__ = 'Duncan Macleod ' @@ -517,7 +529,6 @@ elif opts.archive is True: archives = [] if opts.archive: - from gwsumm import archive archivedir = os.path.join(path, 'archive') mkdir(archivedir) opts.archive = os.path.join(archivedir, '%s-%s-%d-%d.h5' @@ -532,7 +543,6 @@ if opts.archive: # read daily archive for week/month/... mode if hasattr(opts, 'daily_archive') and opts.daily_archive: # find daily archive files - from gwsumm import archive archives.extend(archive.find_daily_archives( opts.gpsstart, opts.gpsend, ifo, args.daily_archive, archivedir)) # then don't read any actual data