예제 #1
0
def image_menu(imdata,scan_pnt=None):
    """
    Interactively inspect/integrate images in ScanData or a
    ImageScan object

    Parameters:
    -----------
    * imdata is either an ImageScan or ScanData object
    * scan_pnt is an integer value for a point to integrate
      None indicates start at the first point

    """
    #if isinstance(imdata,data.ScanData):
    if hasattr(imdata,'get_positioner'):
        imdata = imdata.image
    #elif isinstance(imdata,image_data.ImageScan):
    elif hasattr(imdata,'image'):
        pass
    else:
        print "Invalid image data"
    prompt   = 'Select option >'
    ret      = ''
    roi      = []
    #bad_points = []
    im_max   = None

    # make menu
    if scan_pnt == None:
        short    = False
        npts     = len(imdata.image)
        scan_pnt = 0
        m = Menu(labels=IMG_LABELS,
                 descr=IMG_DESCR,
                 sort=False,matchidx=True)
    else:
        short    = True
        npts     = 1
        scan_pnt = int(scan_pnt)
        m = Menu(labels=IMG_LABELS_SHORT,
                 descr=IMG_DESCR_SHORT,
                 sort=False,matchidx=True)
        
    # local plot fun
    def _implot(imdata,scan_pnt):
        rotangle = imdata.rotangle[scan_pnt]
        im_max   = imdata.im_max[scan_pnt]
        roi      = imdata.rois[scan_pnt]
        figtitle = "Scan Point = %i" % (scan_pnt)
        image_data.image_plot(imdata.image[scan_pnt],fig=1,verbose=True,
                              figtitle=figtitle,im_max=im_max,
                              rotangle=rotangle,roi=roi)

    # check init and plot first
    if imdata._is_init() == False:
        imdata._init_image()
    _implot(imdata,scan_pnt)
    
    # loop
    while ret != 'done':
        roi      = imdata.rois[scan_pnt]
        rotangle = imdata.rotangle[scan_pnt]
        if short:
            header   = IMG_HEADER_SHORT % (str(roi),str(rotangle))
        else:
            header   = IMG_HEADER % (str(npts),str(scan_pnt),
                                     str(roi),str(rotangle))
        m.header = header
        ret      = m.prompt(prompt)

        if ret == 'display':
            _implot(imdata,scan_pnt)
        elif ret == 'imax':
            print 'Image max intensity = ', imdata.image[scan_pnt].max()
            im_max = get_int(prompt='Enter maximum intensity value for image plot',
                             default=imdata.im_max[scan_pnt],min=-1)
            imdata.im_max[scan_pnt] = im_max
            _implot(imdata,scan_pnt)
        elif ret == "rotangle":
            rotangle = get_flt(prompt='Enter rotation angle in degrees ccw',
                               default=imdata.rotangle[scan_pnt],
                               min=-360.,max=360.)
            imdata.rotangle[scan_pnt] = rotangle
            _implot(imdata,scan_pnt)
        elif ret == 'setroi':
            pyplot.figure(1)
            (x1,x2,y1,y2) = pyplot.axis()
            roi  = [int(x1),int(y1),int(x2),int(y2)]
            imdata.rois[scan_pnt] = roi
        elif ret == 'plotsums':
            roi      = imdata.rois[scan_pnt]
            rotangle = imdata.rotangle[scan_pnt]
            image    = image_data.clip_image(imdata.image[scan_pnt],roi,
                                             rotangle=rotangle)
            bgr_par  = imdata.bgrpar[scan_pnt]
            image_data.sum_plot(image,fig=2,**bgr_par)
        elif ret == 'selectroi':
            image = imdata.image[scan_pnt]
            bgr_par = imdata.bgrpar[scan_pnt]
            image_data.sum_plot(image,fig=2,**bgr_par)
            c = cursor(fig=2)
            (c1,y) = c.get_click(msg="Select left col sum")
            (c2,y) = c.get_click(msg="Select right col sum")
            (r1,y) = c.get_click(msg="Select left row sum")
            (r2,y) = c.get_click(msg="Select right row sum")
            roi = [int(c1),int(r1),int(c2),int(r2)]
            imdata.rois[scan_pnt] = roi
        elif ret == 'background':
            bgr_par = imdata.bgrpar[scan_pnt]
            bgr_par = bgr_menu(bgr_par)
            imdata.bgrpar[scan_pnt] = bgr_par
        elif ret == 'copyall':
            roi      = imdata.rois[scan_pnt]
            rotangle = imdata.rotangle[scan_pnt]
            bgr_par  = imdata.bgrpar[scan_pnt]
            #
            imdata.rois = []
            imdata.rotangle = []
            imdata.bgrpar = []
            #
            for j in range(npts):
                imdata.rois.append(copy.copy(roi))
                imdata.rotangle.append(rotangle)
                imdata.bgrpar.append(copy.copy(bgr_par))
        elif ret == 'integrate':
            imdata.integrate(idx=[scan_pnt],
                             plot=True,fig=3)
        elif ret == 'intall':
            yn = get_tf("Plot all images",default=False)
            imdata.integrate(plot=yn)
            #
            pyplot.figure(5, figsize = [5,4])
            pyplot.clf()
            #
            x = num.arange(len(imdata.image))
            pyplot.plot(x,imdata.peaks['I'],'b',label='image sum')
            pyplot.errorbar(x,imdata.peaks['I'],imdata.peaks['Ierr'],fmt='bo')
            #
            pyplot.plot(x,imdata.peaks['I_c'],'r',label='col sum')
            pyplot.errorbar(x,imdata.peaks['I_c'],imdata.peaks['Ierr_c'],fmt='ro')
            #
            pyplot.plot(x,imdata.peaks['I_r'],'g',label='row sum')
            pyplot.errorbar(x,imdata.peaks['I_r'],imdata.peaks['Ierr_r'],fmt='go')
            #
            pyplot.semilogy()
            pyplot.legend(loc = 9)
            pyplot.xlabel('Point')
            pyplot.ylabel('Integrated Intensity')
        #elif ret == 'flag':
        #    if int(scan_pnt) in bad_points:
        #        bad_points.remove(scan_pnt)
        #        print "Data point removed from bad list"
        #    else:
        #        bad_points.append(int(scan_pnt))
        #        print "Data point added to bad list"
        elif ret == 'point':
            scan_pnt = get_int(prompt='Enter scan point',
                               default=scan_pnt,min=0,max = npts-1)
            _implot(imdata,scan_pnt)
        elif ret == 'next':
            if scan_pnt + 1 < npts: 
                scan_pnt = scan_pnt + 1
                _implot(imdata,scan_pnt)
        elif ret == 'previous':
            if scan_pnt - 1 > -1: 
                scan_pnt = scan_pnt - 1
                _implot(imdata,scan_pnt)
        else:
            pass
