コード例 #1
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
コード例 #2
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
コード例 #3
0
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
コード例 #4
0
ファイル: zlayer.py プロジェクト: beamline-i24/zlayer
def run(control_fid):
    if control_fid:
        print control_fid
    else:
        print 'Expected control.inp'
        return 0

    [directory, subdir, filename, exp_time, step_size_x, step_size_y, num_of_x, num_of_y, energy, det_dist] \
                                                                               =  scrape_control(control_fid)

    total_numb_imgs = num_of_x * num_of_y
    filepath = os.path.join(directory, subdir)
    print 'Total number of images: ', total_numb_imgs
    print 'File Path: ', filepath
    sup.beamline('zlayer', [det_dist])
    sup.pilatus('zlayer', [filepath, filename, total_numb_imgs, exp_time])
    sup.zebra1('zlayer', [])
    sup.xspress3('zlayer', [filepath, filename, total_numb_imgs])
    sup.geobrick('zlayer', [])

    print 'Move to XY Start'
    grid_cs_maker()
    xs_start = caget(pv.vgon_pinxs)
    yh_start = caget(pv.vgon_pinyh)
    zs_start = caget(pv.vgon_pinzs)
    omega_start = caget(pv.vgon_omega)
    load_motion_program_data(num_of_x, num_of_y, step_size_x, step_size_y,
                             exp_time, xs_start, yh_start, zs_start)

    print 'pilatus acquire ON'
    caput(pv.pilat_acquire, '1')
    sleep(0.2)
    caput(pv.pilat_acquire, '1')
    caput(pv.xsp3_acquire, '1')
    caput(pv.zebra1_pc_arm, '1')

    print '\n\nCollection Area \n\n'
    print 20 * '\nTHIS NEEDS TO BE FINALIZED. THIS IS NOT A WORKING VERSION'
    caput(pv.step10_pmac_str, '&4b24r')
    sleep(1)

    i = 0
    text_list = ['|', '/', '-', '\\']
    caput(pv.ioc12_gp8, 0)
    while caget(pv.pmc_gridstatus) == 1 or caget(
            pv.pmc_gridcounter) != total_numb_imgs:
        line_of_text = '\r\t\t\t Waiting   ' + 30 * ('%s' % text_list[i % 4])
        print_flush(line_of_text)
        sleep(0.5)
        i += 1
        if caget(pv.ioc12_gp8) != 0:
            print 50 * 'ABORTED '
            caput(pv.pilat_acquire, 0)
            break
        if caget(pv.zebra1_pc_arm_out) != 1:
            print ' ----> Zebra Disarmed <----- '
            break

    print 'Return to Normal'
    sup.beamline('return-to-normal')
    sup.pilatus('return-to-normal')
    sup.zebra1('return-to-normal')
    sup.xspress3('return-to-normal')
    sup.geobrick('return-to-normal')

    print 'EOP'
コード例 #5
0
def run(control_fid):
    print 'Start of Run in quickshot.py'
    caput(pv.ioc12_gp8, 0)
    print control_fid
    [
        directory, subdir, filename, num_imgs, exp_time, energy, det_dist,
        control_fid
    ] = scrape_control(control_fid)

    ######## Preperation
    sup.beamline('quickshot', [det_dist])

    filepath = directory + subdir
    print '\n', filepath + filename, '\n'
    print 'Setting Shutter to Auto'
    caput(pv.shtr_ctrl1, 'Auto')

    sup.pilatus('quickshot', [filepath, filename, num_imgs, exp_time])

    gate_start = 1.0
    gate_width = (exp_time * num_imgs) + 0.5
    print 'gate_start', gate_start
    print 'gate_width', gate_width
    sup.zebra1('quickshot', [gate_start, gate_width])

    ########## Collect
    print 'pilatus acquire ON'
    caput(pv.pilat_acquire, 1)
    sleep(0.2)
    caput(pv.pilat_acquire, 1)
    while True:
        # ioc12_gp8 is the ABORT button
        if caget(pv.ioc12_gp8) == 0:
            print '\tZebra ARMED'
            caput(pv.zebra1_pc_arm, 1)
            sleep(gate_start)
        else:
            print 50 * 'ABORTED '
            caput(pv.pilat_acquire, 0)
            break

        if caget(pv.ioc12_gp8) == 0:
            print '\t\tFast Shutter Opening'
            caput(pv.zebra1_soft_in_b1, 1)

            i = 0
            text_list = ['|', '/', '-', '\\']
            while True:
                line_of_text = '\r\t\t\t Waiting   ' + 30 * ('%s' %
                                                             text_list[i % 4])
                flush_print(line_of_text)
                sleep(0.5)
                i += 1
                if caget(pv.ioc12_gp8) != 0:
                    print 50 * 'ABORTED '
                    caput(pv.pilat_acquire, 0)
                    break
                if caget(pv.zebra1_pc_arm_out) != 1:
                    print ' ----> Zebra Disarmed <----- '
                    break
        else:
            break
        break

    caput(pv.ioc12_gp8, 1)
    print '\n\t\tFast Shutter Closing'
    caput(pv.zebra1_soft_in_b1, 0)
    print '\tZebra DISARMED'
    caput(pv.zebra1_pc_disarm, 1)
    print 'Pilatus Acquire STOP'
    caput(pv.pilat_acquire, 0)
    sleep(0.5)

    ######### Clean Up
    #print 'Setting zebra back to normal'
    sup.zebra1('return-to-normal')
    sup.pilatus('return-to-normal')
    print 'End of Run in quickshot.py'
    return 1