From: W. Trevor King Date: Sat, 4 May 2013 22:16:24 +0000 (-0400) Subject: vibration_analyze: Only highlight the frequency range if we have a config X-Git-Tag: 0.9~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7b9cdcc69a1fd157a644edbf00fa4f6ebdeb0767;p=calibcant.git vibration_analyze: Only highlight the frequency range if we have a config You shouldn't have to mock up a config dictionary just to plot the PSD. With this commit, you can skip config if you just want a quick-and-dirty plot. --- diff --git a/calibcant/vibration_analyze.py b/calibcant/vibration_analyze.py index 9d2fa29..487d027 100644 --- a/calibcant/vibration_analyze.py +++ b/calibcant/vibration_analyze.py @@ -536,12 +536,13 @@ def plot(deflection=None, freq_axis=None, power=None, A=None, B=None, freq_axes.autoscale(tight=True) xmin,xmax = freq_axes.get_xbound() ymin,ymax = freq_axes.get_ybound() - + # highlight the region we're fitting - freq_axes.axvspan( - config['minimum-fit-frequency'], - config['maximum-fit-frequency'], - facecolor='g', alpha=0.1, zorder=-2) + if config: + freq_axes.axvspan( + config['minimum-fit-frequency'], + config['maximum-fit-frequency'], + facecolor='g', alpha=0.1, zorder=-2) if A is not None: fitdata = breit_wigner(freq_axis, A, B, C, D)