
この記事では、これらの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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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 ()
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
- 使用法:UC.py [オプション] [モニター]
- オプション:
- --versionプログラムのバージョン番号を表示して終了
- -h、-このヘルプメッセージを表示して終了する
- -v、--verboseステータスメッセージを標準出力に出力します
- -C COMBINE、-combine = COMBINE
- 引数として渡されたすべてのモニターファイルを結合する
- UC.pyスクリプトから1つのCOMBINEファイルへ。
- (デフォルト=アウト)
- -D寸法、-寸法=寸法
- 監視ファイルのDIMENTIONSの文字列
- で読みます 。 (デフォルト= 0 : 1 : 2 )
次に、単体テスト自体:
Copy Source | Copy HTML
- #!/ usr / bin / env python
- #-*-コーディング:utf-8-*-
- '' 'UC.pyモジュールの単体テスト' ''
- UCをインポート
- インポート unittest
- グローバルモニター
- モニター= '' '# <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 '' '
- クラス Combine_monitors (unittest .TestCase):
- def test_readin_monitor (self):
- MON として open ( 'test_mon' 、 'w' )の場合:
- MON.write(モニター)
- UC.options.verbose = False
- self .assertEqual([[[ 0 . 999、9 . 2349535263、7 . 7537518210999998 ]、
- [ 1 。 9990000000000001、9 。 4331321327000008、7 。 9555258176999999 ]、
- [ 2 。 9990000000000001、9 。 5368308183000003、8 。 1341402536 ]、
- [ 3 。 9990000000000001、9 。 4468066031000006、7 。 9086253192999996 ]、
- [ 4 。 9989999999999997、9 。 1565151681000003、8 。 0027457961999993 ]、
- [ 5 。 9989999999999997、9 。 2310306859000004、7 。 9872398398 ]、
- [ 6 。 9989999999999997、9 。 1540695183.7 。 5236796623000002 ]、
- [ 7 。 9989999999999997、9 。 0727576308、7 。 8499035889000002 ]、
- [ 8 。 9990000000000006、9 。 3113419250000007、8 。 1227557439000009 ]、
- [ 9 。 9990000000000006、8 。 9597834512999999、8 。 3754973753000002 ]、
- [ 10 。 999000000000001、9 。 5761421491000007、8 。 3053224696000001 ]、
- [ 11 。 999000000000001、9 。 5178829976999992、8 。 1660258902000002 ]]、
- UC.readin_monitor( 'test_mon' ))
- def main ():
- unittest 。 メイン ()
- 0を 返す
- __name__ == '__main__'の場合 :
- メイン ()
筆記テストには、一時ファイルの削除を追加する価値があります。 そしてもちろん、新しいスクリプト関数が実装されると、テストの数が増えます。 スクリプトを実行すると、次の結論が導き出されます。
$ ./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モジュールの機能を使用する方法を示しました。 記事の目的はすべての機能の完全な説明ではなかったため、好奇心の強い読者には、記事の最初からのリンクを使用して、自分でそれらを理解する機会が与えられました。
さて、メインの質問に。 このコード/アプローチで何を改善できますか? あなたの答えを待っています。
ご清聴ありがとうございました。