added use of "defaultdict" from collections
This commit is contained in:
parent
fdbde250dc
commit
63569b19b6
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import os,sys,string,re,math,numpy
|
import os,sys,string,re,math,numpy
|
||||||
import damask
|
import damask
|
||||||
|
from collections import defaultdict
|
||||||
from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP
|
from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP
|
||||||
|
|
||||||
scriptID = '$Id$'
|
scriptID = '$Id$'
|
||||||
|
@ -96,8 +97,8 @@ for file in files:
|
||||||
table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:]))
|
table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
# --------------- figure out columns to process
|
# --------------- figure out columns to process
|
||||||
active = {}
|
active = defaultdict(list)
|
||||||
column = {}
|
column = defaultdict(dict)
|
||||||
|
|
||||||
for datatype,info in datainfo.items():
|
for datatype,info in datainfo.items():
|
||||||
for label in info['label']:
|
for label in info['label']:
|
||||||
|
@ -105,8 +106,6 @@ for file in files:
|
||||||
for key in ['1_'+label,label]:
|
for key in ['1_'+label,label]:
|
||||||
if key in table.labels:
|
if key in table.labels:
|
||||||
foundIt = True
|
foundIt = True
|
||||||
if datatype not in active: active[datatype] = []
|
|
||||||
if datatype not in column: column[datatype] = {}
|
|
||||||
active[datatype].append(label)
|
active[datatype].append(label)
|
||||||
column[datatype][label] = table.labels.index(key) # remember columns of requested data
|
column[datatype][label] = table.labels.index(key) # remember columns of requested data
|
||||||
if not foundIt:
|
if not foundIt:
|
||||||
|
|
Loading…
Reference in New Issue