From b63d2eafe83277396d02a58610413520c8cbce68 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 26 Nov 2013 20:19:27 +0000 Subject: [PATCH] new scripts for: -generating vtk point cloud from x,y,z ASCIItable data -adding scalar values and color tuples from ASCIItable to vtk point cloud -permuting data in ASCIItable columns (used to shuffle ordered grain indices) --- processing/post/permuteData.py | 125 ++++++++++++++++++ processing/post/vtk_addPointcloudData.py | 155 +++++++++++++++++++++++ processing/post/vtk_pointcloud.py | 116 +++++++++++++++++ processing/setup/symLink_Processing.py | 3 + 4 files changed, 399 insertions(+) create mode 100755 processing/post/permuteData.py create mode 100755 processing/post/vtk_addPointcloudData.py create mode 100755 processing/post/vtk_pointcloud.py diff --git a/processing/post/permuteData.py b/processing/post/permuteData.py new file mode 100755 index 000000000..95b0b1926 --- /dev/null +++ b/processing/post/permuteData.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python + +import os,re,sys,math,numpy,string +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) + + +# -------------------------------------------------------------------- +# MAIN +# -------------------------------------------------------------------- + +parser = OptionParser(option_class=extendableOption, usage='%prog options [file[s]]', description = """ +Permute all values in given column(s). + +""" + string.replace(scriptID,'\n','\\n') +) + +parser.add_option('-l','--label', dest='label', action='extend', type='string', + help='heading(s) of column to permute', + metavar='