This commit is contained in:
Martin Diehl 2021-03-26 20:56:55 +01:00
parent 3a74270946
commit 9fd244d8a0
9 changed files with 11 additions and 62 deletions

View File

@ -3,7 +3,7 @@ Al:
mechanical:
elastic:
type: Hooke
references:
references:
- J. Vallin et al.,
Journal of Applied Physics 35(6), 1825-1826, 1964,
https://doi.org/10.1063/1.1713749

View File

@ -3,7 +3,7 @@ Au:
mechanical:
elastic:
type: Hooke
references:
references:
- J.P. Hirth and J. Lothe,
Theory of Dislocations, 1982,
John Wiley & Sons

View File

@ -3,7 +3,7 @@ Ni:
mechanical:
elastic:
type: Hooke
references:
references:
- J.P. Hirth and J. Lothe,
Theory of Dislocations, 1982,
John Wiley & Sons

View File

@ -2,9 +2,9 @@ cpTi:
lattice: hP
c/a: 1.587
mechanical:
elastic:
elastic:
type: Hooke
references:
references:
- L. Wang et al.,
Acta Materialia 132, 598-610, 2017,
https://doi.org/10.1016/j.actamat.2017.05.015

View File

@ -76,10 +76,10 @@ def asMFD(mfd_data):
elif type(num) == float:
result += '{:20.12e}'.format(num)
else:
damask.util.croak('WARNING: encountered unknown type: ' + str(type(el)))
print(f'WARNING: encountered unknown type: {type(el)}')
result += '\n'
else:
damask.util.croak('WARNING: encountered unknown type: ' + str(type(el)))
print(f'WARNING: encountered unknown type: {type(el)}')
if section['uid'] > 0:
result += '=end=\n'
return result.strip()
@ -244,9 +244,9 @@ if remote:
py_mentat.py_send('*save_as_model "{}" yes'.format(filenames[0]))
py_mentat.py_get_int("nnodes()")
except py_mentat.InputError as err:
damask.util.croak('{}. Try Tools/Python/"Run as Separate Process" & "Initiate".'.format(err))
print(f'{err}. Try Tools/Python/"Run as Separate Process" & "Initiate".')
sys.exit(-1)
damask.util.croak( 'connected...')
print( 'connected...')
for name in filenames:
while remote and not os.path.exists(name): time.sleep(0.5)

View File

@ -33,9 +33,6 @@ from ._configmaterial import ConfigMaterial # noqa
from ._grid import Grid # noqa
from ._result import Result # noqa
# deprecated
from ._asciitable import ASCIItable # noqa
from ._test import Test # noqa
from .util import extendableOption # noqa

View File

@ -53,8 +53,7 @@ class Test:
self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__))
self.parser = OptionParser(option_class=damask.extendableOption,
description = f'{self.description} (Test class version: {damask.version})',
self.parser = OptionParser(description = f'{self.description} (Test class version: {damask.version})',
usage = './test.py [options]')
self.parser.add_option("-k", "--keep",
action = "store_true",
@ -70,7 +69,6 @@ class Test:
help = "show all test variants without actual calculation")
self.parser.add_option("-s", "--select",
dest = "select",
action = 'extend', metavar = '<string LIST>',
help = "run test(s) of given name only")
self.parser.set_defaults(keep = self.keep,
accept = self.accept,

View File

@ -6,7 +6,6 @@ import shlex
import re
import fractions
from functools import reduce
from optparse import Option
import numpy as np
import h5py
@ -16,7 +15,6 @@ from . import version
# limit visibility
__all__=[
'srepr',
'croak',
'report',
'emph','deemph','warn','strikeout',
'execute',
@ -25,7 +23,6 @@ __all__=[
'project_stereographic',
'hybrid_IA',
'return_message',
'extendableOption',
'execution_stamp',
'shapeshifter', 'shapeblender',
'extend_docstring', 'extended_docstring',
@ -54,25 +51,6 @@ def srepr(arg,glue = '\n'):
return arg if isinstance(arg,str) else repr(arg)
def croak(what, newline = True):
"""
Write formated to stderr.
DEPRECATED
Parameters
----------
what : str or iterable
Content to be displayed.
newline : bool, optional
Separate items of what by newline. Defaults to True.
"""
if what is not None:
sys.stderr.write(srepr(what,glue = '\n') + ('\n' if newline else ''))
sys.stderr.flush()
def report(who = None,
what = None):
"""
@ -81,7 +59,7 @@ def report(who = None,
DEPRECATED
"""
croak( (emph(who)+': ' if who is not None else '') + (what if what is not None else '') + '\n' )
print( (emph(who)+': ' if who is not None else '') + (what if what is not None else '') + '\n' )
def emph(what):
@ -428,27 +406,6 @@ def DREAM3D_cell_data_group(fname):
####################################################################################################
# Classes
####################################################################################################
class extendableOption(Option):
"""
Used for definition of new option parser action 'extend', which enables to take multiple option arguments.
Adopted from online tutorial http://docs.python.org/library/optparse.html
DEPRECATED
"""
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)
class _ProgressBar:
"""
Report progress of an interation as a status bar.

View File

@ -23,9 +23,6 @@ class TestUtil:
with pytest.raises(RuntimeError):
util.execute('/bin/false')
def test_croak(self):
util.croak('Burp!')
@pytest.mark.parametrize('input,output',
[
([0,-2],[0,-1]),