@@ -66,7 +66,7 @@ def __init__(self, xl=None, xu=None) -> None:
66
66
# now create all the masks that are necessary
67
67
self .xl_only , self .xu_only = np .logical_and (~ xl_nan , xu_nan ), np .logical_and (xl_nan , ~ xu_nan )
68
68
self .both_nan = np .logical_and (np .isnan (xl ), np .isnan (xu ))
69
- self .neither_nan = ~ self . both_nan
69
+ self .neither_nan = np . logical_and ( ~ np . isnan ( xl ), ~ np . isnan ( xu ))
70
70
71
71
# if neither is nan than xu must be greater or equal than xl
72
72
any_nan = np .logical_or (np .isnan (xl ), np .isnan (xu ))
@@ -76,18 +76,15 @@ def forward(self, X):
76
76
if X is None or (self .xl is None and self .xu is None ):
77
77
return X
78
78
79
- xl , xu , xl_only , xu_only = self .xl , self .xu , self .xl_only , self .xu_only
80
- both_nan , neither_nan = self .both_nan , self .neither_nan
81
-
82
79
# simple copy the input
83
80
N = np .copy (X )
84
81
85
82
# normalize between zero and one if neither of them is nan
86
- N [..., neither_nan ] = (X [..., neither_nan ] - xl [neither_nan ]) / (xu [neither_nan ] - xl [neither_nan ])
83
+ N [..., self . neither_nan ] = (X [..., self . neither_nan ] - self . xl [self . neither_nan ]) / (self . xu [self . neither_nan ] - self . xl [self . neither_nan ])
87
84
88
- N [..., xl_only ] = X [..., xl_only ] - xl [xl_only ]
85
+ N [..., self . xl_only ] = X [..., self . xl_only ] - self . xl [self . xl_only ]
89
86
90
- N [..., xu_only ] = 1.0 - (xu [xu_only ] - X [..., xu_only ])
87
+ N [..., self . xu_only ] = 1.0 - (self . xu [self . xu_only ] - X [..., self . xu_only ])
91
88
92
89
return N
93
90
0 commit comments