예제 #1
0
 	def ReduceArbitary(self):
 	
 		#try:
		WB,Runs=self.getRuns()
		print Runs, type(Runs)
		
		iliad_setup(self.shortname)
		mapfile=str(self.ui.mapfile.text())
		cal_file=self.shortname+WB+self.exten
		
		
		if self.sumRunsCheck==True:
		#sum runs
			Load(Filename=Runs[0],OutputWorkspace='SummedWksp',Cache=r'Never',LoadLogFiles='0')
			SummedWksp=mtd['SummedWksp']
			for i in range(1,len(Runs)):
				Load(Filename=Runs[i],OutputWorkspace='tmp',Cache=r'Never',LoadLogFiles='0')
				tmp=mtd['tmp']
				SummedWksp=SummedWksp+tmp
			DeleteWorkspace('tmp')
			#overwrite the runs list with 1 entry corresponding to the summed data
			Runs=['SummedWksp']
		
		for Run in Runs:
		
			if self.AutoEi==True:
				ei,rebin_params,self.BkgdRange=autoEi(str(Run),BkgdGen=True,monspecin=int(self.ui.MonSpecNumber.text())) 
			else:
				ei=double(self.ui.EiGuess.text())
				rebin_params=str(-ei*.5)+','+str(ei*(2.5e-3))+','+str(ei*.95)	
		
			#w1=iliad(WB,Run,ei,rebin_params,mapfile,det_cal_file=cal_file,norm_method='current')
			if self.BkgSwitch==True:
				w1=iliad(WB,str(Run),ei,rebin_params,mapfile,det_cal_file=cal_file,norm_method=self.Normalisation,save_format='',background=self.BkgSwitch,bkgd_range=self.BkgdRange)
				RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
			else:
				w1=iliad(WB,str(Run),ei,rebin_params,mapfile,det_cal_file=cal_file,norm_method=self.Normalisation,save_format='')
				RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
		
		
		WkspOut=str(self.ui.outputWksp.text())
		
		if len(WkspOut)>0:
			RenameWorkspace(InputWorkspace=str(Run)+'reduced',OutputWorkspace=str(self.ui.outputWksp.text()))
		else:
			RenameWorkspace(InputWorkspace=str(Run)+'reduced',OutputWorkspace='mar'+str(Run)+'reduced')
			
		String=':) Run '+str(Run)+' reduced successfully ei guess ='+str(ei)+'meV'+' data rebinned with Emin,deltaE,Emax of '+rebin_params
		self.ui.ReduceOutput.addItem(String)
예제 #2
0
from qtiGenie import *
from PySlice2 import *
from autoEi import *
inst='mar'
iliad_setup(inst)
ext='.raw'
mapfile='mari_res2012'
#det_cal_file must be specified if the reduction sends out put to a workpsace
#cal_file='MAR17578.raw'
cal_file='MAR18040.raw'
#load vanadium file

run='18249'
WB='18040'
ei,rebin_params=autoEi(str(run))
w1=iliad(WB,run,ei,rebin_params,mapfile,det_cal_file=cal_file,norm_method='current')

run='18313'
WB='18040'
ei,rebin_params=autoEi(str(run))
w2=iliad(WB,run,ei,rebin_params,mapfile,det_cal_file=cal_file,norm_method='current',save_format='')

run='18322'
WB='18040'
ei,rebin_params=autoEi(str(run))
w3=iliad(WB,run,ei,rebin_params,mapfile,det_cal_file=cal_file,norm_method='current',save_format='')


run='18069'
WB='18040'
ei,rebin_params=autoEi(str(run))
예제 #3
0
파일: red_debug.py 프로젝트: abuts/Python
inst = 'mar'
iliad_setup(inst)
ext = '.raw'
#mapfile='mari_res2012'

mapfile = 'mari_res2013'

#det_cal_file must be specified if the reduction sends out put to a workspace
#cal_file='MAR17578.raw'
cal_file = 'MAR18622.raw'
#load vanadium file

run = '17690'
WB = '18622'
ei, rebin_params, BkgdRange = autoEi(str(run),
                                     BkgdGen=True,
                                     monspecin=2,
                                     BkgdLevel=.4)
print "ei = ", ei
print "rebin_params = ", rebin_params
#print "BkgdRange = ",BkgdRange,bkgd_range = BkgdRange

