Exemplo n.º 1
0
    def read_chunk(self):
        ''' read a chunk of data '''
        if not self.file_open:
            counted_file_parser.open_counted_file(self.filename)
            counted_file_parser.read_metadata()
            self.file_open = True

        # read the chunk
        triplet_count = counted_file_parser.read_chunk()

        # send all the rates to the curves
        for curve in self.curves:
            rate = 0
            pattern = curve.pattern
            if pattern[1] == 1:
                rate = counted_file_parser.get_fpga_rate(pattern[0])
            if pattern[1] == 2:
                rate = counted_file_parser.get_number_rate(*pattern[0])
            if pattern[1] == 3:
                rate = counted_file_parser.get_special_rate(len(pattern[0]))
            position = counted_file_parser.get_motor_controller_position(
                self.scan_motor_controller)
            step = counted_file_parser.get_scan_step()
            loop = counted_file_parser.get_scan_loop()
            curve.add_rate(step, loop, position, rate)

        return triplet_count
Exemplo n.º 2
0
	def read_chunk(self):
		''' read a chunk of data '''
		if not self.file_open: 
			counted_file_parser.open_counted_file(self.filename)
			counted_file_parser.read_metadata()
			self.file_open=True
			
		# read the chunk
		triplet_count=counted_file_parser.read_chunk()

		# if this chunk was aborted, return nothing
		if counted_file_parser.get_aborted(): return 0
		
		# get the step and loop
		step=counted_file_parser.get_scan_step()
		loop=counted_file_parser.get_scan_loop()
		self.max_step=max(step+1, self.max_step)
		self.max_loop=max(loop+1, self.max_loop)
		self.all_triplets+=triplet_count
		self.progress=self.all_triplets*3*4/float(self.filesize)
		
		# append all the rates to the curves
		for curve in self.curves:
			rate=0
			pattern=curve.pattern
			if pattern[1]==1: 
				rate=counted_file_parser.get_fpga_rate(pattern[0])
			elif pattern[1]==2: 
				if len(pattern[0])==2: rate=counted_file_parser.get_number_rate_8x2(*pattern[0])
				if len(pattern[0])==4: rate=counted_file_parser.get_number_rate_4x4(*pattern[0])
			elif pattern[1]==3: 
				rate=counted_file_parser.get_special_rate(len(pattern[0]))
			curve.add_rate(step, loop, rate)
			
		# and the position handler
		for i in range(qy.settings.get('motors.count')):
			position=counted_file_parser.get_motor_controller_position(i)
			self.positions[i].add_position(step, loop, position)
		return triplet_count
Exemplo n.º 3
0
	def read_chunk(self):
		''' read a chunk of data '''
		if not self.file_open: 
			counted_file_parser.open_counted_file(self.filename)
			counted_file_parser.read_metadata()
			self.file_open=True
			
		# read the chunk
		triplet_count=counted_file_parser.read_chunk()
				
		# send all the rates to the curves
		for curve in self.curves:
			rate=0
			pattern=curve.pattern
			if pattern[1]==1: rate=counted_file_parser.get_fpga_rate(pattern[0])
			if pattern[1]==2: rate=counted_file_parser.get_number_rate(*pattern[0])
			if pattern[1]==3: rate=counted_file_parser.get_special_rate(len(pattern[0]))
			position=counted_file_parser.get_motor_controller_position(self.scan_motor_controller)
			step=counted_file_parser.get_scan_step()
			loop=counted_file_parser.get_scan_loop()
			curve.add_rate(step, loop, position, rate)
		
		return triplet_count