Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
import tempfile
tmp_file = tempfile.NamedTemporaryFile(mode='r+b',suffix='.tiff')
tfile = tmp_file.name

 

...

Goog example of __main__

Code Block
import sys

def test_all() :
    print _sep_, '\n%s' % sys._getframe().f_code.co_name
    test_ricker()
    test_morlet()

#------------------------------
if __name__ == "__main__" :
    from time import time
    tname = sys.argv[1] if len(sys.argv) > 1 else '0'
    print 50*'_', '\nTest %s:' % tname
    t0_sec = time()
    if   tname == '0': test_all() 
    elif tname == '1': test_ricker()
    elif tname == '2': test_morlet()
    else : print 'Not-recognized test name: %s' % tname
    msg = 'End of test %s, consumed time (sec) = %.6f' % (tname, time()-t0_sec)
    sys.exit(msg)

 

Virtualenv

Code Block
virtualenv dir-name
source <directoryName>/bin/activate.csh # for tcsh
# or
source <directoryName>/bin/activate     # for bash
pip install <packageName>

... work

deactivate

...