def runTest(self): step = 0.040 run1QLow = 0.010 run1QHigh = 0.06 run2QLow = 0.035 run2QHigh = 0.300 # Create IvsQ workspaces IvsQ1 = self.doQuickOnRun(runNumber=13460, transmissionNumbers=[13463, 13464], instrument='INTER', incidentAngle=0.7) IvsQ1Binned = Rebin(InputWorkspace=IvsQ1, Params=self.createBinningParam( run1QLow, -step, run1QHigh)) # Create IvsQ workspaces IvsQ2 = self.doQuickOnRun(runNumber=13462, transmissionNumbers=[13463, 13464], instrument='INTER', incidentAngle=2.3) IvsQ2Binned = Rebin(InputWorkspace=IvsQ2, Params=self.createBinningParam( run2QLow, -step, run2QHigh)) # Perform the stitching combineMulti.combineDataMulti( [IvsQ1Binned.name(), IvsQ2Binned.name()], self.__stitchedWorkspaceName, [run1QLow, run2QLow], [run1QHigh, run2QHigh], run1QLow, run2QHigh, -step, 1)
def runTest(self): step = 0.040 run1QLow = 0.010 run1QHigh = 0.06 run2QLow = 0.035 run2QHigh = 0.300 # Create IvsQ workspaces IvsQ1 = self.doQuickOnRun(runNumber=13460, transmissionNumbers=[13463,13464], instrument='INTER', incidentAngle=0.7) IvsQ1Binned = Rebin(InputWorkspace=IvsQ1, Params=self.createBinningParam(run1QLow, -step, run1QHigh)) # Create IvsQ workspaces IvsQ2 = self.doQuickOnRun(runNumber=13462, transmissionNumbers=[13463,13464], instrument='INTER', incidentAngle=2.3) IvsQ2Binned = Rebin(InputWorkspace=IvsQ2, Params=self.createBinningParam(run2QLow, -step, run2QHigh)) # Peform the stitching combineMulti.combineDataMulti([IvsQ1Binned.name(), IvsQ2Binned.name()], self.__stitchedWorkspaceName, [run1QLow, run2QLow], [run1QHigh, run2QHigh], run1QLow, run2QHigh, -step, 1)
def AutoReduce(transRun=[], runRange=[], oldList=[]): tupsort = MakeTuples(run_titles) sortedList = SortRuns(tupsort) newList = [item for item in sortedList if item not in oldList] for sample in newList: wq_list = [] overlapLow = [] overlapHigh = [] for item in sample: runno = item[0] angle = item[1] runnos = runno.split('+') # check if runs have been added together runnos = [int(i) for i in runnos] try: angle = float(angle) except ValueError: angle = 0.0 print("Could not determine theta! Skipping run.") if len(runRange) and not len(set(runRange) & set(runnos)): angle = 0.0 # will be skipped below if float(angle) > 0.0: ws = str(runno) # w1 = mtd[runno + '.raw'] # spectra = w1.getRun().getLogData('nspectra').value if not mtd.doesExist(runno + '_IvsQ'): th = angle if len(transRun) > 1 and angle > 2.25: wq, wq_binned = \ ReflectometryReductionOneAuto( InputWorkspace=ws, FirstTransmissionRun=transRun[1], thetaIn=angle, OutputWorkspace=runno + '_IvsQ', OutputWorkspaceWavelength=runno + '_IvsLam', OutputWorkspaceBinned=runno + '_IvsQ_binned') else: wq, wqbinned = \ ReflectometryReductionOneAuto( InputWorkspace=ws, FirstTransmissionRun=transRun[0], thetaIn=angle, OutputWorkspace=runno + '_IvsQ', OutputWorkspaceWavelength=runno + '_IvsLam', OutputWorkspaceBinned=runno + '_IvsQ_binned') else: wq = mtd[runno + '_IvsQ'] th = angle wq_list.append(runno + '_IvsQ') inst = wq.getInstrument() lmin = inst.getNumberParameter('LambdaMin')[0] + 1 lmax = inst.getNumberParameter('LambdaMax')[0] - 2 qmin = 4 * math.pi / lmax * math.sin(th * math.pi / 180) qmax = 4 * math.pi / lmin * math.sin(th * math.pi / 180) overlapLow.append(qmin) overlapHigh.append(qmax) dqq = NRCalculateSlitResolution(Workspace=wq, TwoTheta=angle) if len(wq_list): w1 = getWorkspace(wq_list[0]) w2 = getWorkspace(wq_list[-1]) Qmin = min(w1.readX(0)) Qmax = max(w2.readX(0)) Qmax = 0.3 # print(Qmin, Qmax, dqq) # print(overlapHigh) if len(wq_list) > 1: outputwksp = wq_list[0].split( '_')[0] + '_' + wq_list[-1].split('_')[0][3:] else: outputwksp = wq_list[0].split('_')[0] + '_IvsQ_binned' if not mtd.doesExist(outputwksp): combineDataMulti(wq_list, outputwksp, overlapLow, overlapHigh, Qmin, Qmax, -dqq, 0, keep=True) return sortedList
def AutoReduce(transRun=[], runRange=[], oldList=[]): tupsort = MakeTuples(run_titles) sortedList = SortRuns(tupsort) newList = [item for item in sortedList if item not in oldList] for sample in newList: wq_list = [] overlapLow = [] overlapHigh = [] for item in sample: runno = item[0] angle = item[1] runnos = runno.split('+') # check if runs have been added together runnos = [int(i) for i in runnos] try: angle = float(angle) except ValueError: angle = 0.0 print("Could not determine theta! Skipping run.") if len(runRange) and not len(set(runRange) & set(runnos)): angle = 0.0 # will be skipped below if float(angle) > 0.0: ws = str(runno) # w1 = mtd[runno + '.raw'] # spectra = w1.getRun().getLogData('nspectra').value if not mtd.doesExist(runno + '_IvsQ'): th = angle if len(transRun) > 1 and angle > 2.25: wq, wq_binned = \ ReflectometryReductionOneAuto( InputWorkspace=ws, FirstTransmissionRun=transRun[1], thetaIn=angle, OutputWorkspace=runno + '_IvsQ', OutputWorkspaceWavelength=runno + '_IvsLam', OutputWorkspaceBinned=runno + '_IvsQ_binned') else: wq, wqbinned = \ ReflectometryReductionOneAuto( InputWorkspace=ws, FirstTransmissionRun=transRun[0], thetaIn=angle, OutputWorkspace=runno + '_IvsQ', OutputWorkspaceWavelength=runno + '_IvsLam', OutputWorkspaceBinned=runno + '_IvsQ_binned') else: wq = mtd[runno + '_IvsQ'] th = angle wq_list.append(runno + '_IvsQ') inst = wq.getInstrument() lmin = inst.getNumberParameter('LambdaMin')[0] + 1 lmax = inst.getNumberParameter('LambdaMax')[0] - 2 qmin = 4 * math.pi / lmax * math.sin(th * math.pi / 180) qmax = 4 * math.pi / lmin * math.sin(th * math.pi / 180) overlapLow.append(qmin) overlapHigh.append(qmax) dqq = NRCalculateSlitResolution(Workspace=wq, TwoTheta=angle) if len(wq_list): w1 = getWorkspace(wq_list[0]) w2 = getWorkspace(wq_list[-1]) Qmin = min(w1.readX(0)) Qmax = max(w2.readX(0)) Qmax = 0.3 # print(Qmin, Qmax, dqq) # print(overlapHigh) if len(wq_list) > 1: outputwksp = wq_list[0].split('_')[0] + '_' + wq_list[-1].split('_')[0][3:] else: outputwksp = wq_list[0].split('_')[0] + '_IvsQ_binned' if not mtd.doesExist(outputwksp): combineDataMulti( wq_list, outputwksp, overlapLow, overlapHigh, Qmin, Qmax, -dqq, 0, keep=True) return sortedList