예제 #1
0
파일: Source.py 프로젝트: suhaasa/ClearMap2
 def __init__(self, source = None, shape = None, dtype = None, order = None, location = None, name = None):
   """Source class construtor.
   
   Arguments
   ---------
   shape : tuple of int or None
     Shape of the source, if None try to determine from source.
   dtype : dtype or None
     The data type of the source, if None try to detemrine from source.
   order : 'C' or 'F' or None
     The order of the source, c or fortran contiguous.
   memory : str or None
     The memory type of the source, 'memmap' uses memory mapped array and 'shared'returns a shared memory.
   location : str or None
     The location of the source.
   """
   super(AbstractSource, self).__init__(name = name);
   
   if source is not None:      
     if shape is None and hasattr(source, 'shape'):
       shape = source.shape;
     if dtype is None and hasattr(source, 'dtype'):
       dtype = source.dtype;
     if order is None and hasattr(source, 'order'):
       order = source.order;
     #if memory is None and hasattr(source, 'memory'):
     #  memory = memory.order; 
     if location is None and hasattr(source, 'location'):
       location = source.location;
       
   self._shape    = ensure(shape,    tuple);
   self._dtype    = ensure(dtype,    np.dtype);
   self._order    = ensure(order,    str);
   #self._memory   = ensure(memory,   str);
   self._location = ensure(location, str);
예제 #2
0
파일: Source.py 프로젝트: suhaasa/ClearMap2
 def name(self, value):
   self._name = ensure(value, str);
예제 #3
0
파일: Source.py 프로젝트: suhaasa/ClearMap2
 def location(self, value):
   self._location = ensure(value, str);
예제 #4
0
파일: Source.py 프로젝트: suhaasa/ClearMap2
 def order(self, value):
   if value not in [None, 'C', 'F']:
       raise ValueError("Order %r not in [None, 'C' or 'F']!" % value);
   self._order = ensure(value, str);
예제 #5
0
파일: Source.py 프로젝트: suhaasa/ClearMap2
 def dtype(self, value):
   self._dtype = ensure(value, np.dtype);
예제 #6
0
파일: Source.py 프로젝트: suhaasa/ClearMap2
 def shape(self, value):
   self._shape = ensure(value, tuple);