Exemple #1
0
def load_motion_program_data(motion_program_dict, map_type):
    print 'Loading prog vars for chip'
    name = inspect.stack()[0][3]
    lg.info('%s loading program variables for chip' % name)
    if map_type == '0':
        prefix = 11
    elif map_type == '1':
        prefix = 12
    elif map_type == '2':
        prefix = 13
    elif map_type == '3':
        prefix = 14
    else:
        lg.warning('%s Unknown Map Type, map_type = %s' % (name, map_type))
        print 'Unknown map_type'

    for key in sorted(motion_program_dict.keys()):
        v = motion_program_dict[key]
        pvar_base = prefix * 100
        pvar = pvar_base + v[0]
        value = str(v[1])
        s = 'P' + str(pvar) + '=' + str(value)
        print key, '\t', s
        lg.info('%s %s \t %s' % (name, key, s))
        caput(pv.me14e_pmac_str, s)
        sleep(0.02)
    sleep(0.2)
    print 'done'
    lg.info('%s done' % name)
Exemple #2
0
def definechipgeometry():
    chipname, visit_id, proteinname, num_of_shots, chip_type, map_type, path_key = scrape_dcparameters(
    )
    print 'confirming chip type'
    chip_type2 = str(caget(pv.me14e_gp1))
    if chip_type2 != chip_type:
        print 'You havent set the parameters'
        return 0
    path = '/localhome/local/Documents/sacla/parameter_files/'
    if chip_type == '0':
        chipid = 'toronto'
    elif chip_type == '1':
        chipid = 'oxford'
    elif chip_type == '2':
        chipid = 'hamburg'
    elif chip_type == '3':
        chipid = 'test'
    print path + chipid + '.chip'
    f = open(path + chipid + '.chip', 'r')
    print 'reading', path + chipid + '.chip'
    print 'writing to pmac'
    for line in f:
        cols = line.split()
        pvar = cols[1]
        value = cols[2]
        s = str(pvar) + '=' + str(value)
        print 'set P-variable', s
        caput(pv.me14e_pmac_str, s)
        sleep(0.02)
    print path + chipid + '.chip'
    print 'done'
Exemple #3
0
def main(path_key):
    print 'Starting'
    starttime = time.ctime()
    caput(pv.me14e_pmac_str, '!x0y0z0')

    path_dict = make_path_dict()
    xstart, ystart, xblocks, yblocks, path = path_dict(path_key)

    chipname, visit_id, filepath, chipcapacity, blockcapacity = scrape_dcparameters()
    print '\n\nChip name is', chipname
    print 'visit_id', visit_id
    print 'filepath', filepath
    print 'chipcapacity', chipcapacity
    print 'blockcapacity', blockcapacity
    chip_prog_dict = get_chip_prog_values()
    load_motion_program_data(chip_prog_dict)
    caput(pv.me14e_pmac_str, '&2b11r')

    endtime = time.ctime()
    print 3*'\n'
    print 'Summary'
    print 'Chip name:', chipname
    print 'Filepath:', filepath
    print 'Number of images collected:', chipcapacity
    print 'Start time:', starttime
    print 'End time:', endtime
    print 3*'\n'
