Skip to content

Commit cbd234d

Browse files
committed
Remove numpy warning and ifo messages and in functions dependencies
1 parent 6fcd198 commit cbd234d

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

labfis/uncertainty.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,6 @@
99
import numpy
1010
except ImportError:
1111
numpy = None
12-
logger.warning(
13-
'Faild to import numpy; sqrt, sin, cos, tan, arcsin, arccos, arctan and numpy.ndarray list method wont function')
14-
15-
16-
def skipif(condition, message):
17-
def decorator(fnc):
18-
def wrapper(*args, **kwargs):
19-
if condition:
20-
return fnc(*args, **kwargs)
21-
else:
22-
logger.info(message)
23-
pass
24-
return wrapper
25-
return decorator
2612

2713

2814
class LabFloatError(Exception):
@@ -31,7 +17,7 @@ def __init__(self, *args):
3117
if args[0] == 0:
3218
self.message = "This operation is not supported."
3319
elif args[0] == 1:
34-
self.message = "Too many arguments, expected '(val,err)' or '([[val1,val2,...],[err1,err2,...],...]])' , got: '{0}'".format(
20+
self.message = "Too many arguments, expected '(val,err)' or '([val1,val2,...],[err1,err2,...],...])' , got: '{0}'".format(
3521
args[1])
3622
elif args[0] == 2:
3723
self.message = "Mean list and Uncertainty list must have the same size, expected: '[[val1,val2,...,valn],[err1,err2,...,errn]]' , got: '{0}'".format(
@@ -323,31 +309,24 @@ def __rpow__(self, other):
323309
def __ipow__(self, other):
324310
return self.__pow__(other)
325311

326-
@skipif(numpy, "The sqrt() method is not supported without numpy")
327312
def sqrt(self):
328313
return self.__pow__(0.5)
329314

330-
@skipif(numpy, "The cos() method is not supported without numpy")
331315
def cos(self):
332316
return labfloat(cos(self.mean), abs(-(sin(self.mean)) * self.uncertainty))
333317

334-
@skipif(numpy, "The sin() method is not supported without numpy")
335318
def sin(self):
336319
return labfloat(sin(self.mean), abs(cos(self.mean) * self.uncertainty))
337320

338-
@skipif(numpy, "The tan() method is not supported without numpy")
339321
def tan(self):
340322
return labfloat(tan(self.mean), sqrt((cos(self.mean) ** -4) * self.uncertainty ** 2))
341323

342-
@skipif(numpy, "The arcsin() method is not supported without numpy")
343324
def arcsin(self):
344325
return labfloat(asin(self.mean), self.uncertainty/sqrt(1 - self.mean ** 2))
345326

346-
@skipif(numpy, "The arccos() method is not supported without numpy")
347327
def arccos(self):
348328
return labfloat(acos(self.mean), abs(-self.uncertainty/sqrt(1 - self.mean ** 2)))
349329

350-
@skipif(numpy, "The arctan() method is not supported without numpy")
351330
def arctan(self):
352331
return labfloat(atan(self.mean), self.uncertainty/(1 + self.mean ** 2))
353332

0 commit comments

Comments
 (0)