Skip to content

Commit

Permalink
added debug option
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonjacobs1 committed May 16, 2024
1 parent 37da20a commit 72b362c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions histoqc/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def main(argv=None):
parser.add_argument('--symlink', metavar="TARGET_DIR",
help="create symlink to outdir in TARGET_DIR",
default=None)
parser.add_argument('--debug', action='store_true', help="trigger debugging behavior")
args = parser.parse_args(argv)

# --- multiprocessing and logging setup -----------------------------------
Expand Down Expand Up @@ -162,10 +163,11 @@ def main(argv=None):
'shared_dict': mpm.dict(),
'num_files': num_files,
'force': args.force,
'seed': args.seed
'seed': args.seed,
'debug': args.debug
}
failed = mpm.list()
setup_plotting_backend(lm.logger)
setup_plotting_backend(lm.logger, debug=args.debug)

try:
if args.nprocesses > 1:
Expand Down
12 changes: 6 additions & 6 deletions histoqc/_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def log_pipeline(config, log_manager):

# --- worker process helpers ------------------------------------------

def setup_plotting_backend(logger=None):
def setup_plotting_backend(logger=None, debug=False):
"""loads the correct matplotlib backend
Parameters
Expand All @@ -197,13 +197,13 @@ def setup_plotting_backend(logger=None):
the logging.Logger instance
"""
import matplotlib
if platform.system() != "Windows" and not os.environ.get('DISPLAY'):
if logger is not None:
logger.info('no display found. Using non-interactive Agg backend')
matplotlib.use('Agg')
else:

if debug and (platform.system() == "Windows" or os.environ.get('DISPLAY')):
matplotlib.use('TkAgg')

else:
matplotlib.use('Agg')


class BatchedResultFile:
"""BatchedResultFile encapsulates the results writing
Expand Down

0 comments on commit 72b362c

Please sign in to comment.