def _cond_ind(self): ind = None obj = self.base_object with obj._field_parameter_state(self.field_parameters): for cond in self.conditionals: res = eval(cond) if ind is None: ind = res if ind.shape != res.shape: raise YTIllDefinedCutRegion(self.conditionals) np.logical_and(res, ind, ind) return ind
def _cond_ind(self): ind = None obj = self.base_object locals = self.locals.copy() if 'obj' in locals: raise RuntimeError( '"obj" has been defined in the "locals" ; this is not supported, please rename the variable.' ) locals['obj'] = obj with obj._field_parameter_state(self.field_parameters): for cond in self.conditionals: res = eval(cond, locals) if ind is None: ind = res if ind.shape != res.shape: raise YTIllDefinedCutRegion(self.conditionals) np.logical_and(res, ind, ind) return ind