def getMolecule(self, molecule):
     if(molecule<self.molecules):
         if (type(self.localizations) == type(numpy.array([]))):
             return self.localizations[molecule:molecule+1]
         else:
             cur = self.fp.tell()
             self.fp.seek(16 + molecule*self.record_size)
             data = numpy.fromfile(self.fp,
                                   dtype=i3dtype.i3DataType(),
                                   count=1)
             self.fp.seek(cur)
             return data
Пример #2
0
 def getMolecule(self, molecule):
     if(molecule<self.molecules):
         if (type(self.localizations) == type(numpy.array([]))):
             return self.localizations[molecule:molecule+1]
         else:
             cur = self.fp.tell()
             self.fp.seek(16 + molecule*self.record_size)
             data = numpy.fromfile(self.fp,
                                   dtype=i3dtype.i3DataType(),
                                   count=1)
             self.fp.seek(cur)
             return data
 def getMoleculesInFrameRange(self, start, stop, good_only = True):
     start_mol_num = self.findFrame(start)
     stop_mol_num = self.findFrame(stop)
     if (type(self.localizations) == type(numpy.array([]))):
         data = self.localizations[start_mol_num:stop_mol_num]
     else:
         cur = self.fp.tell()
         self.fp.seek(16 + start_mol_num*self.record_size)
         size = stop_mol_num - start_mol_num
         data = numpy.fromfile(self.fp,
                               dtype=i3dtype.i3DataType(),
                               count=size)
         self.fp.seek(cur)  
     if good_only:
         return i3dtype.maskData(data, (data['c'] != 9))
     else:
         return data
Пример #4
0
 def getMoleculesInFrameRange(self, start, stop, good_only = True):
     start_mol_num = self.findFrame(start)
     stop_mol_num = self.findFrame(stop)
     if (type(self.localizations) == type(numpy.array([]))):
         data = self.localizations[start_mol_num:stop_mol_num]
     else:
         cur = self.fp.tell()
         self.fp.seek(16 + start_mol_num*self.record_size)
         size = stop_mol_num - start_mol_num
         data = numpy.fromfile(self.fp,
                               dtype=i3dtype.i3DataType(),
                               count=size)
         self.fp.seek(cur)  
     if good_only:
         return i3dtype.maskData(data, (data['c'] != 9))
     else:
         return data
def loadI3FileNumpy(filename, verbose = 1):
    fp = open(filename, "rb")

    # Read header
    [frames, molecules, version, status] = readHeader(fp, verbose)

    data = numpy.fromfile(fp, dtype=i3dtype.i3DataType())

    # If the analysis crashed, the molecule list may still 
    # be valid, but the molecule number will be incorrect.
    if(molecules==0):
        print("File appears empty, trying to load anyway.")
        try:
            molecules = numpy.max(data['fr'])
        except:
            molecules = 0
    data = data[:][0:molecules]
    fp.close()
    return data
Пример #6
0
def loadI3FileNumpy(filename, verbose = 1):
    fp = open(filename, "rb")

    # Read header
    [frames, molecules, version, status] = readHeader(fp, verbose)

    data = numpy.fromfile(fp, dtype=i3dtype.i3DataType())

    # If the analysis crashed, the molecule list may still 
    # be valid, but the molecule number will be incorrect.
    if(molecules==0):
        print "File appears empty, trying to load anyway."
        try:
            molecules = numpy.max(data['fr'])
        except:
            molecules = 0
    data = data[:][0:molecules]
    fp.close()
    return data
Пример #7
0
    def nextBlock(self, block_size=400000, good_only=True):

        # check if we have read all the molecules.
        if (self.cur_molecule >= self.molecules):
            return False

        size = block_size

        # adjust size if we'll read past the end of the file.
        if ((self.cur_molecule + size) > self.molecules):
            size = self.molecules - self.cur_molecule

        self.cur_molecule += size

        # read the data
        data = numpy.fromfile(self.fp, dtype=i3dtype.i3DataType(), count=size)

        if good_only:
            return i3dtype.maskData(data, (data['c'] != 9))
        else:
            return data
Пример #8
0
    def nextBlock(self, block_size = 400000, good_only = True):

        # check if we have read all the molecules.
        if(self.cur_molecule>=self.molecules):
            return False

        size = block_size
        
        # adjust size if we'll read past the end of the file.
        if((self.cur_molecule+size)>self.molecules):
            size = self.molecules - self.cur_molecule

        self.cur_molecule += size

        # read the data
        data = numpy.fromfile(self.fp,
                              dtype=i3dtype.i3DataType(),
                              count=size)

        if good_only:
            return i3dtype.maskData(data, (data['c'] != 9))
        else:
            return data