w1 = iliad(WB,
           run,
           ei,
           rebin_params,
           mapfile,
           det_cal_file=cal_file,
           norm_method='current',
           bkgd_range=[14500, 18000])
 	def ReduceArbitary(self):
 	
 		#try:
		WB,Runs=self.getRuns()
		print Runs, type(Runs)
		
		if Runs=='current':
			#get live data
			StartLiveData(UpdateEvery='0',Instrument='MARI',AccumulationMethod="Replace", OutputWorkspace='CurrentRun')
			Runs=['CurrentRun']

		dgreduce.setup(self.shortname)
		mapfile=str(self.ui.mapfile.text())
		cal_file=self.shortname+WB+self.exten
		
		
		if self.sumRunsCheck==True:
		#sum runs
			Load(Filename=Runs[0],OutputWorkspace='SummedWksp',Cache=r'Never',LoadLogFiles='0')
			SummedWksp=mtd['SummedWksp']
			for i in range(1,len(Runs)):
				Load(Filename=Runs[i],OutputWorkspace='tmp',Cache=r'Never',LoadLogFiles='0')
				tmp=mtd['tmp']
				SummedWksp=SummedWksp+tmp
			DeleteWorkspace('tmp')
			#overwrite the runs list with 1 entry corresponding to the summed data
			Runs=['SummedWksp']
		
		for Run in Runs:
		
			if self.AutoEi==True:
				ei,rebin_params,self.BkgdRange=autoEi(str(Run),BkgdGen=True,monspecin=int(self.ui.MonSpecNumber.text())) 
			else:
				ei=self.EiVal
				deltaEi=(ei*.01)/20.0
				rebin_params=str(-ei*.5)+','+str(deltaEi)+','+str(ei*.95)	
		
			#w1=iliad(WB,Run,ei,rebin_params,mapfile,det_cal_file=cal_file,norm_method='current')
			if self.FixEi == True:
				if self.BkgSwitch==True:
					w1=iliad(WB,str(Run),ei,rebin_params,mapfile,det_cal_file=cal_file,fixei=True,norm_method=self.Normalisation,save_format='',background=self.BkgSwitch,bkgd_range=self.BkgdRange)
					RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
				else:
					w1=iliad(WB,str(Run),ei,rebin_params,mapfile,det_cal_file=cal_file,norm_method=self.Normalisation,background=False,fixei=True,save_format='')
					RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
			else:
				if self.BkgSwitch==True:
					w1=iliad(WB,str(Run),ei,rebin_params,mapfile,det_cal_file=cal_file,norm_method=self.Normalisation,save_format='',background=self.BkgSwitch,bkgd_range=self.BkgdRange)
					RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
				else:
					w1=iliad(WB,str(Run),ei,rebin_params,mapfile,det_cal_file=cal_file,background=False,norm_method=self.Normalisation,save_format='')
					RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
		
		WkspOut=str(self.ui.outputWksp.text())
		
		if len(WkspOut)>0:
			RenameWorkspace(InputWorkspace=str(Run)+'reduced',OutputWorkspace=str(self.ui.outputWksp.text()))
		else:
			RenameWorkspace(InputWorkspace=str(Run)+'reduced',OutputWorkspace='mar'+str(Run)+'reduced')
			
		String=':) Run '+str(Run)+' reduced successfully ei guess ='+str(ei)+'meV'+' data rebinned with Emin,deltaE,Emax of '+rebin_params
		self.ui.ReduceOutput.addItem(String)
 	def ReduceArbsolute(self):
 		#absolute normalisation will be preformed
 		#try:
		WB,Runs=self.getRuns()
		print Runs, type(Runs)
		
		iliad_setup(self.shortname)
		mapfile=str(self.ui.mapfile.text())
		cal_file=self.shortname+WB+self.exten
		
		monoWB=str(self.ui.DetVanNum_2.text())
 		MonoRun=str(self.ui.MonoRunNum.text())
		
		sampleMass=double(self.ui.sampleMass.text())
		RMMmass=double(self.ui.RMMmass.text())
		
		monovan_mapfile=mapfile
		
		if self.sumRunsCheck==True:
		#sum runs
			Load(Filename=Runs[0],OutputWorkspace='SummedWksp',Cache=r'Never',LoadLogFiles='0')
			SummedWksp=mtd['SummedWksp']
			for i in range(1,len(Runs)):
				Load(Filename=Runs[i],OutputWorkspace='tmp',Cache=r'Never',LoadLogFiles='0')
				tmp=mtd['tmp']
				SummedWksp=SummedWksp+tmp
			DeleteWorkspace('tmp')
			#overwrite the runs list with 1 entry corresponding to the summed data
			Runs=['SummedWksp']
		
		for Run in Runs:
		
			if self.AutoEi==True:
				ei,rebin_params,self.BkgdRange=autoEi(str(Run),BkgdGen=True,monspecin=int(self.ui.MonSpecNumber.text()))
				#set the absolute van integration range
				tmp=rebin_params.split(',')
				monovanreb=[tmp[0],tmp[2]]
				
			else:
				ei=self.EiVal
				deltaEi=(ei*.01)/20.0
				rebin_params=str(-ei*.5)+','+str(deltaEi)+','+str(ei*.95)
				tmp=rebin_params.split(',')
				monovanreb=[tmp[0],tmp[2]]
			
			
			if self.FixEi == True:
				if self.BkgSwitch==True:
					w1=iliad_abs(str(WB),str(Run),str(MonoRun),str(monoWB),RMMmass,sampleMass,ei,rebin_params,mapfile,monovan_mapfile,det_cal_file=cal_file,fixei=True,norm_method=self.Normalisation,save_format='',abs_units_van_range=monovanreb,background=True,bkgd_range=self.BkgdRange)
					RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
				else:
					w1=iliad_abs(WB,str(Run),MonoRun,monoWB,RMMmass,sampleMass,ei,rebin_params,mapfile,monovan_mapfile,det_cal_file=cal_file,background=False,fixei=True,norm_method=self.Normalisation,save_format='',abs_units_van_range=monovanreb)
					RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
			else:
				if self.BkgSwitch==True:
					w1=iliad_abs(str(WB),str(Run),str(MonoRun),str(monoWB),RMMmass,sampleMass,ei,rebin_params,mapfile,monovan_mapfile,det_cal_file=cal_file,norm_method=self.Normalisation,save_format='',abs_units_van_range=monovanreb,background=True,bkgd_range=self.BkgdRange)
					RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
				else:
					w1=iliad_abs(WB,str(Run),MonoRun,monoWB,RMMmass,sampleMass,ei,rebin_params,mapfile,monovan_mapfile,det_cal_file=cal_file,background=False,norm_method=self.Normalisation,save_format='',abs_units_van_range=monovanreb)
					RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
		
		
		WkspOut=str(self.ui.outputWksp.text())
		
		if len(WkspOut)>0:
			RenameWorkspace(InputWorkspace=str(Run)+'reduced',OutputWorkspace=str(self.ui.outputWksp.text()))
		else:
			RenameWorkspace(InputWorkspace=str(Run)+'reduced',OutputWorkspace='mar'+str(Run)+'reduced')
			
		String=':) Run '+str(Run)+' reduced with absolute normalisation successfully ei guess ='+str(ei)+'meV'+' data rebinned with Emin,deltaE,Emax of '+rebin_params
		self.ui.ReduceOutput.addItem(String)
예제 #6
0
 	def ReduceArbsolute(self):
 		#absolute normalisation will be preformed
 		#try:
		WB,Runs=self.getRuns()
		print Runs, type(Runs)
		
		iliad_setup(self.shortname)
		mapfile=str(self.ui.mapfile.text())
		cal_file=self.shortname+WB+self.exten
		
		monoWB=str(self.ui.DetVanNum_2.text())
 		MonoRun=str(self.ui.MonoRunNum.text())
		
		sampleMass=double(self.ui.sampleMass.text())
		RMMmass=double(self.ui.RMMmass.text())
		
		monovan_mapfile=mapfile
		
		if self.sumRunsCheck==True:
		#sum runs
			Load(Filename=Runs[0],OutputWorkspace='SummedWksp',Cache=r'Never',LoadLogFiles='0')
			SummedWksp=mtd['SummedWksp']
			for i in range(1,len(Runs)):
				Load(Filename=Runs[i],OutputWorkspace='tmp',Cache=r'Never',LoadLogFiles='0')
				tmp=mtd['tmp']
				SummedWksp=SummedWksp+tmp
			DeleteWorkspace('tmp')
			#overwrite the runs list with 1 entry corresponding to the summed data
			Runs=['SummedWksp']
		
		for Run in Runs:
		
			if self.AutoEi==True:
				ei,rebin_params,self.BkgdRange=autoEi(str(Run),BkgdGen=True,monspecin=int(self.ui.MonSpecNumber.text()))
				#set the absolute van integration range
				tmp=rebin_params.split(',')
				monovanreb=[tmp[0],tmp[2]]
				
			else:
				ei=double(self.ui.EiGuess.text())
				rebin_params=str(-ei*.5)+','+str(ei*(2.5e-3))+','+str(ei*.95)	
				tmp=rebin_params.split(',')
				monovanreb=[tmp[0],tmp[2]]
				
			if self.BkgSwitch==True:
				w1=iliad_abs(str(WB),str(Run),str(MonoRun),str(monoWB),RMMmass,sampleMass,ei,rebin_params,mapfile,monovan_mapfile,det_cal_file=cal_file,norm_method=self.Normalisation,save_format='',abs_units_van_range=monovanreb,background=self.BkgSwitch,bkgd_range=self.BkgdRange)
				RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
			else:
				w1=iliad_abs(WB,str(Run),MonoRun,monoWB,RMMmass,sampleMass,ei,rebin_params,mapfile,monovan_mapfile,det_cal_file=cal_file,norm_method=self.Normalisation,save_format='',abs_units_van_range=monovanreb)
				RenameWorkspace(InputWorkspace='w1',OutputWorkspace=str(Run)+'reduced')
		
		
		WkspOut=str(self.ui.outputWksp.text())
		
		if len(WkspOut)>0:
			RenameWorkspace(InputWorkspace=str(Run)+'reduced',OutputWorkspace=str(self.ui.outputWksp.text()))
		else:
			RenameWorkspace(InputWorkspace=str(Run)+'reduced',OutputWorkspace='mar'+str(Run)+'reduced')
			
		String=':) Run '+str(Run)+' reduced with absolute normalisation successfully ei guess ='+str(ei)+'meV'+' data rebinned with Emin,deltaE,Emax of '+rebin_params
		self.ui.ReduceOutput.addItem(String)
