- Timestamp:
- Oct 4, 2019 8:45:39 AM (3 years ago)
- Location:
- sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Common/NIST_NXcanSAS_v709.ipf
r1198 r1218 439 439 HDF5OpenGroup /Z fileID, apertureParent, groupID 440 440 HDF5LoadData /O/Z/N=xg fileID, apertureParent + "x_gap" 441 Wave xg = $(loadDir + ":xg")441 Wave/Z xg = $(loadDir + ":xg") 442 442 443 443 // SAScollimation … … 445 445 HDF5OpenGroup /Z fileID, collimationParent, groupID 446 446 HDF5LoadData /O/Z/N=cdis fileID, collimationParent + "distance" 447 Wave cdis = $(loadDir + ":cdis")447 Wave/Z cdis = $(loadDir + ":cdis") 448 448 449 449 // SASdetector … … 464 464 HDF5LoadData /O/Z/N=xps fileID, detectorParent + "x_pixel_size" 465 465 HDF5LoadData /O/Z/N=xpy fileID, detectorParent + "y_pixel_size" 466 Wave/ T detname = $(loadDir + ":detname")467 Wave sdd = $(loadDir + ":sdd")468 Wave bcx = $(loadDir + ":bcx")469 Wave bcy = $(loadDir + ":bcy")470 Wave xps = $(loadDir + ":xps")471 Wave xpy = $(loadDir + ":xpy")466 Wave/Z/T detname = $(loadDir + ":detname") 467 Wave/Z sdd = $(loadDir + ":sdd") 468 Wave/Z bcx = $(loadDir + ":bcx") 469 Wave/Z bcy = $(loadDir + ":bcy") 470 Wave/Z xps = $(loadDir + ":xps") 471 Wave/Z xpy = $(loadDir + ":xpy") 472 472 If (isMultiDetector) 473 473 ii += 1 … … 484 484 HDF5LoadData /O/Z/N=wvel fileID, sourceParent + "incident_wavelength" 485 485 HDF5LoadData /O/Z/N=wvels fileID, sourceParent + "incident_wavelength_spread" 486 Wave wvel = $(loadDir + ":wvel")487 Wave wvels = $(loadDir + ":wvels")486 Wave/Z wvel = $(loadDir + ":wvel") 487 Wave/Z wvels = $(loadDir + ":wvels") 488 488 489 489 // SASsample … … 493 493 HDF5LoadData /O/Z/N=smplthick fileID, sampleParent + "thickness" 494 494 HDF5LoadData /O/Z/N=smpltrans fileID, sampleParent + "transmission" 495 Wave/T smplname = $(loadDir + ":smplname") 496 Wave smplthick = $(loadDir + ":smplthick") 497 Wave smpltrans = $(loadDir + ":smpltrans") 498 499 textw[0] = title[0] 500 textw[6] = smplname[0] 501 textw[9] = detname[0] 502 rw[4] = smplthick[0] 503 rw[5] = smpltrans[0] 504 rw[10] = xps[0] 505 rw[13] = xpy[0] 506 rw[16] = bcx[0] 507 rw[17] = bcy[0] 508 rw[18] = sdd[0] 509 rw[24] = xg[0] 510 rw[25] = cdis[0] 511 rw[26] = wvel[0] 512 rw[27] = wvels[0] 495 Wave/T/Z smplname = $(loadDir + ":smplname") 496 Wave/Z smplthick = $(loadDir + ":smplthick") 497 Wave/Z smpltrans = $(loadDir + ":smpltrans") 498 499 // error if any of these waves are not loaded from the metadata. Most of these are NOT present 500 // in data that has been passed through NSORT. 501 // -- need to check each one. there must be a better way to do this... 502 if(WaveExists(title)) 503 textw[0] = title[0] 504 else 505 textw[0] = "" 506 endif 507 if(WaveExists(smplname)) 508 textw[6] = smplname[0] 509 else 510 textw[6] = "" 511 endif 512 if(WaveExists(detname)) 513 textw[9] = detname[0] 514 else 515 textw[9] = "" 516 endif 517 if(WaveExists(smplthick)) 518 rw[4] = smplthick[0] 519 else 520 rw[4] = 0 521 endif 522 if(WaveExists(smpltrans)) 523 rw[5] = smpltrans[0] 524 else 525 rw[5] = 0 526 endif 527 if(WaveExists(xps)) 528 rw[10] = xps[0] 529 else 530 rw[10] = 0 531 endif 532 if(WaveExists(xpy)) 533 rw[13] = xpy[0] 534 else 535 rw[13] = 0 536 endif 537 if(WaveExists(bcx)) 538 rw[16] = bcx[0] 539 else 540 rw[16] = 0 541 endif 542 if(WaveExists(bcy)) 543 rw[17] = bcy[0] 544 else 545 rw[17] = 0 546 endif 547 if(WaveExists(sdd)) 548 rw[18] = sdd[0] 549 else 550 rw[18] = 0 551 endif 552 if(WaveExists(xg)) 553 rw[24] = xg[0] 554 else 555 rw[24] = 0 556 endif 557 if(WaveExists(cdis)) 558 rw[25] = cdis[0] 559 else 560 rw[25] = 0 561 endif 562 if(WaveExists(wvel)) 563 rw[26] = wvel[0] 564 else 565 rw[26] = 0 566 endif 567 if(WaveExists(wvels)) 568 rw[27] = wvels[0] 569 else 570 rw[27] = 0 571 endif 572 513 573 514 574 KillWaves title,smplname,detname,smplthick,smpltrans,xps,xpy,bcx,bcy,sdd,xg,cdis,wvel,wvels … … 551 611 /////////////////////////////////////////////////////////////////////////// 552 612 553 /////////////////////////////////////////////////////////////////////////// 554 // 555 // Methods related to NSORT 556 557 Function WriteNSORTedNXcanSASFile(qw,iw,sw,firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34,[res]) 558 Wave qw,iw,sw,res 559 String firstFileName,secondFileName,thirdFileName,fourthFileName,normTo 560 Variable norm12,norm23,norm34 561 562 Variable err=0,refNum,numCols,dialog=1,useRes=0 563 String fullPath="",formatStr="",process 564 565 //check each wave - else REALLY FATAL error when writing file 566 If(!(WaveExists(qw))) 567 err = 1 568 return err 569 Endif 570 If(!(WaveExists(iw))) 571 err = 1 572 return err 573 Endif 574 If(!(WaveExists(sw))) 575 err = 1 576 return err 577 Endif 578 if(WaveExists(res)) 579 useRes = 1 580 endif 581 582 NVAR/Z useTable = root:myGlobals:CombineTable:useTable 583 if(NVAR_Exists(useTable) && useTable==1) 584 SVAR str=root:myGlobals:CombineTable:SaveNameStr //messy, but pass in as a global 585 fullPath = str 586 dialog=0 587 endif 588 589 NewDataFolder/O/S root:Packages:NIST:NSORT 590 SetDataFolder root:Packages:NIST:NSORT 591 592 process = CreateNSORTProcess(firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34) 593 Make/O/T/N=1 processNote = process 594 595 Variable pts = numpnts(qw) 596 Make/O/N=(pts) qval = qw 597 Make/O/N=(pts) aveint = iw 598 Make/O/N=(pts) sigave = sw 599 if (useRes) 600 Make/O/N=(dimsize(res,0)) SigmaQ = res[p][0] 601 Make/O/N=(dimsize(res,0)) QBar = res[p][1] 602 Make/O/N=(dimsize(res,0)) fSubS = res[p][2] 603 Else 604 Make/O/N=(pts) SigmaQ = 0 605 Make/O/N=(pts) QBar = 0 606 Make/O/N=(pts) fSubS = 0 607 EndIf 608 609 Make/O/T/N=11 textRead 610 textRead[6] = firstfileName 611 textRead[0] = "Combined data" 612 613 Make/O/N=52 realsRead = 0 614 615 WriteNxCanSAS1D("NSORT",fullpath,dialog) 616 617 End 618 619 Function/T CreateNSORTProcess(firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34) 620 String firstFileName,secondFileName,thirdFileName,fourthFileName,normTo 621 Variable norm12,norm23,norm34 622 String process 623 String processFormat = "COMBINED FILE CREATED: %s - NSORT-ed %s\t+ %s\t+ %s\t+%s, normalized to %s, multiplicative factor 1-2 = %12.8g\t multiplicative factor 2-3 = %12.8g\t multiplicative factor 3-4 = %12.8g" 624 625 sprintf process,processFormat,date(),firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34 626 return process 627 End 628 629 // 630 /////////////////////////////////////////////////////////////////////////// 613 614 /////////////////////////////////////////////////////////////////////////// -
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Common/NIST_XML_v40.ipf
r1091 r1218 5 5 6 6 //#if( exists("XmlOpenFile") && exists("NCNR_VSANS") ) 7 #if( exists("XmlOpenFile") && exists("NCNR_VSANS"))7 #if( exists("XmlOpenFile") ) 8 8 9 9 #include "cansasXML", version >= 1.10 -
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/SANS/NCNR_Includes_v520.ipf
r1189 r1218 2 2 #pragma version=5.2 3 3 #pragma IgorVersion=6.1 4 5 4 6 5 // to properly set up the template for other facility reduction templates, -
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/SANS/Write_SANS_NXcanSAS.ipf
r1200 r1218 42 42 destStr = "root:Packages:NIST:"+type 43 43 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 44 WAVE intw = $(destStr + ":integersRead") 44 // WAVE intw = $(destStr + ":integersRead") // SRK_0920 45 45 WAVE rw = $(destStr + ":realsRead") 46 46 WAVE/T textw=$(destStr + ":textRead") … … 453 453 End 454 454 455 // 456 /////////////////////////////////////////////////////////////////////////// 457 455 456 /////////////////////////////////////////////////////////////////////////// 457 // 458 // Methods related to NSORT 459 460 461 //these canSANs NSORT files are only necessary for SANS reduction, not USANS or VSANS. as such, 462 // move them to the SANS-specific NXcanSAS file. Conditional compilation did not work since I can't access 463 // user-defined objects through #if 464 // 465 // SRK 092019 466 // 467 468 Function WriteNSORTedNXcanSASFile(qw,iw,sw,firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34,[res]) 469 Wave qw,iw,sw,res 470 String firstFileName,secondFileName,thirdFileName,fourthFileName,normTo 471 Variable norm12,norm23,norm34 472 473 Variable err=0,refNum,numCols,dialog=1,useRes=0 474 String fullPath="",formatStr="",process 475 476 //check each wave - else REALLY FATAL error when writing file 477 If(!(WaveExists(qw))) 478 err = 1 479 return err 480 Endif 481 If(!(WaveExists(iw))) 482 err = 1 483 return err 484 Endif 485 If(!(WaveExists(sw))) 486 err = 1 487 return err 488 Endif 489 if(WaveExists(res)) 490 useRes = 1 491 endif 492 493 NVAR/Z useTable = root:myGlobals:CombineTable:useTable 494 if(NVAR_Exists(useTable) && useTable==1) 495 SVAR str=root:myGlobals:CombineTable:SaveNameStr //messy, but pass in as a global 496 fullPath = str 497 dialog=0 498 endif 499 500 NewDataFolder/O/S root:Packages:NIST:NSORT 501 SetDataFolder root:Packages:NIST:NSORT 502 503 process = CreateNSORTProcess(firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34) 504 Make/O/T/N=1 processNote = process 505 506 Variable pts = numpnts(qw) 507 Make/O/N=(pts) qval = qw 508 Make/O/N=(pts) aveint = iw 509 Make/O/N=(pts) sigave = sw 510 if (useRes) 511 Make/O/N=(dimsize(res,0)) SigmaQ = res[p][0] 512 Make/O/N=(dimsize(res,0)) QBar = res[p][1] 513 Make/O/N=(dimsize(res,0)) fSubS = res[p][2] 514 Else 515 Make/O/N=(pts) SigmaQ = 0 516 Make/O/N=(pts) QBar = 0 517 Make/O/N=(pts) fSubS = 0 518 EndIf 519 520 Make/O/T/N=11 textRead 521 textRead[6] = firstfileName 522 textRead[0] = "Combined data" 523 524 Make/O/N=52 realsRead = 0 525 526 WriteNxCanSAS1D("NSORT",fullpath,dialog) 527 528 End 529 530 531 Function/T CreateNSORTProcess(firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34) 532 String firstFileName,secondFileName,thirdFileName,fourthFileName,normTo 533 Variable norm12,norm23,norm34 534 String process 535 String processFormat = "COMBINED FILE CREATED: %s - NSORT-ed %s\t+ %s\t+ %s\t+%s, normalized to %s, multiplicative factor 1-2 = %12.8g\t multiplicative factor 2-3 = %12.8g\t multiplicative factor 3-4 = %12.8g" 536 537 sprintf process,processFormat,date(),firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34 538 return process 539 End 540 541 // 542 543 544 // 545 /////////////////////////////////////////////////////////////////////////// 546 -
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/USANS/NCNR_USANS_Includes_v230.ipf
r1189 r1218 53 53 54 54 #include "NIST_NXcanSAS_v709" 55 #include "WriteUSANSNXcanSAS"
Note: See TracChangeset
for help on using the changeset viewer.