PythonスクリプトのOptionParserとUnitTest

pythonロゴ この記事では、これらの2つの素晴らしいpythonモジュールの機能を正しく実装しているかどうか、一般の人々に尋ねたいと思います。





背景



いくつかの研究データを処理してグラフィカルに表示するスクリプトが作成されています。 しかし、物語はそれについてではありません。 OptionParserとUnitTestモジュールの組み合わせがどのように使用されるかを示したいと思います。 そして、1つには、コードとその可読性を改善する方法を学びます。 Pythonの第一人者、あなたの批判と提案に非常に感謝します。



モジュール



ソフトウェア製品開発のテスト駆動開発(TDD)メソッドについては、誰もが少なくとも1度は聞いたことがあります。 このアプローチをpythonに実装するとすぐに、Macra Pilgrimの「Diving into Python 3」の本に出会いました。 彼の本の第9章で 、Markは彼のローマ数字変換モジュールの単体テストを実装する方法を詳細に説明しています。 この原則の基礎は、コード自体を書く前にコードの正しい実行を検証するテストを書くことと呼ばれます。



私はこのプログラミング方法について長い間知っていたことを自分から付け加えたいと思いますが、私はそれを以前から使用したことがありませんでした。 したがって、特定のタスクを実行する短いスクリプトにこのアプローチを使用することは完全に不適切になります。 この種のスクリプトを使用すると、コードにエラーがあるかどうかが明確になります。 おおよそ、どの範囲の分布(統計処理)から出力を期待する必要があるかを知っています。



新しいタスクを設計すると、スクリプトが非常に複雑になることがわかりました。 そして、ユニットテストを書くことは正当化されます。 なぜなら その後のリファクタリングとデバッグは大幅に簡素化されます。



次の行はOptionParserです 。これは私が長い間使用しており、長期間使用されるようです。 コードを使用すると、コードが読みやすくなります。 このようなパーサーがいくつかあります。 かつては、アクティブなホリバーが実施されましたが、これについてはどちらが優れています。 彼はオプションの整理と処理に彼の哲学を課しているという非難がありました。 正直なところ、私はこの組織に「奇妙な」何かに気づいていません。 繰り返しますが、これは主にプログラマーが1つまたは別のオプションの可読性をどのように実装するかに依存します。 それでは、ホリバーを脇に置いておきましょう。



ソースコード



ソースコードに直行しましょう。 これまでのところ、実行可能モジュールにはreadin_monitor(モニター)作業関数が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 ()



  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 ()







コードの場所の機能のうち、モジュール自体の最後にあるパーサーオプションの定義に注意したいと思います。 つまり モジュールが別のスクリプトによって呼び出された場合でも、このコードは常に実行されます。 したがって、グローバルに定義された変数のオプションと引数にはデフォルト値があり、引数は空になります。 なぜなら グローバル変数なので、すべての環境からアクセスできます。



-hオプションを指定してスクリプトを実行すると、オプションの使用に関する詳細なヘルプが表示されます。