예제 #7
0
    def ReduceArbitary(self):

        # try:
        WB, Runs = self.getRuns()
        print Runs, type(Runs)

        if Runs == "current":
            # get live data
            StartLiveData(
                UpdateEvery="0", Instrument="MARI", AccumulationMethod="Replace", OutputWorkspace="CurrentRun"
            )
            Runs = ["CurrentRun"]

        dgreduce.setup(self.shortname)
        mapfile = str(self.ui.mapfile.text())
        cal_file = self.shortname + WB + self.exten

        if self.sumRunsCheck == True:
            # sum runs
            Load(Filename=Runs[0], OutputWorkspace="SummedWksp", Cache=r"Never", LoadLogFiles="0")
            SummedWksp = mtd["SummedWksp"]
            for i in range(1, len(Runs)):
                Load(Filename=Runs[i], OutputWorkspace="tmp", Cache=r"Never", LoadLogFiles="0")
                tmp = mtd["tmp"]
                SummedWksp = SummedWksp + tmp
            DeleteWorkspace("tmp")
            # overwrite the runs list with 1 entry corresponding to the summed data
            Runs = ["SummedWksp"]

        for Run in Runs:

            if self.AutoEi == True:
                ei, rebin_params, self.BkgdRange = autoEi(
                    str(Run), BkgdGen=True, monspecin=int(self.ui.MonSpecNumber.text())
                )
            else:
                ei = self.EiVal
                deltaEi = (ei * 0.01) / 20.0
                rebin_params = str(-ei * 0.5) + "," + str(deltaEi) + "," + str(ei * 0.95)

                # w1=iliad(WB,Run,ei,rebin_params,mapfile,det_cal_file=cal_file,norm_method='current')
            if self.FixEi == True:
                if self.BkgSwitch == True:
                    w1 = iliad(
                        WB,
                        str(Run),
                        ei,
                        rebin_params,
                        mapfile,
                        det_cal_file=cal_file,
                        fixei=True,
                        norm_method=self.Normalisation,
                        save_format="",
                        background=self.BkgSwitch,
                        bkgd_range=self.BkgdRange,
                    )
                    RenameWorkspace(InputWorkspace="w1", OutputWorkspace=str(Run) + "reduced")
                else:
                    w1 = iliad(
                        WB,
                        str(Run),
                        ei,
                        rebin_params,
                        mapfile,
                        det_cal_file=cal_file,
                        norm_method=self.Normalisation,
                        background=False,
                        fixei=True,
                        save_format="",
                    )
                    RenameWorkspace(InputWorkspace="w1", OutputWorkspace=str(Run) + "reduced")
            else:
                if self.BkgSwitch == True:
                    w1 = iliad(
                        WB,
                        str(Run),
                        ei,
                        rebin_params,
                        mapfile,
                        det_cal_file=cal_file,
                        norm_method=self.Normalisation,
                        save_format="",
                        background=self.BkgSwitch,
                        bkgd_range=self.BkgdRange,
                    )
                    RenameWorkspace(InputWorkspace="w1", OutputWorkspace=str(Run) + "reduced")
                else:
                    w1 = iliad(
                        WB,
                        str(Run),
                        ei,
                        rebin_params,
                        mapfile,
                        det_cal_file=cal_file,
                        background=False,
                        norm_method=self.Normalisation,
                        save_format="",
                    )
                    RenameWorkspace(InputWorkspace="w1", OutputWorkspace=str(Run) + "reduced")

        WkspOut = str(self.ui.outputWksp.text())

        if len(WkspOut) > 0:
            RenameWorkspace(InputWorkspace=str(Run) + "reduced", OutputWorkspace=str(self.ui.outputWksp.text()))
        else:
            RenameWorkspace(InputWorkspace=str(Run) + "reduced", OutputWorkspace="mar" + str(Run) + "reduced")

        String = (
            ":) Run "
            + str(Run)
            + " reduced successfully ei guess ="
            + str(ei)
            + "meV"
            + " data rebinned with Emin,deltaE,Emax of "
            + rebin_params
        )
        self.ui.ReduceOutput.addItem(String)
