def __init__(self,fn='../dat/23JUL12/23JUL12_0021'\ 'Data4Phi135.txt',isym=False): self.detectors = read(fn) self.phi = self.detectors[0].phi self.ndetectors = len(self.detectors) self.ndet = self.ndetectors # combine detectors for a single phi self.ppscans = [] self.psis = [] for i in xrange(self.ndet): det = self.detectors[i] for j in xrange(len(det.ppscans)): p = det.ppscans[j] self.psis.append(p.psi) self.ppscans.append(p) # sort self.ppscans based on self.psis self.psis, idx = ssort.shellSort(self.psis) self.ppscans = ind_swap(self.ppscans,idx) self.npsi = len(self.psis) # symmetrize the d-spacings... if isym: import copy for i in xrange(len(self.ppscans)/2): i0 = i i1 = -i - 1 p0 = copy.deepcopy(self.ppscans[i0]) p1 = copy.deepcopy(self.ppscans[i1]) #print p0.psi, p1.psi self.ppscans[i0].dspc=(p0.dspc+p1.dspc)/2. self.ppscans[i1].dspc=(p0.dspc+p1.dspc)/2.
def __init__(self,fn='../dat/23JUL12/23JUL12_0021'\ 'Data4Phi135.txt',isym=False): self.detectors = read(fn) self.phi = self.detectors[0].phi self.ndetectors = len(self.detectors) self.ndet = self.ndetectors # combine detectors for a single phi self.ppscans = [] self.psis = [] for i in xrange(self.ndet): det = self.detectors[i] for j in xrange(len(det.ppscans)): p = det.ppscans[j] self.psis.append(p.psi) self.ppscans.append(p) # sort self.ppscans based on self.psis self.psis, idx = ssort.shellSort(self.psis) self.ppscans = ind_swap(self.ppscans, idx) self.npsi = len(self.psis) # symmetrize the d-spacings... if isym: import copy for i in xrange(len(self.ppscans) / 2): i0 = i i1 = -i - 1 p0 = copy.deepcopy(self.ppscans[i0]) p1 = copy.deepcopy(self.ppscans[i1]) #print p0.psi, p1.psi self.ppscans[i0].dspc = (p0.dspc + p1.dspc) / 2. self.ppscans[i1].dspc = (p0.dspc + p1.dspc) / 2.
def sort_sin2psi(self): self.sin2psi, idx = ssort.shellSort(self.sin2psi) self.psis=ind_swap(self.psis,idx) self.dspc=ind_swap(self.dspc,idx) self.th2=ind_swap(self.th2,idx) self.fwhm=ind_swap(self.fwhm,idx) self.ints=ind_swap(self.ints,idx) self.add_ppscans()
def sort_sin2psi(self): self.sin2psi, idx = ssort.shellSort(self.sin2psi) self.psis = ind_swap(self.psis, idx) self.dspc = ind_swap(self.dspc, idx) self.th2 = ind_swap(self.th2, idx) self.fwhm = ind_swap(self.fwhm, idx) self.ints = ind_swap(self.ints, idx) self.add_ppscans()
def put_psi_offset(self,offset=0.0): for idet in xrange(self.ndet): det = self.detectors[idet] for j in xrange(len(det.ppscans)): det.ppscans[j].put_psi_offset(offset) self.psis = self.psis + offset self.psis, idx = ssort.shellSort(self.psis) self.ppscans = ind_swap(self.ppscans,idx) self.npsi = len(self.psis)
def put_psi_offset(self, offset=0.0): for idet in xrange(self.ndet): det = self.detectors[idet] for j in xrange(len(det.ppscans)): det.ppscans[j].put_psi_offset(offset) self.psis = self.psis + offset self.psis, idx = ssort.shellSort(self.psis) self.ppscans = ind_swap(self.ppscans, idx) self.npsi = len(self.psis)