예제 #2
0
파일: rasd_menu.py 프로젝트: jackey-qiu/tdl
def rasd_menu(rasddata, cell = None, bulk_file = None, sur_file = None, f1f2_file = None, E0 = 0.):
    """
    Interactively create RasdList object and inspect/analyze data in it 
    """
    if cell == None:
        ok = False
        while not ok:
            cell = get_flt_list(prompt='Enter unit cell [a,b,c,alpha,beta,gamma,delta1,delta2]')
            if len(cell) != 8:
                print 'invalid unit cell'
            else: ok = True
        
    if bulk_file == None:
        ok = False
        while not ok:
            bulk_file = get_str(prompt='Enter path and\or name of your bulk file (ROD .bul file without header and cell definition)')
            if not os.path.exists(bulk_file):
                print bulk_file+' not found'
            else:
                ok = True
    bulk = []
    f = file(bulk_file,'r')
    data = f.readlines()
    f.close()
    for i in range(len(data)):
        if '#' not in data[i]:
            tmp = str.rsplit(data[i])
            bulk.append([tmp[0],float(tmp[1]),float(tmp[2]),float(tmp[3]),float(tmp[4])])
                
    if sur_file == None:
        ok = False
        while not ok:
            sur_file = get_str(prompt='Enter path and\or name of your surface file (ROD .sur file without header and cell definition)')
            if not os.path.exists(sur_file):
                print sur_file+' not found'
            else:
                ok = True
    surface = []
    f = file(sur_file,'r')
    data = f.readlines()
    f.close()
    for i in range(len(data)):
        if '#' not in data[i]:
            tmp = str.rsplit(data[i])
            surface.append([tmp[0],float(tmp[1]),float(tmp[2]),float(tmp[3]),float(tmp[4]),float(tmp[5])])

    if f1f2_file == None:
        ok = False
        while not ok:
            f1f2_file = get_str(prompt='Enter path and\or name of your f1f2 file (HEPHAESTUS or experimental f1f2 file)')
            if not os.path.exists(f1f2_file):
                print f1f2_file+' not found'
            else:
                ok = True
    f = file(f1f2_file, 'r')
    data = f.readlines()
    f.close()
    f1f2 = num.ndarray((0,3),float)
    for i in range(len(data)):
        if '#' not in data[i]:
            tmp = str.rsplit(data[i])
            f1f2 = num.append(f1f2, [[int(float(tmp[0])),float(tmp[1]),float(tmp[2])]], axis = 0)
    f1f2 = f1f2.transpose()

    if E0 == 0:
        E0 = get_flt(prompt='Enter E0 in eV')

    allrasd = rasd_ana.read_RSD(cell, bulk, surface, database, rasddata, f1f2, E0)
        
    prompt   = 'Select option >'
    ret      = ''

    # make menu
    m = Menu(labels=RASD_LABELS,
                 descr=RASD_DESCR,
                 sort=False, matchidx=True)
    scan_pnt = 0
    norm = True
    
    # loop
    while ret != 'done':
        allrasd.list[scan_pnt] = rasd_ana.RASD_Fourier(allrasd,scan_pnt)
        header   = RASD_HEADER % (str(allrasd.dims),str(scan_pnt),
                                 str(allrasd.list[scan_pnt].AR),str(allrasd.list[scan_pnt].PR),
                                 str(allrasd.list[scan_pnt].e0shift))
        m.header = header
        allrasd.list[scan_pnt].plot(norm = norm, fig = 1)
        ret      = m.prompt(prompt)
        if ret == 'plot_norm':
            norm = get_tf(prompt = 'Plot normalized or not (True/False)', default = norm)
        elif ret == 'setE0shift':
            allrasd.list[scan_pnt].e0shift = get_flt(prompt = 'Enter e0 shift for this scan',
                                                       default = allrasd.list[scan_pnt].e0shift)
            allrasd.list[scan_pnt].E = allrasd.list[scan_pnt].Eorig + allrasd.list[scan_pnt].e0shift
            allrasd.list[scan_pnt].E0 = allrasd.E0 + allrasd.list[scan_pnt].e0shift
        elif ret == 'setPRstart':
            allrasd.list[scan_pnt].PR = get_flt(prompt = 'Enter PR start (0-1)', default = allrasd.list[scan_pnt].PR,
                                                min = 0, max = 1)
        elif ret == 'useInFourier':
            allrasd.list[scan_pnt].use_in_Fourier = get_tf(prompt= 'Use this scan in Fourier synthesis (True/False)?',
                                                           default = allrasd.list[scan_pnt].use_in_Fourier)
        elif ret == 'useInRefine':
            allrasd.list[scan_pnt].use_in_Refine = get_tf(prompt= 'Use this scan for Structure Refinement (True/False)?',
                                                           default = allrasd.list[scan_pnt].use_in_Refine)
        elif ret == 'FourierParams':
            allrasd.ZR = get_int(prompt= 'Atomic number of resonant element', default = allrasd.ZR)
            allrasd.xf = get_flt(prompt= 'number of unit cells along a', default = allrasd.xf)
            allrasd.yf = get_flt(prompt= 'number of unit cells along b', default = allrasd.yf)
            allrasd.zf = get_flt(prompt= 'number of unit cells along c', default = allrasd.zf)
            allrasd.an = get_int(prompt= 'number of datapoints along a', default = allrasd.an)
            allrasd.bn = get_int(prompt= 'number of datapoints along b', default = allrasd.bn)
            allrasd.cn = get_int(prompt= 'number of datapoints along c', default = allrasd.cn)
            allrasd.Plusminus = get_tf(prompt= 'calculate rho(e-) above and below surface', default = allrasd.Plusminus)
        elif ret == 'runFourier':
            allrasd.Fourier = []
            data = []
            for rasd in allrasd.list:
                if rasd.use_in_Fourier:
                    allrasd.Fourier.append([rasd.Q[0],rasd.Q[1],rasd.Q[2],rasd.AR,rasd.PR])
                    data.append(rasd.file)
            if allrasd.Fourier == []: print 'No scans specified for use in Fourier'
            else:
                rasd_ana.Fourier_synthesis(allrasd.Fourier, allrasd.cell, allrasd.ZR,allrasd.xf,allrasd.yf,allrasd.zf,
                                             allrasd.an,allrasd.bn,allrasd.cn,allrasd.Plusminus)
                print 'Scans used for Fourier synthesis: \n'+str(data) 
        elif ret == 'RefinementParams':
            allrasd.natoms = get_int(prompt = 'How many atoms in structure model?', default = allrasd.natoms)
            if allrasd.Rmin == None or len(allrasd.thetamin) != allrasd.natoms:
                allrasd.Rmin = num.zeros((allrasd.natoms,3),float)
                allrasd.Rmax = num.ndarray((0,3),float)
                for i in range(allrasd.natoms):
                    allrasd.Rmax = num.append(allrasd.Rmax, [[allrasd.cell[0],allrasd.cell[1],allrasd.cell[2]]],axis = 0)
                allrasd.thetamin = num.ones((allrasd.natoms),float) *0.05
                allrasd.thetamax = num.ones((allrasd.natoms),float) *0.999
                allrasd.DWmin = num.zeros((allrasd.natoms,6),float)
                for i in range(allrasd.natoms):
                    allrasd.DWmin[i] = [0.001,0.001,0.001,0.,0.,0.]
                allrasd.DWmax = num.zeros((allrasd.natoms,6),float)
                for i in range(allrasd.natoms):
                    allrasd.DWmax[i] = [1.,1.,1.,0.,0.,0.]
            for i in range(allrasd.natoms):
                allrasd.Rmin[i] = get_flt_list(prompt = ('Rmin of atom '+str(i+1)+' [xmin,ymin,zmin] (Angstroem)'), default = allrasd.Rmin[i])
            for i in range(allrasd.natoms):
                allrasd.Rmax[i] = get_flt_list(prompt = ('Rmax of atom '+str(i+1)+' [xmax,ymax,zmax] (Angstroem)'), default = allrasd.Rmax[i])
            for i in range(allrasd.natoms):
                allrasd.thetamin[i] = get_flt(prompt = ('min. occupancy of atom '+str(i+1)), default = allrasd.thetamin[i])
            for i in range(allrasd.natoms):
                allrasd.thetamax[i] = get_flt(prompt = ('max. occupancy of atom '+str(i+1)), default = allrasd.thetamax[i])
            for i in range(allrasd.natoms):
                allrasd.DWmin[i] = get_flt_list(prompt = ('min. DW-factor for atom '+str(i+1)+' [b11,b22,b33,b12,b13,b23]'), default = allrasd.DWmin[i])
            for i in range(allrasd.natoms):
                allrasd.DWmax[i] = get_flt_list(prompt = ('max. DW-factor for atom '+str(i+1)+' [b11,b22,b33,b12,b13,b23]'), default = allrasd.DWmax[i])
            allrasd.Tstart = get_flt(prompt = 'Startimg Temperature for simmulated annealing', default = allrasd.Tstart)
            allrasd.Tend = get_flt(prompt = 'End Temperature for simmulated annealing', default = allrasd.Tend)
            allrasd.cool = get_flt(prompt = 'cooling factor for simmulated annealing (usually 0.7 - 0.95)', default = allrasd.cool, min = 0.1, max = 0.99)
            allrasd.maxrun = get_flt(prompt = 'max. repeats at one Temp.', default = allrasd.maxrun)
            allrasd.MC = get_flt(prompt = 'max fractional parameter change at T = 100', default = allrasd.MC)
            allrasd.RMS_count_max = get_flt(prompt = 'max. annealing (T) steps without improvement', default = allrasd.RMS_count_max)
            allrasd.factor = get_flt(prompt = 'some factor (Boltz. = exp(d(RMS)*factor/T)) in decision process (~1e4 - 1e7)', default = allrasd.factor)
