Changeset 562 for sans/Dev/trunk
- Timestamp:
- Sep 30, 2009 2:56:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Subtract_1D.ipf
r477 r562 467 467 gName2 = S_fileName 468 468 endif 469 470 elseif (V_flag == 4) 471 n0 = StringFromList(0, S_waveNames ,";" ) 472 n1 = StringFromList(1, S_waveNames ,";" ) 473 n2 = StringFromList(2, S_waveNames ,";" ) 474 n3 = StringFromList(3, S_waveNames ,";" ) 475 Duplicate/O $n0, $("w0" + num2istr(type)) 476 Duplicate/O $n1, $("w1" + num2istr(type)) 477 Duplicate/O $n2, $("w2" + num2istr(type)) 478 Duplicate/O $n3, $("w3" + num2istr(type)) 479 if (type==1) 480 gName1 = S_fileName 481 //read in the header of the sample file 482 // not yet implemented 483 numLines = CountNumLines(fileStr) 484 numData = numpnts($n0) 485 numHdr = numLines - numData 486 Make/T/O/N=(numHdr) SampleHeader 487 Open/R refNum as fileStr 488 ii=0 489 do 490 FReadLine refnum, junkStr 491 SampleHeader[ii] = junkStr 492 ii+=1 493 while(ii<numHdr) 494 Close refnum 495 else 496 gName2 = S_fileName 497 endif 469 498 499 elseif (V_flag == 3) 500 n0 = StringFromList(0, S_waveNames ,";" ) 501 n1 = StringFromList(1, S_waveNames ,";" ) 502 n2 = StringFromList(2, S_waveNames ,";" ) 503 Duplicate/O $n0, $("w0" + num2istr(type)) 504 Duplicate/O $n1, $("w1" + num2istr(type)) 505 Duplicate/O $n2, $("w2" + num2istr(type)) 506 if (type==1) 507 gName1 = S_fileName 508 //read in the header of the sample file 509 // not yet implemented 510 numLines = CountNumLines(fileStr) 511 numData = numpnts($n0) 512 numHdr = numLines - numData 513 Make/T/O/N=(numHdr) SampleHeader 514 Open/R refNum as fileStr 515 ii=0 516 do 517 FReadLine refnum, junkStr 518 SampleHeader[ii] = junkStr 519 ii+=1 520 while(ii<numHdr) 521 Close refnum 522 else 523 gName2 = S_fileName 524 endif 470 525 else 471 526 if (V_flag>0) 472 DoAlert 0, "This is NOT a six-column file !"527 DoAlert 0, "This is NOT a 3-, 4- or 6-column file !" 473 528 endif 474 529 endif … … 512 567 Variable err=0,refnum 513 568 String fileName="" 514 String formatStr = "%15.4g %15.4g %15.4g %15.4g %15.4g %15.4g\r\n" 569 String formatStr = "" 570 if (WaveExists(w41) && WaveExists(w51)) 571 //6-column 572 formatStr = "%15.4g %15.4g %15.4g %15.4g %15.4g %15.4g\r\n" 573 elseif(WaveExists(w31)) 574 //4-column (ILL) 575 formatStr = "%15.4g %15.4g %15.4g %15.4g\r\n" 576 else 577 //3-column 578 formatStr = "%15.4g %15.4g %15.4g\r\n" 579 endif 515 580 err += 1 - WaveExists(xresult) 516 581 err += 1 - WaveExists(yresult) 517 582 err += 1 - WaveExists(sresult) 518 err += 1 - WaveExists(w31)519 err += 1 - WaveExists(w41)520 err += 1 - WaveExists(w51)583 //err += 1 - WaveExists(w31) 584 //err += 1 - WaveExists(w41) 585 //err += 1 - WaveExists(w51) 521 586 err += 1 - WaveExists(hdr) 522 587 523 588 if(err>0) 524 DoAlert 0," Some of the data is missing- I can't write out the file"589 DoAlert 0,"We need at least 3 column data - I can't write out the file" 525 590 return(1) 526 591 endif … … 533 598 Open refNum as fileName 534 599 wfprintf refnum,"%s\n",hdr //strings already have \r? 535 wfprintf refnum, formatStr, xresult,yresult,sresult,w31,w41,w51 600 if (WaveExists(w41) && WaveExists(w51)) 601 wfprintf refnum, formatStr, xresult,yresult,sresult,w31,w41,w51 602 elseif (WaveExists(w31)) 603 wfprintf refnum, formatStr, xresult,yresult,sresult,w31 604 else 605 wfprintf refnum,formatStr, xresult,yresult,sresult 606 endif 536 607 Close refnum 537 608
Note: See TracChangeset
for help on using the changeset viewer.