Skip to content

Commit 2f88362

Browse files
committed
Merge branch 'housekeeping_2026-02-20' into 'development'
housekeeping 2026-02-20 Closes #602 and #603 See merge request damask/DAMASK!1175
2 parents 258eb6e + bf3a2a6 commit 2f88362

98 files changed

Lines changed: 190 additions & 172 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitlab-ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ variables:
1414
MARC_VERSION: '2025.1'
1515
PETSC_GCC_LATEST: '2025.11.13'
1616
PETSC_ONEAPI_LATEST: '2025.11.13'
17-
PYTHON_LATEST: '2025.06.05'
17+
PYTHON_LATEST: '2026.02.24'
1818

1919
####################################################################################################
2020
# https://docs.gitlab.com/ci/yaml/workflow
@@ -115,6 +115,7 @@ workflow:
115115
parallel:
116116
matrix:
117117
- IMAGE:
118+
- python:2025.06.05
118119
- python:2025.01.05
119120
- python:310_2412
120121

PRIVATE

env/DAMASK.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd
2828

2929
PATH=${DAMASK_ROOT}/bin:$PATH
3030

31-
SOLVER_GRID=$(type -p DAMASK_grid || true 2>/dev/null)
31+
SOLVER_GRID=$(type -p damask_grid || true 2>/dev/null)
3232
[ "x$SOLVER_GRID" == "x" ] && SOLVER_GRID=$(blink 'Not found!')
33-
SOLVER_MESH=$(type -p DAMASK_mesh || true 2>/dev/null)
33+
SOLVER_MESH=$(type -p damask_mesh || true 2>/dev/null)
3434
[ "x$SOLVER_MESH" == "x" ] && SOLVER_MESH=$(blink 'Not found!')
3535

3636

env/DAMASK.zsh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd
1818

1919
PATH=${DAMASK_ROOT}/bin:$PATH
2020

21-
SOLVER_GRID=$(which DAMASK_grid || true 2>/dev/null)
21+
SOLVER_GRID=$(which damask_grid || true 2>/dev/null)
2222
[[ "x$SOLVER_GRID" == "x" ]] && SOLVER_GRID=$(blink 'Not found!')
23-
SOLVER_MESH=$(which DAMASK_mesh || true 2>/dev/null)
23+
SOLVER_MESH=$(which damask_mesh || true 2>/dev/null)
2424
[[ "x$SOLVER_MESH" == "x" ]] && SOLVER_MESH=$(blink 'Not found!')
2525

2626

