예제 #1
0
 def load(self, runno, norm=True, path=False, focus=True):
     if path:
         wkspname = runno.split('|')[0]
         FileLoc = runno.split('|')[1]
     elif self.isave:
         ofile = open('//isis/inst$/NDX' + self.Instr.name + '/Instrument/logs/lastrun.txt', 'r')
         lstrun = str(int(ofile.readlines()[0].split()[1]) + 1)
         if runno < 10:
             FileLoc = self.Instr.pc_comp + '/' + self.Instr.sname + lstrun + '.s' + '0' + str(runno)
         else:
             FileLoc = self.Instr.pc_comp + '/' + self.Instr.sname + lstrun + '.s' + str(runno)
         print FileLoc
         wkspname = str(lstrun) + '_' + str(runno)
         tempwkspc = LoadRaw(Filename=FileLoc, OutputWorkspace=wkspname)
         self.wkspaces[wkspname] = tempwkspc
     else:
         FileLoc = rawpath(runno, inst=self.Instr.sname) + '\\' + self.Instr.sname + str(runno) + '.raw'
         if not os.path.exists(FileLoc):
             print 'File not found expected in directory ' + FileLoc + '\n'
             print 'use a.load("wksp|filepath", path=True) instead'
             return
         wkspname = str(runno)
     print FileLoc
     tempwkspc = LoadRaw(Filename=FileLoc, OutputWorkspace=wkspname)
     self.wkspaces[wkspname] = tempwkspc
     if norm:
         NormaliseByCurrent(InputWorkspace=wkspname, OutputWorkspace=wkspname)
     if focus:
         AlignDetectors(InputWorkspace=wkspname, OutputWorkspace=wkspname, CalibrationFile=self.Instr.grpOfffile)
         DiffractionFocussing(InputWorkspace=wkspname, OutputWorkspace=wkspname,
                              GroupingFileName=self.Instr.grpOfffile)
         blist = range(1, self.Instr.nbank + 1)
         cry_load.split_bank(wkspname, blist, Del=True)
예제 #2
0
파일: cry_focus.py 프로젝트: mducle/mantid
def divide_samp_vana(EXPR_FILE, Norm):
    print " => SAMPLE FOCUSED"
    if not EXPR_FILE.dataRangeSet:
        cry_load.sets_drange("sample", EXPR_FILE)
    cry_load.split_bank("sample", EXPR_FILE.bankList, Del=False)
    if Norm:
        # === Optional normalization ===
        for i in EXPR_FILE.bankList:
            RebinToWorkspace(WorkspaceToRebin="Vanadium-" + str(i), WorkspaceToMatch="sample-" + str(i),
                             OutputWorkspace="Vanadium-" + str(i))
            Divide(LHSWorkspace="sample-" + str(i), RHSWorkspace="Vanadium-" + str(i),
                   OutputWorkspace="ResultD-" + str(i))
    else:
        for i in EXPR_FILE.bankList:
            RenameWorkspace(InputWorkspace="sample-" + str(i), OutputWorkspace="ResultD-" + str(i))
예제 #3
0
def divide_samp_vana(EXPR_FILE, Norm):
    print " => SAMPLE FOCUSED"
    if not EXPR_FILE.dataRangeSet:
        cry_load.sets_drange("sample", EXPR_FILE)
    cry_load.split_bank("sample", EXPR_FILE.bankList, Del=False)
    if Norm:
        # === Optional normalization ===
        for i in EXPR_FILE.bankList:
            RebinToWorkspace(WorkspaceToRebin="Vanadium-" + str(i), WorkspaceToMatch="sample-" + str(i),
                             OutputWorkspace="Vanadium-" + str(i))
            Divide(LHSWorkspace="sample-" + str(i), RHSWorkspace="Vanadium-" + str(i),
                   OutputWorkspace="ResultD-" + str(i))
    else:
        for i in EXPR_FILE.bankList:
            RenameWorkspace(InputWorkspace="sample-" + str(i), OutputWorkspace="ResultD-" + str(i))
예제 #4
0
def strip_the_vana(EXPR_FILE, LoadUnstrip=""):
    if LoadUnstrip:
        LoadNexusProcessed(Filename=LoadUnstrip, OutputWorkspace="Vanadium", EntryNumber=1)
    print EXPR_FILE.bankList
    cry_load.split_bank("Vanadium", bankList=EXPR_FILE.bankList, Del=True)
    if EXPR_FILE.VanPeakRemove == "interpol":
        print " => Van Bragg-peak stripping"
        print "Smmoth Vana data with " + EXPR_FILE.VanSmooth + " points"
        remove_bins(EXPR_FILE)
    elif EXPR_FILE.VanPeakRemove == "strip":
        print " => Van Bragg-peak stripping"
        van_strip(EXPR_FILE)
    elif EXPR_FILE.VanPeakRemove == "spline":
        van_spline(EXPR_FILE)
    elif EXPR_FILE.VanPeakRemove == "splineonly":
        van_spline_only(EXPR_FILE)
    else:
        return
    save_vana(EXPR_FILE)
예제 #5
0
def strip_the_vana(EXPR_FILE, LoadUnstrip=""):
    if LoadUnstrip:
        LoadNexusProcessed(Filename=LoadUnstrip, OutputWorkspace="Vanadium", EntryNumber=1)
    print EXPR_FILE.bankList
    cry_load.split_bank("Vanadium", bankList=EXPR_FILE.bankList, Del=True)
    if EXPR_FILE.VanPeakRemove == "interpol":
        print " => Van Bragg-peak stripping"
        print "Smmoth Vana data with " + EXPR_FILE.VanSmooth + " points"
        remove_bins(EXPR_FILE)
    elif EXPR_FILE.VanPeakRemove == "strip":
        print " => Van Bragg-peak stripping"
        van_strip(EXPR_FILE)
    elif EXPR_FILE.VanPeakRemove == "spline":
        van_spline(EXPR_FILE)
    elif EXPR_FILE.VanPeakRemove == "splineonly":
        van_spline_only(EXPR_FILE)
    else:
        return
    save_vana(EXPR_FILE)