Exemple #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
Exemple #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"
Exemple #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)
Exemple #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)
Exemple #5
0
 def toStr(pkt):
     src, dest, typ, data = pkt
     data = np.tostring(data)
     return (src, dest, typ, data)
Exemple #6
0
def pack_mat(v, dims):
    return np.tostring(v)
Exemple #7
0
def pack_vec(v):
    return np.tostring(v)
 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 )
Exemple #10
0
def pack_mat(v, dims):
    return np.tostring(v)
Exemple #11
0
def pack_vec(v):
    return np.tostring(v)
Exemple #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")
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)
 def tostring(self, axis=None):
     return np.tostring(self)