- Timestamp:
- Jul 22, 2019 4:16:46 PM (4 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
r1171 r1187 34 34 35 35 // Check fullpath and dialog 36 if(dialog || stringmatch(fullpath, "")) 37 fileID = NxCansas_DoSaveFileDialog() 38 else 39 fileID = NxCansas_CreateFile(fullpath) 40 Endif 41 if(!fileID) 42 abort "Unable to create file at " + fullpath + "." 43 else 44 Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1) 45 sPrintf parentBase,"%s:sasentry%d",base,sasentry // Igor memory base path for all 46 sPrintf nxcansasBase,"/sasentry%d/",sasentry // HDF5 base path for all 47 48 destStr = "root:Packages:NIST:"+type 49 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 50 WAVE intw = $(destStr + ":integersRead") 51 WAVE rw = $(destStr + ":realsRead") 52 WAVE/T textw=$(destStr + ":textRead") 53 WAVE qvals =$(destStr + ":qval") 54 WAVE inten=$(destStr + ":aveint") 55 WAVE sig=$(destStr + ":sigave") 56 WAVE qbar = $(destStr + ":QBar") 57 WAVE sigmaq = $(destStr + ":SigmaQ") 58 WAVE fsubs = $(destStr + ":fSubS") 59 endif 36 print "fullpath: ",fullpath 37 fileID = NXcanSAS_OpenOrCreate(dialog,fullpath,base) 38 39 Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1) 40 sPrintf parentBase,"%s:sasentry%d",base,sasentry // Igor memory base path for all 41 sPrintf nxcansasBase,"/sasentry%d/",sasentry // HDF5 base path for all 42 43 destStr = "root:Packages:NIST:"+type 44 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 45 WAVE intw = $(destStr + ":integersRead") 46 WAVE rw = $(destStr + ":realsRead") 47 WAVE/T textw=$(destStr + ":textRead") 48 WAVE qvals =$(destStr + ":qval") 49 WAVE inten=$(destStr + ":aveint") 50 WAVE sig=$(destStr + ":sigave") 51 WAVE qbar = $(destStr + ":QBar") 52 WAVE sigmaq = $(destStr + ":SigmaQ") 53 WAVE fsubs = $(destStr + ":fSubS") 60 54 61 55 /////////////////////////////////////////////////////////////////////////// … … 141 135 142 136 // Check fullpath and dialog 143 if(dialog || stringmatch(fullpath, "")) 144 fileID = NxCansas_DoSaveFileDialog() 137 fileID = NXcanSAS_OpenOrCreate(dialog,fullpath,base) 138 139 Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1) 140 sPrintf parentBase,"%s:sasentry%d",base,sasentry // Igor memory base path for all 141 sPrintf nxcansasBase,"/sasentry%d/",sasentry // HDF5 base path for all 142 143 destStr = "root:Packages:NIST:"+type 144 145 //must select the linear_data to export 146 NVAR isLog = $(destStr+":gIsLogScale") 147 if(isLog==1) 148 typeStr = ":linear_data" 145 149 else 146 fileID = NxCansas_CreateFile(fullpath) 147 Endif 148 if(!fileID) 149 abort "Unable to create file at " + fullpath + "." 150 else 151 Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1) 152 sPrintf parentBase,"%s:sasentry%d",base,sasentry // Igor memory base path for all 153 sPrintf nxcansasBase,"/sasentry%d/",sasentry // HDF5 base path for all 154 155 destStr = "root:Packages:NIST:"+type 156 157 //must select the linear_data to export 158 NVAR isLog = $(destStr+":gIsLogScale") 159 if(isLog==1) 160 typeStr = ":linear_data" 161 else 162 typeStr = ":data" 163 endif 164 NVAR pixelsX = root:myGlobals:gNPixelsX 165 NVAR pixelsY = root:myGlobals:gNPixelsY 166 Wave data=$(destStr+typeStr) 167 Wave data_err=$(destStr+":linear_data_error") 168 WAVE intw=$(destStr + ":integersRead") 169 WAVE rw=$(destStr + ":realsRead") 170 WAVE/T textw=$(destStr + ":textRead") 171 endif 150 typeStr = ":data" 151 endif 152 NVAR pixelsX = root:myGlobals:gNPixelsX 153 NVAR pixelsY = root:myGlobals:gNPixelsY 154 Wave data=$(destStr+typeStr) 155 Wave data_err=$(destStr+":linear_data_error") 156 WAVE intw=$(destStr + ":integersRead") 157 WAVE rw=$(destStr + ":realsRead") 158 WAVE/T textw=$(destStr + ":textRead") 172 159 173 160 /////////////////////////////////////////////////////////////////////////// … … 456 443 // Basic file open/create and file initialization routines 457 444 445 // Generic open or create file 446 Function NXcanSAS_OpenOrCreate(dialog,fullpath,base) 447 Variable dialog 448 String fullpath,base 449 Variable fileID 450 if(dialog || stringmatch(fullpath, "")) 451 fileID = NxCansas_DoSaveFileDialog(base) 452 else 453 fileID = NxCansas_CreateFile(fullpath,base) 454 Endif 455 if(!fileID) 456 abort "Unable to create file at " + fullpath + "." 457 EndIf 458 return fileID 459 End 460 458 461 // Select/create file through prompt 459 Function NxCansas_DoSaveFileDialog() 462 Function NxCansas_DoSaveFileDialog(base) 463 String base 460 464 Variable refNum, fileID 461 465 String message = "Save a file" … … 465 469 Open /D /F=fileFilters /M=message refNum 466 470 outputPath = S_fileName 467 fileID = NxCansas_CreateFile(outputPath )471 fileID = NxCansas_CreateFile(outputPath,base) 468 472 return fileID 469 473 End 470 474 471 475 // Create file with a known path 472 Function NxCansas_CreateFile(fullpath )473 String fullpath 476 Function NxCansas_CreateFile(fullpath, base) 477 String fullpath,base 474 478 Variable fileID 475 479 Make/T/O/N=1 $("root:file_name") = fullpath … … 477 481 fullpath = ReplaceString("\\", fullpath, ":") 478 482 HDF5CreateFile /Z fileID as fullpath 479 NXCansas_InitializeFile(fileID )483 NXCansas_InitializeFile(fileID, base) 480 484 return fileID 481 485 End … … 509 513 510 514 // Initialize the file to a base state 511 Function NxCansas_InitializeFile(fileID) 512 Variable fileID 515 Function NxCansas_InitializeFile(fileID, base) 516 Variable fileID 517 String base 513 518 String parent,nxParent 514 String/G base = "root:NXcanSAS_file"515 519 Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1) 516 520 sPrintf parent,":sasentry%d",sasentry -
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/USANS/WriteUSANSNXcanSAS.ipf
r1174 r1187 48 48 Variable refNum,integer,realval 49 49 50 if(dialog || stringmatch(fullpath, "")) 51 fileID = NxCansas_DoSaveFileDialog() 52 else 53 fileID = NxCansas_CreateFile(fullpath) 54 Endif 55 56 if(!fileID) 57 abort "Unable to create file at " + fullpath + "." 58 else 59 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 60 WAVE qvals = $(destStr + ":Qvals") 61 WAVE inten = $(destStr + ":DetCts") 62 WAVE sig = $(destStr + ":ErrDetCts") 63 endif 50 51 fileID = NXcanSAS_OpenOrCreate(dialog,fullpath,base) 52 53 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 54 WAVE qvals = $(destStr + ":Qvals") 55 WAVE inten = $(destStr + ":DetCts") 56 WAVE sig = $(destStr + ":ErrDetCts") 64 57 65 58 //check each wave … … 171 164 Variable refNum,integer,realval 172 165 173 if(dialog || stringmatch(fullpath, "")) 174 fileID = NxCansas_DoSaveFileDialog() 175 else 176 fileID = NxCansas_CreateFile(fullpath) 177 Endif 178 179 if(!fileID) 180 abort "Unable to create file at " + fullpath + "." 181 else 182 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 183 WAVE qvals =$(destStr + "Q_dsm") 184 WAVE inten=$(destStr + "I_dsm") 185 WAVE sig=$(destStr + "S_dsm") 186 endif 166 167 fileID = NXcanSAS_OpenOrCreate(dialog,fullpath,base) 168 169 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 170 WAVE qvals =$(destStr + "Q_dsm") 171 WAVE inten=$(destStr + "I_dsm") 172 WAVE sig=$(destStr + "S_dsm") 187 173 188 174 //check each wave -
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/VSANS/V_Write_VSANS_NXcanSAS.ipf
r1186 r1187 15 15 NewDataFolder/O/S $(base) 16 16 17 // Check fullpath and dialog 18 fileID = NXcanSAS_OpenOrCreate(dialog,saveName,base) 17 19 SetDataFolder $(pathStr+folderStr) 18 19 // Check fullpath and dialog20 if(stringmatch(saveName, ""))21 fileID = NxCansas_DoSaveFileDialog()22 else23 fileID = NxCansas_CreateFile(saveName)24 Endif25 if(!fileID)26 abort "Unable to create file at " + saveName + "."27 EndIf28 20 29 21 Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1) … … 69 61 // Run Name and title 70 62 NewDataFolder/O/S $(parentBase) 71 Make/O/T/N=1 $(parentBase + ":title") = {V_get Title(folderStr)}63 Make/O/T/N=1 $(parentBase + ":title") = {V_getSampleDescription(folderStr)} 72 64 CreateStrNxCansas(fileID,nxcansasBase,"","title",$(parentBase + ":title"),empty,empty) 73 65 Make/O/T/N=1 $(parentBase + ":run") = {V_getExperiment_identifier(folderStr)} … … 85 77 // TODO: Reinstate Qdev/resolutions when I can fix the reader issue 86 78 // 87 // Create q entry79 // Create qx and qy entry 88 80 NewDataFolder/O/S $(dataBase + ":q") 89 81 Make/O/T/N=2 $(dataBase + ":q:attr") = {"units"}//,"resolutions"} … … 148 140 149 141 // Check fullpath and dialog 150 if(dialog == 1 || stringmatch(saveName, "")) 151 fileID = NxCansas_DoSaveFileDialog() 152 else 153 fileID = NxCansas_CreateFile(saveName) 154 Endif 155 if(!fileID) 156 abort "Unable to create file at " + saveName + "." 157 EndIf 142 fileID = NXcanSAS_OpenOrCreate(dialog,saveName,base) 158 143 159 144 Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1)
Note: See TracChangeset
for help on using the changeset viewer.