예제 #3
0
def bgr_menu(bgr_params=IMG_BGR_PARAMS):
    """
    Get background options
    """
    prompt   = 'Select option >'

    # make menu
    m   = Menu(labels=BGR_LABELS,descr=BGR_DESCR,sort=False,matchidx=True)
    ret = ''
    
    while ret != 'done':
        header = BGR_HEADER % (bgr_params['bgrflag'],
                               bgr_params['cnbgr'],bgr_params['cwidth'],
                               bgr_params['cpow'],str(bgr_params['ctan']),
                               bgr_params['rnbgr'],bgr_params['rwidth'],
                               bgr_params['rpow'],str(bgr_params['rtan']))
        m.header = header
        ret      = m.prompt(prompt)
        #
        if ret == 'bgrflag':
            bgr_params['bgrflag'] = get_int(prompt='Enter bgrflag',
                                            default=bgr_params['bgrflag'],
                                            valid=[0,1,2,3])
        #
        elif ret == 'cnbgr':
            bgr_params['cnbgr'] = get_int(prompt='Enter col nbgr',
                                          default=bgr_params['cnbgr'],
                                          min=0)
        elif ret == 'cwidth':
            # could use flt??
            bgr_params['cwidth'] = get_int(prompt='Enter col width',
                                           default=bgr_params['cwidth'],
                                           min=0)
        elif ret == 'cpow':
            bgr_params['cpow'] = get_flt(prompt='Enter col pow',
                                         default=bgr_params['cpow'],
                                         min=0.)
        elif ret == 'ctan':
            bgr_params['ctan'] = get_tf(prompt='Enter col tan flag',
                                        default=bgr_params['ctan'])
        #
        elif ret == 'rnbgr':
            bgr_params['rnbgr'] = get_int(prompt='Enter row nbgr',
                                          default=bgr_params['rnbgr'],
                                          min=0)
        elif ret == 'rwidth':
            # could use flt??
            bgr_params['rwidth'] = get_int(prompt='Enter row width',
                                           default=bgr_params['rwidth'],
                                           min=0)
        elif ret == 'rpow':
            bgr_params['rpow'] = get_flt(prompt='Enter row pow',
                                         default=bgr_params['rpow'],
                                         min=0.)
        elif ret == 'rtan':
            bgr_params['rtan'] = get_tf(prompt='Enter row tan flag',
                                        default=bgr_params['rtan'])
        elif ret == 'info':
            show_more(BGR_INFO)
            get_yn(prompt="Continue",default='y')
    return bgr_params
