def loadeverything(savstatdir, filenames, fieldnumber, **kwargs):
    keylist = [key for key, value in kwargs.items()]
    valuelist = [value for key, value in kwargs.items()]
    if "progcycle" in keylist:
        pp = valuelist[keylist.index("progcycle")]
    else:
        pp = -1
    if "selproc" in keylist:
        sellist = valuelist[keylist.index("selproc")]
    else:
        sellist = np.arange(120)
    resultcoll = []
    resnam = []
    poscoll = []
    allsetcoll = []
    explen = 0
    for filename in filenames:
        for selproc in sellist:
            try:
                name, resnamx, poscollx, allsets, cond = loadstatus2(
                    savstatdir, filename + str(selproc) + '_part')
                resultcoll.append(allsets[pp])
                allsetcoll.append(allsets)
                if len(allsets) > explen:
                    explen = len(allsets)
                resnam.append(resnamx)
                poscoll.append(poscollx)
            except:
                _ = 0
        os.chdir(savstatdir)

    resultcoll = flatten(resultcoll, levels=1)
    resnam = flatten(resnam, levels=1)
    poscoll = flatten(poscoll, levels=1)
    return poscoll, resnam, allsetcoll, resultcoll, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, cond
Esempio n. 2
0
def parallelfit3(path2020,savstatdir,setparameters3,runnum,paramsx,praxis):
    time.sleep(runnum/10)
    databasis,datapath,selresidues,conditions,filenamsav,precalc2=setparameters3
    os.chdir(datapath)
    resultcoll=[];poscoll=[];resnam=[]#;precalc2=[]
    resultcoll, resnam, poscoll, dataset,allsets = runfit4(praxis,[],\
    selresidues,precalc2,resnam,conditions,path2020,savstatdir,databasis,filenamsav+str(runnum),paramsx,0,0)
    comment1='fitengines1_1';comment2='x';datver='x';scriptver='x'
    hkio.savstatus2(savstatdir,filenamsav+str(runnum),comment1,comment2,datver,scriptver,precalc2,resnam,poscoll,resultcoll,setparameters3,allsets,dataset)
    allsav=[filenamsav,comment1,comment2,datver,scriptver,precalc2,resnam,poscoll,resultcoll,setparameters3,allsets,dataset]
    return allsav
def loadstatus2(savstatdir, name):
    status = {}
    cwdx = os.getcwd()
    os.chdir(savstatdir)  #'/home/hanskoss/scripts/relaxproc/savstat')
    status = load_obj(name)
    os.chdir(cwdx)
    try:
        cond = status['allconditions']
    except:
        cond = 0
    alls = status['allsets']
    return status['name'], status['resnam'], status['poscoll'], alls, cond
Esempio n. 4
0
def evaluaterdfit(path2020,savstatdir,praxs1,setparameters2,runnum,paramsx,precalc2):
    """Reads in an experimental data set and recalculates the theoretical
    result from provided parameters. This theoretical result is obtained alongside
    chi square (which is printed during the process for inspection).
    The reuturned spin system contains dataset with the object 'fit' which are
    the calculated theoretical results, for example used to calculate residuals.
    """
    time.sleep(runnum/10)
    databasis,datapath,selresidues,conditions,filenamsav=setparameters2
    os.chdir(datapath)
    resnam=[]
    temp1,temp2,temp3,temp4,temp5,temp6,temp7,temp8,temp9,temp10,temp11\
    ,temp12,temp13,temp14,temp15,temp16,temp17,temp18,cond=hkio.\
    loadeverything(savstatdir,[filenamsav],0,decoupl=0)
    ss=runfit4(praxs1,[],selresidues,precalc2,resnam,conditions,path2020,savstatdir,\
    databasis,filenamsav+str(runnum),paramsx,1,cond)
    return ss
def savstatus2b(savstatdir, name, resnam, poscoll, allsets, allconditions):
    status = {}
    cwdx = os.getcwd()
    os.chdir(savstatdir)
    status['savdat1'] = datetime.now()
    status['savdat2'] = str(status['savdat1'])
    status['name'] = name
    status['poscoll'] = poscoll
    status['resnam'] = resnam
    status['allsets'] = allsets
    for i in allsets:
        print i.cost
    print 'printall', len(allsets), len(allsets[0])
    status['allconditions'] = allconditions
    save_obj(status, name + '_part')
    os.chdir(cwdx)
    return status
def savstatus2(savstatdir, name, comment1, comment2, datver, scriptver,
               precalc, resnam, poscoll, resultcoll, setparameters, allsets,
               dataset):
    status = {}
    cwdx = os.getcwd()
    os.chdir(savstatdir)
    status['savdat1'] = datetime.now()
    status['savdat2'] = str(status['savdat1'])
    status['name'] = name
    status['precalc'] = precalc
    status['comment1'] = comment1
    status['comment2'] = comment2
    status['poscoll'] = poscoll
    status['resnam'] = resnam
    status['resultcoll'] = resultcoll
    status['datver'] = datver
    status['scriptver'] = scriptver
    status['setparameters'] = setparameters
    status['allsets'] = allsets
    status['dataset'] = dataset
    save_obj(status, name)
    os.chdir(cwdx)
    return status
def loadss(savstatdir, name):
    cwdx = os.getcwd()
    os.chdir(savstatdir)
    ss = load_obj(name + '_ss.dat')
    os.chdir(cwdx)
    return ss
def savss(savstatdir, spinsystems, name):
    cwdx = os.getcwd()
    os.chdir(savstatdir)
    save_obj(spinsystems, name + '_ss.dat')
    os.chdir(cwdx)