예제 #8
0
    def ReduceArbsolute(self):
        # absolute normalisation will be preformed
        # try:
        WB, Runs = self.getRuns()
        print Runs, type(Runs)

        iliad_setup(self.shortname)
        mapfile = str(self.ui.mapfile.text())
        cal_file = self.shortname + WB + self.exten

        monoWB = str(self.ui.DetVanNum_2.text())
        MonoRun = str(self.ui.MonoRunNum.text())

        sampleMass = double(self.ui.sampleMass.text())
        RMMmass = double(self.ui.RMMmass.text())

        monovan_mapfile = mapfile

        if self.sumRunsCheck == True:
            # sum runs
            Load(Filename=Runs[0], OutputWorkspace="SummedWksp", Cache=r"Never", LoadLogFiles="0")
            SummedWksp = mtd["SummedWksp"]
            for i in range(1, len(Runs)):
                Load(Filename=Runs[i], OutputWorkspace="tmp", Cache=r"Never", LoadLogFiles="0")
                tmp = mtd["tmp"]
                SummedWksp = SummedWksp + tmp
            DeleteWorkspace("tmp")
            # overwrite the runs list with 1 entry corresponding to the summed data
            Runs = ["SummedWksp"]

        for Run in Runs:

            if self.AutoEi == True:
                ei, rebin_params, self.BkgdRange = autoEi(
                    str(Run), BkgdGen=True, monspecin=int(self.ui.MonSpecNumber.text())
                )
                # set the absolute van integration range
                tmp = rebin_params.split(",")
                monovanreb = [tmp[0], tmp[2]]

            else:
                ei = self.EiVal
                deltaEi = (ei * 0.01) / 20.0
                rebin_params = str(-ei * 0.5) + "," + str(deltaEi) + "," + str(ei * 0.95)
                tmp = rebin_params.split(",")
                monovanreb = [tmp[0], tmp[2]]

            if self.FixEi == True:
                if self.BkgSwitch == True:
                    w1 = iliad_abs(
                        str(WB),
                        str(Run),
                        str(MonoRun),
                        str(monoWB),
                        RMMmass,
                        sampleMass,
                        ei,
                        rebin_params,
                        mapfile,
                        monovan_mapfile,
                        det_cal_file=cal_file,
                        fixei=True,
                        norm_method=self.Normalisation,
                        save_format="",
                        abs_units_van_range=monovanreb,
                        background=True,
                        bkgd_range=self.BkgdRange,
                    )
                    RenameWorkspace(InputWorkspace="w1", OutputWorkspace=str(Run) + "reduced")
                else:
                    w1 = iliad_abs(
                        WB,
                        str(Run),
                        MonoRun,
                        monoWB,
                        RMMmass,
                        sampleMass,
                        ei,
                        rebin_params,
                        mapfile,
                        monovan_mapfile,
                        det_cal_file=cal_file,
                        background=False,
                        fixei=True,
                        norm_method=self.Normalisation,
                        save_format="",
                        abs_units_van_range=monovanreb,
                    )
                    RenameWorkspace(InputWorkspace="w1", OutputWorkspace=str(Run) + "reduced")
            else:
                if self.BkgSwitch == True:
                    w1 = iliad_abs(
                        str(WB),
                        str(Run),
                        str(MonoRun),
                        str(monoWB),
                        RMMmass,
                        sampleMass,
                        ei,
                        rebin_params,
                        mapfile,
                        monovan_mapfile,
                        det_cal_file=cal_file,
                        norm_method=self.Normalisation,
                        save_format="",
                        abs_units_van_range=monovanreb,
                        background=True,
                        bkgd_range=self.BkgdRange,
                    )
                    RenameWorkspace(InputWorkspace="w1", OutputWorkspace=str(Run) + "reduced")
                else:
                    w1 = iliad_abs(
                        WB,
                        str(Run),
                        MonoRun,
                        monoWB,
                        RMMmass,
                        sampleMass,
                        ei,
                        rebin_params,
                        mapfile,
                        monovan_mapfile,
                        det_cal_file=cal_file,
                        background=False,
                        norm_method=self.Normalisation,
                        save_format="",
                        abs_units_van_range=monovanreb,
                    )
                    RenameWorkspace(InputWorkspace="w1", OutputWorkspace=str(Run) + "reduced")

        WkspOut = str(self.ui.outputWksp.text())

        if len(WkspOut) > 0:
            RenameWorkspace(InputWorkspace=str(Run) + "reduced", OutputWorkspace=str(self.ui.outputWksp.text()))
        else:
            RenameWorkspace(InputWorkspace=str(Run) + "reduced", OutputWorkspace="mar" + str(Run) + "reduced")

        String = (
            ":) Run "
            + str(Run)
            + " reduced with absolute normalisation successfully ei guess ="
            + str(ei)
            + "meV"
            + " data rebinned with Emin,deltaE,Emax of "
            + rebin_params
        )
        self.ui.ReduceOutput.addItem(String)
예제 #9
0
파일: red_debug.py 프로젝트: abuts/Python
#mono_sample.prop_man.sum_runs = True
#mono_sample.prop_man.save_file_name = r'MAR11001.spe'
#mono_sample.convert_to_energy(r'd:\Data\MantidSystemTests\Data\MAR11060.raw', [r'MAR11001.raw'], 12, None, None, [r'd:\Data\MantidSystemTests\Data\MAR11015.raw'], None)



from qtiGenie import *
from PySlice2 import *
from autoEi import *
inst='mar'
iliad_setup(inst)
ext='.raw'
#mapfile='mari_res2012'

mapfile='mari_res2013'


#det_cal_file must be specified if the reduction sends out put to a workspace
#cal_file='MAR17578.raw'
cal_file='MAR18622.raw'
#load vanadium file

run='17690'
WB='18622'
ei,rebin_params,BkgdRange=autoEi(str(run),BkgdGen=True,monspecin=2,BkgdLevel=.4)
print "ei = ",ei
print "rebin_params = ",rebin_params
#print "BkgdRange = ",BkgdRange,bkgd_range = BkgdRange

w1=iliad(WB,run,ei,rebin_params,mapfile,det_cal_file=cal_file,norm_method='current',bkgd_range = [14500,18000])