Example #1
0
    def findEvents(self, records, sampleIndex):

        #match records to existing tracks
        for track in self.__tracking:
            for rec in records:
                if (track.matchPoint(sampleIndex, rec)):
                    track.addPoint(sampleIndex, rec["s"])
                    records.remove(rec)

        #create new tracking for unused recs
        for rec in records:
            track = Track(sampleIndex, rec["d"])
            track.addPoint(sampleIndex, rec["s"])
            self.__tracking.append(track)
            if self.trackDebugCallback != None:
                self.trackDebugCallback(track, True)

        #end old tracks
        for track in self.__tracking:
            if track.isOld(sampleIndex):
                if track.isSignificant():
                    self.trackCallback(track)
                elif self.trackDebugCallback != None:
                    self.trackDebugCallback(track, False)
                self.__tracking.remove(track)
Example #2
0
        if dataTrack.mode == 'r':

            lines = dataTrack.readlines()

            for lin in lines:

                spl = lin.split()

                # First entry requires initialisation of track using track class definition from file
                if count == 1:
                    track = Track((float(spl[0]), float(spl[1]), float(spl[2])), float(spl[3]), float(spl[4]), trackID, trackStart)
                    # Tracks are all already completed, so add straight to completeTracks array
                    completeTracks.append(track)
                # All other entries can append existing track
                else:
                    track.addPoint((float(spl[0]), float(spl[1]), float(spl[2])), float(spl[3]), float(spl[4]), int(spl[5]))

                count += 1

        dataTrack.close()


    # DEBUG: Read in number of 1 frame detections for analysis
    # dataSingleFrame = open("%sN1Frame.txt" % fileTrackDataOut, "r")
    # line = dataSingleFrame.readlines()
    # spl = line[0].split()
    # N1Frame = int(spl[0])



# Plot single particle track of interest with image background: