1 # calibcant - tools for thermally calibrating AFM cantilevers
3 # Copyright (C) 2007,2008, William Trevor King
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation; either version 3 of the
8 # License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # See the GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 # The author may be contacted at <wking@drexel.edu> on the Internet, or
21 # write to Trevor King, Drexel University, Physics Dept., 3141 Chestnut St.,
22 # Philadelphia PA 19104, USA.
28 # handle extra verbose input modules, only imported if we need them
30 _final_flush_plot = None
34 """Import pylab plotting functions for when we need to plot. This
35 function can be called multiple times, and ensures that the pylab
36 setup is only imported once. It defines the functions
37 _flush_plot() to be called after incremental changes,
38 _final_flush_plot(), to be called at the end of any graphical processing, and
39 _pylab, a reference to the pylab module."""
42 global _final_flush_plot
44 import pylab as _pylab
45 if _flush_plot == None :
46 if config.PYLAB_INTERACTIVE :
47 _flush_plot = _pylab.draw
49 def _flush_plot () : pass
50 if _final_flush_plot == None :
51 if config.PYLAB_INTERACTIVE :
52 _final_flush_plot = _pylab.draw
54 _final_flush_plot = _pylab.show
56 def write_array(ofile, array, seperator):
57 """Erite an iterable array seperated by seperator.
58 Terminate the output with an endline."""
59 strings = [repr(x) for x in array]
60 ofile.write(seperator.join(strings))