new method “head_putGeom” translates info-array into geom-description

This commit is contained in:
Philip Eisenlohr 2015-11-14 01:48:16 +00:00
parent 6211a9faad
commit 2b5cb08c4d
1 changed files with 20 additions and 3 deletions

View File

@ -44,9 +44,12 @@ class ASCIItable():
try: try:
self.__IO__['out'] = (open(outname,'w') if (not os.path.isfile(outname) \ self.__IO__['out'] = (open(outname,'w') if (not os.path.isfile(outname) \
or os.access(outname, os.W_OK)) \ or os.access( outname, os.W_OK) \
) \
and (not self.__IO__['inPlace'] \ and (not self.__IO__['inPlace'] \
or os.access(name, os.W_OK)) else None) if outname else sys.stdout or not os.path.isfile(name) \
or os.access( name, os.W_OK) \
) else None) if outname else sys.stdout
except TypeError: except TypeError:
self.__IO__['out'] = outname self.__IO__['out'] = outname
@ -242,6 +245,20 @@ class ASCIItable():
return info,extra_header return info,extra_header
# ------------------------------------------------------------------
def head_putGeom(self,info):
'''
translate geometry description to header
'''
self.info_append([
"grid\ta {}\tb {}\tc {}".format(*info['grid']),
"size\tx {}\ty {}\tz {}".format(*info['size']),
"origin\tx {}\ty {}\tz {}".format(*info['origin']),
"homogenization\t{}".format(info['homogenization']),
"microstructures\t{}".format(info['microstructures']),
])
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def labels_append(self, def labels_append(self,
what, what,