Changeset 75
- Timestamp:
- Apr 6, 2007 4:20:53 PM (15 years ago)
- Location:
- sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Marquee.ipf
r72 r75 147 147 //ReWriteReal() takes care of open/close on its own 148 148 Print counts, " counts in XY box" 149 ReWriteReal(filename,counts,494)149 WriteBoxCountsToHeader(filename,counts) 150 150 151 151 End -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NCNR_DataReadWrite.ipf
r72 r75 187 187 intw[17] = integer 188 188 189 //1 text field 189 //1 text field - the file association for transmission are the first 4 bytes 190 190 FSetPos refNum,404 191 191 FReadLine/N=42 refNum,textstr … … 571 571 intw[17] = integer 572 572 573 //1 text field 573 //1 text field - the file association for transmission are the first 4 bytes 574 574 FSetPos refNum,404 575 575 FReadLine/N=42 refNum,textstr … … 1009 1009 //this procedure takes care of all file open/close pairs needed 1010 1010 // 1011 Function ReWriteReal(path,value,start)1011 Function WriteVAXReal(path,value,start) 1012 1012 String path 1013 1013 Variable value,start … … 1054 1054 //Print "Wrote end of header to " + num2str(V_filePOS) 1055 1055 1056 Close refnum 1056 Close refnum //at this point, it is as the VAX would have written it. 1057 1057 1058 1058 Return(0) 1059 1059 End 1060 1061 //sample transmission is a real value at byte 158 1062 Function WriteTransmissionToHeader(fname,trans) 1063 String fname 1064 Variable trans 1065 1066 WriteVAXReal(fname,trans,158) //transmission start byte is 158 1067 return(0) 1068 End 1069 1070 //whole transmission is a real value at byte 392 1071 Function WriteWholeTransToHeader(fname,trans) 1072 String fname 1073 Variable trans 1074 1075 WriteVAXReal(fname,trans,392) //transmission start byte is 392 1076 return(0) 1077 End 1078 1079 //box sum counts is a real value at byte 494 1080 Function WriteBoxCountsToHeader(fname,counts) 1081 String fname 1082 Variable counts 1083 1084 WriteVAXReal(fname,counts,494) // start byte is 494 1085 return(0) 1086 End 1087 1088 //beam stop X-pos is at byte 368 1089 Function WriteBSXPosToHeader(fname,xpos) 1090 String fname 1091 Variable xpos 1092 1093 WriteVAXReal(fname,xpos,368) 1094 return(0) 1095 End 1096 1097 //sample thickness is at byte 162 1098 Function WriteThicknessToHeader(fname,num) 1099 String fname 1100 Variable num 1101 1102 WriteVAXReal(fname,num,162) 1103 return(0) 1104 End 1105 1106 //beam center X pixel location is at byte 252 1107 Function WriteBeamCenterXToHeader(fname,num) 1108 String fname 1109 Variable num 1110 1111 WriteVAXReal(fname,num,252) 1112 return(0) 1113 End 1114 1115 //beam center Y pixel location is at byte 256 1116 Function WriteBeamCenterYToHeader(fname,num) 1117 String fname 1118 Variable num 1119 1120 WriteVAXReal(fname,num,256) 1121 return(0) 1122 End 1123 1124 //attenuator number (not its transmission) is at byte 51 1125 Function WriteAttenNumberToHeader(fname,num) 1126 String fname 1127 Variable num 1128 1129 WriteVAXReal(fname,num,51) 1130 return(0) 1131 End 1132 1133 //monitor count is at byte 39 1134 Function WriteMonitorCountToHeader(fname,num) 1135 String fname 1136 Variable num 1137 1138 WriteVAXReal(fname,num,39) 1139 return(0) 1140 End 1141 1142 //total detector count is at byte 47 1143 Function WriteDetectorCountToHeader(fname,num) 1144 String fname 1145 Variable num 1146 1147 WriteVAXReal(fname,num,47) 1148 return(0) 1149 End 1150 1151 //transmission detector count is at byte 388 1152 Function WriteTransDetCountToHeader(fname,num) 1153 String fname 1154 Variable num 1155 1156 WriteVAXReal(fname,num,388) 1157 return(0) 1158 End 1159 1160 //wavelength is at byte 292 1161 Function WriteWavelengthToHeader(fname,num) 1162 String fname 1163 Variable num 1164 1165 WriteVAXReal(fname,num,292) 1166 return(0) 1167 End 1168 1169 //wavelength spread is at byte 296 1170 Function WriteWavelengthDistrToHeader(fname,num) 1171 String fname 1172 Variable num 1173 1174 WriteVAXReal(fname,num,296) 1175 return(0) 1176 End 1177 1178 //temperature is at byte 186 1179 Function WriteTemperatureToHeader(fname,num) 1180 String fname 1181 Variable num 1182 1183 WriteVAXReal(fname,num,186) 1184 return(0) 1185 End 1186 1187 //magnetic field is at byte 190 1188 Function WriteMagnFieldToHeader(fname,num) 1189 String fname 1190 Variable num 1191 1192 WriteVAXReal(fname,num,190) 1193 return(0) 1194 End 1195 1196 //Source Aperture diameter is at byte 280 1197 Function WriteSourceApDiamToHeader(fname,num) 1198 String fname 1199 Variable num 1200 1201 WriteVAXReal(fname,num,280) 1202 return(0) 1203 End 1204 1205 //Sample Aperture diameter is at byte 284 1206 Function WriteSampleApDiamToHeader(fname,num) 1207 String fname 1208 Variable num 1209 1210 WriteVAXReal(fname,num,284) 1211 return(0) 1212 End 1213 1214 //Source to sample distance is at byte 288 1215 Function WriteSrcToSamDistToHeader(fname,num) 1216 String fname 1217 Variable num 1218 1219 WriteVAXReal(fname,num,288) 1220 return(0) 1221 End 1222 1223 //detector offset is at byte 264 1224 Function WriteDetectorOffsetToHeader(fname,num) 1225 String fname 1226 Variable num 1227 1228 WriteVAXReal(fname,num,264) 1229 return(0) 1230 End 1231 1232 //beam stop diameter is at byte 272 1233 Function WriteBeamStopDiamToHeader(fname,num) 1234 String fname 1235 Variable num 1236 1237 WriteVAXReal(fname,num,272) 1238 return(0) 1239 End 1240 1241 //detector offset is at byte 260 1242 Function WriteSDDToHeader(fname,num) 1243 String fname 1244 Variable num 1245 1246 WriteVAXReal(fname,num,260) 1247 return(0) 1248 End 1249 1060 1250 1061 1251 //rewrite a text field back to the header … … 1080 1270 end 1081 1271 1272 Function WriteSamLabelToHeader(fname,str) 1273 String fname,str 1274 1275 RewriteTextToHeader(fname,str,98) 1276 return(0) 1277 End 1278 1082 1279 //rewrite an integer field back to the header 1083 1280 // fname is the full path:name … … 1101 1298 end 1102 1299 1300 Function WriteCountTimeToHeader(fname,num) 1301 String fname 1302 Variable num 1303 1304 RewriteIntegerToHeader(fname,num,31) 1305 return(0) 1306 End 1307 1103 1308 // read specific bits of information from the header 1104 1309 // each of these operations MUST take care of open/close on their own … … 1117 1322 return(str) 1118 1323 End 1324 1119 1325 // file suffix (4 characters @ byte 19) 1120 1326 Function/S getSuffix(fname) … … 1122 1328 1123 1329 return(getStringFromHeader(fname,19,4)) 1330 End 1331 1332 // associated file suffix (for transmission) (4 characters @ byte 404) 1333 Function/S getAssociatedFileSuffix(fname) 1334 String fname 1335 1336 return(getStringFromHeader(fname,404,4)) 1124 1337 End 1125 1338 … … 1187 1400 end 1188 1401 1402 //box counts are stored at byte 494 1403 Function getBoxCounts(fname) 1404 String fname 1405 1406 return(getRealValueFromHeader(fname,494)) 1407 end 1408 1409 //whole detector trasmission is at byte 392 1410 Function getSampleTransWholeDetector(fname) 1411 String fname 1412 1413 return(getRealValueFromHeader(fname,392)) 1414 end 1415 1189 1416 //SampleThickness is at byte 162 1190 1417 Function getSampleThickness(fname) … … 1229 1456 end 1230 1457 1231 // SDDis at byte 2601458 //sample to detector distance is at byte 260 1232 1459 Function getSDD(fname) 1233 1460 String fname … … 1340 1567 ///// TRANSMISSION RELATED FUNCTIONS //////// 1341 1568 //box coordinate are returned by reference 1342 Function GetXYBoxFromFile(filename,x1,x2,y1,y2)1569 Function getXYBoxFromFile(filename,x1,x2,y1,y2) 1343 1570 String filename 1344 1571 Variable &x1,&x2,&y1,&y2 … … 1378 1605 return(0) 1379 1606 End 1607 1608 //associated file suffix is the first 4 characters of a text field starting 1609 // at byte 404 1610 Function WriteAssocFileSuffixToHeader(fname,suffix) 1611 String fname,suffix 1612 1613 Variable refnum 1614 1615 Open/A/T="????TEXT" refnum as fname 1616 FSetPos refnum,404 1617 FBinWrite refnum, suffix 1618 FStatus refnum 1619 FSetPos refnum,V_logEOF 1620 Close refnum 1621 1622 return(0) 1623 end -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/PatchFiles.ipf
r72 r75 412 412 Wave/T textVal 413 413 414 Variable refnum,num ,start414 Variable refnum,num 415 415 String textstr 416 416 417 417 //change the sample label ? 418 418 if(change[0]) 419 RewriteTextToHeader(fname,textVal[0],98)419 WriteSamLabelToHeader(fname,textVal[0]) 420 420 Endif 421 421 … … 423 423 if(change[6]) 424 424 num =str2num(textVal[6]) 425 RewriteIntegerToHeader(fname,num,31)425 WriteCountTimeToHeader(fname,num) 426 426 Endif 427 427 428 428 //ReWriteReal() takes care of open/close on its own 429 if(change[1]) 429 if(change[1]) //sample transmission 430 430 num = str2num(textVal[1]) 431 start = 158 //transmission 432 ReWriteReal(fname,num,start) 433 Endif 434 if(change[2]) 431 WriteTransmissionToHeader(fname,num) 432 Endif 433 if(change[2]) //sample thickness 435 434 num = str2num(textVal[2]) 436 start = 162 //thickness 437 ReWriteReal(fname,num,start) 438 Endif 439 if(change[3]) 435 WriteThicknessToHeader(fname,num) 436 Endif 437 if(change[3]) //pixel X 440 438 num = str2num(textVal[3]) 441 start = 252 //pixel x 442 ReWriteReal(fname,num,start) 443 Endif 444 if(change[4]) 439 WriteBeamCenterXToHeader(fname,num) 440 Endif 441 if(change[4]) // pixel Y 445 442 num = str2num(textVal[4]) 446 start = 256 //pixel y 447 ReWriteReal(fname,num,start) 448 Endif 449 if(change[5]) 443 WriteBeamCenterYToHeader(fname,num) 444 Endif 445 if(change[5]) //attenuator number 450 446 num = str2num(textVal[5]) 451 start = 51 //atten 452 ReWriteReal(fname,num,start) 447 WriteAttenNumberToHeader(fname,num) 453 448 Endif 454 449 //[6] was the counting time, integer written above 455 if(change[7]) 456 num = str2num(textVal[7]) 457 start = 39 //monitor count 458 ReWriteReal(fname,num,start) 459 Endif 460 if(change[8]) 450 if(change[7]) //monitor count 451 num = str2num(textVal[7]) 452 WriteMonitorCountToHeader(fname,num) 453 Endif 454 if(change[8]) //total detector count 461 455 num = str2num(textVal[8]) 462 start = 47 //total detector count 463 ReWriteReal(fname,num,start) 464 Endif 465 if(change[9]) 456 WriteDetectorCountToHeader(fname,num) 457 Endif 458 if(change[9]) //trans det count 466 459 num = str2num(textVal[9]) 467 start = 388 //trans det count 468 ReWriteReal(fname,num,start) 469 Endif 470 if(change[10]) 460 WriteTransDetCountToHeader(fname,num) 461 Endif 462 if(change[10]) //wavelength 471 463 num = str2num(textVal[10]) 472 start = 292 //wavelength 473 ReWriteReal(fname,num,start) 464 WriteWavelengthToHeader(fname,num) 474 465 Endif 475 466 /// 476 if(change[11]) 467 if(change[11]) //wavelength spread 477 468 num = str2num(textVal[11]) 478 start = 296 //wavelength spread 479 ReWriteReal(fname,num,start) 480 Endif 481 if(change[12]) 469 WriteWavelengthDistrToHeader(fname,num) 470 Endif 471 if(change[12]) //temperature 482 472 num = str2num(textVal[12]) 483 start = 186 //temperture 484 ReWriteReal(fname,num,start) 485 Endif 486 if(change[13]) 473 WriteTemperatureToHeader(fname,num) 474 Endif 475 if(change[13]) //magnetic field 487 476 num = str2num(textVal[13]) 488 start = 190 //magnetic field 489 ReWriteReal(fname,num,start) 490 Endif 491 if(change[14]) 477 WriteMagnFieldToHeader(fname,num) 478 Endif 479 if(change[14]) //source aperture 492 480 num = str2num(textVal[14]) 493 start = 280 //source aperture 494 ReWriteReal(fname,num,start) 495 Endif 496 if(change[15]) 481 WriteSourceApDiamToHeader(fname,num) 482 Endif 483 if(change[15]) //sample aperture 497 484 num = str2num(textVal[15]) 498 start = 284 //sample aperture 499 ReWriteReal(fname,num,start) 485 WriteSampleApDiamToHeader(fname,num) 500 486 Endif 501 487 /// 502 if(change[16]) 488 if(change[16]) //source-sam dist 503 489 num = str2num(textVal[16]) 504 start = 288 //source-sam dist 505 ReWriteReal(fname,num,start) 506 Endif 507 if(change[17]) 490 WriteSrcToSamDistToHeader(fname,num) 491 Endif 492 if(change[17]) //det offset 508 493 num = str2num(textVal[17]) 509 start = 264 //det offset 510 ReWriteReal(fname,num,start) 511 Endif 512 if(change[18]) 494 WriteDetectorOffsetToHeader(fname,num) 495 Endif 496 if(change[18]) //beamstop diam 513 497 num = str2num(textVal[18]) 514 start = 272 //beamstop diam 515 ReWriteReal(fname,num,start) 516 Endif 517 if(change[19]) 498 WriteBeamStopDiamToHeader(fname,num) 499 Endif 500 if(change[19]) //SDD 518 501 num = str2num(textVal[19]) 519 start = 260 //SDD 520 ReWriteReal(fname,num,start) 521 Endif 522 //if ReWriteReal() was the last thing called, the file is closed already. just exit 502 WriteSDDToHeader(fname,num) 503 Endif 523 504 Return(0) 524 505 End -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Transmission.ipf
r74 r75 252 252 Variable isTrans, xTol= -5 253 253 254 String textstr,temp,labelStr,date_time,suffix,assoc255 Variable ctime,lambda,sdd,detcnt,cntrate,refNum,trans,thick,xcenter,ycenter,numatten256 Variable lastPoint , beamstop, Whole254 // String textstr,temp,labelStr,date_time,suffix,assoc 255 // Variable ctime,lambda,sdd,detcnt,cntrate,refNum,trans,thick,xcenter,ycenter,numatten 256 Variable lastPoint//, beamstop, Whole 257 257 258 258 isTrans = isTransFile(fname, xTol) … … 283 283 lastPoint = numpnts(GLambda) 284 284 285 Open/R refNum as fname286 287 285 InsertPoints lastPoint,1,G_TRANS_Filenames 288 286 G_TRANS_Filenames[lastPoint]="" … … 292 290 293 291 //read the file suffix 294 FSetPos refNum,19295 FReadLine/N=4 refNum,suffix296 //print suffix297 292 InsertPoints lastPoint,1,GSuffix 298 GSuffix[lastPoint]= suffix293 GSuffix[lastPoint]=getSuffix(fname) 299 294 300 295 //read any suffix that this file is associated with 301 //FSetPos refNum,91 //wrong position302 FSetPos refNum,404303 FReadLine/N=4 refNum,assoc304 //print isTrans, assoc305 296 InsertPoints lastPoint,1,GSuffices 306 GSuffices[lastPoint]= assoc297 GSuffices[lastPoint]=getAssociatedFileSuffix(fname) 307 298 308 299 // read the sample.label text field 309 FSetPos refNum,98 //will start reading at byte 99310 FReadLine/N=60 refNum,labelStr311 300 InsertPoints lastPoint,1,GLabels 312 GLabels[lastPoint]=labelStr 313 314 Close refNum 301 GLabels[lastPoint]=getSampleLabel(fname) 315 302 316 //read the reals with GBLoadWave 317 String GBLoadStr="GBLoadWave/O/N=tempGBwave/T={2,2}/J=2/W=1/Q" 318 String strToExecute 319 303 320 304 //Transmission 321 strToExecute = GBLoadStr + "/S=158/U=1" + "\"" + fname + "\""322 Execute strToExecute323 Wave w=$"tempGBWave0"324 trans = w[0]325 305 InsertPoints lastPoint,1,GTransmission 326 GTransmission[lastPoint]=trans 327 328 //Whole Transmission 329 strToExecute = GBLoadStr + "/S=392/U=1" + "\"" + fname + "\"" 330 Execute strToExecute 331 Wave w=$"tempGBWave0" 332 Whole = w[0] 306 GTransmission[lastPoint]=getSampleTrans(fname) 307 308 //Whole detector Transmission 333 309 InsertPoints lastPoint,1,GWhole 334 GWhole[lastPoint]= Whole310 GWhole[lastPoint]=getSampleTransWholeDetector(fname) 335 311 336 312 //SDD 337 strToExecute = GBLoadStr + "/S=260/U=1" + "\"" + fname + "\""338 Execute strToExecute339 sdd = w[0]340 313 InsertPoints lastPoint,1,GSDD 341 GSDD[lastPoint]= sdd314 GSDD[lastPoint]=getSDD(fname) 342 315 343 316 //wavelength 344 strToExecute = GBLoadStr + "/S=292/U=1" + "\"" + fname + "\""345 Execute strToExecute346 lambda = w[0]347 317 InsertPoints lastPoint,1,GLambda 348 GLambda[lastPoint]=lambda 349 350 // InsertPoints lastPoint,1,GWhole 351 // GWhole[lastPoint]=1 352 353 KillWaves/Z w 354 318 GLambda[lastPoint]=getWavelength(fname) 319 320 return(0) 355 321 End 356 322 … … 533 499 suffix=T_GSuffix[jj] 534 500 filename = pathname + T_GFilenames[ii] 535 Open/A/T="????TEXT" refnum as filename 536 //FSetPos refnum,91 //wrong position 537 FSetPos refnum,404 538 FBinWrite refnum, suffix 539 FStatus refnum 540 FSetPos refnum,V_logEOF 541 Close refnum 501 WriteAssocFileSuffixToHeader(filename,suffix) 542 502 endif 543 503 jj+=1 … … 556 516 suffix=T_GSuffix[jj] 557 517 filename = pathname + S_GFilenames[ii] 558 Open/A/T="????TEXT" refnum as filename 559 //FSetPos refnum,91 //wrong position 560 FSetPos refnum,404 561 FBinWrite refnum, suffix 562 FStatus refnum 563 FSetPos refnum,V_logEOF 564 Close refnum 518 WriteAssocFileSuffixToHeader(filename,suffix) 565 519 endif 566 520 jj+=1 … … 601 555 suffix=T_GSuffix[jj] 602 556 filename = pathname + T_GFilenames[ii] 603 Open/A/T="????TEXT" refnum as filename 604 //FSetPos refnum,91 //wrong position 605 FSetPos refnum,404 606 FBinWrite refnum, suffix 607 FStatus refnum 608 FSetPos refnum,V_logEOF 609 Close refnum 557 WriteAssocFileSuffixToHeader(filename,suffix) 610 558 endif 611 559 jj+=1 … … 662 610 663 611 // write in zeros for the box coordinates 664 Open/A/T="????TEXT" refnum as filename 665 FSetPos refnum,478 666 FBinWrite/F=3/B=3 refNum, zero 667 FBinWrite/F=3/B=3 refNum, zero 668 FBinWrite/F=3/B=3 refNum, zero 669 FBinWrite/F=3/B=3 refNum, zero 670 FStatus refnum //move to the end of the file before closing 671 FSetPos refnum,V_logEOF 672 Close refnum 673 612 WriteXYBoxToHeader(filename,0,0,0,0) 613 674 614 // write in a null suffix 675 Open/A/T="????TEXT" refnum as filename 676 FSetPos refnum,404 //suffix start byte is 404 677 FBinWrite refnum, suffix 678 FStatus refnum 679 FSetPos refnum,V_logEOF 680 Close refnum 615 WriteAssocFileSuffixToHeader(filename,suffix) 681 616 682 //write a trans==1 to the file header of the raw data (open/close done in function) 683 ReWriteReal(filename,1,158) //transmission start byte is 158 684 ReWriteReal(filename,1,392) //WholeTrans start byte is 392 617 //write a trans==1 to the file header of the raw data 618 WriteTransmissionToHeader(filename,1) //sample trans 619 620 WriteWholeTransToHeader(filename,1) //WholeTrans start byte is 392 685 621 686 622 //then update the table that is displayed … … 693 629 endif 694 630 695 // // Write suffix of empty beam file into transmission files696 // ii= 0697 // do698 // if (cmpstr(T_EMP_Filenames[ii],"")!=0)699 // jj=0700 // do701 // if (cmpstr(T_EMP_Filenames[ii],T_GFilenames[jj])==0)702 // suffix=T_GSuffix[jj]703 // filename = pathname + T_GFilenames[ii]704 // Open/A/T="????TEXT" refnum as filename705 // //FSetPos refnum,91 //wrong position706 // FSetPos refnum,404707 // FBinWrite refnum, suffix708 // FStatus refnum709 // FSetPos refnum,V_logEOF710 // Close refnum711 // endif712 // jj+=1713 // while(jj<num_t_files)714 // endif715 // ii+=1716 // while(ii<num_t_files)717 631 718 632 if(target == 1) … … 721 635 do 722 636 filename = pathname + S_GFilenames[ii] 723 Open/A/T="????TEXT" refnum as filename 724 //FSetPos refnum,91 //wrong position 725 FSetPos refnum,404 726 FBinWrite refnum, suffix 727 FStatus refnum 728 FSetPos refnum,V_logEOF 729 Close refnum 637 // write in a null suffix 638 WriteAssocFileSuffixToHeader(filename,suffix) 730 639 731 640 //write a trans==1 to the file header of the raw data (open/close done in function) 732 ReWriteReal(filename,1,158) //transmission start byte is 158641 WriteTransmissionToHeader(filename,1) //sample trans 733 642 734 643 //then update the table that is displayed … … 742 651 return(0) 743 652 End 744 745 746 // assigns both the empty file to the trans file747 // and the trans file to the scattering file748 // - writes out 4 characters to the file headers @ byte 404749 //750 // assignments are only permanently made when the transmissions751 // are actually calculated752 //753 // NOT USED - AssignSelTransFilestoData(first,last) has been generalized to take a range754 // 3/31/04 SRK755 //Function AssignTransFilesToData()756 //757 // Wave/T T_EMP_Filenames = $"root:myGlobals:TransHeaderInfo:T_EMP_Filenames"758 // Wave/T T_GSuffices = $"root:myGlobals:TransHeaderInfo:T_Suffices"759 // Wave/T T_GFilenames = $"root:myGlobals:TransHeaderInfo:T_Filenames"760 // Wave/T T_GSuffix = $"root:myGlobals:TransHeaderInfo:T_Suffix"761 //762 // Wave/T S_TRANS_Filenames = $"root:myGlobals:TransHeaderInfo:S_TRANS_Filenames"763 // Wave/T S_GSuffices = $"root:myGlobals:TransHeaderInfo:S_Suffices"764 // Wave/T S_GFilenames = $"root:myGlobals:TransHeaderInfo:S_Filenames"765 // Wave/T S_GSuffix = $"root:myGlobals:TransHeaderInfo:S_Suffix"766 //767 // Variable num_s_files, num_t_files, ii, jj768 // Variable refnum769 // num_t_files = numpnts(T_GFilenames)770 // num_s_files = numpnts(S_GFilenames)771 // String suffix = ""772 // PathInfo catPathName773 // String pathname = S_path774 // String filename775 //776 // // Write suffix of empty beam file into transmission files777 // ii= 0778 // do779 // if (cmpstr(T_EMP_Filenames[ii],"")!=0)780 // jj=0781 // do782 // if (cmpstr(T_EMP_Filenames[ii],T_GFilenames[jj])==0)783 // suffix=T_GSuffix[jj]784 // filename = pathname + T_GFilenames[ii]785 // Open/A/T="????TEXT" refnum as filename786 // //FSetPos refnum,91 //wrong position787 // FSetPos refnum,404788 // FBinWrite refnum, suffix789 // FStatus refnum790 // FSetPos refnum,V_logEOF791 // Close refnum792 // endif793 // jj+=1794 // while(jj<num_t_files)795 // endif796 // ii+=1797 // while(ii<num_t_files)798 //799 // // Write suffix of transmission files into scattering files800 // ii= 0801 // do802 // if (cmpstr(S_TRANS_Filenames[ii],"")!=0)803 // jj=0804 // do805 // if (cmpstr(S_TRANS_Filenames[ii],T_GFilenames[jj])==0)806 // suffix=T_GSuffix[jj]807 // filename = pathname + S_GFilenames[ii]808 // Open/A/T="????TEXT" refnum as filename809 // //FSetPos refnum,91 //wrong position810 // FSetPos refnum,404811 // FBinWrite refnum, suffix812 // FStatus refnum813 // FSetPos refnum,V_logEOF814 // Close refnum815 // endif816 // jj+=1817 // while(jj<num_t_files)818 // endif819 // ii+=1820 // while(ii<num_s_files)821 //822 // return(0)823 //End824 825 826 827 // NOT USED --- CalcSelTransFromHeader(first,last) has been generalized to accept a selection828 // and modified to account for different attenuation factors. 3/31/04 SRK829 //830 //Function CalcTransFromHeader()831 // String filename832 // Wave/T T_EMP_Filenames = $"root:myGlobals:TransHeaderInfo:T_EMP_Filenames"833 // Wave/T T_GFilenames = $"root:myGlobals:TransHeaderInfo:T_Filenames"834 //835 // Wave/T S_TRANS_Filenames = $"root:myGlobals:TransHeaderInfo:S_TRANS_Filenames"836 // Wave/T S_GFilenames = $"root:myGlobals:TransHeaderInfo:S_Filenames"837 // Wave S_GTransmission = $"root:myGlobals:TransHeaderInfo:S_Transmission"838 //839 // Variable num_s_files, num_t_files, ii, jj840 // Variable refnum, transCts, emptyCts841 // num_t_files = numpnts(T_GFilenames)842 // num_s_files = numpnts(S_GFilenames)843 // String suffix = ""844 // PathInfo catPathName845 // String pathname = S_path846 // String textStr="",abortStr=""847 // String emptyFile, transFile848 //849 // ii= 0850 // do851 // if (cmpstr(S_TRANS_Filenames[ii],"")!=0)852 // jj=0853 // do854 // if (cmpstr(S_TRANS_Filenames[ii],T_GFilenames[jj])==0)855 // //Look for an empty beam for the transmission then856 // if (cmpstr(T_EMP_Filenames[jj],"")!=0)//Do the transmission calculation857 // textStr = ""858 // filename=pathname+S_GFilenames[ii]859 // emptyFile = pathname+T_EMP_Filenames[jj]860 // transFile = pathname+T_GFilenames[jj]861 // //////////862 // // check the empty beam file for previously selected coordinates863 // //if they exist, set the xy string , save the normalized counts somewhere864 // //the value was written to an unused r*4 header analysis.factor (@b494)865 // Variable x1,x2,y1,y2,err866 // Open/R refnum as emptyFile867 // FSetPos refnum,478868 // FBinRead/F=3/B=3 refnum, x1869 // FBinRead/F=3/B=3 refnum, x2870 // FBinRead/F=3/B=3 refnum, y1871 // FBinRead/F=3/B=3 refnum, y2872 // Close refnum873 // //read the real count value874 // String GBLoadStr="GBLoadWave/O/N=tempGBwave/T={2,2}/J=2/W=1/Q"875 // String strToExecute876 // strToExecute = GBLoadStr + "/S=494/U=1" + "\"" + emptyFile + "\""877 // Execute strToExecute878 // Wave w=$"tempGBWave0"879 // Variable/G root:myGlobals:Patch:gTransCts = w[0]880 // emptyCts = w[0]881 //882 // //883 // if( ((x1-x2)==0) || ((y1-y2)==0) ) //zero width marquee in either direction884 // //no region selected885 // //prompt user to select box w/marquee886 // DoWindow/F TransFileTable887 // Abort "Use \"Set BCENT File\", then \"SetXYBox\" to select XY range in empty beam file "+T_EMP_Filenames[jj]888 // //from here the Marquee menu selection must handle the task of setting the box889 // //and updating the information in the file header890 // Endif891 //892 // //read in trans file to add to SAM893 // ReadHeaderAndData(transFile)894 // //adds to SAM895 // err = Raw_to_work("SAM")896 // //sum region in SAM897 // transCts = SumCountsInBox(x1,x2,y1,y2,"SAM")898 //899 // //calculate trans based on empty beam value900 // Variable trans= transCts/emptyCts901 //902 // //write out counts and transmission903 // textstr += " Trans counts = "+num2str(transCts) + " Trans = "+num2str(trans)904 // Print S_GFilenames[ii], textstr905 // //Print ii,jj906 // //Print "Empty counts = ",emptycts, "Trans counts = "+num2str(transCts) + " Trans = "+num2str(trans)907 //908 // //write the trans to the file header of the raw data (open/close done in function)909 // Variable start = 158 //transmission start byte910 // ReWriteReal(filename,trans,start)911 //912 // //then update the global that is displayed913 // S_GTransmission[ii] = trans914 //915 // else // There is no empty assigned916 // abortStr = "Empty beam file not assigned properly for " + T_GFilenames[jj]917 // Print abortStr918 // //Abort abortStr919 // return(1)920 // endif921 // endif922 // jj+=1923 // while(jj<num_t_files)924 // else //no transmission file925 // abortStr = "Transmission beam file not assigned properly for " + S_GFilenames[ii]926 // Print abortStr927 // endif928 // ii+=1929 // while(ii<num_s_files)930 // print "done"931 // return(0)932 //End933 934 935 653 936 654 //given a selection of scattering files, calculates the transmission … … 997 715 //if they exist, set the xy string , save the normalized counts somewhere 998 716 //the value was written to an unused r*4 header analysis.factor (@b494) 999 Open/R refnum as emptyFile 1000 FSetPos refnum,478 1001 FBinRead/F=3/B=3 refnum, x1 1002 FBinRead/F=3/B=3 refnum, x2 1003 FBinRead/F=3/B=3 refnum, y1 1004 FBinRead/F=3/B=3 refnum, y2 1005 Close refnum 717 GetXYBoxFromFile(emptyFile,x1,x2,y1,y2) 718 1006 719 //read the real count value 1007 strToExecute = GBLoadStr + "/S=494/U=1" + "\"" + emptyFile + "\"" 1008 Execute strToExecute 1009 Wave w=$"tempGBWave0" 1010 // Variable/G root:myGlobals:Patch:gTransCts = w[0] 1011 emptyCts = w[0] 720 emptyCts = getBoxCounts(emptyFile) 1012 721 // read the attenuator number of the empty beam file 1013 strToExecute = GBLoadStr + "/S=39/U=4" + "\"" + emptyFile + "\"" 1014 Execute strToExecute 1015 attenEmp = w[3] 722 attenEmp = getAttenNumber(emptyFile) 1016 723 // 1017 724 if( ((x1-x2)==0) || ((y1-y2)==0) ) //zero width marquee in either direction … … 1046 753 endif 1047 754 //write the trans to the file header of the raw data (open/close done in function) 1048 ReWriteReal(filename,trans,158) //transmission start byte is 158755 WriteTransmissionToHeader(filename,trans) 1049 756 1050 757 //then update the global that is displayed … … 1117 824 //if they exist, set the xy string , save the normalized counts somewhere 1118 825 //the value was written to an unused r*4 header analysis.factor (@b494) 1119 Open/R refnum as emptyFile 1120 FSetPos refnum,478 1121 FBinRead/F=3/B=3 refnum, x1 1122 FBinRead/F=3/B=3 refnum, x2 1123 FBinRead/F=3/B=3 refnum, y1 1124 FBinRead/F=3/B=3 refnum, y2 1125 Close refnum 826 getXYBoxFromFile(emptyFile,x1,x2,y1,y2) 827 1126 828 //read the real count value 1127 strToExecute = GBLoadStr + "/S=494/U=1" + "\"" + emptyFile + "\"" 1128 Execute strToExecute 1129 Wave w=$"tempGBWave0" 1130 // Variable/G root:myGlobals:Patch:gTransCts = w[0] 1131 emptyCts = w[0] 829 emptyCts = getBoxCounts(emptyFile) 1132 830 // read the attenuator number of the empty beam file 1133 strToExecute = GBLoadStr + "/S=39/U=4" + "\"" + emptyFile + "\"" 1134 Execute strToExecute 1135 attenEmp = w[3] 831 attenEmp = getAttenNumber(emptyFile) 1136 832 // 1137 833 if( ((x1-x2)==0) || ((y1-y2)==0) ) //zero width marquee in either direction … … 1168 864 endif 1169 865 //write the trans to the file header of the raw data (open/close done in function) 1170 ReWriteReal(filename,trans,158) //transmission start byte is 158866 WriteTransmissionToHeader(filename,trans) //transmission start byte is 158 1171 867 1172 868 //then update the global that is displayed … … 1242 938 //if they exist, set the xy string , save the normalized counts somewhere 1243 939 //the value was written to an unused r*4 header analysis.factor (@b494) 1244 Open/R refnum as emptyFile 1245 FSetPos refnum,478 1246 FBinRead/F=3/B=3 refnum, x1 1247 FBinRead/F=3/B=3 refnum, x2 1248 FBinRead/F=3/B=3 refnum, y1 1249 FBinRead/F=3/B=3 refnum, y2 1250 Close refnum 940 941 getXYBoxFromFile(emptyFile,x1,x2,y1,y2) 1251 942 //read the real count value 1252 strToExecute = GBLoadStr + "/S=494/U=1" + "\"" + emptyFile + "\"" 1253 Execute strToExecute 1254 Wave w=$"tempGBWave0" 1255 // Variable/G root:myGlobals:Patch:gTransCts = w[0] 1256 emptyCts = w[0] 943 emptyCts = getBoxCounts(emptyFile) 1257 944 // read the attenuator number of the empty beam file 1258 strToExecute = GBLoadStr + "/S=39/U=4" + "\"" + emptyFile + "\"" 1259 Execute strToExecute 1260 attenEmp = w[3] 945 attenEmp = getAttenNumber(emptyFile) 1261 946 // 1262 947 if( ((x1-x2)==0) || ((y1-y2)==0) ) //zero width marquee in either direction … … 1298 983 endif 1299 984 //write the trans to the file header of the raw data (open/close done in function) 1300 ReWriteReal(filename,trans,392) //WholeTrans start byte is 392985 WriteWholeTransToHeader(filename,trans) 1301 986 1302 987 //then update the global that is displayed … … 1483 1168 //the value was written to an unused r*4 header analysis.factor (@b494) 1484 1169 Variable refnum,x1,x2,y1,y2,err 1485 Open/R refnum as filename 1486 FSetPos refnum,478 1487 FBinRead/F=3/B=3 refnum, x1 1488 FBinRead/F=3/B=3 refnum, x2 1489 FBinRead/F=3/B=3 refnum, y1 1490 FBinRead/F=3/B=3 refnum, y2 1491 Close refnum 1492 //read the real count value 1493 String GBLoadStr="GBLoadWave/O/N=tempGBwave/T={2,2}/J=2/W=1/Q" 1494 String strToExecute 1495 strToExecute = GBLoadStr + "/S=494/U=1" + "\"" + filename + "\"" 1496 Execute strToExecute 1497 Wave w=$"tempGBWave0" 1498 Variable/G root:myGlobals:gTransCts = w[0] //***NOTE this is NOT in the Trans sub-folder 1170 getXYBoxFromFile(filename,x1,x2,y1,y2) 1171 1172 //read the real count value, assign to a global 1173 Variable/G root:myGlobals:gTransCts = getBoxCounts(filename) //***NOTE this is NOT in the Trans sub-folder 1499 1174 // 1500 1175 if( ((x1-x2)==0) || ((y1-y2)==0) ) //zero width marquee in either direction … … 1547 1222 1548 1223 UpdateBoxCoordinates() 1549 KillWaves/Z w1550 1224 Return (0) 1551 1225 End … … 1795 1469 1796 1470 Variable start 1797 //x-position starts after byte 368 1798 //ReWriteReal() takes care of open/close on its own 1799 start = 368 //BS x-position 1800 ReWriteReal(fname,xpos,start) 1471 //x-position starts after byte 368 in VAX files 1472 WriteBSXPosToHeader(fname,xpos) 1801 1473 return(0) 1802 1474 End
Note: See TracChangeset
for help on using the changeset viewer.