Esempio n. 1
0
    def addMC(MC):
        '''
		INPUT:
			MC :: NPArray<NPArray<Float>>
		'''
        theStr = np.tostring(MC)
        if theStr in self.MCdict:
            self.MCdict[theStr] += 1
        else:
            self.MCdict[theStr] = 1
Esempio n. 2
0
    def delMC_all(MC):
        '''
		INPUT:
			MC :: NPArray<NPArray<Float>>
		'''
        theStr = np.tostring(MC)
        if theStr in self.MCdict:
            del self.MCdict[theStr]
        else:
            print "\nError! ~~ delMC_once() ~~ Your input MC is not in the class dictionary!\n"
Esempio n. 3
0
def np2image(np, path):
    "Save an image array to a file."
    if len(np.shape) > 2:
        if np.shape[2] == 3:
            mode = 'RGB'
        elif np.shape[2] == 2:
            mode = 'LA'
    else:
        mode = 'L'
    im = Image.frombytes(mode, (np.shape[1], np.shape[0]), np.tostring())
    im.save(path)
Esempio n. 4
0
def np2image(np, path):
    "Save an image array to a file."
    if len(np.shape) > 2:
        if np.shape[2] == 3:
            mode = 'RGB'
        elif np.shape[2] == 2:
            mode = 'LA'
    else:
        mode = 'L'
    im = Image.fromstring(
        mode, (np.shape[1], np.shape[0]), np.tostring())
    im.save(path)
Esempio n. 5
0
 def toStr(pkt):
     src, dest, typ, data = pkt
     data = np.tostring(data)
     return (src, dest, typ, data)
Esempio n. 6
0
def pack_mat(v, dims):
    return np.tostring(v)
Esempio n. 7
0
def pack_vec(v):
    return np.tostring(v)
Esempio n. 8
0
 def toStr(pkt):
     src, dest, typ, data = pkt
     data = np.tostring(data)
     return (src, dest, typ, data)
def toString( array ):
    from numpy import tostring
    array.shape = -1,
    return tostring( array )
Esempio n. 10
0
def pack_mat(v, dims):
    return np.tostring(v)
Esempio n. 11
0
def pack_vec(v):
    return np.tostring(v)
Esempio n. 12
0
def read_pol(snap, pol):
    bram_data = snap.sbrams[pol].read_raw()
    return numpy.array(numpy.tostring(bram_data, dtype=">Q"), dtype="uint64")
Esempio n. 13
0
def np2image(np, path):
    "Save an image array to a file."
    im = Image.fromstring(
        'RGB', (np.shape[1], np.shape[0]), np.tostring())
    im.save(path)
Esempio n. 14
0
 def tostring(self, axis=None):
     return np.tostring(self)