def _import_module(dtype): # Make sure the proper block module is loaded, too _import_block_module(dtype) mod = None if dtype == numpy.float32: _temp = __import__('vsip.signal', globals(), locals(), ['_window_f'], -1) mod = _temp._window_f elif dtype in (float, numpy.float64): _temp = __import__('vsip.signal', globals(), locals(), ['_window_d'], -1) mod = _temp._window_d if not mod: raise ValueError, 'Unsupported dtype %s'%(dtype) return mod
def _import_module(dtype): # Make sure the proper block module is loaded, too _import_block_module(dtype) mod = None if dtype == numpy.float32: _temp = __import__('vsip.signal', globals(), locals(), ['_window_f'], -1) mod = _temp._window_f elif dtype in (float, numpy.float64): _temp = __import__('vsip.signal', globals(), locals(), ['_window_d'], -1) mod = _temp._window_d if not mod: raise ValueError, 'Unsupported dtype %s' % (dtype) return mod
def cast(dtype, v): mod = _import_block_module(dtype) return v.__class__(block=as_type(v.block, dtype))