def cs_maker():
    fiducial_dict = {}
    fiducial_dict['f1'] = {}
    fiducial_dict['f2'] = {}

    fiducial_dict['f1']['x'] = 18.975 
    fiducial_dict['f1']['y'] = 0 
    fiducial_dict['f1']['z'] = 0 

    fiducial_dict['f2']['x'] = 0 
    fiducial_dict['f2']['y'] = 21.375
    fiducial_dict['f2']['z'] = 0 
    
    #1mm / counts per nanometer (give cts/mm)
    scale = 10000
    #d1, d2 = fiducial_positions
    f1 = open('/localhome/local/Documents/sacla/parameter_files/fiducial_1.txt','r')    
    f1_lines = f1.readlines()
    f1_lines_x = f1_lines[0].rstrip('/n') 
    f1_lines_y = f1_lines[1].rstrip('/n') 
    f1_lines_z = f1_lines[2].rstrip('/n') 
    f1_x = float(f1_lines_x)
    f1_y = float(f1_lines_y)
    f1_z = float(f1_lines_z)

    f2 = open('/localhome/local/Documents/sacla/parameter_files/fiducial_2.txt','r')    
    f2_lines = f2.readlines()
    f2_lines_x = f2_lines[0].rstrip('/n') 
    f2_lines_y = f2_lines[1].rstrip('/n') 
    f2_lines_z = f2_lines[2].rstrip('/n') 
    f2_x = float(f2_lines_x)
    f2_y = float(f2_lines_y)
    f2_z = float(f2_lines_z)
    #Evaluate numbers
    x1factor = (f1_x / fiducial_dict['f1']['x']) *scale
    y1factor = (f1_y / f1_x)                     *scale
    z1factor = (f1_z / f1_x)                     *scale
    x2factor = (f2_x / f2_y)                     *scale
    y2factor = (f2_y / fiducial_dict['f2']['y']) *scale
    z2factor = (f2_z / f2_y)                     *scale
    z3factor = scale

    cs1 = "#1->%+1.5fX%+1.5fY%+1.5fZ" % (-1*x1factor, y1factor, z1factor)
    cs2 = "#2->%+1.5fX%+1.5fY%+1.5fZ" % (x2factor, y2factor, z2factor)
    cs3 = "#3->0X+0Y%+fZ"    % (z3factor)
    print cs1
    print cs2
    print cs3
    caput(pv.me14e_pmac_str, '!x0y0z0')
    sleep(1)
    caput(pv.me14e_pmac_str, '&2')
    sleep(1)
    caput(pv.me14e_pmac_str, cs1)
    sleep(1)
    caput(pv.me14e_pmac_str, cs2)
    sleep(1)
    caput(pv.me14e_pmac_str, cs3)
    sleep(1)
    print 'done'
Exemple #5
0
def clear_lite_map():
    print 'Please wait, clearing map'
    for i in range(1, 82):
        pvar = 'ME14E-MO-IOC-01:GP' + str(i + 10)
        caput(pvar, 0)
        sleep(0.02)
    print 'map cleared'
    return 1
Exemple #6
0
def main():
    block_start_list = scrape_pvar_file('oxford_darren.BAK')
    for entry in block_start_list:
        block, x, y = entry
        print block, x, y
        caput(pv.me14e_pmac_str, '!x%sy%s' % (x, y))
        time.sleep(0.4)
    print 10 * 'Done '
Exemple #7
0
def finish_sacla():
    print 'Finishing SACLA'
    name = inspect.stack()[0][3]
    lg.info('%s Finishing SACLA' % name)
    caput(pv.me14e_pmac_str, '!x0y0z0')
    lg.info('%s pmac_str=!x0y0z0' % name)
    end_time = time.ctime()
    return end_time
Exemple #8
0
def fill_lite_map():
    print 'Please wait, filling map'
    for i in range(1, 82):
        pvar = 'ME14E-MO-IOC-01:GP' + str(i + 10)
        caput(pvar, 1)
        sleep(0.02)
    print 'map filled'
    return 1
def main():
    dir = '/dls_sw/work/R3.14.12.3/ioc/ME14E/ME14E-MO-IOC-01/ME14E-MO-IOC-01App/scripts/'
    block_start_list = scrape_pvar_file(dir + 'sacla3_oxford.pvar')
    for entry in block_start_list:
        block, x, y = entry
        print block, x, y
        caput(pv.me14e_pmac_str, '!x%sy%s' % (x, y))
        time.sleep(0.4)
    print 10 * 'Done '
Exemple #10
0
def load_motion_program_data(motion_program_dict):
    print 'Loading prog vars for chip'
    for k, v in motion_program_dict.items():
        pvar = 1100 + v[0]  
        value = str(v[1])
        s = 'P' + str(pvar) + '=' + str(value)
        caput(pv.me14e_pmac_str, s)
        sleep(0.02)
    print 'done'
