Changeset 641 for sans/Dev/trunk
- Timestamp:
- Mar 16, 2010 5:50:17 PM (13 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/CatVSTable.ipf
r605 r641 24 24 25 25 Variable err 26 Variable t1 = ticks 27 26 28 PathInfo catPathName 27 29 if(v_flag==0) … … 102 104 #endif 103 105 106 #if (exists("NCNR")==6) 104 107 ModifyTable width(:myGlobals:CatVSHeaderInfo:nGuides)=40 108 #endif 105 109 106 110 ModifyTable width(Point)=0 //JUN04, remove point numbers - confuses users since point != run … … 124 128 Make/T/O/N=0 notRAWlist 125 129 do 130 126 131 //get current item in the list 127 132 partialName = StringFromList(ii, list, ";") 128 133 //get a valid file based on this partialName and catPathName 129 134 tempName = FindValidFilename(partialName) 135 130 136 If(cmpstr(tempName,"")==0) //a null string was returned 131 137 //write to notebook that file was not found … … 141 147 //make sure the file is really a RAW data file 142 148 ok = CheckIfRawData(fullName) 149 143 150 if (!ok) 144 151 //write to notebook that file was not a RAW SANS file … … 159 166 KillWaves/Z notRAWlist 160 167 // 161 168 Print "Total time (s) = ",(ticks - t1)/60.15 169 Print "Time per raw data file (s) = ",(ticks - t1)/60.15/(numItems-numpnts(notRawList)) 170 return(0) 162 171 End 163 172 … … 200 209 Wave GField = $"root:myGlobals:CatVSHeaderInfo:Field" 201 210 Wave GMCR = $"root:myGlobals:CatVSHeaderInfo:MCR" //added Mar 2008 211 202 212 #if (exists("ILL_D22")==6) 203 213 Wave GReactPow = $"root:myGlobals:CatVSHeaderInfo:ReactorPower" //activate for ILL June 2008 ( and the sort line too) 204 214 Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR,GReactPow 215 #endif 216 217 #if (exists("NCNR")==6) 218 // Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR 219 Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR,gNumGuides 205 220 #else 206 // Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR 207 Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR,gNumGuides 208 #endif 221 //must be HFIR or ANSTO 222 Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR 223 #endif 224 209 225 210 226 return(0) … … 236 252 Wave ReactorPower = $"root:myGlobals:CatVSHeaderInfo:reactorpower" //activate for ILL, June 08 (+ edit line) 237 253 Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR, ReactorPower as "Data File Catalog" 238 #else 254 #endif 255 256 #if (exists("NCNR")==6) 239 257 // original order, magnetic at the end 240 258 // Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR as "Data File Catalog" … … 243 261 // alternate ordering, put the magnetic information first 244 262 // Edit Filenames, Labels, RotAngle, Temperature, Field, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens as "Data File Catalog" 263 #else 264 // either HFIR or ANSTO 265 Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR as "Data File Catalog" 245 266 #endif 246 267 … … 379 400 #endif 380 401 381 // number of guides 402 // number of guides, only for NCNR 403 #if (exists("NCNR")==6) 382 404 InsertPoints lastPoint,1,GNumGuides 383 405 GNumGuides[lastPoint] = numGuides(getSourceToSampleDist(fname)) 406 #endif 384 407 385 408 return(0) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_DataReadWrite.ipf
r572 r641 50 50 Endif 51 51 52 Variable t1=ticks 52 53 53 54 variable error … … 89 90 KillWaves/Z M_listAttr, nsList,W_xmlcontentnodes 90 91 92 Print "Time to load and display (s) = ",(ticks-t1)/60.15 91 93 Return(0) //Do not change. 92 94 End … … 127 129 //Open/R refNum as fname 128 130 STRING/G errorMsg 129 Variable refNum 131 Variable refNum,t1=ticks 130 132 //print "Loading", filename, "..." 131 133 if (stringmatch(filename,"*.xml") <1) … … 216 218 //data =0 217 219 220 // Print "Time to open (s) = ",(ticks-t1)/60.15 218 221 219 222 //ORNL HFIR SANS DATA 220 223 String tempheadhfir 221 224 tempheadhfir = "" 222 ReadHFIRSansRaw(refNum,curFolder,tempheadhfir) 225 226 ReadHFIRSansRaw(refNum,curFolder,tempheadhfir) 223 227 224 225 226 227 228 229 230 231 232 233 228 i=0 229 do 230 //Take the file name from "actual file name", not from the header: (JC found some cases that those are different.) 231 //This DOLOOP can be removed where the problem is solved.... 232 textw[0]=stringfromlist(i,filename,":") 233 if (stringmatch(textw[0],"*.xml")>0) 234 break 235 endif 236 i +=1 237 while (1) 234 238 235 239 //return the data folder to root … … 605 609 return 0 //Not a xml file. Do nothing... 606 610 endif 607 611 608 612 //ORNL HFIR SANS strings meta DATA 609 613 vresult=ReadVFromHHead(refNum,wantedterm,unit) 610 614 611 615 //return the data folder to root 612 616 //SetDataFolder root: … … 641 645 String fname 642 646 643 return(getRealValueFromHeader(fname,"attenuation","percent")) //in unit o dpercents647 return(getRealValueFromHeader(fname,"attenuation","percent")) //in unit of percents 644 648 end 645 649 … … 989 993 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 990 994 Function ReadHFIRSansRaw(refNum,curFolder,tempheadhfir) 991 992 995 Variable refNum 996 String curFolder,tempheadhfir 993 997 994 995 998 String curPath="root:Packages:NIST:"+curFolder 999 SetDataFolder curPath 996 1000 Make/O/N=23 $(curPath+":IntegersRead") 997 1001 Make/O/N=52 $(curPath+":RealsRead") … … 1005 1009 Variable pixnumx=0,pixnumy=0 1006 1010 String val = ""// numerical and text values 1007 Variable value 1011 Variable value,t1=ticks 1008 1012 1009 1013 //Initialize wave values … … 1043 1047 endfor 1044 1048 //endif 1045 1049 // Print "Time to list attributes (s) = ",(ticks-t1)/60.15 1046 1050 1047 1051 XMLelemlist(refNum) 1048 1052 WAVE/T W_ElementList 1053 // Print "Time to list elements (s) = ",(ticks-t1)/60.15 1049 1054 1050 1055 for (ind = 0; ind<DimSize(W_ElementList,0); ind +=1) … … 1179 1184 1180 1185 endfor 1181 1186 1187 // Print "Time to loop over elements (s) = ",(ticks-t1)/60.15 1188 1189 //If the data is a sensitivity scan, normalize so that the average =1. 1190 print curFolder 1191 if (stringmatch(curFolder,"DIV") >0) 1192 WaveStats/Z/Q data 1193 data /= V_avg 1194 endif 1182 1195 //keep a string with the filename in the RAW folder 1183 1196 … … 1213 1226 1214 1227 SetDataFolder curPath 1215 Killwaves/Z nsList,M_listAttr,M_xmlContent,W_ElementList,M_listXPath,W_xmlcontentnodes 1228 1229 // Print "Time to exit reader (s) = ",(ticks-t1)/60.15 1230 1231 // Killwaves/Z nsList,M_listAttr,M_xmlContent,W_ElementList,M_listXPath,W_xmlcontentnodes 1232 return(0) 1233 1216 1234 End 1217 1235 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_Utils.ipf
r572 r641 269 269 String fullName="",partialName="",item="" 270 270 //get list of raw data files in folder that match "num" (add leading zeros) 271 if( (num>999 ) || (num<=0) )271 if( (num>9999) || (num<=0) ) 272 272 //Print "error in FindFileFromRunNumber(num), file number too large or too small" 273 273 Return ("") 274 274 Endif 275 //make a threecharacter string of the run number275 //make a four character string of the run number 276 276 String numStr="" 277 if(num<10) 277 278 if(num > 999) 279 numStr = num2str(num) 280 endif 281 if(num > 99) 282 numStr = "0"+num2str(num) 283 endif 284 if(num > 9) 278 285 numStr = "00"+num2str(num) 279 286 else 280 if(num<100) 281 numStr = "0"+num2str(num) 282 else 283 numStr = num2str(num) 284 Endif 285 Endif 287 numStr = "000"+num2Str(num) 288 endif 286 289 287 290 //make sure that path exists … … 397 400 End 398 401 402 // for HFIR data, both DIV and RAW are determined by looking for "*.xml" 403 Function CheckIfDIVData(fname) 404 String fname 405 return(CheckIfRawData(fname)) 406 End 407 399 408 // function returns 1 if file is a transmission file, 0 if not 400 409 // 401 410 // called by Transmission.ipf, CatVSTable.ipf, NSORT.ipf 411 // 412 // SRK MAR 2010 - apparently from what I can see in the files, the beam stop "out" 413 // position is 25 mm for all four beam stop Y POSITIONS 414 // - if one is larger, (in the hundreds of mm) then it's in, and the run is not a transmission 415 // - so if all four y positions are less than (tol) 30 mm, call it a trans file 416 // 417 // there is a field for this in the header, write "True", so I don't need to guess again. 402 418 // 403 419 Function isTransFile(fName) /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! … … 409 425 else 410 426 //Check from beam stop motor position 411 Variable beamtrap_1y=0,beamtrap_2y=0,beamtrap_3y=0,beamtrap_4y=0 427 Variable beamtrap_1y=0,beamtrap_2y=0,beamtrap_3y=0,beamtrap_4y=0,tol=30 412 428 // if(your test here) 413 429 beamtrap_1y=getRealValueFromHeader(fname,"trap_y_101mm","mm") … … 416 432 beamtrap_4y=getRealValueFromHeader(fname,"trap_y_76mm","mm") 417 433 418 if (beamtrap_1y<10 && beamtrap_2y<10 && beamtrap_3y<10 && beamtrap_4y<10) 434 // if (beamtrap_1y<10 && beamtrap_2y<10 && beamtrap_3y<10 && beamtrap_4y<10) 435 if (beamtrap_1y < tol && beamtrap_2y < tol && beamtrap_3y < tol && beamtrap_4y < tol) 419 436 //Write the flag ON 420 437 Write_isTransmissionToHeader(fName,"True") … … 530 547 Function/S ValidFileString(partialName) 531 548 String partialName 532 533 String tempName = "" 534 //Variable ii,refnum 549 550 String tempName = "",msg="" 551 Variable ii,refnum 552 553 ii=0 554 do 555 if(ii==0) 556 //first pass, try the partialName 535 557 tempName = partialName 558 Open/Z/R/T="????TEXT"/P=catPathName refnum tempName //Does open file (/Z flag) 559 if(V_flag == 0) 560 //file exists 561 Close refnum //YES needed, 562 break 563 endif 564 else 565 tempName = partialName + ";" + num2str(ii) 566 Open/Z/R/T="????TEXT"/P=catPathName refnum tempName 567 if(V_flag == 0) 568 //file exists 569 Close refnum 570 break 571 endif 572 Endif 573 ii+=1 574 //print "ii=",ii 575 while(ii<11) 576 //go get the selected bits of information, using tempName, which exists 577 if(ii>=11) 578 //msg = partialName + " not found. is version number > 11?" 579 //DoAlert 0, msg 580 //PathInfo catPathName 581 //Print S_Path 582 Return ("") //use null string as error condition 583 Endif 584 536 585 Return (tempName) 537 586 End … … 835 884 Function AttenuationFactor(fileStr,lam,attenuation) 836 885 String fileStr 837 Variable lam,attenuation // 0 =< attenuation <= 1 : where no attenuator stands for 0.886 Variable lam,attenuation // 0 =< attenuation <= 100 (%) : where no attenuator stands for 0. 838 887 839 888 Variable attenFactor=1 840 889 841 890 // your code here 842 attenFactor = 1- attenuation //???Attenuate transmission891 attenFactor = 1- attenuation*0.01 //???Attenuate transmission 843 892 844 893 return(attenFactor) … … 915 964 endif 916 965 endif 917 if( stringmatch(item,"*.xml") ) 918 if (CheckIfRawData(S_path+item) >0) 919 newlist += item + ";" 920 endif 921 endif 966 // if condition is in here twice, not sure why since they are both "*.xml" 967 // if( stringmatch(item,"*.xml") ) 968 // if (CheckIfRawData(S_path+item) >0) 969 // newlist += item + ";" 970 // endif 971 // endif 922 972 endfor 923 973 newList = SortList(newList,";",0) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_v520.ipf
r607 r641 2 2 #pragma version=5.0 3 3 #pragma IgorVersion=6.1 4 5 6 // to properly set up the template for other facility reduction templates, 7 // function NCNR() must exist here in the Includes file. 8 // 9 Function NCNR() 10 //does nothing but define NCNR() 11 return(0) 12 End 13 4 14 5 15 //************* -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_DataReadWrite.ipf
r596 r641 41 41 return(1) 42 42 Endif 43 // Variable t1=ticks 43 44 //Print "GetFileNameFromPath(filename) = " + GetFileNameFromPathNoSemi(filename) 44 45 ReadHeaderAndData(filename) //this is the full Path+file … … 50 51 // //data is displayed here 51 52 // fRawWindowHook() 52 53 54 // Print "time to load and display (s) = ",(ticks-t1)/60.15 53 55 Return(0) 54 56 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ProtocolAsPanel.ipf
r601 r641 2062 2062 String junkStr="" 2063 2063 if(! waveexists($"root:Packages:NIST:DIV:data")) 2064 junkStr = PromptForPath("Select the detector sensitivity file") 2065 If(strlen(junkStr)==0 || CheckIfRawData(junkStr)) //raw check==1 if RAW, DIV is not 2064 junkStr = PromptForPath("Select the detector sensitivity file") 2065 Print junkStr 2066 #if(exists("HFIR")==6) 2067 if(strlen(junkStr)==0 || !CheckIfDIVData(junkStr)) //if either is false, exit 2068 //Print strlen(junkStr) 2069 //Print CheckIfDIVData(junkStr) 2066 2070 SetDataFolder root: 2067 2071 Abort "No DIV (PLEX) file selected. Please use setABSParams again, selecting the empty beam file and then the detector sensitivity (Plex_) file" 2068 Endif 2069 ReadHeaderAndWork("DIV", junkStr) 2072 endif 2073 #else 2074 if(strlen(junkStr)==0 || CheckIfRawData(junkStr)) //for NCNR, not raw is sufficient, but better in the future to confirm it is DIV if either is false, exit 2075 SetDataFolder root: 2076 Abort "No DIV (PLEX) file selected. Please use setABSParams again, selecting the empty beam file and then the detector sensitivity (Plex_) file" 2077 endif 2078 #endif 2079 ReadHeaderAndWork("DIV", junkStr) 2070 2080 endif 2071 2081 //toggle SANS_Data to linear display if needed, so that we're working with linear scaled data
Note: See TracChangeset
for help on using the changeset viewer.