Skip to content

Commit 9e3de06

Browse files
committed
Merge branch 'housekeeping_2025-03-27' into 'development'
housekeeping 2025-03-27 See merge request damask/DAMASK!1063
2 parents 2637f37 + c0770d9 commit 9e3de06

21 files changed

+400
-130
lines changed

.github/workflows/Python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99

1010
strategy:
1111
matrix:
12-
python-version: ['3.10', '3.11', '3.12', '3.13']
12+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.14t']
1313
os: [ubuntu-latest, macos-latest, windows-latest]
1414
fail-fast: false
1515

.gitlab-ci.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Marc_patch:
237237
- cd examples/Marc && python3 -c "import damask;damask.solver.Marc(version=${MARC_VERSION}).submit_job('r-value','texture',True,'h')"
238238
- test -f "${CI_PROJECT_DIR}/src/Marc/DAMASK_Marc.marc" || { echo "Marc simulation failed, DAMASK_Marc.marc not generated"; exit 1; }
239239

240-
Marc_Intel:
240+
Marc_compile:
241241
stage: compile
242242
image: git.damask-multiphysics.org:5050/damask/damask/marc_patched:${MARC_VERSION}
243243
tags:
@@ -247,17 +247,6 @@ Marc_Intel:
247247
- cd PRIVATE/testing
248248
- pytest -k 'compile and Marc'
249249

250-
setup_Marc:
251-
stage: compile
252-
image: git.damask-multiphysics.org:5050/damask/damask/marc_patched:${MARC_VERSION}
253-
tags:
254-
- matesting2_docker
255-
before_script:
256-
- source env/DAMASK.sh
257-
- cd examples/Marc && python3 -c "import damask;damask.solver.Marc(version=${MARC_VERSION}).submit_job('r-value','texture',True,'h')"
258-
script:
259-
- test -f "${CI_PROJECT_DIR}/src/Marc/DAMASK_Marc.marc" || { echo "Marc simulation failed, DAMASK_Marc.marc not generated"; exit 1; }
260-
261250

262251
###################################################################################################
263252

@@ -326,9 +315,14 @@ open-source_signal_restart_GCC:
326315
after_script:
327316
- echo Job end:" $(date)"
328317

329-
Marc:
318+
Marc_run:
330319
stage: fortran
331-
extends: setup_Marc
320+
image: git.damask-multiphysics.org:5050/damask/damask/marc_patched:${MARC_VERSION}
321+
tags:
322+
- matesting2_docker
323+
before_script:
324+
- source env/DAMASK.sh
325+
- cd examples/Marc && python3 -c "import damask;damask.solver.Marc(version=${MARC_VERSION}).submit_job('r-value','texture',True,'h')"
332326
script:
333327
- cd ${CI_PROJECT_DIR}/PRIVATE/testing
334328
- pytest -k 'not compile and Marc' -m 'not cifail'