Exemple #11
0
def load_stock_map(map_choice):
    name = inspect.stack()[0][3]
    lg.info('%s Adjusting Lite Map EDM Screen' %name)
    print 'Please wait, adjusting lite map'
    #
    r33 = [19,18,17,26,31,32,33,24,25]
    r55 = [9,10,11,12,13,16,27,30,41,40,39,38,37,34,23,20] + r33 
    r77 = [7,6,5,4,3,2,1,14,15,28,29,42,43,44,45,46,47,48,49,36,35,22,21,8] + r55
    #
    h33 = [3,2,1,6,7,8,9,4,5]
    x33 = [31,32,33,40,51,50,49,42,41]
    x55 = [25,24,23,22,21,34,39,52,57,58,59,60,61,48,43,30] + x33
    x77 = [11,12,13,14,15,16,17,20,35,38,53,56,71,70,69,68,67,66,65,62,47,44,29,26] + x55
    x99 = [9,8,7,6,5,4,3,2,1,18,19,36,37,54,55,72,73,74,75,76,77,78,79,80,81,64,63,46,45,28,27,10] + x77
    x44 = [22,21,20,19,30,35,46,45,44,43,38,27,28,29,36,37]
    x49 = [x+1 for x in range(49)]
    x66 = [10,11,12,13,14,15,18,31,34,47,50,51,52,53,54,55,42,39,26,23] + x44
    x88 = [8,7,6,5,4,3,2,1,16,17,32,33,48,49,64,63,62,61,60,59,58,57,56,41,40,25,24,9] + x66

    map_dict = {}
    map_dict['Just The First Block']= [1]
    map_dict['clear']= []
    #
    map_dict['r33'] = r33
    map_dict['r55'] = r55
    map_dict['r77'] = r77
    #
    map_dict['h33'] = h33
    #
    map_dict['x33'] = x33
    map_dict['x44'] = x44
    map_dict['x49'] = x49
    map_dict['x55'] = x55
    map_dict['x66'] = x66
    map_dict['x77'] = x77
    map_dict['x88'] = x88
    map_dict['x99'] = x99

    print 'Clearing'
    lg.info('%s Clearing GP 10-74' %name)
    for i in range(1, 65):
        pvar = 'ME14E-MO-IOC-01:GP' + str(i + 10)
        caput(pvar, 0)
	sys.stdout.write('.')
	sys.stdout.flush() 
    print '\nMap cleared'
    lg.info('%s Cleared Map' %name)
    print 'Loading map_choice', map_choice
    lg.info('%s Loading Map Choice %s' %(name, map_choice))
    for i in map_dict[map_choice]:
        pvar = 'ME14E-MO-IOC-01:GP' + str(i + 10)
        caput(pvar, 1)
    print 10*'Done '
Exemple #12
0
def uploadchipparameters():
    path = '/localhome/local/Documents/sacla/parameter_files/'
    f = open(path + 'currentchip.map', 'r')
    for line in f:
        cols = line.split()
        pvar = cols[1]
        value = cols[2]
        s = str(pvar) + '=' + str(value)
        print 'set P-variable', s
        caput(pv.me14e_pmac_str, s)
        sleep(0.02)
    print 'done'
