📜 ⬆️ ⬇️

OptionParser and UnitTest in python scripts

python logo In this article, I want to ask the public whether I correctly implement the capabilities of these two wonderful python modules, which have long been included in the standard (vital) set of Python pillows of the entire planet.


Prehistory


A script is written for processing and graphing some research data. But the story is not about that. I would like to show exactly how the OptionParser and UnitTest modules are used. And for one to learn ways to improve the code and its readability. So the guru of Python, I will be very grateful to your criticism and suggestions.

Modules


Everyone has heard about Test Driven Development (TDD) software development at least once in their life. Directly with the implementation of this approach for the python, I encountered in the book of Macra Pilgrim "Diving into Python 3". In the ninth chapter of his book, Mark describes in detail the method of implementing unit tests for his module for converting Roman numbers. The basis of this principle can be called writing a test to check the correctness of code execution before writing the code itself.
')
From myself I want to add that I knew about this programming method a long time ago, but I have never used it before for a banal reason - the time of writing the code is almost doubled. And thus, it does not make sense to use the data approach for short scripts that perform a specific-specific task. With such scripts, it’s understandable if there is an error in the code, since approximately you know from what range of distributions (statistical processing) you should expect output data.

Designing the same task showed that the script will be quite complicated. And writing Unit tests to it will be justified. Because subsequent refactoring and debugging will be much easier.

The next in line is the OptionParser , which I have been using for a long time, and it looks like it will be used for a long time. The readability of the code when it is used increases many times. Parsers like this are a few. And at one time there were active holivars, about which one is better. There were accusations that he imposes his philosophy on organizing and processing options. To be honest, nothing “strange” in this organization was noticed by me. And again, this will primarily depend on the programmer as he realizes the readability of this or that option. So we postpone the holivar for the time being.

Source code


Let's go straight to the source code. In the module being executed, so far there is only one working function readin_monitor (monitor).

Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  1. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  2. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  3. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  4. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  5. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  6. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  7. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  8. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  9. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  10. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  11. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  12. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  13. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  14. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  15. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  16. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  17. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  18. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  19. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  20. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  21. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  22. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  23. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  24. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  25. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  26. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  27. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  28. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  29. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  30. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  31. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  32. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  33. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  34. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  35. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  36. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  37. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  38. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  39. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  40. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  41. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  42. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  43. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  44. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()
  45. Copy Source | Copy HTML #!/usr/bin/env python # -*- coding: utf-8 -*- version = '0.0.1' version_name = 'gamma' modify_date = '2009-12-26' from optparse import OptionParser import matplotlib import numpy as np import scipy.stats as stats import warnings warnings .filterwarnings( 'ignore' , '' , DeprecationWarning) # turning off deprecation warning in python 2.6 kB = 8 .31441e- 3 / 4 . 184 def readin_monitor (monitor): '''Read in monitor file. Ignoring all strings starting with # symbol. <br/> Function returns all stored data from the strings as list of lists of <br/> floats.''' num = 0 data = [] for line in open (monitor, 'r' ): try : if line[ 0 ] != '#' : data.append([ float (i) for i in line.split()]) num = num + 1 except : pass if options.verbose: print ( 'Read in %i data points from monitor file %s' % (num, monitor)) return data def main (): return 0 global options global args parser = OptionParser( "usage: %prog [options] [monitors]" , version= '%prog ' +version+ ' from ' +modify_date) parser .add_option( "-v" , "--verbose" , action= "store_true" , dest= "verbose" , default=False, help= "Print status messages to stdout" ) parser .add_option( "-C" , "--combine" , dest= "combine" , action= "store" , default= "" , help= 'Combine all monitor files passed as arguments \ <br/> to the UC.py script to one COMBINE file' ) parser .add_option( '-D' , '--dimentions' , dest= 'dimentions' , default = '1:2' , help= 'String of DIMENTIONS for monitor files to be \ <br/> read in. (defaut = %default)' ) (options, args) = parser .parse_args() if __name__ == '__main__' : main ()


From the peculiarities of the location of the code, I would like to mention the definition of the parser options at the end of the module itself. Those. this piece of code will always be executed, even if the module is called by another script. Thus, in the globally defined variables options and args there will be default values, args will be empty. Because global variables, then access to them will be possible from any environment.

