Exemplo n.º 1
0
def data(request):
    mode = request.POST['mode']
    try:
	fp = request.FILES['file']
    except:
	return HttpResponse('Key error')
    handle_uploaded_file(fp)
    go = True
    if mode == 'GSAS' or mode =='GSASTOF':
	go = False
	for line in fp:
	    if len(line.split()) > 0:
		if line.split()[0] == 'BANK':
		    if len(line.split()) == 10:
			go = True
    elif mode == 'XYSIGMA':
	go = False
	ln3 = False
	ln2 = False
	for line in fp:
	    if len(line.split()) >= 3:
		if ln3:
		    ln2 = True
		ln3 = True
	    elif len(line.split()) >= 2:
		ln2 = True
	if ln3 and ln2:
	    go = True
    if go == True:
	(tt, observed, error) = H.readIllData(os.path.join('/tmp/bland',str(fp.name)), str(mode), None)
    else:
	return HttpResponse('Sorry, this didn\'t work')    
    request.session['tt'], request.session['obs'] = tt, observed
    ret = json.dumps([list(tt), list(observed), list(error)])
    return HttpResponse(ret)
Exemplo n.º 2
0
def data(request):
    mode = request.POST['mode']
    try:
        fp = request.FILES['file']
    except:
        return HttpResponse('Key error')
    handle_uploaded_file(fp)
    go = True
    if mode == 'GSAS' or mode == 'GSASTOF':
        go = False
        for line in fp:
            if len(line.split()) > 0:
                if line.split()[0] == 'BANK':
                    if len(line.split()) == 10:
                        go = True
    elif mode == 'XYSIGMA':
        go = False
        ln3 = False
        ln2 = False
        for line in fp:
            if len(line.split()) >= 3:
                if ln3:
                    ln2 = True
                ln3 = True
            elif len(line.split()) >= 2:
                ln2 = True
        if ln3 and ln2:
            go = True
    if go == True:
        (tt, observed,
         error) = H.readIllData(os.path.join('/tmp/bland', str(fp.name)),
                                str(mode), None)
    else:
        return HttpResponse('Sorry, this didn\'t work')
    request.session['tt'], request.session['obs'] = tt, observed
    ret = json.dumps([list(tt), list(observed), list(error)])
    return HttpResponse(ret)
Exemplo n.º 3
0
import hkl_model as Mod
np.seterr(divide="ignore", invalid="ignore")

DATAPATH = os.path.dirname(os.path.abspath(__file__))
backgFile = os.path.join(DATAPATH, "ce1.bac")
observedFile = os.path.join(DATAPATH, "ceo2.dat")
infoFile = os.path.join(DATAPATH, "ce1.pcr")

(spaceGroup, crystalCell, atoms) = H.readInfo(infoFile)
wavelength = 1.540560  #+1.544330
backg = H.LinSpline(None)
ttMin = 25.0
ttMax = 143.0
ttStep = 0.0249947045118
exclusions = None
tt, observed, error = H.readIllData(observedFile, "", backgFile)


def fit():
    # PYTHONPATH=. bumps Al2O3.py --fit=dream --store=M1 --burn=100 --steps=500
    cell = Mod.makeCell(crystalCell, spaceGroup.xtalSystem())
    cell.a.pm(0.5)
    m = Mod.Model(tt,
                  observed,
                  backg,
                  0,
                  0,
                  1,
                  wavelength,
                  spaceGroup,
                  cell,
Exemplo n.º 4
0
import hkl_model as Mod
np.seterr(divide="ignore", invalid="ignore")

DATAPATH = os.path.dirname(os.path.abspath(__file__))
backgFile = os.path.join(DATAPATH, "ybacud1a.bac")
observedFile = os.path.join(DATAPATH, "ybacud1a.dat")
infoFile = os.path.join(DATAPATH, "ybacud1a.pcr")

(spaceGroup, crystalCell, atoms) = H.readInfo(infoFile)
wavelength = 1.907972
backg = H.LinSpline(None)
ttMin = 0.0
ttMax = 155.449996948
ttStep = 0.0499839218483
exclusions = [[0, 6], [155.45, 180]]
tt, observed = H.readIllData(observedFile, "D1A", backgFile)


def fit():
    # PYTHONPATH=. bumps Al2O3.py --fit=dream --store=M1 --burn=100 --steps=500
    cell = Mod.makeCell(crystalCell, spaceGroup.xtalSystem())
    cell.a.pm(0.5)
    cell.b.pm(0.5)
    cell.c.pm(0.5)
    m = Mod.Model(tt,
                  observed,
                  backg,
                  0,
                  0,
                  1,
                  wavelength,
Exemplo n.º 5
0
import hkl_model as Mod
np.seterr(divide="ignore", invalid="ignore")    

DATAPATH = os.path.dirname(os.path.abspath(__file__))
backgFile = os.path.join(DATAPATH,"pbso4.bac")
observedFile = os.path.join(DATAPATH,"pbso4.dat")
infoFile = os.path.join(DATAPATH,"pbso4.pcr")

(spaceGroup, crystalCell, atoms) = H.readInfo(infoFile)
wavelength = 1.912000
backg = H.LinSpline(None)
ttMin = 10
ttMax = 155.449996948
ttStep = 0.0499828168207
exclusions = None #[[0,10],[154,180]]
tt, observed, error = H.readIllData(observedFile, "D1A", backgFile)
def fit():
    # PYTHONPATH=. bumps Al2O3.py --fit=dream --store=M1 --burn=100 --steps=500
    cell = Mod.makeCell(crystalCell, spaceGroup.xtalSystem)
    cell.a.pm(0.5)
    cell.b.pm(0.5)
    cell.c.pm(0.5)
    m = Mod.Model(tt, observed, backg, 0, 0, 1, wavelength, spaceGroup, cell,
                atoms, exclusions, base=min(observed), zero=-0.09459, error=error, eta=0)
    m.u.range(0,1)
    m.zero.pm(0.5)
    m.v.range(-1,0)
    m.w.range(0,1)
    m.eta.range(0,1)
    m.scale.range(0,100)
    m.base.pm(500)
Exemplo n.º 6
0
backgFile = os.path.join(DATAPATH,r"hobk_bas.bac")
observedFile = os.path.join(DATAPATH,r"hobk.dat")
infoFile = os.path.join(DATAPATH,r"hobk.cfl")

(spaceGroup, crystalCell, magAtomList, symmetry) = H.readMagInfo(infoFile)
atomList = H.readInfo(infoFile)[2]

wavelength = 2.524000
ttMin = 10.010000228881836
ttMax = 89.81000518798828
ttStep = 0.20000000298
exclusions = []

#print H.getMaxNumRef(H.getS(ttMax, wavelength), crystalCell.volume)

tt, observed = H.readIllData(observedFile, "D1B", backgFile)
#print H.getMaxNumRef(H.getS(ttMax, wavelength), crystalCell.volume)
#sMin, sMax = H.getS(ttMin, wavelength), H.getS(ttMax, wavelength)
#refList = H.hklGen(spaceGroup, crystalCell, sMin, sMax, True)
#print len(refList)
#print len(H.satelliteGen(crystalCell, symmetry, sMax, refList))
backg = H.LinSpline(None)
#print backg
basisSymmetry = copy(symmetry)
if (basisSymmetry.centerType() == 2):
    # change to acentric
    basisSymmetry.setCenterType(1)
basisSymmetry.setNumIrreps(1)

## Number of the basis from BasIreps (1-6)
basisIndex = 2