python/damask/_colormap.py

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ def __eq__(self,
6969
Return self==other.
7070
7171
Test equality of other.
72+
73+
Parameters
74+
----------
75+
other : Colormap
76+
Colormap to check for equality.
77+
78+
Returns
79+
-------
80+
eq : bool
81+
Wheter self equals other.
7282
"""
7383
if not isinstance(other, Colormap):
7484
return NotImplemented
@@ -81,6 +91,16 @@ def __add__(self,
8191
Return self+other.
8292
8393
Concatenate.
94+
95+
Parameters
96+
----------
97+
other : Colormap
98+
Colormap to concatenate.
99+
100+
Returns
101+
-------
102+
new : Colormap
103+
Concatenated colormap.
84104
"""
85105
return Colormap(np.vstack((self.colors,other.colors)),
86106
f'{self.name}+{other.name}')
@@ -92,6 +112,16 @@ def __iadd__(self,
92112
Return self+=other.
93113
94114
Concatenate (in-place).
115+
116+
Parameters
117+
----------
118+
other : Colormap
119+
Colormap to concatenate.
120+
121+
Returns
122+
-------
123+
updated : Colormap
124+
Concatenated colormap.
95125
"""
96126
return self.__add__(other)
97127

@@ -102,6 +132,16 @@ def __mul__(self,
102132
Return self*other.
103133
104134
Repeat.
135+
136+
Parameters
137+
----------
138+
factor : int
139+
Number of repetitions.
140+
141+
Returns
142+
-------
143+
new : Colormap
144+
Repeated colormap.
105145
"""
106146
return Colormap(np.vstack([self.colors]*factor),f'{self.name}*{factor}')
107147

@@ -111,6 +151,16 @@ def __imul__(self,
111151
Return self*=other.
112152
113153
Repeat (in-place).
154+
155+
Parameters
156+
----------
157+
factor : int
158+
Number of repetitions.
159+
160+
Returns
161+
-------
162+
updated : Colormap
163+
Repeated colormap.
114164
"""
115165
return self.__mul__(factor)
116166

@@ -120,6 +170,11 @@ def __invert__(self) -> 'Colormap':
120170
Return ~self.
121171
122172
Reverse.
173+
174+
Returns
175+
-------
176+
new : Colormap
177+
Reversed colormap.
123178
"""
124179
return self.reversed()
125180

@@ -767,28 +822,119 @@ def _msh2lab(msh: np.ndarray) -> np.ndarray:
767822

768823
@staticmethod
769824
def _lab2rgb(lab: np.ndarray) -> np.ndarray:
825+
"""
826+
CIELAB to Red Green Blue.
827+
828+
Parameters
829+
----------
830+
lab : numpy.ndarray, shape (3)
831+
CIELAB values.
832+
833+
Returns
834+
-------
835+
rgb : numpy.ndarray, shape (3)
836+
RGB values in the range [[0,1],[0,1],[0,1]].
837+
"""
770838
return Colormap._xyz2rgb(Colormap._lab2xyz(lab))
771839

772840
@staticmethod
773841
def _rgb2lab(rgb: np.ndarray) -> np.ndarray:
842+
"""
843+
Red Green Blue to CIELAB.
844+
845+
Parameters
846+
----------
847+
rgb : numpy.ndarray, shape (3)
848+
RGB values in the range [[0,1],[0,1],[0,1]].
849+
850+
Returns
851+
-------
852+
lab : numpy.ndarray, shape (3)
853+
CIELAB values.
854+
"""
774855
return Colormap._xyz2lab(Colormap._rgb2xyz(rgb))
775856

776857
@staticmethod
777858
def _msh2rgb(msh: np.ndarray) -> np.ndarray:
859+
"""
860+
Msh to Red Green Blue.
861+
862+
Parameters
863+
----------
864+
msh : numpy.ndarray, shape (3)
865+
Msh values.
866+
867+
Returns
868+
-------
869+
rgb : numpy.ndarray, shape (3)
870+
RGB values in the range [[0,1],[0,1],[0,1]].
871+
"""
778872
return Colormap._lab2rgb(Colormap._msh2lab(msh))
779873

780874
@staticmethod
781875
def _rgb2msh(rgb: np.ndarray) -> np.ndarray:
876+
"""
877+
Red Green Blue to Msh.
878+
879+
Parameters
880+
----------
881+
rgb : numpy.ndarray, shape (3)
882+
RGB values in the range [[0,1],[0,1],[0,1]].
883+
884+
Returns
885+
-------
886+
msh : numpy.ndarray, shape (3)
887+
Msh values.
888+
"""
782889
return Colormap._lab2msh(Colormap._rgb2lab(rgb))
783890

784891
@staticmethod
785892
def _hsv2msh(hsv: np.ndarray) -> np.ndarray:
893+
"""
894+
Hue Saturation Value to msh.
895+
896+
Parameters
897+
----------
898+
hsv : numpy.ndarray, shape (3)
899+
HSV values in the range [[0,360],[0,1],[0,1]].
900+
901+
Returns
902+
-------
903+
msh : numpy.ndarray, shape (3)
904+
Msh values.
905+
"""
786906
return Colormap._rgb2msh(Colormap._hsv2rgb(hsv))
787907

788908
@staticmethod
789909
def _hsl2msh(hsl: np.ndarray) -> np.ndarray:
910+
"""
911+
Hue Saturation Luminance to Msh.
912+
913+
Parameters
914+
----------
915+
hsl : numpy.ndarray, shape (3)
916+
HSL values in the range [[0,360],[0,1],[0,1]].
917+
918+
Returns
919+
-------
920+
msh : numpy.ndarray, shape (3)
921+
Msh values.
922+
"""
790923
return Colormap._rgb2msh(Colormap._hsl2rgb(hsl))
791924

792925
@staticmethod
793926
def _xyz2msh(xyz: np.ndarray) -> np.ndarray:
927+
"""
928+
CIEXYZ to Msh.
929+
930+
Parameters
931+
----------
932+
xyz : numpy.ndarray, shape (3)
933+
CIEXYZ values.
934+
935+
Returns
936+
-------
937+
msh : numpy.ndarray, shape (3)
938+
Msh values.
939+
"""
794940
return Colormap._lab2msh(Colormap._xyz2lab(xyz))

python/damask/_crystal.py

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -803,14 +803,29 @@ def __eq__(self,
803803

804804
@property
805805
def parameters(self) -> Optional[dict]:
806-
"""Return lattice parameters a, b, c, alpha, beta, gamma."""
806+
"""
807+
Return lattice parameters.
808+
809+
Returns
810+
-------
811+
parameters : dict
812+
Lattice parameters a, b, c, alpha, beta, gamma.
813+
"""
807814
has_parameters = all([hasattr(self,p) for p in ['a','b','c','alpha','beta','gamma']])
808815
return dict(a=self.a,b=self.b,c=self.c,
809816
alpha=self.alpha,beta=self.beta,gamma=self.gamma) if has_parameters else None
810817

811818
@property
812819
def immutable(self) -> dict[str, float]:
813-
"""Return immutable lattice parameters."""
820+
"""
821+
Return immutable lattice parameters.
822+
823+
Returns
824+
-------
825+
immutable : dict
826+
Lattice parameters a, b, c, alpha, beta, gamma
827+
that are fixed for the given crystal family.
828+
"""
814829
# ToDo: use pattern matching in Python 3.10
815830
_immutable: dict[CrystalFamily, dict[str,float]] = {
816831
'cubic': {
@@ -855,7 +870,13 @@ def orientation_relationships(self) -> list[str]:
855870
@property
856871
def standard_triangle(self) -> Union[dict[str, np.ndarray], None]:
857872
"""
858-
Corners of the standard triangle.
873+
Returns corners of the standard triangle.
874+
875+
Returns
876+
-------
877+
standard_triangle : dict
878+
Proper and improper corners of the standard triangle
879+
for the given crystal family.
859880
860881
Notes
861882
-----
@@ -920,6 +941,11 @@ def symmetry_operations(self) -> Rotation:
920941
"""
921942
Return symmetry operations.
922943
944+
Returns
945+
-------
946+
symmetry_operations : damask.Rotation
947+
Symmetry operations for given crystal family.
948+
923949
Notes
924950
-----
925951
The symmetry operations defined here only consider Rotations.
@@ -1086,7 +1112,7 @@ def lattice_points(self) -> np.ndarray:
10861112

10871113
def to_lattice(self, *,
10881114
direction: Optional[FloatSequence] = None,
1089-
plane: Optional[FloatSequence] = None) -> np.ndarray:
1115+
plane: Optional[FloatSequence] = None) -> np.ndarray: # numpydoc ignore=PR01,PR02
10901116
"""
10911117
Calculate lattice vector corresponding to crystal frame direction or plane normal.
10921118
@@ -1114,7 +1140,7 @@ def to_frame(self, *,
11141140
uvw: Optional[IntSequence] = None,
11151141
hkl: Optional[IntSequence] = None,
11161142
uvtw: Optional[IntSequence] = None,
1117-
hkil: Optional[IntSequence] = None) -> np.ndarray:
1143+
hkil: Optional[IntSequence] = None) -> np.ndarray: # numpydoc ignore=PR01,PR02
11181144
"""
11191145
Calculate crystal frame vector corresponding to lattice direction [uvw]/[uvtw] or plane normal (hkl)/(hkil).
11201146
@@ -1294,7 +1320,7 @@ def relation_operations(self,
12941320

12951321
def Schmid(self, *,
12961322
N_slip: Optional[Union[IntSequence, Literal['*']]] = None,
1297-
N_twin: Optional[Union[IntSequence, Literal['*']]] = None) -> np.ndarray:
1323+
N_twin: Optional[Union[IntSequence, Literal['*']]] = None) -> np.ndarray: # numpydoc ignore=PR01,PR02
12981324
u"""
12991325
Calculate Schmid matrix P = d ⨂ n for selected deformation systems.
13001326

0 commit comments

Comments
 (0)