-
-
- attr
- /
-
- store cmd history
-
-
-
- attr
- /
-
-
-
-
-
-
- Scalar
- /Geometry/Vx
- Geometry
- Vector along x define the spectral mesh
-
-
-
- Scalar
- /Geometry/Vy
- Geometry
- Vector along y defines the spectral mesh
-
-
-
- Scalar
- /Geometry/Vz
- Geometry
- Vector along z defines the spectral mesh
-
-
-
- Scalar
- /Geometry/ip
- Geometry
-
-
-
-
- Scalar
- /Geometry/node
- Geometry
-
-
-
-
- Scalar
- /Geometry/grain
- Geometry
-
-
-
-
- Vector
- /Geometry/pos
- Geometry
-
-
-
-
- Scalar
- /Geometry/elem
- Geometry
-
-
-
-
-
- Scalar
- /Crystallite/phase
- Crystallite
-
-
-
-
- Scalar
- /Crystallite/texture
- Crystallite
-
-
-
-
- Scalar
- /Crystallite/volume
- Crystallite
-
-
-
-
- Vector
- /Crystallite/orientation
- Crystallite
-
-
-
-
- Vector
- /Crystallite/eulerangles
- Crystallite
- Bunnge Euler angles in degrees
-
-
-
- Vector
- /Crystallite/grainrotation
- Crystallite
-
-
-
-
- Tensor
- /Crystallite/f
- Crystallite
- deformation gradient (F)
-
-
-
- Tensor
- /Crystallite/p
- Crystallite
- Pikola Kirkhoff stress
-
-
-
- Tensor
- /Crystallite/Cauchy
- Crystallite
- Cauchy stress tensor
-
-
-
- Tensor
- /Crystallite/lnV
- Crystallite
-
-
-
-
- Scalar
- /Crystallite/MisesCauchy
- Crystallite
- von Mises equivalent of Cauchy stress
-
-
-
- Scalar
- /Crystallite/MiseslnV
- Crystallite
- left von Mises strain
-
-
-
-
- Vector
- /Constitutive/resistance_slip
- Constitutive
-
-
-
-
- Vector
- /Constitutive/shearrate_slip
- Constitutive
-
-
-
-
- Vector
- /Constitutive/resolvedstress_slip
- Constitutive
-
-
-
-
- Scalar
- /Constitutive/totalshear
- Constitutive
-
-
-
-
- Matrix
- /Constitutive/accumulatedshear_slip
- Constitutive
- vector contains accumulated shear per slip system
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/damask/__init__.py b/lib/damask/__init__.py
index 1875ffdae..5b748ee19 100644
--- a/lib/damask/__init__.py
+++ b/lib/damask/__init__.py
@@ -3,29 +3,11 @@
"""Main aggregator"""
import os,sys,time
-h5py_flag = os.path.join(os.path.dirname(__file__),'../../.noH5py')
-h5py_grace = 7200 # only complain once every 7200 sec (2 hours)
-h5py_msg = "h5py module not found."
-
-now = time.time()
-
with open(os.path.join(os.path.dirname(__file__),'../../VERSION')) as f:
version = f.readline()[:-1]
from .environment import Environment # noqa
from .asciitable import ASCIItable # noqa
-try:
- from .h5table import H5Table # noqa
- if os.path.exists(h5py_flag): os.remove(h5py_flag) # delete flagging file on success
-except ImportError:
- if os.path.exists(h5py_flag):
- if now - os.path.getmtime(h5py_flag) > h5py_grace: # complain (again) every so-and-so often
- sys.stderr.write(h5py_msg+'\n')
- with open(h5py_flag, 'a'):
- os.utime(h5py_flag,(now,now)) # update flag modification time to "now"
- else:
- open(h5py_flag, 'a').close() # create flagging file
- sys.stderr.write(h5py_msg+'\n') # complain for the first time
from .config import Material # noqa
from .colormaps import Colormap, Color # noqa
diff --git a/lib/damask/h5table.py b/lib/damask/h5table.py
deleted file mode 100644
index 67d5853b6..000000000
--- a/lib/damask/h5table.py
+++ /dev/null
@@ -1,146 +0,0 @@
-# -*- coding: UTF-8 no BOM -*-
-
-# ----------------------------------------------------------- #
-# Ideally the h5py should be enough to serve as the data #
-# interface for future DAMASK, but since we are still not #
-# sure when this major shift will happen, it seems to be a #
-# good idea to provide a interface class that help user ease #
-# into using HDF5 as the new daily storage driver. #
-# ----------------------------------------------------------- #
-
-import os
-import h5py
-import numpy as np
-import xml.etree.cElementTree as ET
-
-# ---------------------------------------------------------------- #
-# python 3 has no unicode object, this ensures that the code works #
-# on Python 2&3 #
-# ---------------------------------------------------------------- #
-try:
- test = isinstance('test', unicode)
-except(NameError):
- unicode = str
-
-
-def lables_to_path(label, dsXMLPath=None):
- """Read the XML definition file and return the path."""
- if dsXMLPath is None:
- # use the default storage layout in DS_HDF5.xml
- if "h5table.pyc" in __file__:
- dsXMLPath = os.path.abspath(__file__).replace("h5table.pyc",
- "DS_HDF5.xml")
- else:
- dsXMLPath = os.path.abspath(__file__).replace("h5table.py",
- "DS_HDF5.xml")
- # This current implementation requires that all variables
- # stay under the root node, the nesting is defined through the
- # h5path.
- # Allow new derived data to be put under the root
- tree = ET.parse(dsXMLPath)
- try:
- dataType = tree.find('{}/type'.format(label)).text
- h5path = tree.find('{}/h5path'.format(label)).text
- except:
- dataType = "Scalar"
- h5path = "/{}".format(label) # just put it under root
- return (dataType, h5path)
-
-
-class H5Table(object):
- """
- Lightweight interface class for h5py
-
- DESCRIPTION
- -----------
- Interface/wrapper class for manipulating data in HDF5 with DAMASK
- specialized data structure.
- --> try to maintain a minimal API design.
- PARAMETERS
- ----------
- h5f_path: str
- Absolute path of the HDF5 file
- METHOD
- ------
- del_entry() -- Force delete attributes/group/datasets (dangerous)
- get_attr() -- Return attributes if possible
- add_attr() -- Add NEW attributes to dataset/group (no force overwrite)
- get_data() -- Retrieve data in numpy.ndarray
- add_data() -- Add dataset to H5 file
- get_cmdlog() -- Return the command used to generate the data if possible
- NOTE
- ----
- 1. As an interface class, it uses the lazy evaluation design
- that reads the data only when it is absolutely necessary.
- 2. The command line used to generate each new feature is stored with
- each dataset as dataset attribute.
-
- """
-
- def __init__(self, h5f_path, new_file=False, dsXMLFile=None):
- self.h5f_path = h5f_path
- self.dsXMLFile = dsXMLFile
- msg = 'Created by H5Talbe from DAMASK'
- mode = 'w' if new_file else 'a'
- with h5py.File(self.h5f_path, mode) as h5f:
- h5f['/'].attrs['description'] = msg
-
- def del_entry(self, feature_name):
- """Delete entry in HDF5 table"""
- dataType, h5f_path = lables_to_path(feature_name,
- dsXMLPath=self.dsXMLFile)
- with h5py.File(self.h5f_path, 'a') as h5f:
- del h5f[h5f_path]
-
- def get_attr(self, attr_name):
- dataType, h5f_path = lables_to_path(attr_name,
- dsXMLPath=self.dsXMLFile)
- with h5py.File(self.h5f_path, 'a') as h5f:
- rst_attr = h5f[h5f_path].attrs[attr_name]
- return rst_attr
-
- def add_attr(self, attr_name, attr_data):
- dataType, h5f_path = lables_to_path(attr_name,
- dsXMLPath=self.dsXMLFile)
- with h5py.File(self.h5f_path, 'a') as h5f:
- h5f[h5f_path].attrs[attr_name] = attr_data
- h5f.flush()
-
- def get_data(self, feature_name=None):
- """Extract dataset from HDF5 table and return it in a numpy array"""
- dataType, h5f_path = lables_to_path(feature_name,
- dsXMLPath=self.dsXMLFile)
- with h5py.File(self.h5f_path, 'a') as h5f:
- h5f_dst = h5f[h5f_path] # get the handle for target dataset(table)
- rst_data = np.zeros(h5f_dst.shape)
- h5f_dst.read_direct(rst_data)
- return rst_data
-
- def add_data(self, feature_name, dataset, cmd_log=None):
- """Adding new feature into existing HDF5 file"""
- dataType, h5f_path = lables_to_path(feature_name,
- dsXMLPath=self.dsXMLFile)
- with h5py.File(self.h5f_path, 'a') as h5f:
- # NOTE:
- # --> If dataset exists, delete the old one so as to write
- # a new one. For brand new dataset. For brand new one,
- # record its state as fresh in the cmd log.
- try:
- del h5f[h5f_path]
- print("***deleting old {} from {}".format(feature_name,self.h5f_path))
- except:
- # if no cmd log, None will used
- cmd_log = str(cmd_log) + " [FRESH]"
- h5f.create_dataset(h5f_path, data=dataset)
- # store the cmd in log is possible
- if cmd_log is not None:
- h5f[h5f_path].attrs['log'] = str(cmd_log)
- h5f.flush()
-
- def get_cmdlog(self, feature_name):
- """Get cmd history used to generate the feature"""
- dataType, h5f_path = lables_to_path(feature_name,
- dsXMLPath=self.dsXMLFile)
- with h5py.File(self.h5f_path, 'a') as h5f:
- cmd_logs = h5f[h5f_path].attrs['log']
- return cmd_logs
diff --git a/processing/post/h5_addCalculation.py b/processing/post/h5_addCalculation.py
deleted file mode 100755
index 0ce1981a1..000000000
--- a/processing/post/h5_addCalculation.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python2.7
-# -*- coding: UTF-8 no BOM -*-
-
-import os
-# import re
-# import sys
-import collections
-# import math
-import damask
-# import numpy as np
-from optparse import OptionParser
-
-scriptName = os.path.splitext(os.path.basename(__file__))[0]
-scriptID = ' '.join([scriptName, damask.version])
-
-
-# ----- Helper functions ----- #
-def listify(x):
- return x if isinstance(x, collections.Iterable) else [x]
-
-
-# --------------------------------------------------------------------
-# MAIN
-# --------------------------------------------------------------------
-usageEx = """
-usage_in_details:
- Column labels are tagged by '#label#' in formulas.
- Use ';' for ',' in functions. Numpy is available as 'np'.
- Special variables: #_row_# -- row index
-
- Examples:
- (1) magnitude of vector -- "np.linalg.norm(#vec#)"
- (2) rounded root of row number -- "round(math.sqrt(#_row_#);3)"
-"""
-desp = "Add or alter column(s) with derived values according to "
-desp += "user-defined arithmetic operation between column(s)."
-
-parser = OptionParser(option_class=damask.extendableOption,
- usage='%prog options [file[s]]' + usageEx,
- description=desp,
- version=scriptID)
-parser.add_option('-l', '--label',
- dest='labels',
- action='extend', metavar='