4Misc_Starth4Platformh@9VersionCheck xHH%.7@gyHHdh xHH%.7@gyHHdh x HH%.7@gyHHdh ^Graph*WDashSettings#  ! ~:6Normal@ Menlo<HHHH$$4 4 4 4 4 4 homeuKdMacintosh HD:Users:fangyuan:Documents:ARPES:* Macintosh HDBDARPES cu Documents!/:Users:fangyuan:Documents:ARPES/ ARPES Macintosh HDUsers/fangyuan/Documents/ARPES/VRecentWindows"VASP Loader.ipfVaspUtilities.ipf 4Misc_EndhTXOPState_Start hPeakFunctions2-64in4XOPState_Endh\!*// Platform=Macintosh, IGORVersion=8.040, architecture=Intel, systemTextEncoding="MacRoman", historyTextEncoding="UTF-8", procwinTextEncoding="UTF-8", recreationTextEncoding="UTF-8", build=34722 #pragma TextEncoding = "UTF-8" Silent 101 // use | as bitwise or -- not comment. DefaultFont "Helvetica" MoveWindow/C 2,626,1438,810 MoveWindow/P 382,222,1082,677 KillStrings/Z root:gWMSetNextTextFilesTextEncoding #pragma TextEncoding = "UTF-8" #pragma rtGlobals=3 // Use modern global access method and strict wave access. //ARPES cut angle to momentum Function YFATMSpec() NewDataFolder /O root:Blue if (DataFolderExists("root:Blue:Map")==0) NewDataFolder root:Blue:Map YFSpecInit() endif // Make the panel NewPanel /W=(300,100,1130,665) /K=1 /N=panelBlueMap as "Cut Angle To Momentum" ModifyPanel cbRGB=(48896,52992,65280), fixedSize=1 // Make the spec list selection tools GroupBox specListGroupBox,pos={5,5},size={130,220},title="Spec Selection" NVAR selectedRow = root:Blue:Map:selectedRow ListBox specListBox,pos={10,25},size={120,170},frame=4,mode=1,proc=YFSpecListBoxProc ListBox specListBox,listWave=root:Blue:Map:listWave,selRow=selectedRow ListBox specListBox help={"A text wave contain spec waves"} Button updateButton,pos={10,200},size={115,20},title="Update List",proc=YFSpecButtonProc // Make the momentum cut creation tools NVAR theta = root:Blue:Map:theta SetVariable thetaSetVar,pos={145,25},size={85,16},title="theta:",value=theta SetVariable thetaSetVar help={"The tilt value of the sample"} NVAR phid = root:Blue:Map:phid SetVariable phidSetVar,pos={235,25},size={85,16},title="phid:",value=phid SetVariable phidSetVar help={"The phi tilt value of the sample"} NVAR EF = root:Blue:Map:EF SetVariable EFSetVar,pos={145,50},size={85,16},title="EF:",value=EF SetVariable EFSetVar help={"A special energy that will be in the center of one energy bin (it doesn't necessarily have to be the Fermi energy)"} NVAR bin = root:Blue:Map:bin SetVariable binSetVar,pos={235,50},size={85,16},title="bin:",value=bin SetVariable binSetVar help={"bin"} // Make the miscellaneous tools GroupBox miscGroupBox,pos={140,80},size={175,145},title="Misc. Tools" Button momentumButton,pos={145,115},size={145,20},title="Convert to momentum",proc=YFSpecButtonProc Button expMomButton,pos={145,140},size={145,20},title="Export k Spec",proc=YFSpecButtonProc Button expMomButton help={"Copies the k-space map to the current folder"} CheckBox checkNaN,pos={160,165},size={75,15},title="0 to NaN",value= 1,proc=YFSpecCheckProc CheckBox checkNaN help={"Replaces all zeroes with NaNs in both maps (but not in the cubes themselves)"} // Make the angle cut display area GroupBox angleDispGroupBox,pos={5,270},size={270,270},title="Angle Spec Display" Display/W=(10,290,270,535)/HOST=# RenameWindow #,GangleMap WAVE angleCube = root:Blue:Map:angleCube AppendImage angleCube ModifyImage angleCube ctab={*,*,ColdWarm,0} ModifyGraph wbRGB=(48896,52992,65280), gbRGB=(48896,52992,65280) ModifyGraph nticks=4,minor=1,fSize=12,standoff=0,tkLblRot(left)=0,btLen=3 ModifyGraph margin(left)=30,margin(bottom)=42,margin(top)=13,margin(right)=16 ModifyGraph swapXY=1 Label left "\eEnergy (eV)" Label bottom "\etheta (deg)" SetActiveSubwindow ## // Make the momentum cut display area GroupBox momentumMapDispGroupBox,pos={350,5},size={470,535},title="Momentum Spec Display" Display/W=(355,25,805,535)/HOST=# RenameWindow #,GkMap WAVE kcube = root:Blue:Map:kcube AppendImage kcube ModifyImage kcube ctab={*,*,ColdWarm,0} ModifyGraph wbRGB=(48896,52992,65280), gbRGB=(48896,52992,65280) ModifyGraph swapXY=1 //ModifyGraph nticks=4,minor=1,fSize=12,standoff=0,tkLblRot(left)=0,btLen=3 //ModifyGraph margin(left)=50,margin(bottom)=35,margin(top)=5,margin(right)=5 //ModifyGraph width=0, height={Aspect,DimDelta(kMap,1)*(DimSize(kMap,1)-1)/(DimDelta(kMap,0)*(DimSize(kMap,0)-1))} Label left "Energy (eV)" Label bottom "k\\Bx\\M (Å\\S-1\\M)" SetActiveSubwindow ## // Get ready to do stuff and update the display YFSpecUpdateDisplay() End Function YFSpecInit() // Store the current folder location String currDF = GetDataFolder(1) SetDataFolder root:Blue:Map // Declare global variables, strings, and waves Make /O /T /N=0 listWave Make /d/O /N=(2,2) angleCube Make /d/O /N=(2,2) kCube Variable /G selectedRow = -1 Variable /G theta Variable /G phid Variable /G EF=16.745 Variable /G bin=1 Variable /G status=0 Variable /G doNaN = 1 // Return to the current folder SetDataFolder currDF // Get the list of 2D text waves in the folder WAVE /T listWave = root:Blue:Map:listWave String list = WaveList("*",";","DIMS:2") Redimension /N=(ItemsInList(list)) listWave listWave = StringFromList(p,list) End Function YFSpecUpdateDisplay() NVAR status = root:Blue:Map:status if (status == 0) // No DA30 data has been chosen, so disable all the controls // Disable the angle cube controls SetVariable thetaSetVar disable=2 SetVariable phidSetVar disable=2 SetVariable EFSetVar disable=2 SetVariable binSetVar disable=2 // Enable some of the misc. tools CheckBox checkNaN disable = 2 Button momentumButton disable = 2 Button expMomButton disable = 2 SetWindow panelBlueMap#GangleMap, hide=1 SetWindow panelBlueMap#GkMap, hide=1 elseif (status == 1) // A momentum map has been created, so display it and enable all the controls // Enable the angle cube controls SetVariable thetaSetVar disable=0 SetVariable phidSetVar disable=0 SetVariable EFSetVar disable=0 SetVariable binSetVar disable=0 // Enable the misc. tools CheckBox checkNaN disable = 0 Button momentumButton disable = 0 Button expMomButton disable = 0 SetWindow panelBlueMap#GangleMap, hide=0 SetWindow panelBlueMap#GkMap, hide=0 endif End Function YFSpecKCube() WAVE angleCube = root:Blue:Map:angleCube WAVE kCube = root:Blue:Map:kCube NVAR doNaN = root:Blue:Map:doNaN NVAR status = root:Blue:Map:status NVAR theta = root:Blue:Map:theta NVAR phid = root:Blue:Map:phid NVAR bin = root:Blue:Map:bin NVAR EF = root:Blue:Map:EF MakeListSpec(angleCube) wave momentumlist Make /d/O /N=(DimSize(momentumList,0)) tem=0 tem=momentumlist[p][0] // Now find the k-space bounding of the cut Variable kyMin, kyMax WaveStats /Q tem kyMin = V_min kyMax = V_max variable mapsizey=bin*dimsize(anglecube,1) variable delta=(kymax-kymin)/(mapsizey-1) // Set up the k cube and the Jacobian Redimension /N=(DimSize(anglecube,0),mapSizeY) kCube SetScale /P y kyMin, delta, kCube SetScale /P x DimOffset(anglecube,0), DimDelta(anglecube,0), kCube kCube = 0 duplicate/o kcube, BlueJacobian // Make the k cube Variable pee, i,j for(i=0;i= 0 && pee < DimSize(kCube,1)) kCube[i][pee] += momentumList[j][1] BlueJacobian[i][pee] += 1 endif endfor endfor for(i=0;i numpnts(listWave) - 1) selectedRow = -1 ListBox specListBox,selRow=selectedRow else if(status==0) status=1 endif endif duplicate/o $listwave[selectedRow], tempspec redimension/n=(tempspec[0],tempspec[1]) root:Blue:Map:anglecube duplicate/o tempspec, root:Blue:Map:anglecube killwaves tempspec YFSpecUpdateDisplay() endif endif return 0 End Function YFSpecCheckProc(ctrlName,checked) : CheckBoxControl String ctrlName Variable checked strswitch (ctrlName) case "checkNaN": NVAR doNaN = root:Blue:Map:doNaN if (checked) donan=1 CheckBox checkNan value = 1 else donan=0 CheckBox checkNan value = 0 endif break endswitch End //ARPES map angle to momentum Function YFATMmap() NewDataFolder /O root:Blue if (DataFolderExists("root:Blue:Map")==0) NewDataFolder root:Blue:Map YFMapInit() endif // Make the panel NewPanel /W=(300,100,1330,665) /K=1 /N=panelBlueMap as "DA30 Map Angle To Momentum" ModifyPanel cbRGB=(48896,52992,65280), fixedSize=1 // Make the spec list selection tools GroupBox specListGroupBox,pos={5,5},size={130,220},title="Cube Selection" NVAR selectedRow = root:Blue:Map:selectedRow ListBox specListBox,pos={10,25},size={120,170},frame=4,mode=1,proc=YFMapListBoxProc ListBox specListBox,listWave=root:Blue:Map:listWave,selRow=selectedRow ListBox specListBox help={"A text wave contain cube waves"} Button updateButton,pos={10,200},size={115,20},title="Update List",proc=YFMapButtonProc // Make the angle cube creation tools GroupBox angleGroupBox,pos={140,5},size={220,220},title="Angle Cube Creation" GroupBox angleGroupBox help={"Tools for displaying angle cube"} NVAR theta = root:Blue:Map:theta SetVariable thetaSetVar,pos={145,25},size={85,16},title="theta:",value=theta SetVariable thetaSetVar help={"The tilt value of the sample"} NVAR phid = root:Blue:Map:phid SetVariable phidSetVar,pos={235,25},size={85,16},title="phid:",value=phid SetVariable phidSetVar help={"The phi tilt value of the sample"} NVAR EF = root:Blue:Map:EF SetVariable EFSetVar,pos={145,50},size={170,16},title="Center Energy:",value=EF,proc=YFMapSetVarProc SetVariable EFSetVar help={"A special energy that will be in the center of one energy bin (it doesn't necessarily have to be the Fermi energy)"} NVAR EW = root:Blue:Map:EW SetVariable EWSetVar,pos={145,75},size={210,16},title="Energy Steps To Integrate:",value=EW,proc=YFMapSetVarProc SetVariable EWSetVar help={"The number of energy steps to include in each energy bin. This must be an odd number since it includes a central energy value and a few neighbors to either side."} NVAR rawDeltaE = root:Blue:Map:rawDeltaE TitleBox energy1TitleBox,pos={145,100},size={170,13},frame=0 TitleBox energy2TitleBox,pos={145,125},size={170,13},frame=0 Button angleButton,pos={145,150},size={165,20},title="Create Angle Cube",proc=YFMapButtonProc // Make the momentum cube creation tools GroupBox kGroupBox,pos={145,175},size={175,75},title="Momentum Cube Creation" GroupBox kGroupBox help={"Tools for converting an angle cube into a k cube whose axes are kx, ky, and energy"} NVAR pixels = root:Blue:Map:pixels SetVariable pixelsSetVar,pos={150,200},size={150,16},title="Pixels:",value=pixels,proc=YFMapSetVarProc,limits={2,inf,1} SetVariable pixelsSetVar help={"The largest dimension of the resulting k map, in pixels"} NVAR symmNeg = root:Blue:Map:symmNeg CheckBox checkNeg,pos={370,5},size={90,15},title="x/y --> -x/y",value= symmNeg,proc=YFMapCheckProc CheckBox checkNeg help={"Adds reflection symmetry about the x and y axes (four operations)"} NVAR symmXY = root:Blue:Map:symmXY CheckBox checkXY,pos={370,20},size={90,15},title="x --> y",value= symmXY,proc=YFMapCheckProc CheckBox checkXY help={"Adds reflection symmetry about the line y=x (two operations)"} NVAR symm3Rot = root:Blue:Map:symm3Rot CheckBox check3Rot,pos={460,5},size={70,15},title="3-fold rot.",value= symm3Rot,proc=YFMapCheckProc CheckBox check3Rot help={"Adds three-fold rotational symmetry (three operations)"} NVAR symm3Refl = root:Blue:Map:symm3Refl CheckBox check3Refl,pos={460,20},size={70,15},title="3-fold refl.",value= symm3Refl,proc=YFMapCheckProc CheckBox check3Refl help={"Adds three-fold rotational and reflection symmetry (six operations)"} NVAR rphi = root:Blue:Map:rphi SetVariable rphiSetVar,pos={370,35},size={85,16},title="rphi:",value=rphi SetVariable rphiSetVar help={"The rotation value of the map"} NVAR rotphi = root:Blue:Map:rotphi CheckBox checkrotphi,pos={460,35},size={70,15},title="rot. phi",value= rotphi,proc=YFMapCheckProc CheckBox checkrotphi help={"Adds phi rotation"} Button momentumButton,pos={370,60},size={150,20},title="Create Momentum Cube",proc=YFMapButtonProc // Make the miscellaneous tools GroupBox miscGroupBox,pos={365,80},size={175,145},title="Misc. Tools" Button stopKButton,pos={370,105},size={135,20},title="Stop Calculating K",proc=YFMapButtonProc Button stopKButton help={"Removes the k cube/map. Useful if you want to tweak the angle cube without automatically updating the k cube."} Button expAngleButton,pos={370,130},size={135,20},title="Export Angle Map",proc=YFMapButtonProc Button expAngleButton help={"Copies the angle map to the current folder"} Button expMomButton,pos={370,155},size={135,20},title="Export k Map",proc=YFMapButtonProc Button expMomButton help={"Copies the k-space map to the current folder"} Button expButton,pos={370,180},size={135,20},title="Export All",proc=YFMapButtonProc Button expButton help={"Exports the relevant cubes, maps, and settings to the current folder. It is smart enough to export the settings that were used to create the cubes, rather than the currently selected settings."} CheckBox checkNorm,pos={370,205},size={75,15},title="Normalize",value= 1,proc=YFMapCheckProc CheckBox checkNorm,help={"Decide if you want to normalize the data or not"} CheckBox checkNaN,pos={455,205},size={75,15},title="0 to NaN",value= 0,proc=YFMapCheckProc CheckBox checkNaN help={"Replaces all zeroes with NaNs in both maps (but not in the cubes themselves)"} // Make the energy slider GroupBox energyGroup,pos={5,230},size={540,35} GroupBox energyGroup help={"Use this slider to choose constant-energy slices of the angle and momentum cubes (referred to as angle maps and k maps)"} NVAR currentEnergy = root:Blue:Map:currentEnergy TitleBox energy3TitleBox,pos={10,240},size={120,12},frame=0 TitleBox energy3TitleBox title="Energy: " + num2str(currentEnergy) + " eV" WAVE angleCube = root:Blue:Map:angleCube Slider energySlider,pos={125,240},size={415,16},value=currentEnergy,proc=YFMapSliderProc,vert= 0,ticks= 0 Slider energySlider limits={DimOffset(angleCube,2),DimOffset(angleCube,2)+(DimSize(angleCube,2)-1)*DimDelta(angleCube,2),DimDelta(angleCube,2)} // Make the angle map display area GroupBox angleDispGroupBox,pos={5,270},size={540,270},title="Angle Map Display" Display/W=(10,290,540,535)/HOST=# RenameWindow #,GangleMap WAVE angleMap = root:Blue:Map:angleMap AppendImage angleMap ModifyImage angleMap ctab={*,*,ColdWarm,0} ModifyGraph wbRGB=(48896,52992,65280), gbRGB=(48896,52992,65280) ModifyGraph nticks=4,minor=1,fSize=12,standoff=0,tkLblRot(left)=0,btLen=3 ModifyGraph margin(left)=50,margin(bottom)=35,margin(top)=10,margin(right)=25 Label left "thetaa (deg)" Label bottom "phi (deg)" SetActiveSubwindow ## // Make the momentum map display area GroupBox momentumMapDispGroupBox,pos={550,5},size={470,535},title="Momentum Map Display" Display/W=(555,25,1005,535)/HOST=# RenameWindow #,GkMap WAVE kMap = root:Blue:Map:kMap AppendImage kMap ModifyImage kMap ctab={*,*,ColdWarm,0} ModifyGraph wbRGB=(48896,52992,65280), gbRGB=(48896,52992,65280) //ModifyGraph nticks=4,minor=1,fSize=12,standoff=0,tkLblRot(left)=0,btLen=3 //ModifyGraph margin(left)=50,margin(bottom)=35,margin(top)=5,margin(right)=5 //ModifyGraph width=0, height={Aspect,DimDelta(kMap,1)*(DimSize(kMap,1)-1)/(DimDelta(kMap,0)*(DimSize(kMap,0)-1))} Label left "k\\By\\M (Å\\S-1\\M)" Label bottom "k\\Bx\\M (Å\\S-1\\M)" SetActiveSubwindow ## // Get ready to do stuff and update the display YFMapUpdateDisplay() End Function YFMapInit() // Store the current folder location String currDF = GetDataFolder(1) SetDataFolder root:Blue:Map // Declare global variables, strings, and waves Make /O /T /N=0 listWave Make /O /N=(2,2) angleMap Make /O /N=(2,2) kMap Make /O /N=(2,2,2) angleCube Make /O /N=(2,2,2) kCube Make /O /N=0 angleRecord Make /O /N=0 kRecord Variable /G selectedRow = -1 Variable /G theta Variable /G phid Variable /G EF Variable /G EW Variable /G status=0 Variable /G doNaN = 0 Variable /G doNorm = 1 Variable /G currentEnergy Variable /G rawDeltaE Variable /G pixels = 200 Variable /G symmNeg Variable /G symmXY Variable /G symm3Rot Variable /G symm3Refl Variable /G rotphi Variable /G rphi // Return to the current folder SetDataFolder currDF // Get the list of 2D text waves in the folder WAVE /T listWave = root:Blue:Map:listWave String list = WaveList("*",";","DIMS:3") Redimension /N=(ItemsInList(list)) listWave listWave = StringFromList(p,list) End Function YFMapUpdateDisplay() NVAR status = root:Blue:Map:status if (status == 0) // No DA30 data has been chosen, so disable all the controls // Disable the angle cube controls SetVariable thetaSetVar disable=2 SetVariable phidSetVar disable=2 SetVariable EFSetVar disable=2 SetVariable EWSetVar disable=2 Button angleButton disable = 2 // Disable the momentum cube controls SetVariable pixelsSetVar disable = 2 SetVariable rphiSetVar disable=2 Button momentumButton disable = 2 CheckBox checkNeg disable = 2 CheckBox checkXY disable = 2 CheckBox check3Rot disable = 2 CheckBox check3Refl disable = 2 CheckBox checkrotphi disable = 2 // Enable some of the misc. tools CheckBox checkNorm disable = 2 CheckBox checkNaN disable = 2 Button stopKButton disable = 2 Button expAngleButton disable = 2 Button expMomButton disable = 2 Button expButton disable = 2 // Disable the energy slider TitleBox energy3TitleBox title="" Slider energySlider disable=2 // Hide the angle map display SetWindow panelBlueMap#GangleMap, hide=1 // Hide the momentum map display SetWindow panelBlueMap#GkMap, hide=1 elseif (status == 1) // A DA30 data has been chosen, so enable the angle map controls // Enable the angle cube controls SetVariable thetaSetVar disable=0 SetVariable phidSetVar disable=0 SetVariable EFSetVar disable=0 SetVariable EWSetVar disable=0 Button angleButton disable = 0 // Disable the momentum cube controls SetVariable pixelsSetVar disable = 2 SetVariable rphiSetVar disable=2 Button momentumButton disable = 2 CheckBox checkNeg disable = 2 CheckBox checkXY disable = 2 CheckBox check3Rot disable = 2 CheckBox check3Refl disable = 2 CheckBox checkrotphi disable = 2 // Enable some of the misc. tools CheckBox checkNorm disable = 0 CheckBox checkNaN disable = 0 Button stopKButton disable = 2 Button expAngleButton disable = 2 Button expMomButton disable = 2 Button expButton disable = 2 // Disable the energy slider TitleBox energy3TitleBox title="" Slider energySlider disable=2 // Hide the angle map display SetWindow panelBlueMap#GangleMap, hide=1 // Hide the momentum map display SetWindow panelBlueMap#GkMap, hide=1 elseif (status == 2) // An angle map has been created, so display it and enable the momentum map controls // Enable the angle cube controls SetVariable thetaSetVar disable=0 SetVariable phidSetVar disable=0 SetVariable EFSetVar disable=0 SetVariable EWSetVar disable=0 Button angleButton disable = 0 // Enable the momentum cube controls SetVariable pixelsSetVar disable = 0 SetVariable rphiSetVar disable=0 CheckBox checkNeg disable = 0 CheckBox checkXY disable = 0 CheckBox check3Rot disable = 0 CheckBox check3Refl disable = 0 CheckBox checkrotphi disable = 0 Button momentumButton disable = 0 // Enable some of the misc. tools CheckBox checkNorm disable = 2 CheckBox checkNaN disable = 0 Button stopKButton disable = 2 Button expAngleButton disable = 0 Button expMomButton disable = 2 Button expButton disable = 0 // Enable the energy slider Slider energySlider disable=0 // Show the angle map display SetWindow panelBlueMap#GangleMap, hide=0 // Hide the momentum map display SetWindow panelBlueMap#GkMap, hide=1 elseif (status == 3) // A momentum map has been created, so display it and enable all the controls // Enable the angle cube controls SetVariable thetaSetVar disable=0 SetVariable phidSetVar disable=0 SetVariable EFSetVar disable=0 SetVariable EWSetVar disable=0 Button angleButton disable = 0 // Enable the momentum cube controls SetVariable pixelsSetVar disable = 0 SetVariable rphiSetVar disable=0 CheckBox checkNeg disable = 0 CheckBox checkXY disable = 0 CheckBox check3Rot disable = 0 CheckBox check3Refl disable = 0 CheckBox checkrotphi disable = 0 Button momentumButton disable = 0 // Enable the misc. tools CheckBox checkNorm disable = 2 CheckBox checkNaN disable = 2 Button stopKButton disable = 0 Button expAngleButton disable = 0 Button expMomButton disable = 0 Button expButton disable = 0 // Enable the energy slider Slider energySlider disable=0 // Show the angle map display SetWindow panelBlueMap#GangleMap, hide=0 // Hide the momentum map display SetWindow panelBlueMap#GkMap, hide=0 endif End Function YFMapAngleCube() wave tempspec WAVE angleCube = root:Blue:Map:angleCube WAVE angleMap = root:Blue:Map:angleMap WAVE angleRecord = root:Blue:Map:angleRecord NVAR status = root:Blue:Map:status NVAR EF = root:Blue:Map:EF NVAR EW = root:Blue:Map:EW NVAR theta = root:Blue:Map:theta NVAR phid = root:Blue:Map:phid NVAR currentEnergy = root:Blue:Map:currentEnergy NVAR doNaN = root:Blue:Map:doNaN NVAR doNorm = root:Blue:Map:doNorm // Find the index of the closest energy value to EF Variable EFi = round((EF - DimOffset(tempspec,0))/DimDelta(tempspec,0)) // Find the lowest index of any energy value we will use in the cube Variable Emini = EFi - 0.5*(EW-1) - EW*floor((EFi - 0.5*(EW-1))/EW) // Find the number of energy bins we will use in the cube Variable numE = floor((DimSize(tempSpec,0) - Emini)/EW) // Find the total number of q values Variable numQ = DimSize(tempSpec,1) // Prepare the cube redimension /N=(DimSize(tempspec,2), numQ, numE) angleCube SetScale /P x Dimoffset(tempspec,2), DimDelta(tempspec,2), angleCube SetScale /P y DimOffset(tempSpec,1), DimDelta(tempSpec,1), angleCube SetScale /P z DimOffset(tempSpec,0) + (Emini + 0.5*(EW-1))*DimDelta(tempSpec,0), EW*DimDelta(tempSpec,0), angleCube // Create the cube and the do normalization Variable i,j,k angleCube = 0 for(j=0; j 1) mapSizeX = pixels mapSizeY = floor(pixels/ratio) delta = (kxMax - kxMin)/(pixels - 1) else mapSizeX = floor(pixels*ratio) mapSizeY = pixels delta = (kyMax - kyMin)/(pixels - 1) endif // Set up the k cube and the Jacobian Redimension /N=(mapSizeX, mapSizeY, DimSize(anglecube,2)) kCube SetScale /P x kxMin, delta, kCube SetScale /P y kyMin, delta, kCube SetScale /P z DimOffset(anglecube,2), DimDelta(anglecube,2), kCube kCube = 0 Make /O /N=(mapSizeX, mapSizeY) BlueJacobian BlueJacobian = 0 // Make the k cube Variable pee, qew Variable i,j,u,v Make /O /N=(DimSize(angleCube,0)*ceil(DimDelta(angleCube,0)/DimDelta(angleCube,1)), DimSize(angleCube,1)) YFUpsampled SetScale /I x DimOffset(angleCube,0), DimOffset(angleCube,0) + (DimSize(angleCube,0)-1)*DimDelta(angleCube,0), YFUpsampled SetScale /P y DimOffset(angleCube,1), DimDelta(angleCube,1), YFUpsampled for(i=0;i= 0 && pee < DimSize(kCube,0) && qew >= 0 && qew < DimSize(kCube,1)) kCube[pee][qew][i] += momentumList[j][2] BlueJacobian[pee][qew] += 1 endif endfor for(u=0;u diff) // The value is too big, so revert back to 1 EW = 1 endif // Update the text display TitleBox energy2TitleBox title="Your Chosen Bin Width: " + num2str(rawDeltaE*(EW-1)) + " eV" break case "pixelsSetVar": // Make sure the value is an integer pixels = round(varNum) break endswitch End Function YFMapSliderProc(sa) : SliderControl STRUCT WMSliderAction &sa strswitch(sa.ctrlName) case "energySlider": if(sa.eventCode==3||sa.eventCode==9) NVAR currentEnergy = root:Blue:Map:currentEnergy NVAR status = root:Blue:Map:status NVAR doNaN = root:Blue:Map:doNaN WAVE angleCube = root:Blue:Map:angleCube WAVE angleMap = root:Blue:Map:angleMap WAVE kCube = root:Blue:Map:kCube WAVE kMap = root:Blue:Map:kMap // Update the current energy currentEnergy = sa.curval // Update the energy display TitleBox energy3TitleBox title="Energy: " + num2str(currentEnergy) + " eV" // Update the angleMap angleMap = angleCube[p][q][round((currentEnergy-DimOffset(angleCube,2))/DimDelta(angleCube,2))] Redimension /N=(DimSize(kCube,0), DimSize(kCube,1)) kMap SetScale /P x DimOffset(kCube,0), DimDelta(kCube,0), kMap SetScale /P y DimOffset(kCube,1), DimDelta(kCube,1), kMap if (status == 3) // Update the kMap kMap = kCube[p][q][round((currentEnergy-DimOffset(kCube,2))/DimDelta(kCube,2))] // Remove zeros if desired if (doNan) kMap = (kMap[p][q]==0) ? NaN : kMap[p][q] endif endif endif break endswitch End Function YFMapButtonProc(ctrlName) String ctrlName WAVE /T listWave = root:Blue:Map:listWave NVAR stage = root:Blue:Map:status NVAR doNorm = root:Blue:Map:doNorm NVAR doNan = root:Blue:Map:doNan NVAR selectedRow = root:Blue:Map:selectedRow strswitch(ctrlName) case "updateButton": // Update the wave list string list = WaveList("*",";","DIMS:3") Redimension /N=(ItemsInList(list)) listWave listWave = StringFromList(p,list) // Reset the status and update the display selectedRow = -1 ListBox specListBox,selRow = selectedRow stage = 0 donorm=1 CheckBox checkNorm value = 1 donan=0 CheckBox checkNan value = 0 YFMapUpdateDisplay() break case "angleButton": YFMapAngleCube() if (stage == 3) YFMapKCube() endif YFMapUpdateDisplay() break case "momentumButton": YFMapKCube() YFMapUpdateDisplay() break case "expMomButton": Duplicate /O root:Blue:Map:kMap kMap break case "expAngleButton": Duplicate /O root:Blue:Map:angleMap angleMap break case "stopKButton": stage = 2 YFMapUpdateDisplay() break case "expButton": WAVE angleRecord = root:Blue:Map:angleRecord WAVE kRecord = root:Blue:Map:kRecord WAVE angleCube0 = root:Blue:Map:angleCube WAVE kCube0 = root:Blue:Map:kCube WAVE angleMap0 = root:Blue:Map:angleMap WAVE kMap0 = root:Blue:Map:kMap NVAR currentEnergy0 = root:Blue:Map:currentEnergy if (stage <= 1) // This should never happen, but if it does, don't do anything return 0 endif if (stage > 1) // There is an angle cube Duplicate /O angleCube0 angleCube Duplicate /O angleMap0 angleMap Variable /G theta = angleRecord[0] Variable /G phid = angleRecord[1] Variable /G EF = angleRecord[2] Variable /G EW = angleRecord[3] Variable /G doNorm = angleRecord[4] Variable /G doNan = angleRecord[5] endif if (stage == 3) // There is also a k map Duplicate /O kCube0 kCube Duplicate /O kMap0 kMap doNan = kRecord[0] endif Variable /G status = stage Variable /G currentEnergy = currentEnergy0 break endswitch End Function YFMapListBoxProc(ctrlName,row,col,event) : ListBoxControl String ctrlName Variable row Variable col Variable event //1=mouse down, 2=up, 3=dbl click, 4=cell select with mouse or keys //5=cell select with shift key, 6=begin edit, 7=end NVAR status = root:Blue:Map:status NVAR EF = root:Blue:Map:EF NVAR rawDeltaE = root:Blue:Map:rawDeltaE NVAR EW = root:Blue:Map:EW WAVE /T specList = root:Blue:Map:specList if (event == 3) WAVE /T listWave = root:Blue:Map:listWave NVAR selectedRow = root:Blue:Map:selectedRow if (selectedRow != row) selectedRow = row if (selectedRow > numpnts(listWave) - 1) selectedRow = -1 ListBox specListBox,selRow=selectedRow else if(status==0) status=1 endif endif YFMapUpdateDisplay() endif duplicate/o $listwave[selectedRow],tempspec EF = DimOffset(tempSpec,0) + (DimSize(tempSpec,0)-1)*DimDelta(tempSpec,0) rawDeltaE = DimDelta(tempSpec,0) // Update some displays TitleBox energy1TitleBox title="Spectrum Energy Step: " + num2str(rawDeltaE) + " eV" TitleBox energy2TitleBox title="Your Chosen Bin Width: " + num2str(rawDeltaE*(EW-1)) + " eV" endif return 0 End Function YFMapCheckProc(ctrlName,checked) : CheckBoxControl String ctrlName Variable checked strswitch (ctrlName) case "checkNorm": NVAR doNorm = root:Blue:Map:doNorm if (checked) donorm=1 CheckBox checkNorm value = 1 else donorm=0 CheckBox checkNorm value = 0 endif break case "checkNaN": NVAR doNaN = root:Blue:Map:doNaN if (checked) donan=1 CheckBox checkNan value = 1 else donan=0 CheckBox checkNan value = 0 endif break case "checkNeg": NVAR symmNeg = root:Blue:Map:symmNeg if (checked) symmNeg = 1 else symmNeg = 0 endif break case "checkXY": NVAR symmXY = root:Blue:Map:symmXY if (checked) symmXY = 1 else symmXY = 0 endif break case "check3Rot": NVAR symm3Rot = root:Blue:Map:symm3Rot NVAR symm3Refl = root:Blue:Map:symm3Refl if (checked) symm3Rot = 1 symm3Refl = 0 CheckBox check3Refl value = 0 else symm3Rot = 0 endif break case "check3Refl": NVAR symm3Refl = root:Blue:Map:symm3Refl NVAR symm3Rot = root:Blue:Map:symm3Rot if (checked) symm3Refl = 1 symm3Rot = 0 CheckBox check3Rot value = 0 else symm3Refl = 0 endif break case "checkrotphi": NVAR rotphi = root:Blue:Map:rotphi if (checked) rotphi = 1 else rotphi = 0 endif break endswitch End