1 #pragma rtGlobals=3 // Use modern global access method and strict wave access. 2 #pragma IgorVersion = 6.2 3 #pragma ModuleName = PearlAreaImport 4 #include <HDF5 Browser> 5 #include "pearl-gui-tools" 43 string fileName, path, type, creator
45 variable handledOpen = 0
49 string NickName = CleanupName(ParseFilePath(3, FileName,
":", 0, 0), 0)
50 string FileExt = LowerStr(ParseFilePath(4, FileName, ":", 0, 0))
54 svar /z cnn = gsCustomNickName
56 if (exists("gvNickNameIndex") != 2)
57 variable/g gvNickNameIndex = 1
59 nvar nni = gvNickNameIndex
60 NickName = cnn + num2str(nni)
64 if (stringmatch(FileExt, "h5") == 1)
68 string/g s_latest_datafile = result
69 string/g s_latest_nickname = nickname
71 handledOpen = strlen(result) > 0
111 if (ParamIsDefault(ignoredate))
114 if (ParamIsDefault(unique))
118 string basename = ParseFilePath(3, filename, ":", 0, 0)
119 string extension = ParseFilePath(4, filename, ":", 0, 0)
123 if (strsearch(basename, "scienta", 0, 2) >= 0)
125 elseif (strsearch(basename, "pshell", 0, 2) >= 0)
127 elseif (strsearch(basename, "OP-SL", 0, 2) >= 0)
129 elseif (strsearch(basename, "ES-PS", 0, 2) >= 0)
134 if (ParamIsDefault(sourcename))
135 sourcename = autosource
138 variable nparts = ItemsInList(basename, "-")
140 string datepart = StringFromList(1, basename, "-")
141 variable l_datepart = strlen(datepart)
143 datepart = datepart[l_datepart-6, l_datepart-1]
145 string indexpart = StringFromList(2, basename, "-")
147 sprintf nickname, "%s_%s", sourcename, indexpart
149 sprintf nickname, "%s_%s_%s", sourcename, datepart, indexpart
152 nickname = CleanupName(basename, 0)
155 if (unique && CheckName(nickname, 11))
156 nickname = UniqueName(nickname + "_", 11, 0)
170 string message = "Select data files"
172 string filefilters = "Area Detector HDF5 Files (*.h5):.h5;"
173 filefilters += "All Files:.*;"
175 PathInfo /S $APathName
176 Open /D /R /F=filefilters /M=message /MULT=1 refNum
177 filepaths = S_fileName
179 dfref saveDF = GetDataFolderDFR()
182 if (strlen(filepaths) > 0)
183 variable nfiles = ItemsInList(filepaths, "\r")
185 for(ifile = 0; ifile < nfiles; ifile += 1)
186 String path = StringFromList(ifile, filepaths, "\r")
213 if (ParamIsDefault(load_data))
216 if (ParamIsDefault(load_attr))
220 dfref saveDF = GetDataFolderDFR()
222 newdatafolder /s/o $("root:" + ANickName)
226 string instrumentpath = "/entry/instrument/"
227 string detectorpath = instrumentpath + "detector/"
228 string attributespath = instrumentpath + "NDAttributes/"
234 variable /g adh5_perf_secs
235 timerRefNum = startMSTimer
238 #if Exists("HDF5OpenFile") 239 HDF5OpenFile /P=$APathName/R fileID as AFileName
241 AFileName = s_path + s_filename
242 print
"loading " + s_filename +
"\r" 248 newdatafolder /o/s attr
254 if (waveexists(data))
264 Abort
"HDF5 XOP not loaded." 267 if (timerRefNum >= 0)
268 adh5_perf_secs = stopMSTimer(timerRefNum) / 1e6
301 function /s
adh5_load_reduced(ANickName, APathName, AFileName, reduction_func, reduction_param, [load_data, load_attr, progress])
307 string reduction_param
313 if (ParamIsDefault(load_data))
316 if (ParamIsDefault(load_attr))
319 if (ParamIsDefault(progress))
323 dfref saveDF = GetDataFolderDFR()
325 newdatafolder /s/o $("root:" + ANickName)
329 string instrumentpath = "/entry/instrument/"
330 string detectorpath = instrumentpath + "detector/"
331 string attributespath = instrumentpath + "NDAttributes/"
337 variable /g adh5_perf_secs
338 timerRefNum = startMSTimer
341 #if Exists("HDF5OpenFile") 342 HDF5OpenFile /P=$APathName/R fileID as AFileName
344 AFileName = s_path + s_filename
345 print
"loading " + s_filename +
"\r" 348 newdatafolder /o/s attr
361 Abort
"HDF5 XOP not loaded." 364 if (timerRefNum >= 0)
365 adh5_perf_secs = stopMSTimer(timerRefNum) / 1e6
393 if (ParamIsDefault(load_data))
396 if (ParamIsDefault(load_attr))
400 dfref saveDF = GetDataFolderDFR()
402 newdatafolder /o/s pearl_area
403 newdatafolder /o/s preview
407 string instrumentpath = "/entry/instrument/"
408 string detectorpath = instrumentpath + "detector/"
409 string attributespath = instrumentpath + "NDAttributes/"
415 variable /g adh5_perf_secs
416 timerRefNum = startMSTimer
419 #if Exists("HDF5OpenFile") 420 HDF5OpenFile /P=$APathName/R/Z fileID as AFileName
422 AFileName = s_path + s_filename
425 datasetname = detectorpath +
"data" 426 STRUCT HDF5DataInfo di
428 variable err = HDF5DatasetInfo(fileID, datasetname, 0, di)
430 print
"error accessing detector/data" 434 print
"error: rank of dataset < 2" 438 variable dim2start = 0, dim2count = 1, dim3start = 0, dim3count = 1
440 dim2start = floor(di.dims[di.ndims - 3] / 2)
444 dim3start = floor(di.dims[di.ndims - 4] / 2)
451 string destpath = GetDataFolder(1, saveDF) + ANickName
452 if (waveexists(data))
453 duplicate /o data, $destpath
454 wave /z data = $destpath
460 newdatafolder /o/s attr
464 if (waveexists(data))
471 print "error opening file " + AFileName
475 Abort
"HDF5 XOP not loaded." 478 if (timerRefNum >= 0)
479 adh5_perf_secs = stopMSTimer(timerRefNum) / 1e6
500 dfref saveDF = GetDataFolderDFR()
504 string instrumentpath = "/entry/instrument/"
505 string detectorpath = instrumentpath + "detector/"
506 string attributespath = instrumentpath + "NDAttributes/"
516 #if Exists("HDF5OpenFile") 517 HDF5OpenFile /P=$APathName/R/Z fileID as AFileName
519 AFileName = s_path + s_filename
522 datasetname = detectorpath +
"data" 523 STRUCT HDF5DataInfo di
525 variable err = HDF5DatasetInfo(fileID, datasetname, 0, di)
527 print
"error accessing detector/data" 531 for (idim = 0; idim < di.ndims; idim += 1)
532 sprintf s,
"dim %u: %u points", idim, di.dims[idim]
533 if (strlen(s_info) > 0)
534 s_info = s_info +
"\r" + s
540 dfref df = NewFreeDataFolder()
544 for (idim = 1; idim < 5; idim += 1)
545 sprintf s, "Scan%uActive", idim
547 if (waveexists(w) && (numpnts(w) > 0) && (w[0] > 0))
548 sprintf s, "Scan%uPositioner1", idim
550 sprintf s, "scan %u: %s", idim, wt[0]
551 if (strlen(s_info) > 0)
552 s_info = s_info + "\r" + s
561 print "error opening file " + AFileName
565 Abort
"HDF5 XOP not loaded." 585 #if Exists("HDF5LoadData") 590 datasetname = detectorpath +
"data" 591 STRUCT HDF5DataInfo di
593 variable err = HDF5DatasetInfo(fileID, datasetname, 0, di)
595 print
"error accessing detector/data" 599 print
"error: rank of dataset < 2" 603 HDF5LoadData /O /Q /Z fileID, datasetname
607 Abort
"HDF5 XOP not loaded." 628 duplicate /free data, tempdata
629 variable nd = wavedims(tempdata)
630 variable nx = dimsize(tempdata, nd - 1)
631 variable ny = dimsize(tempdata, nd - 2)
632 variable nz = dimsize(tempdata, nd - 3)
633 variable nt = dimsize(tempdata, nd - 4)
638 redimension /n=(ny) data
639 setdimlabel 0, -1, AD_Dim1, data
640 data = tempdata[p][0]
642 redimension /n=(nx) data
643 setdimlabel 0, -1, AD_Dim0, data
644 data = tempdata[0][p]
646 redimension /n=(nx,ny) data
647 setdimlabel 0, -1, AD_Dim0, data
648 setdimlabel 1, -1, AD_Dim1, data
649 data = tempdata[q][p]
654 redimension /n=(ny,nz) data
655 setdimlabel 0, -1, AD_Dim1, data
656 setdimlabel 1, -1, AD_DimN, data
657 multithread data = tempdata[q][p][0]
659 redimension /n=(nx,nz) data
660 setdimlabel 0, -1, AD_Dim0, data
661 setdimlabel 1, -1, AD_DimN, data
662 multithread data = tempdata[q][0][p]
664 redimension /n=(nx,ny) data
665 setdimlabel 0, -1, AD_Dim0, data
666 setdimlabel 1, -1, AD_Dim1, data
667 multithread data = tempdata[0][q][p]
669 redimension /n=(nx,ny,nz) data
670 setdimlabel 0, -1, AD_Dim0, data
671 setdimlabel 1, -1, AD_Dim1, data
672 setdimlabel 2, -1, AD_DimN, data
673 multithread data = tempdata[r][q][p]
679 redimension /n=(nx,ny,nt) data
680 setdimlabel 0, -1, AD_Dim0, data
681 setdimlabel 1, -1, AD_Dim1, data
682 setdimlabel 2, -1, AD_DimX, data
683 multithread data = tempdata[r][0][q][p]
685 redimension /n=(nx,ny,nz,nt) data
686 setdimlabel 0, -1, AD_Dim0, data
687 setdimlabel 1, -1, AD_Dim1, data
688 setdimlabel 2, -1, AD_DimN, data
689 setdimlabel 3, -1, AD_DimX, data
690 multithread data = tempdata[s][r][q][p]
709 dfref dataDF = GetWavesDataFolderDFR(data)
710 dfref attrDF = dataDF:attr
711 if (DataFolderRefStatus(attrDF) == 0)
729 dfref saveDF = GetDataFolderDFR()
730 dfref dataDF = GetWavesDataFolderDFR(data)
733 if (ParamIsDefault(source))
735 wave /SDFR=attrDF /Z AcquisitionMode
736 wave /SDFR=attrDF /T /Z Manufacturer
738 if (waveexists(Manufacturer) && (numpnts(Manufacturer) >= 1))
739 strswitch(Manufacturer[0])
747 elseif (waveexists(AcquisitionMode) && (numpnts(AcquisitionMode) >= 1))
748 if (stringmatch(note(AcquisitionMode), "*SCIENTA*"))
784 if (ParamIsDefault(progress))
790 #if Exists("HDF5LoadData") 795 datasetname = detectorpath +
"data" 796 STRUCT HDF5DataInfo di
798 variable err = HDF5DatasetInfo(fileID, datasetname, 0, di)
800 print
"error accessing detector/data" 804 print
"error: rank of dataset < 2" 809 variable idx, idy, idz, idt, izt
815 variable nx, ny, nz, nt, nzt
821 make /n=(nx,ny,nz,nt) /o data
822 string dim_labels =
"AD_Dim0;AD_Dim1;AD_DimN;AD_DimX;AD_DimY" 824 dim_label = StringFromList(0, dim_labels,
";")
825 setdimlabel 0, -1, $dim_label, data
826 dim_labels = RemoveFromList(dim_label, dim_labels,
";")
827 dim_label = StringFromList(0, dim_labels, ";")
828 setdimlabel 1, -1, $dim_label, data
829 dim_labels = RemoveFromList(dim_label, dim_labels, ";")
833 for (
id = idy - 1; (
id >= 0) && (nz == 1);
id -= 1)
837 dim_label = StringFromList(0, dim_labels, ";")
838 setdimlabel 2, -1, $dim_label, data
840 dim_labels = RemoveListItem(0, dim_labels, ";")
842 for (
id = idz - 1; (
id >= 0) && (nt == 1);
id -= 1)
846 dim_label = StringFromList(0, dim_labels, ";")
847 setdimlabel 3, -1, $dim_label, data
849 dim_labels = RemoveListItem(0, dim_labels, ";")
851 redimension /n=(nx,ny,nz,nt) data
868 HDF5MakeHyperslabWave(GetDataFolder(1) + "slab", max(di.ndims, 4))
874 slab[idx][%Block] = nx
875 slab[idy][%Block] = ny
878 for (iz = 0; iz < nz; iz += 1)
879 for (it = 0; it < nt; it += 1)
880 slab[idz][%Start] = iz
881 slab[idt][%Start] = it
882 HDF5LoadData /O /Q /Z /SLAB=slab /N=slabdata fileID, datasetname
884 switch (WaveDims(slabdata))
886 data[][][iz][it] = slabdata[q][p]
889 data[][][iz][it] = slabdata[0][q][p]
892 data[][][iz][it] = slabdata[0][0][q][p]
910 redimension /n=(nx,ny) data
912 redimension /n=(nx,ny,nz) data
919 Abort
"HDF5 XOP not loaded." 953 #if Exists("HDF5LoadData") 958 datasetname = detectorpath +
"data" 959 STRUCT HDF5DataInfo di
961 variable err = HDF5DatasetInfo(fileID, datasetname, 0, di)
963 print
"error accessing detector/data" 967 print
"error: rank of dataset < 1" 972 variable idx, idy, idz, idt
974 idy = di.ndims >= 2 ? di.ndims - 2 : 1
975 idz = di.ndims >= 3 ? di.ndims - 3 : 2
976 idt = di.ndims >= 4 ? di.ndims - 4 : 3
980 ny = di.ndims >= 2 ? di.dims[idy] : 1
982 variable dim2end = dim2start + dim2count - 1
983 variable dim3end = dim3start + dim3count - 1
987 HDF5MakeHyperslabWave(GetDataFolder(1) +
"slab", max(di.ndims, 4))
993 slab[idx][%Block] = nx
994 slab[idy][%Block] = ny
996 make /n=(nx,ny)/o/d data
1000 for (iz = dim2start; iz <= dim2end; iz += 1)
1001 for (it = dim3start; it <= dim3end; it += 1)
1002 slab[idz][%Start] = iz
1003 slab[idt][%Start] = it
1004 HDF5LoadData /O /Q /Z /SLAB=slab /N=slabdata fileID, datasetname
1006 switch (WaveDims(slabdata))
1012 data += slabdata[q][p]
1016 data += slabdata[0][q][p]
1020 data += slabdata[0][0][q][p]
1027 setdimlabel 0, -1, AD_Dim0, data
1028 setdimlabel 1, -1, AD_Dim1, data
1031 Abort
"HDF5 XOP not loaded." 1041 string all_funcs = FunctionList("*", ";", "KIND:6,NPARAMS:2,VALTYPE:8")
1045 variable nn = ItemsInList(all_funcs, ";")
1052 for (ii = 0; ii < nn; ii += 1)
1053 funcname = StringFromList(ii, all_funcs, ";")
1054 info = FunctionInfo(funcname)
1055 accept = (NumberByKey("RETURNTYPE", info, ":", ";") == 0x4000)
1056 accept = accept && (cmpstr(StringByKey("THREADSAFE", info, ":", ";"), "yes") == 0)
1057 accept = accept && (NumberByKey("N_PARAMS", info, ":", ";") == 2)
1058 accept = accept && (NumberByKey("N_OPT_PARAMS", info, ":", ";") == 0)
1061 accept = accept && (NumberByKey("PARAM_0_TYPE", info, ":", ";") == 0x4002)
1062 accept = accept && (NumberByKey("PARAM_1_TYPE", info, ":", ";") == 0x3000)
1065 result = AddListItem(funcname, result, ";")
1069 result = SortList(result, ";", 4)
1116 make /n=0 /free dest1, dest2
1122 make /n=2 /free /wave results
1138 redimension /n=(dimsize(image, dim)) profile
1139 setscale /p x dimoffset(image, dim), dimdelta(image, dim), waveunits(image, dim), profile
1140 setscale d 0, 0, waveunits(image, -1), profile
1141 setdimlabel 0, -1, $getdimlabel(image, dim, -1), profile
1169 string reduction_param
1170 string result_prefix
1172 wave /wave results = reduction_func(source, reduction_param)
1175 return reduction_param
1194 string result_prefix
1195 variable start_index
1197 variable nw = numpnts(results)
1200 for (iw = 0; iw < nw; iw += 1)
1201 sw = result_prefix + num2str(iw + start_index)
1202 duplicate /o results[iw], $sw
1232 string reduction_param
1236 if (ParamIsDefault(progress))
1239 if (ParamIsDefault(nthreads))
1245 #if Exists("HDF5LoadData") 1250 datasetname = detectorpath +
"data" 1251 STRUCT HDF5DataInfo di
1252 InitHDF5DataInfo(di)
1253 variable err = HDF5DatasetInfo(fileID, datasetname, 0, di)
1255 print
"error accessing detector/data" 1259 print
"error: rank of dataset < 2" 1264 variable idx, idy, idz, idt
1270 variable nx, ny, nz, nt
1278 for (
id = idy - 1; (
id >= 0) && (nz == 1);
id -= 1)
1279 if (di.dims[
id] > 1)
1284 for (
id = idz - 1; (
id >= 0) && (nt == 1);
id -= 1)
1285 if (di.dims[
id] > 1)
1297 variable nzt = nz * nt
1301 HDF5MakeHyperslabWave(GetDataFolder(1) + "slab", max(di.ndims, 4))
1307 slab[idx][%Block] = nx
1308 slab[idy][%Block] = ny
1312 nthreads = ThreadProcessorCount
1315 variable threadGroupID = ThreadGroupCreate(nthreads)
1317 for (ithread = 0; ithread < nthreads; ithread += 1)
1321 make /n=(nzt) /df /free processing_folders
1328 make /n=(nx,ny)/d image_template
1329 setdimlabel 0, -1, AD_Dim0, image_template
1330 setdimlabel 1, -1, AD_Dim1, image_template
1337 make /n=0 /free /wave result_waves
1340 for (iz = 0; iz < nz; iz += 1)
1341 for (it = 0; it < nt; it += 1)
1343 slab[idz][%Start] = iz
1344 slab[idt][%Start] = it
1345 dfname = "processing_" + num2str(izt)
1346 newdatafolder /s $dfname
1347 HDF5LoadData /O /Q /Z /SLAB=slab /N=slabdata fileID, datasetname
1350 duplicate image_template, image
1351 variable /g r_index = iz
1352 variable /g s_index = it
1353 string /g func_param = reduction_param
1357 ThreadGroupPutDF threadGroupID, :
1359 processing_folders[izt] = GetDataFolderDFR()
1361 wave /wave reduced_waves =
reduce_slab_image(slabdata, image, reduction_func, func_param)
1362 variable /g func_result = numpnts(reduced_waves)
1364 WaveClear slabdata, image, reduced_waves
1379 killwaves /z slab, image_template
1385 for (izt = 0; (izt < nzt) && (result == 0); izt += 1)
1388 dfr = ThreadGroupGetDFR(threadGroupID, 1000)
1389 if (DatafolderRefStatus(dfr) != 0)
1393 if (update_progress_panel(izt))
1400 dfr = processing_folders[izt]
1402 if (update_progress_panel(izt))
1413 nvar rr = dfr:r_index
1414 nvar ss = dfr:s_index
1415 nvar func_result = dfr:func_result
1417 if (func_result < 1)
1422 if (numpnts(result_waves) == 0)
1423 redimension /n=(func_result) result_waves
1424 for (iw = 0; iw < func_result; iw += 1)
1425 sw = "redw_" + num2str(iw)
1426 wave profile = dfr:$sw
1427 sw = "ReducedData" + num2str(iw+1)
1428 make /n=(dimsize(profile, 0), nz, nt) /d /o $sw
1430 setdimlabel 0, -1, $getdimlabel(profile, 0, -1), data
1431 setscale /p x dimoffset(profile, 0), dimdelta(profile, 0), waveunits(profile, 0), data
1432 setscale d 0, 0, waveunits(profile, -1), data
1433 result_waves[iw] = data
1436 for (iw = 0; iw < func_result; iw += 1)
1437 sw = "redw_" + num2str(iw)
1438 wave profile = dfr:$sw
1439 wave data = result_waves[iw]
1440 data[][rr][ss] = profile[p]
1445 variable tstatus = ThreadGroupRelease(threadGroupID)
1450 for (izt = 0; izt < nzt; izt += 1)
1451 KillDataFolder /Z processing_folders[izt]
1456 nw = numpnts(result_waves)
1457 for (iw = 0; iw < nw; iw += 1)
1458 wave data = result_waves[iw]
1460 redimension /n=(dimsize(data, 0)) data
1462 redimension /n=(dimsize(data, 0),nz) data
1463 setdimlabel 1, -1, AD_DimN, data
1465 setdimlabel 1, -1, AD_DimN, data
1466 setdimlabel 2, -1, AD_DimX, data
1475 Abort
"HDF5 XOP not loaded." 1485 dfref dfr = ThreadGroupGetDFR(0, 1000)
1486 if (DataFolderRefStatus(dfr) == 0)
1496 wave slabdata = dfr:slabdata
1497 wave image = dfr:image
1498 svar func_param = dfr:func_param
1499 nvar rr = dfr:r_index
1500 nvar ss = dfr:s_index
1503 newdatafolder /s outDF
1504 variable /g r_index = rr
1505 variable /g s_index = ss
1506 wave /wave reduced_waves =
reduce_slab_image(slabdata, image, reduction_func, func_param)
1507 variable /g func_result = numpnts(reduced_waves)
1511 WaveClear slabdata, image, reduced_waves
1512 ThreadGroupPutDF 0, :
1519 threadsafe static function /wave
reduce_slab_image(slabdata, image, reduction_func, reduction_param)
1523 string reduction_param
1525 switch (WaveDims(slabdata))
1527 image = slabdata[q][p]
1530 image = slabdata[0][q][p]
1533 image = slabdata[0][0][q][p]
1537 return reduction_func(image, reduction_param)
1554 string attributespath
1560 #if Exists("HDF5LoadData") 1563 HDF5ListGroup /F /TYPE=2 fileID, attributespath
1564 string h5datasets = S_HDF5ListGroup
1565 HDF5ListAttributes /TYPE=1 /Z fileID, attributespath
1566 string h5attributes = S_HDF5ListAttributes
1568 variable nds = ItemsInList(h5datasets,
";")
1569 variable na = ItemsInList(h5attributes, ";")
1576 make /n=(nds+na) /t /o IN, ID, IV, IU
1578 for (ids = 0; ids < nds; ids += 1)
1579 datasetname = StringFromList(ids, h5datasets, ";")
1580 HDF5LoadData /O/Q fileID, datasetname
1582 datawavename = StringFromList(0, s_wavenames)
1586 HDF5LoadData /A="source"/O/Q/TYPE=2 fileID, datasetname
1589 s_source = source[0]
1598 nds = ItemsInList(h5attributes, ";")
1602 for (ids = 0; ids < nds; ids += 1)
1603 datasetname = StringFromList(ids, h5attributes, ";")
1604 HDF5LoadData /A=datasetname/O/Q/TYPE=1 fileID, attributespath
1606 datawavename = StringFromList(0, s_wavenames)
1611 redimension /n=(idest) IN, ID, IV, IU
1612 sort {IN, ID}, IN, ID, IV, IU
1616 Abort
"HDF5 XOP not loaded." 1652 if (exists(datawavename) == 1)
1653 if (strlen(source) > 0)
1654 Note $datawavename,
"PV=" + source
1656 switch(WaveType($datawavename, 1))
1658 wave w_attr = $datawavename
1659 n_attr = numpnts(w_attr)
1660 sprintf s_attr,
"%.12g", w_attr[0]
1663 wave /t wt_attr = $datawavename
1664 n_attr = numpnts(wt_attr)
1672 ID[idest] = datawavename
1690 dfref saveDF = GetDataFolderDFR()
1692 dfref dataDF = GetWavesDataFolderDFR(data)
1695 wave /SDFR=attrDF LensMode
1696 wave /SDFR=attrDF /Z ChannelBegin, ChannelEnd
1697 wave /SDFR=attrDF /Z SliceBegin, SliceEnd
1700 variable ELow, EHigh, ALow, AHigh
1704 strswitch(GetDimLabel(data, 0, -1))
1714 strswitch(GetDimLabel(data, 1, -1))
1727 ELow = dimoffset(data, EDim)
1728 EHigh = dimoffset(data, EDim) + dimdelta(data, EDim) * (dimsize(data, EDim) - 1)
1732 ALow = dimoffset(data, ADim)
1733 AHigh = dimoffset(data, ADim) + dimdelta(data, ADim) * (dimsize(data, ADim) - 1)
1738 if (waveexists(LensMode) && (numpnts(LensMode) >= 1))
1754 if (waveexists(ChannelBegin) && waveexists(ChannelEnd) && (numpnts(ChannelBegin) >= 1) && (numpnts(ChannelEnd) >= 1))
1755 ELow = ChannelBegin[0]
1756 EHigh = ChannelEnd[0]
1758 if (waveexists(SliceBegin) && waveexists(SliceEnd) && (numpnts(SliceBegin) >= 1) && (numpnts(SliceEnd) >= 1))
1759 ALow = SliceBegin[0]
1766 setscale /i x ELow, EHigh, EUnit, data
1769 setscale /i y ELow, EHigh, EUnit, data
1774 setscale /i x ALow, AHigh, AUnit, data
1777 setscale /i y ALow, AHigh, AUnit, data
1781 setscale d 0, 0, "arb.", data
1783 setdatafolder saveDF
1795 dfref saveDF = GetDataFolderDFR()
1797 dfref dataDF = GetWavesDataFolderDFR(data)
1798 wave /SDFR=dataDF AcquisitionMode, DetectorMode, EnergyMode
1800 wave /SDFR=dataDF /z Scan1Active, Scan2Active
1801 wave /SDFR=dataDF /t /z Scan1Positioner1, Scan1Readback1
1802 wave /SDFR=dataDF /t /z Scan1Positioner2, Scan1Readback2
1803 wave /SDFR=dataDF /t /z Scan2Positioner1, Scan2Readback1
1804 wave /SDFR=dataDF /t /z Scan2Positioner2, Scan2Readback2
1810 strswitch(GetDimLabel(data, 0, -1))
1812 setscale /i x zscale[0], zscale[numpnts(zscale)-1], "", data
1815 strswitch(GetDimLabel(data, 1, -1))
1817 setscale /i y zscale[0], zscale[numpnts(zscale)-1], "", data
1820 strswitch(GetDimLabel(data, 2, -1))
1822 setscale /i z zscale[0], zscale[numpnts(zscale)-1], "", data
1826 setdatafolder saveDF
string adh5_load_preview(string ANickName, string APathName, string AFileName, variable load_data=defaultValue, variable load_attr=defaultValue)
load a single image from a HDF5 file created by the Area Detector software.
string adh5_load_info(string APathName, string AFileName)
load descriptive info from a HDF5 file created by the Area Detector software.
variable ad_load_dialog(string APathName)
load area detector data files selected in a file dialog window
threadsafe wave ad_profile_x_w(wave dataset, variable q1, variable q2, wave destwave, variable noavg=defaultValue)
1D cut through 2D dataset along X dimension, existing destination wave.
static variable read_attribute_info(string datawavename, string source, variable *idest)
sub-function of adh5_loadattr_all.
static dfr GetAttrDataFolderDFR(wave data)
find the attributes data folder of an area detector dataset.
threadsafe variable adh5_setup_profile(wave image, wave profile, variable dim)
set up a one-dimensional wave for a line profile based on a 2D original wave.
threadsafe variable adh5_get_result_waves(wave results, string result_prefix, variable start_index)
copy waves from wave reference wave into current data folder
variable adh5_scale_scienta(wave data)
set the energy and angle scales of an area detector dataset from the Scienta analyser.
string adh5_test_reduction_func(wave source, funcref reduction_func, string reduction_param, string result_prefix)
wrapper function for testing reduction functions from the command line.
variable adh5_loadattr_all(variable fileID, string attributespath)
load an NDAttributes group from an open HDF5 file into the current data folder.
variable adh5_scale_scan(wave data)
scales the extra dimensions of an area detector dataset according to the EPICS scan ...
string ad_suggest_foldername(string filename, variable ignoredate=defaultValue, string sourcename=defaultValue, variable unique=defaultValue)
generate the name of a data folder based on a file name.
threadsafe wave ad_profile_y_w(wave dataset, variable p1, variable p2, wave destwave, variable noavg=defaultValue)
1D cut through 2D dataset along X dimension, existing destination wave.
string adh5_load_complete(string ANickName, string APathName, string AFileName, variable load_data=defaultValue, variable load_attr=defaultValue)
import everything from a HDF5 file created by the Area Detector software.
variable adh5_load_reduced_detector(variable fileID, string detectorpath, funcref reduction_func, string reduction_param, variable progress=defaultValue, variable nthreads=defaultValue)
load a reduced detector dataset from the open HDF5 file.
string adh5_load_reduced(string ANickName, string APathName, string AFileName, funcref reduction_func, string reduction_param, variable load_data=defaultValue, variable load_attr=defaultValue, variable progress=defaultValue)
load and reduce a dataset from a HDF5 file created by the Area Detector software. ...
variable adh5_redim(wave data)
redimension a multi-dimensional area detector array loaded from HDF5.
threadsafe wave adh5_default_reduction(wave source, string *param)
function prototype for adh5_load_reduced_detector
variable adh5_load_detector_slabs(variable fileID, string detectorpath, variable progress=defaultValue)
load the detector dataset from the open HDF5 file.
variable adh5_scale(wave data, string source=defaultValue)
set the dimension scales of an area detector dataset.
variable adh5_load_detector(variable fileID, string detectorpath)
load the detector dataset from the open HDF5 file.
static threadsafe wave reduce_slab_image(wave slabdata, wave image, funcref reduction_func, string reduction_param)
static variable BeforeFileOpenHook(variable refNum, string fileName, string path, string type, string creator, variable kind)
callback function for drag&drop of HDF5 files into Igor.
string adh5_list_reduction_funcs()
get a list of functions which can be used as reduction functions.
variable adh5_load_detector_image(variable fileID, string detectorpath, variable dim2start, variable dim2count, variable dim3start, variable dim3count)
load a single image from the detector dataset of the open HDF5 file
static threadsafe variable reduce_slab_worker(funcref reduction_func)