python/damask/_geomgrid.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ def from_Voronoi_tessellation(cells: IntSequence,
648648
"""
649649
coords = grid_filters.coordinates0_point(cells,size).reshape(-1,3)
650650
tree = spatial.KDTree(seeds,boxsize=np.asarray(size) if periodic else None)
651-
material_ = tree.query(coords, workers = int(os.environ.get('OMP_NUM_THREADS',4)))[1]
651+
material_ = np.asarray(tree.query(coords, workers = int(os.environ.get('OMP_NUM_THREADS',4)))[1])
652652

653653
return GeomGrid(material = (material_ if material is None else np.array(material)[material_]).reshape(cells),
654654
size = size,
@@ -1003,14 +1003,11 @@ def flip(self,
10031003
if not set(directions).issubset(valid):
10041004
raise ValueError(f'invalid direction "{set(directions).difference(valid)}" specified')
10051005

1006-
mat = np.flip(self.material, [valid.index(d) for d in directions if d in valid])
1007-
ic = {}
1008-
for label in self.initial_conditions:
1009-
ic[label] = np.flip(self.initial_conditions[label],[valid.index(d) for d in directions if d in valid])
1010-
return GeomGrid(material = mat,
1006+
directions_ = tuple([valid.index(d) for d in directions if d in valid])
1007+
return GeomGrid(material = np.flip(self.material, directions_),
10111008
size = self.size,
10121009
origin = self.origin,
1013-
initial_conditions = ic,
1010+
initial_conditions = {label:np.flip(ic, directions_) for label,ic in self.initial_conditions.items()},
10141011
comments = self.comments+[util.execution_stamp('GeomGrid','flip')],
10151012
)
10161013

@@ -1056,10 +1053,12 @@ def rotate(self,
10561053
material = self.material
10571054
# These rotations are always applied in the reference coordinate system, i.e. (z,x,z) not (z,x',z'')
10581055
# see https://www.cs.utexas.edu/~theshark/courses/cs354/lectures/cs354-14.pdf
1059-
for angle,axes in zip(R.as_Euler_angles(degrees=True)[::-1], [(0,1),(1,2),(0,1)]):
1060-
material_temp = ndimage.rotate(material,angle,axes,order=0,prefilter=False,
1056+
for angle,axes in zip(np.flip(R.as_Euler_angles(degrees=True)), [(0,1),(1,2),(0,1)]):
1057+
material_temp = ndimage.rotate(material,angle,axes,
10611058
output=self.material.dtype,
1062-
cval=np.nanmax(self.material) + 1 if fill is None else fill)
1059+
order=0,
1060+
cval=np.nanmax(self.material) + 1 if fill is None else fill,
1061+
prefilter=False) # type: ignore[call-overload]
10631062
# avoid scipy interpolation errors for rotations close to multiples of 90°
10641063
material = material_temp if np.prod(material_temp.shape) != np.prod(material.shape) else \
10651064
np.rot90(material,k=np.rint(angle/90.).astype(np.int64),axes=axes)

python/damask/_result.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,7 @@ def export_VTK(self,
20202020

20212021
for grp_label,dataset in outs.items():
20222022
v = v.set(' / '.join(['/'.join([grp_type,grp_field,grp_label]),
2023-
dataset.dtype.metadata.get('unit')]),dataset)
2023+
dataset.dtype.metadata['unit']]),dataset) # type: ignore[index]
20242024

20252025
v.save(out_dir/f'{self.fname.stem}_inc{grp_inc.split(prefix_inc)[-1].zfill(N_digits)}',
20262026
parallel=parallel)
@@ -2083,14 +2083,14 @@ def create_and_open(obj,name):
20832083
for grp_label in self._visible['phases']:
20842084
try:
20852085
data = _read(f['/'.join([grp_inc,'phase',grp_label,'mechanical',q])])
2086-
lattice = data.dtype.metadata['lattice']
20872086
# Map to DREAM.3D IDs
2088-
if lattice == 'hP':
2089-
crystal_structure.append(0)
2090-
elif lattice in ['cI','cF']:
2091-
crystal_structure.append(1)
2092-
elif lattice == 'tI':
2093-
crystal_structure.append(8)
2087+
match data.dtype.metadata['lattice']: # type: ignore[index]
2088+
case 'hP':
2089+
crystal_structure.append(0)
2090+
case 'cI' | 'cF':
2091+
crystal_structure.append(1)
2092+
case 'tI':
2093+
crystal_structure.append(8)
20942094

20952095
cell_orientation[at_cell_ph[c][grp_label],:] = \
20962096
Rotation(data[in_data_ph[c][grp_label],:]).as_Euler_angles().astype(np.float32)

python/damask/_rotation.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ def __array__(self: MyType,
275275
*,
276276
copy: Optional[bool] = None) -> np.ndarray:
277277
"""Initializer for numpy."""
278-
return self.quaternion.__array__(dtype) if util.version(np.__version__) < '2.0.0' else \
279-
self.quaternion.__array__(dtype,copy=copy) # type: ignore[arg-type]
278+
return np.asarray(self.quaternion,dtype) if util.version(np.__version__) < '2.0.0' else \
279+
np.asarray(self.quaternion,dtype,copy=copy)
280280

281281

282282
def __len__(self: MyType) -> int:
@@ -693,7 +693,7 @@ def misorientation_angle(self: MyType,
693693
################################################################################################
694694
# convert to different orientation representations (numpy arrays)
695695

696-
def as_quaternion(self) -> np.ndarray:
696+
def as_quaternion(self) -> npt.NDArray[np.floating]:
697697
"""
698698
Represent as unit quaternion.
699699
@@ -705,7 +705,7 @@ def as_quaternion(self) -> np.ndarray:
705705
return self.quaternion.copy()
706706

707707
def as_Euler_angles(self,
708-
degrees: bool = False) -> np.ndarray:
708+
degrees: bool = False) -> npt.NDArray[np.floating]:
709709
"""
710710
Represent as Bunge Euler angles.
711711
@@ -769,7 +769,7 @@ def as_axis_angle(self,
769769
else:
770770
return ax
771771

772-
def as_matrix(self) -> np.ndarray:
772+
def as_matrix(self) -> npt.NDArray[np.floating]:
773773
"""
774774
Represent as rotation matrix.
775775
@@ -791,7 +791,7 @@ def as_matrix(self) -> np.ndarray:
791791
return Rotation._qu2om(self.quaternion)
792792

