@@ -159,11 +159,11 @@ def __init__(self, samples: list[Union[ndarray, list[Any]]], names: list[str], i
159
159
self .tag = None
160
160
161
161
@property
162
- def value (self ) -> Union [ float , int64 , float64 , int ] :
162
+ def value (self ) -> float :
163
163
return self ._value
164
164
165
165
@property
166
- def dvalue (self ) -> Union [ float , float64 ] :
166
+ def dvalue (self ) -> float :
167
167
return self ._dvalue
168
168
169
169
@property
@@ -481,7 +481,7 @@ def reweight(self, weight: "Obs") -> "Obs":
481
481
"""
482
482
return reweight (weight , [self ])[0 ]
483
483
484
- def is_zero_within_error (self , sigma : Union [ float , int ] = 1 ) -> Union [ bool , bool ] :
484
+ def is_zero_within_error (self , sigma : float = 1 ) -> bool :
485
485
"""Checks whether the observable is zero within 'sigma' standard errors.
486
486
487
487
Parameters
@@ -493,7 +493,7 @@ def is_zero_within_error(self, sigma: Union[float, int]=1) -> Union[bool, bool]:
493
493
"""
494
494
return self .is_zero () or np .abs (self .value ) <= sigma * self ._dvalue
495
495
496
- def is_zero (self , atol : float = 1e-10 ) -> Union [ bool , bool ] :
496
+ def is_zero (self , atol : float = 1e-10 ) -> bool :
497
497
"""Checks whether the observable is zero within a given tolerance.
498
498
499
499
Parameters
@@ -867,7 +867,7 @@ def __truediv__(self, y: Any) -> Union[Obs, NotImplementedType, ndarray]:
867
867
else :
868
868
return derived_observable (lambda x , ** kwargs : x [0 ] / y , [self ], man_grad = [1 / y ])
869
869
870
- def __rtruediv__ (self , y : Union [ float , int ] ) -> Obs :
870
+ def __rtruediv__ (self , y : float ) -> Obs :
871
871
if isinstance (y , Obs ):
872
872
return derived_observable (lambda x , ** kwargs : x [0 ] / x [1 ], [y , self ], man_grad = [1 / self .value , - y .value / self .value ** 2 ])
873
873
else :
@@ -878,13 +878,13 @@ def __rtruediv__(self, y: Union[float, int]) -> Obs:
878
878
else :
879
879
return derived_observable (lambda x , ** kwargs : y / x [0 ], [self ], man_grad = [- y / self .value ** 2 ])
880
880
881
- def __pow__ (self , y : Union [Obs , float , int ]) -> Obs :
881
+ def __pow__ (self , y : Union [Obs , float ]) -> Obs :
882
882
if isinstance (y , Obs ):
883
883
return derived_observable (lambda x , ** kwargs : x [0 ] ** x [1 ], [self , y ], man_grad = [y .value * self .value ** (y .value - 1 ), self .value ** y .value * np .log (self .value )])
884
884
else :
885
885
return derived_observable (lambda x , ** kwargs : x [0 ] ** y , [self ], man_grad = [y * self .value ** (y - 1 )])
886
886
887
- def __rpow__ (self , y : Union [ float , int ] ) -> Obs :
887
+ def __rpow__ (self , y : float ) -> Obs :
888
888
return derived_observable (lambda x , ** kwargs : y ** x [0 ], [self ], man_grad = [y ** self .value * np .log (y )])
889
889
890
890
def __abs__ (self ) -> Obs :
@@ -941,7 +941,7 @@ class CObs:
941
941
"""Class for a complex valued observable."""
942
942
__slots__ = ['_real' , '_imag' , 'tag' ]
943
943
944
- def __init__ (self , real : Obs , imag : Union [Obs , float , int ]= 0.0 ):
944
+ def __init__ (self , real : Obs , imag : Union [Obs , float ]= 0.0 ):
945
945
self ._real = real
946
946
self ._imag = imag
947
947
self .tag = None
@@ -951,7 +951,7 @@ def real(self) -> Obs:
951
951
return self ._real
952
952
953
953
@property
954
- def imag (self ) -> Union [Obs , float , int ]:
954
+ def imag (self ) -> Union [Obs , float ]:
955
955
return self ._imag
956
956
957
957
def gamma_method (self , ** kwargs ):
@@ -979,7 +979,7 @@ def __add__(self, other: Any) -> Union[CObs, ndarray]:
979
979
else :
980
980
return CObs (self .real + other , self .imag )
981
981
982
- def __radd__ (self , y : Union [complex , float , Obs , int ]) -> "CObs" :
982
+ def __radd__ (self , y : Union [complex , Obs ]) -> "CObs" :
983
983
return self + y
984
984
985
985
def __sub__ (self , other : Any ) -> Union [CObs , ndarray ]:
@@ -990,7 +990,7 @@ def __sub__(self, other: Any) -> Union[CObs, ndarray]:
990
990
else :
991
991
return CObs (self .real - other , self .imag )
992
992
993
- def __rsub__ (self , other : Union [complex , float , Obs , int ]) -> "CObs" :
993
+ def __rsub__ (self , other : Union [complex , Obs ]) -> "CObs" :
994
994
return - 1 * (self - other )
995
995
996
996
def __mul__ (self , other : Any ) -> Union [CObs , ndarray ]:
@@ -1012,7 +1012,7 @@ def __mul__(self, other: Any) -> Union[CObs, ndarray]:
1012
1012
else :
1013
1013
return CObs (self .real * other , self .imag * other )
1014
1014
1015
- def __rmul__ (self , other : Union [complex , Obs , CObs , float , int ]) -> "CObs" :
1015
+ def __rmul__ (self , other : Union [complex , Obs , CObs ]) -> "CObs" :
1016
1016
return self * other
1017
1017
1018
1018
def __truediv__ (self , other : Any ) -> Union [CObs , ndarray ]:
@@ -1024,7 +1024,7 @@ def __truediv__(self, other: Any) -> Union[CObs, ndarray]:
1024
1024
else :
1025
1025
return CObs (self .real / other , self .imag / other )
1026
1026
1027
- def __rtruediv__ (self , other : Union [complex , float , Obs , CObs , int ]) -> CObs :
1027
+ def __rtruediv__ (self , other : Union [complex , Obs , CObs ]) -> CObs :
1028
1028
r = self .real ** 2 + self .imag ** 2
1029
1029
if hasattr (other , 'real' ) and hasattr (other , 'imag' ):
1030
1030
return CObs ((self .real * other .real + self .imag * other .imag ) / r , (self .real * other .imag - self .imag * other .real ) / r )
@@ -1164,7 +1164,7 @@ def _intersection_idx(idl: list[Union[range, list[int]]]) -> Union[range, list[i
1164
1164
return idinter
1165
1165
1166
1166
1167
- def _expand_deltas_for_merge (deltas : ndarray , idx : Union [range , list [int ]], shape : int , new_idx : Union [range , list [int ]], scalefactor : Union [ float , int ] ) -> ndarray :
1167
+ def _expand_deltas_for_merge (deltas : ndarray , idx : Union [range , list [int ]], shape : int , new_idx : Union [range , list [int ]], scalefactor : float ) -> ndarray :
1168
1168
"""Expand deltas defined on idx to the list of configs that is defined by new_idx.
1169
1169
New, empty entries are filled by 0. If idx and new_idx are of type range, the smallest
1170
1170
common divisor of the step sizes is used as new step size.
0 commit comments