def load_lite_map():
    load_stock_map('clear')
    toronto_block_dict = {\
            'A1':'01', 'A2':'02', 'A3':'03', 'A4':'04', 'A5':'05', 'A6':'06','A7':'07', 'A8':'08', 'A9':'09'
           ,'B1':'18', 'B2':'17', 'B3':'16', 'B4':'15', 'B5':'14', 'B6':'13','B7':'12', 'B8':'11', 'B9':'10'
           ,'C1':'19', 'C2':'20', 'C3':'21', 'C4':'22', 'C5':'23', 'C6':'24','C7':'25', 'C8':'26', 'C9':'27'
           ,'D1':'36', 'D2':'35', 'D3':'34', 'D4':'33', 'D5':'32', 'D6':'31','D7':'30', 'D8':'29', 'D9':'28'
           ,'E1':'37', 'E2':'38', 'E3':'39', 'E4':'40', 'E5':'41', 'E6':'42','E7':'43', 'E8':'44', 'E9':'45'
           ,'F1':'54', 'F2':'53', 'F3':'52', 'F4':'51', 'F5':'50', 'F6':'49','F7':'48', 'F8':'47', 'F9':'46'
           ,'G1':'55', 'G2':'56', 'G3':'57', 'G4':'58', 'G5':'59', 'G6':'60','G7':'61', 'G8':'62', 'G9':'63'
           ,'H1':'72', 'H2':'71', 'H3':'70', 'H4':'69', 'H5':'68', 'H6':'67','H7':'66', 'H8':'65', 'H9':'64'
           ,'I1':'73', 'I2':'74', 'I3':'75', 'I4':'76', 'I5':'77', 'I6':'78','I7':'79', 'I8':'80', 'I9':'81'}
    oxford_block_dict = {\
            'A1':'01', 'A2':'02', 'A3':'03', 'A4':'04', 'A5':'05', 'A6':'06','A7':'07', 'A8':'08'
           ,'B1':'16', 'B2':'15', 'B3':'14', 'B4':'13', 'B5':'12', 'B6':'11','B7':'10', 'B8':'09'
           ,'C1':'17', 'C2':'18', 'C3':'19', 'C4':'20', 'C5':'21', 'C6':'22','C7':'23', 'C8':'24'
           ,'D1':'32', 'D2':'31', 'D3':'30', 'D4':'29', 'D5':'28', 'D6':'27','D7':'26', 'D8':'25'
           ,'E1':'33', 'E2':'34', 'E3':'35', 'E4':'36', 'E5':'37', 'E6':'38','E7':'39', 'E8':'40'
           ,'F1':'48', 'F2':'47', 'F3':'46', 'F4':'45', 'F5':'44', 'F6':'43','F7':'42', 'F8':'41'
           ,'G1':'49', 'G2':'50', 'G3':'51', 'G4':'52', 'G5':'53', 'G6':'54','G7':'55', 'G8':'56'
           ,'H1':'64', 'H2':'63', 'H3':'62', 'H4':'61', 'H5':'60', 'H6':'59','H7':'58', 'H8':'57'}
    hamburg_block_dict = {\
            'A1':'01', 'A2':'02', 'A3':'03'
           ,'B1':'06', 'B2':'05', 'B3':'04'
           ,'C1':'07', 'C2':'08', 'C3':'09'}
    chip_type = caget(pv.me14e_gp1)
    if chip_type == 0:
        print 'Toronto Block Order'
        block_dict = toronto_block_dict
    elif chip_type == 1:
        print 'Oxford Block Order'
        block_dict = oxford_block_dict
    elif chip_type == 2:
        print 'Hamburg Block Order'
        block_dict = hamburg_block_dict

    path = '/localhome/local/Documents/sacla/litemaps/'
    lite_map_fid = caget(pv.me14e_gp5) + '.lite'
    print 'opening', path + lite_map_fid
    f = open(path + lite_map_fid, 'r')

    print 'please wait, loading LITE map'
    for line in f.readlines():
        entry = line.split()
        block_name = entry[0]
        yesno = entry[1]
        block_num = toronto_block_dict[block_name]
        pvar = 'ME14E-MO-IOC-01:GP' + str(int(block_num) + 10)
        print block_name, yesno, pvar
        caput(pvar, yesno)
    print 10 * 'Done '
def upload_full():
    path = '/localhome/local/Documents/sacla/fullmaps/'
    f = open(path + 'currentchip.full', 'r').readlines()

    for x in range(len(f) / 2):
        pmac_list = []
        for i in range(2):
            pmac_list.append(f.pop(0).rstrip('\n'))
        writeline = " ".join(pmac_list)
        print writeline
        caput(pv.me14e_pmac_str, writeline)
        sleep(0.02)

    print 10 * 'Done '