793793
def as_Rodrigues_vector(self,
794-
compact: bool = False) -> np.ndarray:
794+
compact: bool = False) -> npt.NDArray[np.floating]:
795795
"""
796796
Represent as Rodrigues–Frank vector with separate axis and angle argument.
797797
@@ -823,7 +823,7 @@ def as_Rodrigues_vector(self,
823823
else:
824824
return ro
825825

826-
def as_homochoric(self) -> np.ndarray:
826+
def as_homochoric(self) -> npt.NDArray[np.floating]:
827827
"""
828828
Represent as homochoric vector.
829829
@@ -842,7 +842,7 @@ def as_homochoric(self) -> np.ndarray:
842842
"""
843843
return Rotation._qu2ho(self.quaternion)
844844

845-
def as_cubochoric(self) -> np.ndarray:
845+
def as_cubochoric(self) -> npt.NDArray[np.floating]:
846846
"""
847847
Represent as cubochoric vector.
848848

python/damask/_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def __getitem__(self,
126126
(item[0], item[1]) if isinstance(item[0],(slice,np.ndarray)) else \
127127
(slice(None,None,None),item)
128128
sliced = self.data.loc[item_]
129-
cols = np.array(sliced.columns if isinstance(sliced,pd.core.frame.DataFrame) else [item_[1]])
129+
cols = np.array(sliced.columns if isinstance(sliced,pd.DataFrame) else [item_[1]])
130130
_,idx = np.unique(cols,return_index=True)
131131
return self.__class__(shapes={k:self.shapes[k] for k in cols[np.sort(idx)]},
132132
data=sliced,

python/damask/_vtk.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,9 @@ def show(self,
717717
(this includes tensor datasets as they are flattened).
718718
"""
719719
# See http://compilatrix.com/article/vtk-1 for possible improvements.
720+
if os.name == 'posix' and 'DISPLAY' not in os.environ:
721+
logger.warning('Found no rendering device')
722+
return
720723
try:
721724
import wx
722725
_ = wx.App(False) # noqa
@@ -769,8 +772,5 @@ def show(self,
769772

770773
iren = vtkRenderWindowInteractor()
771774
iren.SetRenderWindow(window)
772-
if os.name == 'posix' and 'DISPLAY' not in os.environ:
773-
logger.warning('Found no rendering device')
774-
else:
775-
window.Render()
776-
iren.Start()
775+
window.Render()
776+
iren.Start()

python/damask/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import numpy as _np
2222
import h5py as _h5py
2323
try:
24-
import numba as _nb # type: ignore[import-not-found]
24+
import numba as _nb # type: ignore
2525
except ImportError:
2626
_nb = False
2727

0 commit comments

Comments
 (0)