-
Notifications
You must be signed in to change notification settings - Fork 39
/
plotJunk.py
55 lines (45 loc) · 1.9 KB
/
plotJunk.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# REDPy - Repeating Earthquake Detector in Python
# Copyright (C) 2016-2020 Alicia Hotovec-Ellis ([email protected])
# Licensed under GNU GPLv3 (see LICENSE.txt)
import redpy.config
import redpy.table
import redpy.plotting
import argparse
import numpy as np
import os
"""
Run this script to output the contents of the junk table for troubleshooting.
usage: plotJunk.py [-h] [-v] [-c CONFIGFILE]
optional arguments:
-h, --help show this help message and exit
-v, --verbose increase written print statements
-c CONFIGFILE, --configfile CONFIGFILE
use configuration file named CONFIGFILE instead of
default settings.cfg
"""
parser = argparse.ArgumentParser(description=
"Run this script to output the contents of the junk table for troubleshooting.")
parser.add_argument("-v", "--verbose", action="count", default=0,
help="increase written print statements")
parser.add_argument("-c", "--configfile",
help="use configuration file named CONFIGFILE instead of default settings.cfg")
args = parser.parse_args()
if args.configfile:
opt = redpy.config.Options(args.configfile)
if args.verbose: print("Using config file: {}".format(args.configfile))
else:
opt = redpy.config.Options("settings.cfg")
if args.verbose: print("Using config file: settings.cfg")
if args.verbose: print("Creating folder to store junk images named '{}{}'/junk".format(
opt.outputPath,opt.groupName))
try:
os.mkdir('{}{}/junk'.format(opt.outputPath,opt.groupName))
except OSError:
print("Folder exists.")
if args.verbose: print("Opening hdf5 table: {}".format(opt.filename))
h5file, rtable, otable, ttable, ctable, jtable, dtable, ftable = redpy.table.openTable(opt)
if args.verbose: print("Creating junk plots...")
redpy.plotting.createJunkPlots(jtable, opt)
if args.verbose: print("Closing table...")
h5file.close()
if args.verbose: print("Done")