Running the script with the -h option will give you detailed help on using the options:

Copy Source | Copy HTML
  1. Usage: UC.py [options] [monitors]
  2. Options:
  3. --version show program version number and exit
  4. -h, - help show this help message and exit
  5. -v, --verbose Print status messages to stdout
  6. -C COMBINE, --combine = COMBINE
  7. Combine all monitor files passed as arguments
  8. to the UC.py script to one COMBINE file.
  9. (defaut = out)
  10. -D DIMENTIONS, --dimentions = DIMENTIONS
  11. String of DIMENTIONS for monitor files to be
  12. read in . (defaut = 0 : 1 : 2 )


Next, the unit tests themselves:

Copy Source | Copy HTML
  1. #! / usr / bin / env python
  2. # - * - coding: utf-8 - * -
  3. '' 'Unit tests for UC.py module.' ''
  4. import UC
  5. import unittest
  6. global monitor
  7. MD = time (ps), CV # 1, CV # 2 <br/> 0.9990 <br/> 3 br /> 10.9990 9.5761421491 8.3053224696 <br/> 11.9990 9.5178829977 8.1660258902 '' '
  8. class Combine_monitors ( unittest .TestCase):
  9. def test_readin_monitor (self):
  10. with open ( 'test_mon' , 'w' ) as MON:
  11. MON.write (monitor)
  12. UC.options.verbose = False
  13. self .assertEqual ([[ 0. 999 , 9. 2349535263 , 7. 7537518210999998 ],
  14. [ 1 . 99900000000001 , 9 . 4331321327000008 , 7 . 9555258176999999 ],
  15. [ 2 . 99900000000001 , 9 . 5368308183000003 , 8 . 1341402536 ]
  16. [ 3 . 99900000000001 , 9 . 4468066031000006 , 7 . 9086253192999996 ],
  17. [ 4 . 9989999999999997 , 9 . 1565151681000003 , 8 . 0027457961999993 ],
  18. [ 5 . 9989999999999997 , 9 . 2310306859000004 , 7 . 9872398398 ]
  19. [ 6 . 9989999999999997 , 9 . 1540695183 , 7 . 5236796623000002 ],
  20. [ 7 . 9989999999999997 , 9 . 0727576308 , 7 . 8499035889000002 ],
  21. [ 8 . 99900000000006 , 9 . 3113419250000007 , 8 . 1227557439000009 ],
  22. [ 9 . 99900000000006 , 8 . 9597834512999999 , 8 . 3754973753000002 ]
  23. [ 10 . 9990000000001 , 9 . 5761421491000007 , 8 . 3053224696000001 ],
  24. [ 11 . 9990000000001 , 9 . 5178829976999992 , 8 . 1,660258902000002 ]],
  25. UC.readin_monitor ( 'test_mon' ))
  26. def main ():
  27. unittest . main ()
  28. return 0
  29. if __name__ == '__main__' :
  30. main ()


To the written test it is worth adding deletion of temporary files. And of course, increase the number of tests, as new script functions are implemented. Running the script leads to the following conclusion:

$ ./test-UC.py
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK


To write this small piece of code, I had to “fool everyone” a bit (it seems that you can translate the verb cheat). The test was written after writing the readin_monitor () function itself from the main module. The result of the function was simply thrown out by the print into stdout. And from there I transferred the test module to the source code.

What not to like - seems to be deceiving themselves. First, we write the code, then the test, thereby violating the TDD development philosophy. Also, the output results, due to the specificity of the language, turned out to be not exact (meaning 5.9989999999999997 = 5.9990 rounding). If you run the same unit test in a different version of python, you might get a test error. For Python 3.1, the test was passed positively, but such accuracy tests still alarm me. You can, of course, organize rounding yourself up to, say, the 5th decimal point, and compare already rounded data. But this is fraught with severe weighting of the code, and, as a result, the poor readability of it.

Total


Using the example of two short embryos of scripts, we showed how you can use the capabilities of OptionParser and UnitTest modules. The purpose of the article was not a full description of all their capabilities, so the curious reader was given the opportunity to understand them himself, using the links from the beginning of the article.

Well, to the main issue. What can be improved in this code / approach? Waiting for your answers.

Thanks for attention.

Source: https://habr.com/ru/post/79435/


All Articles