Exemple #15
0
def upload_full():
    fullmap_path = '/dls_sw/i24/scripts/fastchips/fullmaps/'
    f = open(fullmap_path + 'currentchip.full', 'r').readlines()

    for x in range(len(f) / 2):
        pmac_list = []
        for i in range(2):
	    pmac_list.append(f.pop(0).rstrip('\n'))
	writeline = " ".join(pmac_list)
	print writeline
	caput(pv.me14e_pmac_str, writeline)
	sleep(0.02)

    print 10*'Done '
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
Exemple #17
0
def upload_parameters():
    path = '/localhome/local/Documents/sacla/litemaps/'
    f = open(path + 'currentchip.map', 'r')
    for line in f:
        cols = line.split()
        pvar = cols[1]
        value = cols[2]
        s = str(pvar) + '=' + str(value)
        #print 'set P-variable', s
        sys.stdout.write(s + ' ')
        sys.stdout.flush()
        caput(pv.me14e_pmac_str, s)
        sleep(0.02)
    print
    print 10 * 'Done '
 def OnToggleClick(self,Event):
     btn = Event.GetEventObject()
     print btn.GetValue()
     label = int(btn.GetLabel())
     print label, self.btn_names[btn.GetLabel()]
     if btn.GetValue():
         btn.SetBackgroundColour('Red')
         pvar = 'ME14E-MO-IOC-01:GP' + str(label + 10)
         caput(pvar, 1)
         print btn.GetValue(),True
     else:
         btn.SetBackgroundColour('White')
         pvar = 'ME14E-MO-IOC-01:GP' + str(label + 10)
         caput(pvar, 0)
         print btn.GetValue(), False
def upload_full():
    name = inspect.stack()[0][3]
    #fullmap_path = '/dls_sw/i24/scripts/fastchips/fullmaps/'
    fullmap_path = '/localhome/local/Documents/sacla/parameter_files/'
    f = open(fullmap_path + 'currentchip.full', 'r').readlines()

    for x in range(len(f) / 2):
        pmac_list = []
        for i in range(2):
	    pmac_list.append(f.pop(0).rstrip('\n'))
	writeline = " ".join(pmac_list)
	print writeline
	caput(pv.me14e_pmac_str, writeline)
	sleep(0.02)

    print 10*'Done '
def load_stock_map(map_choice):
    print 'Please wait, adjusting lite map'
    x33 = [31, 32, 33, 40, 51, 50, 49, 42, 41]
    x55 = [25, 24, 23, 22, 21, 34, 39, 52, 57, 58, 59, 60, 61, 48, 43, 30
           ] + x33
    x77 = [
        11, 12, 13, 14, 15, 16, 17, 20, 35, 38, 53, 56, 71, 70, 69, 68, 67, 66,
        65, 62, 47, 44, 29, 26
    ] + x55
    x99 = [
        9, 8, 7, 6, 5, 4, 3, 2, 1, 18, 19, 36, 37, 54, 55, 72, 73, 74, 75, 76,
        77, 78, 79, 80, 81, 64, 63, 46, 45, 28, 27, 10
    ] + x77
    x44 = [22, 21, 20, 19, 30, 35, 46, 45, 44, 43, 38, 27, 28, 29, 36, 37]
    x49 = [x + 1 for x in range(49)]
    x66 = [
        10, 11, 12, 13, 14, 15, 18, 31, 34, 47, 50, 51, 52, 53, 54, 55, 42, 39,
        26, 23
    ] + x44
    x88 = [
        8, 7, 6, 5, 4, 3, 2, 1, 16, 17, 32, 33, 48, 49, 64, 63, 62, 61, 60, 59,
        58, 57, 56, 41, 40, 25, 24, 9
    ] + x66
    map_dict = {}
    map_dict['clear'] = [1]
    map_dict['x33'] = x33
    map_dict['x44'] = x44
    map_dict['x49'] = x49
    map_dict['x55'] = x55
    map_dict['x66'] = x66
    map_dict['x77'] = x77
    map_dict['x88'] = x88
    map_dict['x99'] = x99
    print 'Clearing'
    for i in range(1, 82):
        pvar = 'ME14E-MO-IOC-01:GP' + str(i + 10)
        #val = caget(pvar)
        #if val == 1:
        caput(pvar, 0)
        sys.stdout.write('.')
        sys.stdout.flush()
    print '\nmap cleared'
    print 'loading map_choice', map_choice
    for i in map_dict[map_choice]:
        pvar = 'ME14E-MO-IOC-01:GP' + str(i + 10)
        caput(pvar, 1)
    print 10 * 'Done '
