From 6593bdad03a0ad4839bc9c7684c349ff630a55d4 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 30 Sep 2011 15:57:51 -0400 Subject: [PATCH] Move surface-related logging from debug to info (debug is noisy). --- pypiezo/surface.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/pypiezo/surface.py b/pypiezo/surface.py index 7bf5d1b..b7f868f 100644 --- a/pypiezo/surface.py +++ b/pypiezo/surface.py @@ -92,12 +92,12 @@ def get_surface_position_data(piezo, axis_name, max_deflection, steps=2000, frequency=10e3, min_position=None, max_position=None): "Measure the distance to the surface" - _LOG.debug('get surface position') + _LOG.info('get surface position') orig_position = piezo.last_output[axis_name] # fully retract the piezo min_position,max_position = _get_min_max_positions( piezo, axis_name, min_position=min_position, max_position=max_position) - _LOG.debug('retract the piezo to %d' % min_position) + _LOG.info('retract the piezo to %d' % min_position) dtype = piezo.channel_dtype(axis_name, direction='output') out = _linspace(orig_position, min_position, steps, dtype=dtype) out = out.reshape((len(out), 1)).astype( @@ -109,7 +109,7 @@ def get_surface_position_data(piezo, axis_name, max_deflection, steps=2000, } ret1 = piezo.named_ramp(data=out, **ramp_kwargs) # locate high deflection position - _LOG.debug('approach until there is dangerous deflection (> %d)' + _LOG.info('approach until there is dangerous deflection (> %d)' % max_deflection) if SLEEP_DURING_SURF_POS_AQUISITION == True: _sleep(.2) # sleeping briefly seems to reduce bounce? @@ -118,13 +118,13 @@ def get_surface_position_data(piezo, axis_name, max_deflection, steps=2000, step=(max_position-min_position)/steps, return_data=True) high_contact_pos = piezo.last_output[axis_name] # fully retract the piezo again - _LOG.debug('retract the piezo to %d again' % min_position) + _LOG.info('retract the piezo to %d again' % min_position) if SLEEP_DURING_SURF_POS_AQUISITION == True: _sleep(.2) out = _linspace(high_contact_pos, min_position, steps, dtype=dtype) ret2 = piezo.named_ramp(data=out, **ramp_kwargs) # scan to the high contact position - _LOG.debug('ramp in to the deflected position %d' % high_contact_pos) + _LOG.info('ramp in to the deflected position %d' % high_contact_pos) if SLEEP_DURING_SURF_POS_AQUISITION == True: _sleep(.2) out = _linspace(min_position, high_contact_pos, steps, dtype=dtype) @@ -132,7 +132,7 @@ def get_surface_position_data(piezo, axis_name, max_deflection, steps=2000, if SLEEP_DURING_SURF_POS_AQUISITION == True: _sleep(.2) # return to the original position - _LOG.debug('return to the original position %d' % orig_position) + _LOG.info('return to the original position %d' % orig_position) out = _linspace(high_contact_pos, orig_position, steps, dtype=dtype) ret3 = piezo.named_ramp(data=out, **ramp_kwargs) return {'ret1':ret1, 'mtpod':mtpod, 'ret2':ret2, @@ -167,7 +167,7 @@ def analyze_surface_position_data( """ # ususes ddict["approach"] for analysis # the others are just along to be plotted - _LOG.debug('snalyze surface position data') + _LOG.info('analyze surface position data') data = ddict['approach'] # analyze data, using bilinear model @@ -180,9 +180,9 @@ def analyze_surface_position_data( start_def = int(data['deflection'].min()) final_def = int(data['deflection'].max()) # start_def and start_pos are probably for 2 different points - _LOG.debug('min deflection %d, max deflection %d' + _LOG.info('min deflection %d, max deflection %d' % (start_def, final_def)) - _LOG.debug('min position %d, max position %d' + _LOG.info('min position %d, max position %d' % (start_pos, final_pos)) left_offset = start_def @@ -190,14 +190,14 @@ def analyze_surface_position_data( kink_position = (final_pos+start_pos)/2.0 right_slope = 2.0*(final_def-start_def)/(final_pos-start_pos) pstart = [left_offset, left_slope, kink_position, right_slope] - _LOG.debug('guessed params: %s' % pstart) + _LOG.info('guessed params: %s' % pstart) offset_scale = (final_pos - start_pos)/100 left_slope_scale = right_slope/10 kink_scale = (final_pos-start_pos)/100 right_slope_scale = right_slope scale = [offset_scale, left_slope_scale, kink_scale, right_slope_scale] - _LOG.debug('guessed scale: %s' % scale) + _LOG.info('guessed scale: %s' % scale) def residual(p, y, x): Y = bilinear(x, p) @@ -207,7 +207,7 @@ def analyze_surface_position_data( args=(data["deflection"][dump_before_index:], data["z"][dump_before_index:]), full_output=True, maxfev=10000) - _LOG.debug('best fit parameters: %s' % (params,)) + _LOG.info('best fit parameters: %s' % (params,)) if _package_config['matplotlib']: if not _matplotlib: @@ -250,7 +250,8 @@ def analyze_surface_position_data( raise EdgeKink(kink=params[2], edge=start_pos, window=kink_window) if params[2] > final_pos-kink_window: raise EdgeKink(kink=params[2], edge=final_pos, window=kink_window) - _LOG.debug('surface position %s' % params[2]) + _LOG.info('surface position %s' % params[2]) + _matplotlib_pyplot.show() if return_all_parameters: return params return params[2] -- 2.26.2