changed return type of util.shapeblender and util.shapeshifter from Sequence[SupportsIndex] to Tuple[SupportsIndex, ...]
ignored lines in orientation module that attempt to pass objects of type Tuple[SupportsIndex, ...] to np.broadcast_to()
This commit is contained in:
parent
ef051ceef9
commit
cb1143a472
|
@ -657,7 +657,7 @@ class Orientation(Rotation,Crystal):
|
||||||
"""
|
"""
|
||||||
eq = self.equivalent
|
eq = self.equivalent
|
||||||
blend = util.shapeblender(eq.shape,np.array(vector).shape[:-1])
|
blend = util.shapeblender(eq.shape,np.array(vector).shape[:-1])
|
||||||
poles = eq.broadcast_to(blend,mode='right') @ np.broadcast_to(np.array(vector),blend+(3,))
|
poles = eq.broadcast_to(blend,mode='right') @ np.broadcast_to(np.array(vector),blend+(3,)) #type: ignore
|
||||||
ok = self.in_SST(poles,proper=proper)
|
ok = self.in_SST(poles,proper=proper)
|
||||||
ok &= np.cumsum(ok,axis=0) == 1
|
ok &= np.cumsum(ok,axis=0) == 1
|
||||||
loc = np.where(ok)
|
loc = np.where(ok)
|
||||||
|
@ -886,8 +886,7 @@ class Orientation(Rotation,Crystal):
|
||||||
blend += sym_ops.shape
|
blend += sym_ops.shape
|
||||||
v = sym_ops.broadcast_to(shape) \
|
v = sym_ops.broadcast_to(shape) \
|
||||||
@ np.broadcast_to(v.reshape(util.shapeshifter(v.shape,shape+(3,))),shape+(3,))
|
@ np.broadcast_to(v.reshape(util.shapeshifter(v.shape,shape+(3,))),shape+(3,))
|
||||||
return ~(self.broadcast_to(blend)) \
|
return ~(self.broadcast_to(blend))@ np.broadcast_to(v,blend+(3,)) #type: ignore
|
||||||
@ np.broadcast_to(v,blend+(3,))
|
|
||||||
|
|
||||||
|
|
||||||
def Schmid(self, *,
|
def Schmid(self, *,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import re
|
||||||
import fractions
|
import fractions
|
||||||
from collections import abc
|
from collections import abc
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from typing import Union, Tuple, Iterable, Callable, Dict, List, Any, Literal, SupportsIndex, Sequence
|
from typing import Union, Tuple, Iterable, Callable, Dict, List, Any, Literal, SupportsIndex
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -427,7 +427,7 @@ def hybrid_IA(dist: np.ndarray,
|
||||||
def shapeshifter(fro: Tuple[int, ...],
|
def shapeshifter(fro: Tuple[int, ...],
|
||||||
to: Tuple[int, ...],
|
to: Tuple[int, ...],
|
||||||
mode: Literal['left','right'] = 'left',
|
mode: Literal['left','right'] = 'left',
|
||||||
keep_ones: bool = False) -> Sequence[SupportsIndex]:
|
keep_ones: bool = False) -> Tuple[SupportsIndex, ...]:
|
||||||
"""
|
"""
|
||||||
Return dimensions that reshape 'fro' to become broadcastable to 'to'.
|
Return dimensions that reshape 'fro' to become broadcastable to 'to'.
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ def shapeshifter(fro: Tuple[int, ...],
|
||||||
|
|
||||||
|
|
||||||
def shapeblender(a: Tuple[int, ...],
|
def shapeblender(a: Tuple[int, ...],
|
||||||
b: Tuple[int, ...]) -> Sequence[SupportsIndex]:
|
b: Tuple[int, ...]) -> Tuple[SupportsIndex, ...]:
|
||||||
"""
|
"""
|
||||||
Return a shape that overlaps the rightmost entries of 'a' with the leftmost of 'b'.
|
Return a shape that overlaps the rightmost entries of 'a' with the leftmost of 'b'.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue