Changeset 1034
- Timestamp:
- Apr 25, 2017 2:55:34 PM (5 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_BeamCenter.ipf
r1024 r1034 14 14 // -- move everything into it's own folder, rather than root: 15 15 // 16 // -- am I working in detector coordinates (1->n) or in array coordinates (0->n-1)?? 16 17 17 18 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_FileCatalog.ipf
r1025 r1034 36 36 // But typically, I'd like to see that the disk version really did get updated... 37 37 // -- make a background task to periodically "kill" a few of the files? maybe too dangerous. 38 39 40 38 // -- change the V_GetHeaderInfoToWave function to allow "refreshing" of a single row, say after 39 // a file has been patched - then the disk and local copies are in sync 40 // 41 // -- run a profiler on the catalog to see if there is an obvious place to speed up the process 42 // 43 44 Function catalogProfiler() 45 V_BuildCatVeryShortTable() 46 End 41 47 42 48 // … … 552 558 // group_id (sample) 553 559 InsertPoints lastPoint,1,G_ID 554 G_ID[lastPoint] = V_getSample_group _ID(fname)560 G_ID[lastPoint] = V_getSample_groupID(fname) 555 561 556 562 return(0) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_RW_Utils.ipf
r1031 r1034 416 416 base_name = "" 417 417 else 418 base_name = StringFromList(0,FileName,".") 419 endif 420 421 HDF5LoadGroup/Z/L=7/O/R/T=$base_name :, fileID, hdf5Path // recursive 418 base_name = StringFromList(0,FileName,".") // just the first part of the name, no .nxs.ngv 419 endif 420 421 422 // TODO 423 // -- write a separate function or add a flag to this one that will read everything, including the DAS_logs 424 // -- the DAS_logs are not needed for reduction, and slow everything down a LOT (0.6 s per file vs 0.04 s per file!) 425 426 // 427 //// loads everything with one line (includes /DAS_logs) 428 // HDF5LoadGroup/Z/L=7/O/R/T=$base_name :, fileID, hdf5Path // recursive 429 // 430 431 432 433 //// to skip DAS_logs. I need to generate all of the data folders myself 434 //// must be an easier way to handle the different path syntax, but at least this works 435 436 String curDF = GetDataFolder(1) 437 438 // load root/entry 439 hdf5path = "/entry" 440 // NewDataFolder/O $(curDF) 441 if(isFolder == -1) 442 NewDataFolder/O $(curDF+base_name) 443 endif 444 if(isFolder == -1) 445 NewDataFolder/O/S $(curDF+base_name+":entry") 446 else 447 // base_name is "", so get rid of the leading ":" on ":entry" 448 NewDataFolder/O/S $(curDF+base_name+"entry") 449 endif 450 HDF5LoadGroup/Z/L=7/O :, fileID, hdf5Path // NOT recursive 451 452 453 if(isFolder == -1) 454 NewDataFolder/O/S $(curDF+base_name+":entry:control") 455 else 456 NewDataFolder/O/S $(curDF+base_name+"entry:control") 457 endif 458 hdf5path = "/entry/control" 459 HDF5LoadGroup/Z/L=7/O/R :, fileID, hdf5Path // YES recursive 460 461 if(isFolder == -1) 462 NewDataFolder/O/S $(curDF+base_name+":entry:instrument") 463 else 464 NewDataFolder/O/S $(curDF+base_name+"entry:instrument") 465 endif 466 hdf5path = "/entry/instrument" 467 HDF5LoadGroup/Z/L=7/O/R :, fileID, hdf5Path // YES recursive 468 469 if(isFolder == -1) 470 NewDataFolder/O/S $(curDF+base_name+":entry:reduction") 471 else 472 NewDataFolder/O/S $(curDF+base_name+"entry:reduction") 473 endif 474 hdf5path = "/entry/reduction" 475 HDF5LoadGroup/Z/L=7/O/R :, fileID, hdf5Path // YES recursive 476 477 if(isFolder == -1) 478 NewDataFolder/O/S $(curDF+base_name+":entry:sample") 479 else 480 NewDataFolder/O/S $(curDF+base_name+"entry:sample") 481 endif 482 hdf5path = "/entry/sample" 483 HDF5LoadGroup/Z/L=7/O/R :, fileID, hdf5Path // YES recursive 484 485 if(isFolder == -1) 486 NewDataFolder/O/S $(curDF+base_name+":entry:user") 487 else 488 NewDataFolder/O/S $(curDF+base_name+"entry:user") 489 endif 490 hdf5path = "/entry/user" 491 HDF5LoadGroup/Z/L=7/O/R :, fileID, hdf5Path // YES recursive 492 493 494 422 495 if ( V_Flag != 0 ) 423 496 Print fileName + ": could not open as HDF5 file" … … 429 502 430 503 //s_toc() 504 505 SetDataFolder root: 506 431 507 return(0) 432 508 end -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf
r1027 r1034 2294 2294 End 2295 2295 2296 //group ID 2297 // DONE 2298 // x- is this duplicated? 2299 // x- yes, this is a duplicated field in the /entry/sample block (and is probably more appropriate there) 2300 // x- so pick a single location, rather than needing to duplicate. 2301 // 2302 Function V_getSample_group_ID(fname) 2303 String fname 2304 2305 // do not use the entry/reduction location 2306 // String path = "entry:reduction:group_id" 2307 String path = "entry:sample:group_id" 2308 2309 return(V_getRealValueFromHDF5(fname,path)) 2310 end 2296 ////group ID 2297 //// DONE 2298 //// x- is this duplicated? 2299 //// x- yes, this is a duplicated field in the /entry/sample block (and is probably more appropriate there) 2300 //// x- so pick a single location, rather than needing to duplicate. 2301 //// x- REPLACE with a single function V_getSample_GroupID() 2302 //// 2303 //Function V_getSample_group_ID(fname) 2304 // String fname 2305 // 2306 //// do not use the entry/reduction location 2307 //// String path = "entry:reduction:group_id" 2308 // String path = "entry:sample:group_id" 2309 // 2310 // return(V_getRealValueFromHDF5(fname,path)) 2311 //end 2311 2312 2312 2313 Function/S V_getReduction_intent(fname) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Write.ipf
r1022 r1034 5810 5810 // TODO -- I need to make sure that this is an integer in the JSON definition 5811 5811 // -- currently a text value in the data file - see trac ticket 5812 // x- this is also a duplicated field in the reduction block (reductio /group_id is no longer used)5812 // x- this is also a duplicated field in the reduction block (reduction/group_id is no longer used) 5813 5813 // 5814 5814 // group ID !!! very important for matching up files -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Marquee_Operations.ipf
r1032 r1034 219 219 Return (counts) 220 220 End 221 222 223 Function V_FindCentroid() : GraphMarquee 224 225 // //get the current displayed data (so the correct folder is used) 226 // SVAR cur_folder=root:myGlobals:gDataDisplayType 227 // String dest = "root:Packages:NIST:" + cur_folder 228 229 Variable xzsum,yzsum,zsum,xctr,yctr 230 Variable left,right,bottom,top,ii,jj,counts 231 232 233 234 GetMarquee left,bottom 235 if(V_flag == 0) 236 Print "There is no Marquee" 237 else 238 left = round(V_left) //get integer values for selection limits 239 right = round(V_right) 240 top = round(V_top) 241 bottom = round(V_bottom) 242 243 // NOTE: 244 // this function MODIFIES x and y values on return, converting them to panel coordinates 245 // detector panel is identified from the (left,top) coordinate (x1,y2) 246 String detStr = V_FindDetStrFromLoc(left,right,bottom,top) 247 // Printf "Detector = %s\r",detStr 248 249 // 250 SVAR gCurDispType = root:Packages:NIST:VSANS:Globals:gCurDispType 251 // this function will modify the x and y values (passed by reference) as needed to keep on the panel 252 V_KeepSelectionInBounds(left,right,bottom,top,detStr,gCurDispType) 253 Print left,right,bottom,top 254 255 256 // selection valid now, calculate beamcenter 257 // get the waves of the data and the data_err 258 Wave data = V_getDetectorDataW(gCurDispType,detStr) 259 Wave data_err = V_getDetectorDataErrW(gCurDispType,detStr) 260 261 xzsum = 0 262 yzsum = 0 263 zsum = 0 264 // count over rectangular selection, doing each row, L-R, bottom to top 265 ii = bottom -1 266 do 267 ii +=1 268 jj = left-1 269 do 270 jj += 1 271 counts = data[jj][ii] 272 xzsum += jj*counts 273 yzsum += ii*counts 274 zsum += counts 275 while(jj<right) 276 while(ii<top) 277 278 xctr = xzsum/zsum 279 yctr = yzsum/zsum 280 281 // add 1 to each to get to detector coordinates (1,128) 282 // rather than the data array which is [0,127] 283 // xctr+=1 284 // yctr+=1 285 286 Print "X-center (in array coordinates 0->n-1 ) = ",xctr 287 Print "Y-center (in array coordinates 0->n-1 ) = ",yctr 288 endif 289 290 //back to root folder (redundant) 291 SetDataFolder root: 292 293 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_PatchFiles.ipf
r1033 r1034 348 348 349 349 listWave[8][1] = "group_id (sample)" 350 listWave[8][2] = num2str(V_getSample_group _ID(fname))350 listWave[8][2] = num2str(V_getSample_groupID(fname)) 351 351 352 352 listWave[9][1] = "Box Coordinates"
Note: See TracChangeset
for help on using the changeset viewer.