From 15a6015bc2f57af64d0f1b81d0babc5abc438747 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 7 Aug 2014 16:51:26 +0000 Subject: [PATCH] added some more post processing tests DAMASK env now reports in MiB (GiB is too big for small machines) --- DAMASK_env.sh | 4 +- processing/post/permuteData.py | 132 +++++++++++++-------------------- processing/post/rotateData.py | 120 +++++++++++------------------- processing/post/scaleData.py | 111 ++++++++++----------------- processing/post/shiftData.py | 118 +++++++++++------------------ 5 files changed, 180 insertions(+), 305 deletions(-) diff --git a/DAMASK_env.sh b/DAMASK_env.sh index 9d7b6a8b8..1497effda 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -60,8 +60,8 @@ if [ ! -z "$PS1" ]; then echo "FFTW $FFTW_ROOT" echo "HDF5 $HDF5_ROOT (for future use)" echo - echo -n "heap size/GiB "; echo "`ulimit -d`/1024/1024" | bc - echo -n "stack size/GiB "; echo "`ulimit -s`/1024/1024" | bc + echo -n "heap size/MiB "; echo "`ulimit -d`/1024" | bc + echo -n "stack size/MiB "; echo "`ulimit -s`/1024" | bc fi export DAMASK_NUM_THREADS diff --git a/processing/post/permuteData.py b/processing/post/permuteData.py index 5c44a0bc9..19328a29e 100755 --- a/processing/post/permuteData.py +++ b/processing/post/permuteData.py @@ -1,125 +1,95 @@ #!/usr/bin/env python # -*- coding: UTF-8 no BOM -*- -import os,re,sys,math,numpy,string +import os,sys,string +import numpy as np +from optparse import OptionParser import damask -from collections import defaultdict -from optparse import OptionParser, Option - -scriptID = '$Id$' -scriptName = scriptID.split()[1] - -# ----------------------------- -class extendableOption(Option): -# ----------------------------- -# used for definition of new option parser action 'extend', which enables to take multiple option arguments -# taken from online tutorial http://docs.python.org/library/optparse.html - - ACTIONS = Option.ACTIONS + ("extend",) - STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",) - TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",) - ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",) - - def take_action(self, action, dest, opt, value, values, parser): - if action == "extend": - lvalue = value.split(",") - values.ensure_value(dest, []).extend(lvalue) - else: - Option.take_action(self, action, dest, opt, value, values, parser) +scriptID = string.replace('$Id$','\n','\\n') +scriptName = scriptID.split()[1][:-3] # -------------------------------------------------------------------- # MAIN # -------------------------------------------------------------------- -parser = OptionParser(option_class=extendableOption, usage='%prog options [file[s]]', description = """ +parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Permute all values in given column(s). -""" + string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) -parser.add_option('-l','--label', dest='label', action='extend', type='string', - help='heading(s) of column to permute', - metavar='