def start_sacla(): print 'Starting SACLA' name = inspect.stack()[0][3] lg.info('%s Starting SACLA' % name) start_time = time.ctime() chip_name, sub_dir, n_exposures, chip_type, map_type = scrape_parameter_file( location='SACLA') #### Hack for sacla3 to bismuth chip type for oxford inner if str(chip_type) == '3': lg.debug('%s\t:Hack for SACLA3 bismuth for oxford inner' % name) chip_type = '1' if map_type == '0': chip_format = get_format(chip_type)[:4] total_numb_imgs = np.prod(chip_format) if str(chip_type) == '6': xs = int(caget(pv.me14e_gp6)) ys = int(caget(pv.me14e_gp7)) print xs, ys, type(xs), type(ys) total_numb_imgs = xs * ys caput(pv.me14e_gp10, total_numb_imgs) caput(pv.me14e_pmac_str, 'P2402=0') print 'Total number of images', total_numb_imgs elif map_type == '1' or map_type == '3': chip_format = get_format(chip_type)[2:4] block_count = 0 f = open( '/localhome/local/Documents/sacla/parameter_files/currentchip.map', 'r') for line in f.readlines(): entry = line.split() if entry[2] == '1': block_count += 1 f.close() print 'block_count', block_count lg.info('%s\t:block_count=%s' % (name, block_count)) print chip_format lg.info('%s\t:chip_format=%s' % (name, chip_format)) #################### n_exposures = caget(pv.me14e_gp3) print n_exposures lg.info('%s\t:n_exposures=%s' % (name, n_exposures)) #################### total_numb_imgs = np.prod(chip_format) * block_count # * n_exposures caput(pv.me14e_gp10, total_numb_imgs) caput(pv.me14e_pmac_str, 'P2402=0') print 'Total number of images', total_numb_imgs elif map_type == '2': lg.warning('%s Not Set Up For Full Mapping' % name) print 'FIX ME, Im not set up for full mapping ' else: lg.warning('%s Unknown Map Type, map_type = %s' % (name, map_type)) print 'Unknown map type' ###make sure flipper is out moveto('flipperout') sleep(1) moveto('lightout') sleep(3) return start_time
def start_i24(): print 'Starting i24' start_time = time.ctime() run_num = caget(pv.pilat_filenumber) print 80 * '-', run_num chip_name, visit, sub_dir, n_exposures, chip_type, map_type, exptime, \ dcdetdist = scrape_parameter_file(location='i24') sup.beamline('collect') print 'hello', dcdetdist, type(dcdetdist) sup.beamline('quickshot', [dcdetdist]) if map_type == '0': chip_format = get_format(chip_type)[:4] total_numb_imgs = np.prod(chip_format) elif map_type == '1': chip_format = get_format(chip_type)[2:4] block_count = 0 f = open('/dls_sw/i24/scripts/fastchips/litemaps/currentchip.map', 'r') for line in f.readlines(): entry = line.split() if entry[2] == '1': block_count += 1 f.close() print 'block_count', block_count print chip_format #################### n_exposures = caget(pv.me14e_gp3) print n_exposures #################### #total_numb_imgs = np.prod(chip_format) * block_count total_numb_imgs = np.prod(chip_format) * block_count * n_exposures print 'Total number of images', total_numb_imgs elif map_type == '2': print 'FIX ME, Im not set up for full mapping ' else: print 'Unknown map type' print 'total_numb_imgs', total_numb_imgs, '\n\n\n' filepath = visit + sub_dir filename = chip_name #print 'AAAAAAAAAAAAAAAAAAAAA', filepath, filename sup.pilatus('fastchip', [filepath, filename, total_numb_imgs, exptime]) #sup.pilatus('fastchip-hatrx', [filepath, filename, total_numb_imgs, exptime]) sup.zebra1('fastchip') print 'Acquire Region' caput(pv.pilat_acquire, '1') # Arm pilatus caput(pv.zebra1_pc_arm_out, '1') # Arm zebra caput(pv.zebra1_soft_in_b1, '1') # Open fast shutter (zebra gate) caput(pv.pilat_filename, filename) time.sleep(1.5) return start_time
def start_sacla(): print 'Starting SACLA' start_time = time.ctime() chip_name, sub_dir, n_exposures, chip_type, map_type = scrape_parameter_file( location='SACLA') #### Hack for sacla3 to bismuth chip type for oxford inner if str(chip_type) == '3': chip_type = '1' if map_type == '0': chip_format = get_format(chip_type)[:4] total_numb_imgs = np.prod(chip_format) elif map_type == '1': chip_format = get_format(chip_type)[2:4] block_count = 0 f = open( '/localhome/local/Documents/sacla/parameter_files/currentchip.map', 'r') for line in f.readlines(): entry = line.split() if entry[2] == '1': block_count += 1 f.close() print 'block_count', block_count print chip_format #################### n_exposures = caget(pv.me14e_gp3) print n_exposures #################### #total_numb_imgs = np.prod(chip_format) * block_count * n_exposures #print 'Total number of images', total_numb_imgs elif map_type == '2': print 'FIX ME, Im not set up for full mapping ' else: print 'Unknown map type' return start_time
def get_chip_prog_values(chip_type, location, exptime=16, n_exposures=1): name = inspect.stack()[0][3] lg.info('%s' % name) #### Hack for sacla3 to bismuth chip type for oxford inner if chip_type == '3': lg.debug('%s\t:Hack for SACLA3 bismuth for oxford inner' % name) chip_type = '1' if chip_type in ['0', '1', '2', '5', '7', '8']: xblocks, yblocks, x_num_steps, y_num_steps, w2w, b2b_horz, b2b_vert = get_format( chip_type) x_step_size = w2w y_step_size = w2w x_block_size = ((x_num_steps - 1) * w2w) + b2b_horz y_block_size = ((y_num_steps - 1) * w2w) + b2b_vert """ print 'rrrrrrrrrrrrrrrrrrrrrrrrrrrrr' print x_num_steps print y_num_steps print xblocks print yblocks print w2w print b2b_horz print b2b_vert print x_block_size print y_block_size print 'rrrrrrrrrrrrrrrrrrrrrrrrrrrrr' '0' = 'Toronto' = [9, 9, 12, 12, 0.125, 2.2 , 2.5 ] '1' = 'Oxford ' = [8, 8, 20, 20, 0.125, 3.175, 3.175] '2' = 'Hamburg' = [3, 3, 53, 53, 0.150, 8.58 , 8.58 ] '5' = 'Regina ' = [7, 7, 20, 20, 0.125, 3.7 , 3.7 ] """ if chip_type == '2': if caget(pv.me14e_gp2) == 2: print 'Full Mapping on Hamburg -> xblocks = 6' lg.info('%s Full Mapping on Hamburg -> xblocks = 6' % name) xblocks = 6 else: xblocks = 3 elif chip_type == '4': print 'This is a Bismuth Chip' lg.info('%s This is a Bismuth Chip' % name) x_num_steps = caget(pv.me14e_gp6) y_num_steps = caget(pv.me14e_gp7) x_step_size = caget(pv.me14e_gp8) y_step_size = x_step_size xblocks = 7 yblocks = 7 x_block_size = 15 #placeholder y_block_size = 15 #placeholder elif chip_type == '6': print 'This is a Custom Chip' lg.info('%s This is a Custom Chip' % name) x_num_steps = caget(pv.me14e_gp6) y_num_steps = caget(pv.me14e_gp7) x_step_size = caget(pv.me14e_gp8) y_step_size = x_step_size xblocks = 1 yblocks = 1 x_block_size = 0 #placeholder y_block_size = 0 #placeholder else: print 'Unknown chip_type' lg.warning('%s Unknown chip_type, chip_type = %s' % (name, chip_type)) chip_dict = \ {'X_NUM_STEPS': [11, x_num_steps], 'Y_NUM_STEPS': [12, y_num_steps], 'X_STEP_SIZE': [13, x_step_size], 'Y_STEP_SIZE': [14, y_step_size], 'DWELL_TIME': [15, exptime], #SACLA 15ms + 1ms 'X_START': [16, 0], 'Y_START': [17, 0], 'Z_START': [18, 0], 'X_NUM_BLOCKS': [20, xblocks], 'Y_NUM_BLOCKS': [21, yblocks], 'X_BLOCK_SIZE': [24, x_block_size], 'Y_BLOCK_SIZE': [25, y_block_size], 'COLTYPE': [26, 41], 'N_EXPOSURES': [30, n_exposures]} if location == 'i24': chip_dict['DWELL_TIME'][1] = 1000 * float(exptime) return chip_dict
def start_i24(): print 'Starting i24' name = inspect.stack()[0][3] lg.info('%s Starting i24' % name) start_time = time.ctime() run_num = caget(pv.pilat_filenumber) print 80 * '-', run_num lg.info('%s run_num = %s' % (name, run_num)) chip_name, visit, sub_dir, n_exposures, chip_type, map_type, exptime, \ dcdetdist = scrape_parameter_file(location='i24') sup.beamline('collect') print 'hello', dcdetdist, type(dcdetdist) #lg.info('%s dcdetdist, %s, of type %s = %s'%(name,dcdetdist, type(dcdetdist))) lg.info('%s Launching quickshot' % (name)) sup.beamline('quickshot', [dcdetdist]) if map_type == '0': chip_format = get_format(chip_type)[:4] if chip_type == '6': # Chip Type 6 is Custom print 'Calculating total number of images' total_numb_imgs = int(caget(pv.me14e_gp6) * caget(pv.me14e_gp7)) lg.info('%s !!!!!! Calculating total number of images %s' % (name, total_numb_imgs)) print total_numb_imgs else: total_numb_imgs = np.prod(chip_format) elif map_type == '1': chip_format = get_format(chip_type)[2:4] block_count = 0 f = open('/dls_sw/i24/scripts/fastchips/litemaps/currentchip.map', 'r') for line in f.readlines(): entry = line.split() if entry[2] == '1': block_count += 1 f.close() print 'block_count', block_count print chip_format lg.info('%s\t:block_count=%s' % (name, block_count)) lg.info('%s\t:chip_format=%s' % (name, chip_format)) #################### n_exposures = caget(pv.me14e_gp3) print n_exposures lg.info('%s\t:n_exposures=%s' % (name, n_exposures)) #################### #total_numb_imgs = np.prod(chip_format) * block_count total_numb_imgs = np.prod(chip_format) * block_count * n_exposures print 'Total number of images', total_numb_imgs lg.info('%s\t:Total number of images = %s' % (name, total_numb_imgs)) elif map_type == '2': lg.warning('%s\t:Not Set Up For FUll Mapping=%s' % (name)) print 'FIX ME, Im not set up for full mapping ' else: lg.warning('%s Unknown Map Type, map_type = %s' % (name, map_type)) print 'Unknown map type' print 'total_numb_imgs', total_numb_imgs, '\n\n\n' lg.info('%s\t:----->Total number of images = %s' % (name, total_numb_imgs)) filepath = visit + sub_dir filename = chip_name #print 'AAAAAAAAAAAAAAAAAAAAA', filepath, filename sup.pilatus('fastchip', [filepath, filename, total_numb_imgs, exptime]) #sup.pilatus('fastchip-hatrx', [filepath, filename, total_numb_imgs, exptime]) sup.zebra1('fastchip') print 'Acquire Region' lg.info('%s\t:Acquire Region' % (name)) caput(pv.pilat_acquire, '1') # Arm pilatus caput(pv.zebra1_pc_arm_out, '1') # Arm zebra caput(pv.zebra1_soft_in_b1, '1') # Open fast shutter (zebra gate) caput(pv.pilat_filename, filename) time.sleep(1.5) return start_time
# Prep for SACLA3 # ############################################## def flush_print(text): sys.stdout.write(str(text)) sys.stdout.flush() def get_chip_prog_values(chip_type, location, exptime=16, n_exposures=1): name = inspect.stack()[0][3] lg.info('%s' %name) #### Hack for sacla3 to bismuth chip type for oxford inner if chip_type =='3': lg.debug('%s\t:Hack for SACLA3 bismuth for oxford inner'%name) chip_type = '1' if chip_type in ['0','1','2','5']: xblocks, yblocks, x_num_steps, y_num_steps, w2w, b2b_horz, b2b_vert = get_format(chip_type) x_step_size = w2w y_step_size = w2w x_block_size = ((x_num_steps - 1) * w2w) + b2b_horz y_block_size = ((y_num_steps - 1) * w2w) + b2b_vert """ print 'rrrrrrrrrrrrrrrrrrrrrrrrrrrrr' print x_num_steps print y_num_steps print xblocks print yblocks print w2w print b2b_horz print b2b_vert print x_block_size