Copy Source | Copy HTML



  1. 使用法:UC.py [オプション] [モニター]
  2. オプション:
  3. --versionプログラムのバージョン番号を表示して終了
  4. -h、-このヘルプメッセージ表示して終了する
  5. -v、--verboseステータスメッセージを標準出力に出力します
  6. -C COMBINE、-combine = COMBINE
  7. 引数として渡されたすべてのモニターファイルを結合する
  8. UC.pyスクリプトから1つのCOMBINEファイルへ。
  9. (デフォルト=アウト)
  10. -D寸法、-寸法=寸法
  11. 監視ファイルのDIMENTIONSの文字列
  12. で読みます 。 (デフォルト= 012




次に、単体テスト自体:



Copy Source | Copy HTML



  1. #!/ usr / bin / env python
  2. #-*-コーディング:utf-8-*-
  3. '' 'UC.pyモジュールの単体テスト' ''
  4. UCをインポート
  5. インポート unittest
  6. グローバルモニター
  7. モニター= '' '# <br/> #MD 時間(ps)、CV#1、CV#2 <br/> <br/> 0.9990 9.2349535263 7.7537518211 <br/> 1.9990 9.4331321327 7.9555258177 <br/> 2.9990 9.5368308183 8.134140253636 <BR/> 3.9990 9.4468066031 7.9086253193 <BR/> 4.9990 9.1565151681 8.0027457962 <BR/> 5.9990 9.2310306859 7.9872398398 <BR/> 6.9990 9.1540695183 7.5236796623 <BR/> 7.9990 9.0727576308 7.8499035889 <BR/> 8.9990 9.3113419250 8.1227557439 <BR/> 9.9990 8.9597834513 8.3754973753 < br /> 10.9990 9.5761421491 8.3053224696 <br/> 11.9990 9.5178829977 8.1660258902 '' '
  8. クラス Combine_monitors (unittest .TestCase):
  9. def test_readin_monitor (self):
  10. MON として open'test_mon''w' )の場合:
  11. MON.write(モニター)
  12. UC.options.verbose = False
  13. self .assertEqual([[[ 0 . 999、9 . 2349535263、7 . 7537518210999998 ]、
  14. [ 19990000000000001、94331321327000008、79555258176999999 ]、
  15. [ 29990000000000001、95368308183000003、81341402536 ]、
  16. [ 39990000000000001、94468066031000006、79086253192999996 ]、
  17. [ 49989999999999997、91565151681000003、80027457961999993 ]、
  18. [ 59989999999999997、92310306859000004、79872398398 ]、
  19. [ 69989999999999997、91540695183.75236796623000002 ]、
  20. [ 79989999999999997、90727576308、78499035889000002 ]、
  21. [ 89990000000000006、93113419250000007、81227557439000009 ]、
  22. [ 99990000000000006、89597834512999999、83754973753000002 ]、
  23. [ 10999000000000001、95761421491000007、83053224696000001 ]、
  24. [ 11999000000000001、95178829976999992、81660258902000002 ]]、
  25. UC.readin_monitor( 'test_mon' ))
  26. def main ():
  27. unittestメイン ()
  28. 0を 返す
  29. __name__ == '__main__'の場合
  30. メイン ()




筆記テストには、一時ファイルの削除を追加する価値があります。 そしてもちろん、新しいスクリプト関数が実装されると、テストの数が増えます。 スクリプトを実行すると、次の結論が導き出されます。



$ ./test-UC.py

.

----------------------------------------------------------------------

Ran 1 test in 0.000s



OK









この小さなコードを書くには、「みんなを欺く」必要がありました(動詞チートを翻訳できるようです)。 テストは、readin_monitor()関数自体がメインモジュールから書き込まれた後に作成されました。 関数の結果は、標準出力のprintによって単にスローされました。 そしてそこから、テストモジュールをソースコードにアップロードしました。



気に入らないもの-自分をだましているようです。 最初にコードを作成し、次にテストを作成するため、TDD開発の哲学に違反します。 また、言語の仕様により、出力結果は正確ではありませんでした(5.9989999999999997 = 5.9990の丸めを意味します)。 異なるバージョンのpythonで同じユニットテストを実行すると、テストエラーが発生する場合があります。 Python 3.1の場合、テストは肯定的に合格しましたが、そのような精度テストについてはまだ気にしています。 もちろん、小数点以下5桁までの丸めを整理し、すでに丸められたデータを比較することもできます。 しかし、これにはコードの強い重み付けが伴い、その結果、コードの可読性が低下します。



合計



例として2つの短いスクリプトを使用して、OptionParserおよびUnitTestモジュールの機能を使用する方法を示しました。 記事の目的はすべての機能の完全な説明ではなかったため、好奇心の強い読者には、記事の最初からのリンクを使用して、自分でそれらを理解する機会が与えられました。



さて、メインの質問に。 このコード/アプローチで何を改善できますか? あなたの答えを待っています。



ご清聴ありがとうございました。



All Articles