Changeset 750
- Timestamp:
- Oct 4, 2010 10:15:08 AM (12 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_Utils.ipf
r710 r750 236 236 // "ABC" returned as an invalid result 237 237 // XXXXSANS_expXX._scan1234_5678.xmp ==> "12345678" 238 // -- result is an 8-character string 239 // 238 240 Function/S GetRunNumStrFromFile(item) //,numposition) 239 241 String item … … 368 370 End 369 371 372 373 //make an (N) character string of the run number 374 //Moved to facility utils 375 // 376 // same scheme to get 8-character string as in GetRunNumStrFromFile(item) 377 // 378 Function/S RunDigitString(num) 379 Variable num 380 381 String numStr="" 382 383 //make 8 digit string from run number 384 sprintf numStr,"%08u",num 385 386 if(strlen(numStr) > 8) 387 return("") 388 else 389 return(numstr) 390 endif 391 392 End 393 394 //given a filename of a SANS data filename of the form 395 //TTTTTnnn.SAn_TTT_Txxx 396 //returns the prefix "TTTTT" as some number of characters 397 //returns "" as an invalid file prefix 398 // 399 // HFIR writes out files with a "prefix" of the following -- since there is really no "prefix" 400 // like in the VAX scheme: 401 // newFileName = ReplaceString(".xml",textPath[0],"") //removes 4 chars 402 // newFileName = ReplaceString("SANS",newFileName,"") //removes 4 more chars = 8 403 // newFileName = ReplaceString("exp",newFileName,"") //removes 3 more chars = 11 404 // newFileName = ReplaceString("scan",newFileName,"") //removes 4 more chars = 15, should be enough? 405 // 406 // 407 // -- so the raw data: BioSANS_exp9_scan1828_0001.xml 408 // -- translates to: Bio_9_1828_0001.AVE 409 // 410 // 411 // NCNR-specifc, does not really belong here - it's a beta procedure used for the 412 // Combine Files Panel, and I'm not sure of how I'm really going to get this to work properly 413 // since the .ABS file written is not of the form that NSORT->Set3NSORTFiles(low,med,hi,pref) 414 // is trying to construct 415 // 416 // changed (Oct 2010) the naming for HFIR from ExecuteProtocol to: 417 // newFileName = GetPrefixStrFromFile(textPath[0])+GetRunNumStrFromFile(textPath[0]) 418 // -- translates to: BioSANS18280001.AVE 419 // 420 Function/S GetPrefixStrFromFile(item) 421 String item 422 String invalid = "" //"" is not a valid run prefix, since it's text 423 Variable num=-1 424 425 //find the "dash" 426 String runStr="" 427 Variable pos = strsearch(item,"_",0) 428 if(pos == -1) 429 //"dot" not found 430 return (invalid) 431 else 432 //found 433 if (pos <=3) 434 //not enough characters 435 return (invalid) 436 else 437 runStr = item[0,pos-1] 438 return (runStr) 439 Endif 440 Endif 441 End 442 443 444 370 445 //function to test a binary file to see if it is a RAW binary SANS file 371 446 //first checks the total bytes in the file (which for raw data is 33316 bytes) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ILL_Utils.ipf
r683 r750 327 327 328 328 329 //make an (N) character string of the run number 330 //Moved to facility utils 331 // 332 // same scheme to get 6-character string as in GetRunNumStrFromFile(item) 333 // 334 Function/S RunDigitString(num) 335 Variable num 336 337 // String fullName="",partialName="",item="" 338 // String numStr="" 339 // 340 // numStr = num2istr(num) 341 // // pad to 6 characters 342 // switch(strlen(numstr)) // numeric switch 343 // case 6: // execute if case matches expression 344 // break // exit from switch 345 // case 5: 346 // numStr = "0"+numStr 347 // break 348 // case 4: 349 // numStr = "00"+numStr 350 // break 351 // case 3: 352 // numStr = "000"+numStr 353 // break 354 // case 2: 355 // numStr = "0000"+numStr 356 // break 357 // case 1: 358 // numStr = "00000"+numStr 359 // break 360 // default: // optional default expression executed 361 // endswitch 362 // 363 364 String numStr="" 365 366 //make 6 digit string from run number 367 sprintf numStr,"%06u",num 368 369 //Print "numstr = ",numstr 370 if(strlen(numstr) > 6) 371 return("") 372 else 373 return(numstr) 374 endif 375 376 End 377 378 return(numstr) 379 End 380 381 // there is no prefix on D22 data files - they're just a run number 382 // 383 // so return null 384 // 385 // NCNR-specifc, does not really belong here - it's a beta procedure used for the 386 // Combine Files Panel, and I'm not sure of how I'm really going to get this to work properly 387 // since the .ABS file written is not of the form that NSORT->Set3NSORTFiles(low,med,hi,pref) 388 // is trying to construct 389 // 390 Function/S GetPrefixStrFromFile(item) 391 String item 392 return("") 393 End 329 394 330 395 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf
r715 r750 423 423 //returns "" as an invalid file prefix 424 424 // 425 // NCNR-specifc, does not really belong here - but it's a beta procedure anyhow... 425 // NCNR-specifc, does not really belong here - but it's a beta procedure used for the 426 // Combine Files Panel 426 427 // 427 428 Function/S GetPrefixStrFromFile(item) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ProtocolAsPanel.ipf
r745 r750 1880 1880 newFileName = ReplaceString(".nx.hdf", tempFilename, "") 1881 1881 #elif (exists("HFIR")==6) 1882 newFileName = ReplaceString(".xml",textPath[0],"") //removes 4 chars 1883 newFileName = ReplaceString("SANS",newFileName,"") //removes 4 more chars = 8 1884 newFileName = ReplaceString("exp",newFileName,"") //removes 3 more chars = 11 1885 newFileName = ReplaceString("scan",newFileName,"") //removes 4 more chars = 15, should be enough? 1882 // newFileName = ReplaceString(".xml",textPath[0],"") //removes 4 chars 1883 // newFileName = ReplaceString("SANS",newFileName,"") //removes 4 more chars = 8 1884 // newFileName = ReplaceString("exp",newFileName,"") //removes 3 more chars = 11 1885 // newFileName = ReplaceString("scan",newFileName,"") //removes 4 more chars = 15, should be enough? 1886 newFileName = GetPrefixStrFromFile(textPath[0])+GetRunNumStrFromFile(textPath[0]) 1886 1887 #else 1887 1888 newFileName = UpperStr(GetNameFromHeader(textPath[0])) //NCNR data drops here, trims to 8 chars
Note: See TracChangeset
for help on using the changeset viewer.