Skip to content

Commit

Permalink
Merge pull request #1075 from vasole/tiled2
Browse files Browse the repository at this point in the history
Restore compatibility with tiled branch of silx
  • Loading branch information
vasole authored May 5, 2024
2 parents 09af8ed + 951b038 commit 7647058
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion PyMca5/PyMcaGui/pymca/PyMcaNexusWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
__contact__ = "sole@esrf.fr"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
import os
import sys
import posixpath
import h5py
import logging
from PyMca5.PyMcaGui import PyMcaQt as qt
from PyMca5.PyMcaCore import DataObject
from PyMca5.PyMcaCore.NexusDataSource import silxh5open
from PyMca5.PyMcaGui.io.hdf5 import QNexusWidget
from PyMca5.PyMcaGui.pymca import QStackWidget
from PyMca5.PyMcaIO import HDF5Stack1D
Expand Down Expand Up @@ -160,7 +162,16 @@ def _stackSignal(self, index=-1, load=False):
stack = phynxFile[name]
else:
#create a new instance
phynxFile = h5py.File(filename, 'r')
if os.path.exists(filename):
# this already tries silx
phynxFile = h5py.File(filename, "r")
elif '%' in name:
try:
phynxFile = h5py.File(name, 'r', driver='family')
except Exception:
phynxFile = silxh5open(filename)
else:
phynxFile = silxh5open(filename)
stack = phynxFile[name]

# try to find out the "energy" axis
Expand Down
2 changes: 1 addition & 1 deletion PyMca5/PyMcaGui/pymca/QDataSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def getSourceType(sourceName0):
except Exception:
pass
return SpecFileDataSource.SOURCE_TYPE
elif sourceName.startswith("tiled:") or \
elif (sourceName.startswith("tiled") and ("http" in sourceName)) or \
sourceName.startswith(r"http:/") or \
sourceName.startswith(r"https:/"):
# only chance is to use silx via an h5py-like API
Expand Down

0 comments on commit 7647058

Please sign in to comment.