예제 #4
0
파일: rasd_menu.py 프로젝트: jackey-qiu/tdl
def rasd_menu(rasddata,
              cell=None,
              bulk_file=None,
              sur_file=None,
              f1f2_file=None,
              E0=0.):
    """
    Interactively create RasdList object and inspect/analyze data in it 
    """
    if cell == None:
        ok = False
        while not ok:
            cell = get_flt_list(
                prompt='Enter unit cell [a,b,c,alpha,beta,gamma,delta1,delta2]'
            )
            if len(cell) != 8:
                print 'invalid unit cell'
            else:
                ok = True

    if bulk_file == None:
        ok = False
        while not ok:
            bulk_file = get_str(
                prompt=
                'Enter path and\or name of your bulk file (ROD .bul file without header and cell definition)'
            )
            if not os.path.exists(bulk_file):
                print bulk_file + ' not found'
            else:
                ok = True
    bulk = []
    f = file(bulk_file, 'r')
    data = f.readlines()
    f.close()
    for i in range(len(data)):
        if '#' not in data[i]:
            tmp = str.rsplit(data[i])
            bulk.append([
                tmp[0],
                float(tmp[1]),
                float(tmp[2]),
                float(tmp[3]),
                float(tmp[4])
            ])

    if sur_file == None:
        ok = False
        while not ok:
            sur_file = get_str(
                prompt=
                'Enter path and\or name of your surface file (ROD .sur file without header and cell definition)'
            )
            if not os.path.exists(sur_file):
                print sur_file + ' not found'
            else:
                ok = True
    surface = []
    f = file(sur_file, 'r')
    data = f.readlines()
    f.close()
    for i in range(len(data)):
        if '#' not in data[i]:
            tmp = str.rsplit(data[i])
            surface.append([
                tmp[0],
                float(tmp[1]),
                float(tmp[2]),
                float(tmp[3]),
                float(tmp[4]),
                float(tmp[5])
            ])

    if f1f2_file == None:
        ok = False
        while not ok:
            f1f2_file = get_str(
                prompt=
                'Enter path and\or name of your f1f2 file (HEPHAESTUS or experimental f1f2 file)'
            )
            if not os.path.exists(f1f2_file):
                print f1f2_file + ' not found'
            else:
                ok = True
    f = file(f1f2_file, 'r')
    data = f.readlines()
    f.close()
    f1f2 = num.ndarray((0, 3), float)
    for i in range(len(data)):
        if '#' not in data[i]:
            tmp = str.rsplit(data[i])
            f1f2 = num.append(
                f1f2, [[int(float(tmp[0])),
                        float(tmp[1]),
                        float(tmp[2])]],
                axis=0)
    f1f2 = f1f2.transpose()

    if E0 == 0:
        E0 = get_flt(prompt='Enter E0 in eV')

    allrasd = rasd_ana.read_RSD(cell, bulk, surface, database, rasddata, f1f2,
                                E0)

    prompt = 'Select option >'
    ret = ''

    # make menu
    m = Menu(labels=RASD_LABELS, descr=RASD_DESCR, sort=False, matchidx=True)
    scan_pnt = 0
    norm = True

    # loop
    while ret != 'done':
        allrasd.list[scan_pnt] = rasd_ana.RASD_Fourier(allrasd, scan_pnt)
        header = RASD_HEADER % (str(
            allrasd.dims), str(scan_pnt), str(
                allrasd.list[scan_pnt].AR), str(allrasd.list[scan_pnt].PR),
                                str(allrasd.list[scan_pnt].e0shift))
        m.header = header
        allrasd.list[scan_pnt].plot(norm=norm, fig=1)
        ret = m.prompt(prompt)
        if ret == 'plot_norm':
            norm = get_tf(prompt='Plot normalized or not (True/False)',
                          default=norm)
        elif ret == 'setE0shift':
            allrasd.list[scan_pnt].e0shift = get_flt(
                prompt='Enter e0 shift for this scan',
                default=allrasd.list[scan_pnt].e0shift)
            allrasd.list[scan_pnt].E = allrasd.list[
                scan_pnt].Eorig + allrasd.list[scan_pnt].e0shift
            allrasd.list[
                scan_pnt].E0 = allrasd.E0 + allrasd.list[scan_pnt].e0shift
        elif ret == 'setPRstart':
            allrasd.list[scan_pnt].PR = get_flt(
                prompt='Enter PR start (0-1)',
                default=allrasd.list[scan_pnt].PR,
                min=0,
                max=1)
        elif ret == 'useInFourier':
            allrasd.list[scan_pnt].use_in_Fourier = get_tf(
                prompt='Use this scan in Fourier synthesis (True/False)?',
                default=allrasd.list[scan_pnt].use_in_Fourier)
        elif ret == 'useInRefine':
            allrasd.list[scan_pnt].use_in_Refine = get_tf(
                prompt='Use this scan for Structure Refinement (True/False)?',
                default=allrasd.list[scan_pnt].use_in_Refine)
        elif ret == 'FourierParams':
            allrasd.ZR = get_int(prompt='Atomic number of resonant element',
                                 default=allrasd.ZR)
            allrasd.xf = get_flt(prompt='number of unit cells along a',
                                 default=allrasd.xf)
            allrasd.yf = get_flt(prompt='number of unit cells along b',
                                 default=allrasd.yf)
            allrasd.zf = get_flt(prompt='number of unit cells along c',
                                 default=allrasd.zf)
            allrasd.an = get_int(prompt='number of datapoints along a',
                                 default=allrasd.an)
            allrasd.bn = get_int(prompt='number of datapoints along b',
                                 default=allrasd.bn)
            allrasd.cn = get_int(prompt='number of datapoints along c',
                                 default=allrasd.cn)
            allrasd.Plusminus = get_tf(
                prompt='calculate rho(e-) above and below surface',
                default=allrasd.Plusminus)
        elif ret == 'runFourier':
            allrasd.Fourier = []
            data = []
            for rasd in allrasd.list:
                if rasd.use_in_Fourier:
                    allrasd.Fourier.append(
                        [rasd.Q[0], rasd.Q[1], rasd.Q[2], rasd.AR, rasd.PR])
                    data.append(rasd.file)
            if allrasd.Fourier == []:
                print 'No scans specified for use in Fourier'
            else:
                rasd_ana.Fourier_synthesis(allrasd.Fourier, allrasd.cell,
                                           allrasd.ZR, allrasd.xf, allrasd.yf,
                                           allrasd.zf, allrasd.an, allrasd.bn,
                                           allrasd.cn, allrasd.Plusminus)
                print 'Scans used for Fourier synthesis: \n' + str(data)
        elif ret == 'RefinementParams':
            allrasd.natoms = get_int(
                prompt='How many atoms in structure model?',
                default=allrasd.natoms)
            if allrasd.Rmin == None or len(allrasd.thetamin) != allrasd.natoms:
                allrasd.Rmin = num.zeros((allrasd.natoms, 3), float)
                allrasd.Rmax = num.ndarray((0, 3), float)
                for i in range(allrasd.natoms):
                    allrasd.Rmax = num.append(
                        allrasd.Rmax,
                        [[allrasd.cell[0], allrasd.cell[1], allrasd.cell[2]]],
                        axis=0)
                allrasd.thetamin = num.ones((allrasd.natoms), float) * 0.05
                allrasd.thetamax = num.ones((allrasd.natoms), float) * 0.999
                allrasd.DWmin = num.zeros((allrasd.natoms, 6), float)
                for i in range(allrasd.natoms):
                    allrasd.DWmin[i] = [0.001, 0.001, 0.001, 0., 0., 0.]
                allrasd.DWmax = num.zeros((allrasd.natoms, 6), float)
                for i in range(allrasd.natoms):
                    allrasd.DWmax[i] = [1., 1., 1., 0., 0., 0.]
            for i in range(allrasd.natoms):
                allrasd.Rmin[i] = get_flt_list(
                    prompt=('Rmin of atom ' + str(i + 1) +
                            ' [xmin,ymin,zmin] (Angstroem)'),
                    default=allrasd.Rmin[i])
            for i in range(allrasd.natoms):
                allrasd.Rmax[i] = get_flt_list(
                    prompt=('Rmax of atom ' + str(i + 1) +
                            ' [xmax,ymax,zmax] (Angstroem)'),
                    default=allrasd.Rmax[i])
            for i in range(allrasd.natoms):
                allrasd.thetamin[i] = get_flt(
                    prompt=('min. occupancy of atom ' + str(i + 1)),
                    default=allrasd.thetamin[i])
            for i in range(allrasd.natoms):
                allrasd.thetamax[i] = get_flt(
                    prompt=('max. occupancy of atom ' + str(i + 1)),
                    default=allrasd.thetamax[i])
            for i in range(allrasd.natoms):
                allrasd.DWmin[i] = get_flt_list(
                    prompt=('min. DW-factor for atom ' + str(i + 1) +
                            ' [b11,b22,b33,b12,b13,b23]'),
                    default=allrasd.DWmin[i])
            for i in range(allrasd.natoms):
                allrasd.DWmax[i] = get_flt_list(
                    prompt=('max. DW-factor for atom ' + str(i + 1) +
                            ' [b11,b22,b33,b12,b13,b23]'),
                    default=allrasd.DWmax[i])
            allrasd.Tstart = get_flt(
                prompt='Startimg Temperature for simmulated annealing',
                default=allrasd.Tstart)
            allrasd.Tend = get_flt(
                prompt='End Temperature for simmulated annealing',
                default=allrasd.Tend)
            allrasd.cool = get_flt(
                prompt=
                'cooling factor for simmulated annealing (usually 0.7 - 0.95)',
                default=allrasd.cool,
                min=0.1,
                max=0.99)
            allrasd.maxrun = get_flt(prompt='max. repeats at one Temp.',
                                     default=allrasd.maxrun)
            allrasd.MC = get_flt(
                prompt='max fractional parameter change at T = 100',
                default=allrasd.MC)
            allrasd.RMS_count_max = get_flt(
                prompt='max. annealing (T) steps without improvement',
                default=allrasd.RMS_count_max)
            allrasd.factor = get_flt(
                prompt=
                'some factor (Boltz. = exp(d(RMS)*factor/T)) in decision process (~1e4 - 1e7)',
                default=allrasd.factor)
        elif ret == 'runRefine':
            if allrasd.Rmin == None:
                print 'Please define simmulated annealing parameters first'
            else:
                allrasd.reflist = []
                for rasd in allrasd.list:
                    if rasd.use_in_Refine:
                        allrasd.reflist.append(rasd)
                if allrasd.reflist == []:
                    print 'No scans specified for use in refinement'
                else:
                    rasd_ana.simulated_annealing(allrasd)
        elif ret == 'select':
            scan_pnt = get_int(prompt='Enter scan number',
                               default=scan_pnt,
                               min=0,
                               max=allrasd.dims - 1)
        elif ret == 'next':
            if scan_pnt + 1 < allrasd.dims:
                scan_pnt = scan_pnt + 1
        elif ret == 'previous':
            if scan_pnt - 1 > -1:
                scan_pnt = scan_pnt - 1
        else:
            pass