def push(self, *args, **kwargs): if len(args) == 1: loc = array2Point(args[0], self.config, self.raw_point) push_name = "push_" pargs = (loc, ) elif len(args) == 2: tag = args[0] val = args[1] push_fname, data_type = self._get_pushfname("push_", tag, val=val) pargs = (tag, safe_cast(data_type, val)) elif len(args) == 3: tag = args[0] loc = array2Point(args[1], self.config, self.raw_point) val = args[2] push_fname, data_type = self._get_pushfname("push_", tag, val=val) try: pargs = (tag, loc, safe_cast(data_type, val)) except ValueError: raise Exception("Forced type casting failed in push.") else: raise Exception("Push function accept 1, 2 or 3 parameters.") push = getattr(self.raw, push_fname) push(*pargs)
def fetch(self, *args, **kwargs): tag = args[0] data_type = map_type[self._get_tag_type(tag)] if len(args) == 1: fetch_fname = "fetch_" + ALLOWED_IO_TYPES[data_type] fargs = (tag, ) if len(args) == 5: loc = array2Point(args[1], self.config, self.raw_point) time = args[2] spatial_sampler = args[3] chrono_sampler = args[4] fetch_fname, ss, cs = self._get_fetch_5args( "fetch", tag, data_type, spatial_sampler, chrono_sampler) barrier_enabled = True if type(time).__name__ == 'float': barrier_time = mui4py_mod.numeric_limits_real elif type(time).__name__ == 'int': barrier_time = mui4py_mod.numeric_limits_int else: raise Exception("Unrecognized time type '{}'.".format( type(time).__name__)) fargs = (tag, loc, time, ss.raw, cs.raw, barrier_enabled, barrier_time) fetch = getattr(self.raw, fetch_fname) return safe_cast(self._get_tag_type(tag), fetch(*fargs))
def fetch(self, *args, **kwargs): tag = args[0] data_type = map_type[self._get_tag_type(tag)] if len(args) == 1: fetch_fname = "fetch_" + ALLOWED_IO_TYPES[data_type] fargs = (tag, ) if len(args) == 5: loc = array2Point(args[1], self.config, self.raw_point) time = args[2] spatial_sampler = args[3] chrono_sampler = args[4] fetch_fname, ss, cs = self._get_fetch_5args("fetch", tag, data_type, spatial_sampler, chrono_sampler) fargs = (tag, loc, time, ss.raw, cs.raw) fetch = getattr(self.raw, fetch_fname) return safe_cast(self._get_tag_type(tag), fetch(*fargs))
def Point(self, points): return array2Point(points, self.config, self.raw_point)