Changeset 1194
- Timestamp:
- Aug 15, 2019 2:33:23 PM (3 years ago)
- Location:
- sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Common/NIST_NXcanSAS_v709.ipf
r1193 r1194 88 88 Variable fileID 89 89 String base 90 String parent,nxParent90 String location,nxParent 91 91 Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1) 92 String location = base + parent 92 sPrintf location,"%s:sasentry%d",base,sasentry // Igor memory base path for all 93 sPrintf nxParent,"/sasentry%d/",sasentry // HDF5 base path for all 93 94 NewDataFolder/O/S $(location) 94 95 Make/O/T/N=1 $(location + ":vals") = {""} … … 145 146 Make/O/T/N=1 vals_i_wave 146 147 vals_i_wave[0] = vals_i 147 if(! stringmatch(name_i,""))148 if(!CmpStr(name_i,"") == 0) 148 149 HDF5SaveData /A=name_i vals_i_wave, fileID, path 149 150 endif … … 217 218 218 219 groupID = NxCansas_CreateGroup(fileID,parent) 219 220 220 221 // Save data to disk 221 222 if(!stringmatch(var,"")) … … 226 227 endif 227 228 endif 228 229 229 230 NxCansas_writeAttributes(fileID,parent+var,attr,attrValues) 230 231 … … 318 319 Wave q = $(baseStr + "_q") 319 320 Wave dq = $(baseStr + "_dq") 321 322 // 323 // FIXME: All points set to the same value - need to loop 324 // 325 320 326 Make/O/N=(xdim,ydim) $(baseStr + "_qx") = q[0] 321 327 Make/O/N=(xdim,ydim) $(baseStr + "_qy") = q[1] … … 410 416 Wave rw = $(loadDir + ":realsRead") 411 417 Wave/T textw = $(loadDir + ":textRead") 412 print rw413 418 int isMultiDetector = 0, ii = 0 414 419 … … 536 541 // 537 542 /////////////////////////////////////////////////////////////////////////// 543 544 /////////////////////////////////////////////////////////////////////////// 545 // 546 // Methods related to NSORT 547 548 Function WriteNSORTedNXcanSASFile(qw,iw,sw,firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34,[res]) 549 Wave qw,iw,sw,res 550 String firstFileName,secondFileName,thirdFileName,fourthFileName,normTo 551 Variable norm12,norm23,norm34 552 553 Variable err=0,refNum,numCols,dialog=1,useRes=0 554 String fullPath="",formatStr="",process 555 556 //check each wave - else REALLY FATAL error when writing file 557 If(!(WaveExists(qw))) 558 err = 1 559 return err 560 Endif 561 If(!(WaveExists(iw))) 562 err = 1 563 return err 564 Endif 565 If(!(WaveExists(sw))) 566 err = 1 567 return err 568 Endif 569 if(WaveExists(res)) 570 useRes = 1 571 endif 572 573 NVAR/Z useTable = root:myGlobals:CombineTable:useTable 574 if(NVAR_Exists(useTable) && useTable==1) 575 SVAR str=root:myGlobals:CombineTable:SaveNameStr //messy, but pass in as a global 576 fullPath = str 577 dialog=0 578 endif 579 580 process = CreateNSORTProcess(firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34) 581 582 NewDataFolder/O/S root:Packages:NIST:NSORT 583 SetDataFolder root:Packages:NIST:NSORT 584 585 Variable pts = numpnts(qw) 586 Make/O/N=(pts) qval = qw 587 Make/O/N=(pts) aveint = iw 588 Make/O/N=(pts) sigave = sw 589 if (useRes) 590 Make/O/N=(dimsize(res,0)) SigmaQ = res[p][0] 591 Make/O/N=(dimsize(res,0)) QBar = res[p][1] 592 Make/O/N=(dimsize(res,0)) fSubS = res[p][2] 593 Else 594 Make/O/N=(pts) SigmaQ = 0 595 Make/O/N=(pts) QBar = 0 596 Make/O/N=(pts) fSubS = 0 597 EndIf 598 599 Make/O/T/N=11 textRead 600 textRead[6] = firstfileName 601 textRead[0] = "Combined data" 602 603 Make/O/N=52 realsRead = 0 604 605 WriteNxCanSAS1D("NSORT",fullpath,dialog) 606 607 End 608 609 Function/T CreateNSORTProcess(firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34) 610 String firstFileName,secondFileName,thirdFileName,fourthFileName,normTo 611 Variable norm12,norm23,norm34 612 String process 613 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" 614 615 sprintf process,processFormat,date(),firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34 616 return process 617 End 618 619 // 620 /////////////////////////////////////////////////////////////////////////// -
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/SANS/NSORT.ipf
r1190 r1194 202 202 NVAR useXMLOutput = root:Packages:NIST:gXML_Write 203 203 NVAR useNXcanSASOutput = root:Packages:NIST:gNXcanSAS_Write 204 205 //206 // TODO: create WriteNSORTedNXcanSASFile207 //208 204 209 205 if (useXMLOutput == 1) … … 212 208 else 213 209 WriteNSORTedXMLFile(q3,i3,sig3,firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34) 210 endif 211 elseif (useNXcanSASOutput == 1) 212 if(WaveExists(res)) 213 WriteNSORTedNXcanSASFile(q3,i3,sig3,firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34,res=res) 214 else 215 WriteNSORTedNXcanSASFile(q3,i3,sig3,firstFileName,secondFileName,thirdFileName,fourthFileName,normTo,norm12,norm23,norm34) 214 216 endif 215 217 else -
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/SANS/Write_SANS_NXcanSAS.ipf
r1189 r1194 34 34 35 35 // Check fullpath and dialog 36 print "fullpath: ",fullpath37 36 fileID = NXcanSAS_OpenOrCreate(dialog,fullpath,base) 38 37 … … 94 93 95 94 // Write all meta data 96 WriteMetaData(fileID,parentBase,nxcansasBase,rw,textw) 95 if (CmpStr(type,"NSORT") == 0) 96 Wave process = $(destStr + ":process") 97 // TODO: Write to file 98 Else 99 WriteMetaData(fileID,parentBase,nxcansasBase,rw,textw) 100 EndIf 97 101 98 102 // … … 278 282 // TODO: Reinstate Qdev/resolutions when I can fix the reader issue 279 283 // 280 281 284 282 285 // Create qx and qy entry … … 344 347 Make/O/T/N=5 $(apertureBase + ":attrVals") = {"SASaperture","NXaperture"} 345 348 CreateStrNxCansas(fileID,apertureParent,"","",empty,$(apertureBase + ":attr"),$(apertureBase + ":attrVals")) 346 347 //348 // TODO: Where do I get rectangular dimensions from?349 //350 351 349 // Create SASaperture shape entry 352 350 Make/O/T/N=1 $(apertureBase + ":shape") = {"pinhole"}
Note: See TracChangeset
for help on using the changeset viewer.