Skip to content

Commit

Permalink
implement (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehenke authored Aug 13, 2024
1 parent 01e576a commit 8f65b0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
14 changes: 4 additions & 10 deletions ptychodus/plugins/lclsFileReaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(self) -> None:

def read(self, filePath: Path) -> DiffractionDataset:
dataset = SimpleDiffractionDataset.createNullInstance(filePath)
metadata = DiffractionMetadata.createNullInstance(filePath)

try:
with tables.open_file(filePath, mode='r') as h5File:
Expand All @@ -83,16 +84,6 @@ def read(self, filePath: Path) -> DiffractionDataset:
filePath=filePath,
dataPath=self._dataPath,
)

with h5py.File(filePath, 'r') as h5File:
metadata = DiffractionMetadata.createNullInstance(filePath)
contentsTree = self._treeBuilder.build(h5File)

try:
data = h5File.get_node(self._dataPath)
except KeyError:
logger.debug('Unable to find data.')
else:
metadata = DiffractionMetadata(
numberOfPatternsPerArray=numberOfPatterns,
numberOfPatternsTotal=numberOfPatterns,
Expand All @@ -101,6 +92,9 @@ def read(self, filePath: Path) -> DiffractionDataset:
filePath=filePath,
)

with h5py.File(filePath, 'r') as h5File:
contentsTree = self._treeBuilder.build(h5File)

dataset = SimpleDiffractionDataset(metadata, contentsTree, [array])
except OSError:
logger.debug(f'Unable to read file \"{filePath}\".')
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module = [
"pvaccess",
"pvapy.*",
"scipy.*",
"tables.*",
"tifffile",
"tike.*",
]
Expand Down

0 comments on commit 8f65b0f

Please sign in to comment.