Exemple #21
0
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
Exemple #22
0
def define_current_chip(chipid):
    path = '/localhome/local/Documents/sacla/parameter_files/'
    f = open(path + chipid + '.chip', 'r')
    print 'reading', path + chipid + '.chip'
    print 'writing to pmac'
    for line in f:
        cols = line.split()
        pvar = cols[1]
        value = cols[2]
        s = str(pvar) + '=' + str(value)
        #print 'set P-variable', s
        sys.stdout.write(s + ' ')
        sys.stdout.flush()
        caput(pv.me14e_pmac_str, s)
        sleep(0.02)
    print
    print path + chipid + '.chip'
    print 10 * 'Done '
Exemple #23
0
def cs_reset():
    cs1 = "#1->%+10000X%+0Y%+0Z"
    cs2 = "#2->%+0X%+10000Y%+0Z"
    cs3 = "#3->0X+0Y+10000Z"
    print '\n'.join([cs1, cs2, cs3])
    caput(pv.me14e_pmac_str, '&2')
    sleep(0.5)
    caput(pv.me14e_pmac_str, cs1)
    sleep(0.5)
    caput(pv.me14e_pmac_str, cs2)
    sleep(0.5)
    caput(pv.me14e_pmac_str, cs3)
    print 10*'CSDone '
Exemple #24
0
def load_motion_program_data(motion_program_dict, map_type):
    print 'Loading prog vars for chip'
    if map_type == '0':
        prefix = 11
    elif map_type == '1':
        prefix = 12
    elif map_type == '2':
        prefix = 13
    else:
        print 'Unknown map_type'

    for key in sorted(motion_program_dict.keys()):
        v = motion_program_dict[key]
        pvar_base = prefix * 100
        pvar = pvar_base + v[0]
        value = str(v[1])
        s = 'P' + str(pvar) + '=' + str(value)
        print key, '\t', s
        caput(pv.me14e_pmac_str, s)
        sleep(0.02)
    print 'done'
def block_check():
    name = inspect.stack()[0][3]
    caput(pv.me14e_gp9, 0)
    while True:
        if caget(pv.me14e_gp9) == 0:
            block_start_list = scrape_pvar_file('sacla3_oxford.pvar')
            for entry in block_start_list:
                if caget(pv.me14e_gp9) != 0:
                    lg.warning('%s Block Check Aborted'%(name))
                    print 50*'Aborted'
                    sleep(1.0)
                    break
                block, x, y = entry
                print block, x, y
                lg.info('%s %s %s %s' %(name, block, x, y))
                caput(pv.me14e_pmac_str, '!x%sy%s' %(x,y)) 
                time.sleep(0.4)
        else:
	    print 'Block Check Aborted due to GP 9 not equalling 0'
            lg.warning('%s Block Check Aborted due to GP 9 not equalling 0'%(name))
            break
        break
    print 10*'Done '
def cs_reset():
    name = inspect.stack()[0][3]
    cs1 = "#1->+10000X+0Y+0Z"
    cs2 = "#2->+0X+10000Y+0Z"
    cs3 = "#3->0X+0Y+10000Z"
    strg = '\n'.join([cs1, cs2, cs3])
    print strg
    lg.info('%s %s' % (name, strg))
    caput(pv.me14e_pmac_str, '&2')
    sleep(0.5)
    caput(pv.me14e_pmac_str, cs1)
    sleep(0.5)
    caput(pv.me14e_pmac_str, cs2)
    sleep(0.5)
    caput(pv.me14e_pmac_str, cs3)
    print 10 * 'CSDone '
