예제 #1
0
파일: toolsFit.py 프로젝트: htlemke/ixppy
def pearsonVIIsplit(xdata,Amp,xc,H,A,mL,mH):
  #% Usage: [ycalc] = pearsonVIIsplit(X, xdata)
  #% Split pearson VII peak profile as described in 
  #% Toraya, H. (1990). "Array-Type Universal Profile 
  #% Function for Powder Pattern Fitting." 
  #% Journal of Applied Crystallography 23: 485-491. 
  #%
  #% I would be interested in another version where the profile is
  #% ANALYTICALLY convoluted with a rectangular function of certain width.
  #% I tried one day, it should work, but I gave up.
  #% 
  #% Henrik T. Lemke, March 2009
  # Amp=height
  # xc = center
  # H = FWHM
  # A = assymetry, symmetric is 1
  # mL,mH = wings >=1

  xdata = np.asarray(iterfy(xdata))

  ycalc = np.zeros_like(xdata)
  ycalc[xdata<=xc] = Amp*2.*(1+A)/(np.sqrt(np.pi)*H)\
      *((A*gamma(mL-.5))/(np.sqrt(2.**(1./mL)-1)*gamma(mL)) \
    + gamma(mH-.5)/(np.sqrt(2.**(1./mH)-1)*gamma(mH)))**(-1)\
    *(1 + (2.**(1./mL)-1)*((1+A)/A)**2 * ((xdata[xdata<=xc]-xc)/H)**2) **(-mL)
  A = 1/A
  ycalc[xdata>xc] = Amp*2.*(1+A)/(np.sqrt(np.pi)*H)\
      *((A*gamma(mH-.5))/(np.sqrt(2.**(1./mH)-1)*gamma(mH)) \
    + gamma(mL-.5)/(np.sqrt(2.**(1./mL)-1)*gamma(mL)))**(-1)\
    *(1 + (2.**(1./mH)-1)*((1+A)/A)**2 * ((xdata[xdata>xc]-xc)/H)**2) **(-mH)
  return ycalc
예제 #2
0
def gamdel2Qfib(gamma,delta,alpha,lam):
  gamma = np.array(iterfy(gamma))
  delta = np.array(iterfy(delta))

  shpgam = np.shape(gamma)
  shpdel = np.shape(delta)
  if not shpgam==shpdel:
    logbook("gamma and delta array must have same shape!")
    return
  gamma = gamma.ravel()
  delta = delta.ravel()
  Qs =  2*np.pi/lam * np.array((-rotmat3D([0,1,0],-alpha))*np.mat([
    np.cos(delta)*np.cos(gamma)-1,
    -np.cos(delta)*np.sin(gamma),
    -np.sin(delta)]))
  Qip = np.sign(Qs[1,:])*np.sqrt(Qs[0,:]**2+Qs[1,:]**2);
  Qop = Qs[2,:]
  Qip = Qip.reshape(shpgam)
  Qop = Qop.reshape(shpgam)
  return Qip,Qop
예제 #3
0
파일: lsfHelper.py 프로젝트: htlemke/ixppy
def applyOnRunlist(input,runnos,experiment,save=True,cacheDir='',identifier=''):
  if type(input) is str:
    fina = input
  elif type(input) is list:
    funcs = input
    fina = writePyFile(funcs,experiment=experiment,save=save,identifier=identifier,cacheDir=cacheDir)
  returns = []
  for runno in runnos:
    if len(iterfy(runno))>1:
      returns.append(applyFileOnRun(fina,runno))
    else:
      returns.append(applyFileOnRun(fina,[runno]))
  return returns