Changeset 557
- Timestamp:
- Sep 16, 2009 3:51:45 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
r544 r557 114 114 "Read Detector Count" 115 115 "-" 116 "PatchFileNameInHeader" 117 "ReadFileNameInHeader" 118 "-" 116 119 "AddALLToLayout" 117 120 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_DataReadWrite.ipf
r544 r557 1318 1318 End 1319 1319 1320 // file name, starts at byte 2 1321 // limit to 21 characters 1322 // 1323 // be sure that any white space to pad to 21 characters is at the front of the string 1324 Function WriteFileNameToHeader(fname,str) 1325 String fname,str 1326 1327 Variable i 1328 String newStr="" 1329 // printf "\"%s\"\t%d\r",str,strlen(str) 1330 1331 //strip any white spaces from the end (from TrimWSR(str) in cansasXML.ipf) 1332 for (i=strlen(str)-1; char2num(str[i])<=32 && i>=0; i-=1) // find last non-white space 1333 endfor 1334 str = str[0,i] 1335 // printf "\"%s\"\t%d\r",str,strlen(str) 1336 1337 // if the string is less than 21 characters, fix it with white space at the beginning 1338 if(strlen(str) < 21) 1339 newStr = PadString(newStr,21,0x20) //pad with fortran-style spaces 1340 newStr[21-strlen(str),20] = str 1341 else 1342 newStr = str 1343 endif 1344 // printf "\"%s\"\t%d\r",newstr,strlen(newstr) 1345 1346 WriteTextToHeader(fname,newstr,2) 1347 return(0) 1348 End 1349 1350 1320 1351 //rewrite an integer field back to the header 1321 1352 // fname is the full path:name … … 1396 1427 1397 1428 return(getStringFromHeader(fname,78,11)) 1429 End 1430 1431 // file name (21 characters @ byte 2) 1432 Function/S getFileName(fname) 1433 String fname 1434 1435 return(getStringFromHeader(fname,2,21)) 1398 1436 End 1399 1437 … … 2517 2555 End 2518 2556 2557 2558 // Sept 2009 -SRK 2559 // the ICE instrument control software is not correctly writing out the file name to the header in the specific 2560 // case of a file prefix less than 5 characters. ICE is quite naturally putting the blanke space(s) at the end of 2561 // the string. However, the VAX puts them at the beginning... 2562 Proc PatchFileNameInHeader(firstFile,lastFile) 2563 Variable firstFile=1,lastFile=100 2564 2565 fPatchFileName(firstFile,lastFile) 2566 2567 End 2568 2569 Proc ReadFileNameInHeader(firstFile,lastFile) 2570 Variable firstFile=1,lastFile=100 2571 2572 fReadFileName(firstFile,lastFile) 2573 End 2574 2575 2576 // simple utility to patch the file name in the file headers 2577 // lo is the first file number 2578 // hi is the last file number (inclusive) 2579 // 2580 // will read the 21 character file name and put any spaces at the front of the string 2581 // like the VAX does. Should have absolutely no effect if there are spaces at the 2582 // beginning of the string, as the VAX does. 2583 Function fPatchFileName(lo,hi) 2584 Variable lo,hi 2585 2586 Variable ii 2587 String file,fileName 2588 2589 //loop over all files 2590 for(ii=lo;ii<=hi;ii+=1) 2591 file = FindFileFromRunNumber(ii) 2592 if(strlen(file) != 0) 2593 fileName = getFileName(file) 2594 WriteFileNameToHeader(file,fileName) 2595 else 2596 printf "run number %d not found\r",ii 2597 endif 2598 endfor 2599 2600 return(0) 2601 End 2602 2603 // simple utility to read the file name stored in the file header (and the suffix) 2604 Function fReadFileName(lo,hi) 2605 Variable lo,hi 2606 2607 String file,fileName,suffix 2608 Variable ii 2609 2610 for(ii=lo;ii<=hi;ii+=1) 2611 file = FindFileFromRunNumber(ii) 2612 if(strlen(file) != 0) 2613 fileName = getFileName(file) 2614 suffix = getSuffix(file) 2615 printf "File %d: File name = %s\t\tSuffix = %s\r",ii,fileName,suffix 2616 else 2617 printf "run number %d not found\r",ii 2618 endif 2619 endfor 2620 2621 return(0) 2622 End 2623 2624 2625 2626 2519 2627 // April 2009 - AJJ 2520 2628 // The new ICE instrument control software was not correctly writing the run.defdir field
Note: See TracChangeset
for help on using the changeset viewer.