Exemple #27
0
def finish_i24():
    print 'Finishing i24'
    caput(pv.zebra1_soft_in_b1, '0')          # Close the fast shutter
    caput(pv.zebra1_pc_arm_out, '0')          # Disarm the zebra
    sleep(0.2)
    sup.zebra1('return-to-normal')
    sup.pilatus('return-to-normal')
    caput(pv.me14e_pmac_str, '!x0y0z0')
    end_time = time.ctime()
    return end_time
def returntonormal():
    print '\n***** Entering Return To Normal'
    print 'returntonormal - '
    caput(pv.zebra1_disarm, 1)
    caput(pv.shtr_ctrl2, 'Close')
    caput(pv.shtr_ctrl1, 'Auto')
    zebra1('return-to-normal')
    beamline('Tray_switch2pin')
    pilatus('return-to-normal')
    xpress3('return-to-normal')
    print '***** leaving returntonormal'
def main():
    print 'Starting'
    starttime = time.ctime()
    caput(pv.me14e_pmac_str, '!x0y0z0')

    path_dict = make_path_dict()
    chipname, visit_id, proteinname, chipcapacity, blockcapacity, path_key = scrape_dcparameters(
    )
    xstart, ystart, xblocks, yblocks, coltype, path = path_dict[int(path_key)]
    block_id = str(string.uppercase.index(path[0][0]) + 1) + path[0][1]
    print '\n\nChip name is', chipname
    print 'visit_id', visit_id
    print 'proteinname', proteinname
    print 'chipcapacity', chipcapacity
    print 'blockcapacity', blockcapacity
    print 'path_key:', path_key
    print 'path:', path
    print 'xstart', xstart
    print 'ystart', ystart
    print 'xblocks', xblocks
    print 'yblocks', yblocks
    print 'Block ID', block_id
    print 'coltype', coltype
    chip_prog_dict = get_chip_prog_values(xstart, ystart, xblocks, yblocks,
                                          coltype, block_id)

    print 'Moving to Start'
    caput(pv.me14e_pmac_str, '!x%sy%sz0' % (xstart, ystart))
    sleep(1)

    load_motion_program_data(chip_prog_dict)
    caput(pv.me14e_pmac_str, '&2b11r')
    #caput(pv.me14e_pmac_str, '&2b24r')

    #endtime = time.ctime()
    print 3 * '\n'
    print 'Summary'
    print 'Chip name:', chipname
    print 'Protein name:', proteinname
    print 'Number of images collected:', chipcapacity
    print 'Start time:', starttime
    #print 'End time:', endtime
    #caput(pv.me14e_pmac_str, '!x0y0z0')
    print 3 * '\n'
Exemple #30
0
def main():
    print 'Starting'
    starttime = time.ctime()
    caput(pv.me14e_pmac_str, '!x0y0z0')

    path_dict = make_path_dict()
    chipname, visit_id, filepath, chipcapacity, blockcapacity, path_key = scrape_dcparameters(
    )
    xstart, ystart, xblocks, yblocks, coltype, path = path_dict[int(path_key)]
    print '\n\nChip name is', chipname
    print 'visit_id', visit_id
    print 'filepath', filepath
    print 'chipcapacity', chipcapacity
    print 'blockcapacity', blockcapacity
    print 'path_key:', path_key
    print 'path:', path
    print 'xstart', xstart
    print 'ystart', ystart
    print 'xblocks', xblocks
    print 'yblocks', yblocks
    print 'coltype', coltype
    chip_prog_dict = get_chip_prog_values(xstart, ystart, xblocks, yblocks,
                                          coltype)

    print 'Moving to Start'
    caput(pv.me14e_pmac_str, '!x%sy%sz0' % (xstart, ystart))
    sleep(1)

    load_motion_program_data(chip_prog_dict)
    caput(pv.me14e_pmac_str, '&2b11r')
    endtime = time.ctime()
    print 3 * '\n'
    print 'Summary'
    print 'Chip name:', chipname
    print 'Filepath:', filepath
    print 'Number of images collected:', chipcapacity
    print 'Start time:', starttime
    print 'End time:', endtime
    print 3 * '\n'