Skip to content

Commit

Permalink
Define parameter DEBUGPLOT_CODES to set valid values.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicocardiel committed Jul 4, 2017
1 parent e169880 commit e0a58f7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions numina/array/display/pause_debugplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

import matplotlib.pyplot as plt

DEBUGPLOT_CODES = (0, -1, 1, -2, 2, -10, 10, -11, 11, -12, 12,
-21, 21, -22, 22)


def pause_debugplot(debugplot, optional_prompt=None, pltshow=False):
"""Ask the user to press RETURN to continue after plotting.
Expand All @@ -39,15 +42,18 @@ def pause_debugplot(debugplot, optional_prompt=None, pltshow=False):
12 : debug, plots with pauses
21 : debug, extra plots without pauses
22 : debug, extra plots with pause
NOTE: negative values are also valid and indicate that a call
to plt.close() is also performed
optional_prompt : string
Optional prompt.
pltshow : bool
If True, a call to plt.show() is also performed.
pltclose: bool
If True, a call to plt.close() is also performed.
"""

if debugplot not in DEBUGPLOT_CODES:
raise ValueError('Invalid debugplot value:', debugplot)

if debugplot < 0:
debugplot_ = -debugplot
pltclose = True
Expand Down

0 comments on commit e0a58f7

Please sign in to comment.