Changeset 491
- Timestamp:
- Apr 14, 2009 8:06:48 PM (13 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_v520.ipf
r482 r491 105 105 "Patch Detector Pixel Size" 106 106 "Read Detector Pixel Size" 107 "Patch User Account Name" 108 "Read User Account Name" 107 109 "-" 108 110 "AddALLToLayout" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_DataReadWrite.ipf
r483 r491 1304 1304 End 1305 1305 1306 //user account name, starts at byte 78 1307 // limit to 11 characters 1308 Function WriteAcctNameToHeader(fname,str) 1309 String fname,str 1310 1311 if(strlen(str) > 9) 1312 str = str[0,8] 1313 endif 1314 str = "["+str+"]" 1315 WriteTextToHeader(fname,str,78) 1316 return(0) 1317 End 1318 1306 1319 //rewrite an integer field back to the header 1307 1320 // fname is the full path:name … … 1376 1389 return(getStringFromHeader(fname,55,20)) 1377 1390 End 1391 1392 // user account (11 characters @ byte 78) 1393 Function/S getAcctName(fname) 1394 String fname 1395 1396 return(getStringFromHeader(fname,78,11)) 1397 End 1398 1378 1399 1379 1400 // read a single real value with GBLoadWave … … 2494 2515 2495 2516 End 2517 2518 // April 2009 - AJJ 2519 // The new ICE instrument control software was not correctly writing the run.defdir field 2520 // The format of that field should be [NGxSANSn] where x is 3 or 7 and nn is 0 through 50 2521 2522 Proc PatchUserAccountName(firstFile,lastFile,acctName) 2523 Variable firstFile=1,lastFile=100 2524 String acctName = "NG3SANS0" 2525 2526 fPatchUserAccountName(firstFile,lastFile,acctName) 2527 2528 End 2529 2530 Proc ReadUserAccountName(firstFile,lastFile) 2531 Variable firstFile=1,lastFile=100 2532 2533 fReadUserAccountName(firstFile,lastFile) 2534 End 2535 2536 // simple utility to patch the user account name in the file headers 2537 // pass in the account name as a string 2538 // lo is the first file number 2539 // hi is the last file number (inclusive) 2540 // 2541 Function fPatchUserAccountName(lo,hi,acctName) 2542 Variable lo,hi 2543 String acctName 2544 2545 Variable ii 2546 String file 2547 2548 //loop over all files 2549 for(ii=lo;ii<=hi;ii+=1) 2550 file = FindFileFromRunNumber(ii) 2551 if(strlen(file) != 0) 2552 WriteAcctNameToHeader(file,acctName) 2553 else 2554 printf "run number %d not found\r",ii 2555 endif 2556 endfor 2557 2558 return(0) 2559 End 2560 2561 // simple utility to read the user account name stored in the file header 2562 Function fReadUserAccountName(lo,hi) 2563 Variable lo,hi 2564 2565 String file,acctName 2566 Variable ii 2567 2568 for(ii=lo;ii<=hi;ii+=1) 2569 file = FindFileFromRunNumber(ii) 2570 if(strlen(file) != 0) 2571 acctName = getAcctName(file) 2572 printf "File %d: Account name = %s\r",ii,acctName 2573 else 2574 printf "run number %d not found\r",ii 2575 endif 2576 endfor 2577 2578 return(0) 2579 End
Note: See TracChangeset
for help on using the changeset viewer.