Skip to content

Commit

Permalink
continue implementing NexusEntry class
Browse files Browse the repository at this point in the history
  • Loading branch information
bingli621 committed Sep 25, 2024
1 parent 00b9271 commit 70b6551
Show file tree
Hide file tree
Showing 249 changed files with 73 additions and 75 deletions.
Binary file modified .DS_Store
Binary file not shown.
10 changes: 7 additions & 3 deletions src/tavi/data/nxentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,18 @@ def from_nexus(cls, path_to_nexus: str) -> dict:
nexus_dict = NexusEntry._read_recursively(nexus_file)
return cls([(key, val) for key, val in nexus_dict.items()])

def to_nexus(self, path_to_nexus: str) -> None:
# TODO
def to_nexus(self, path_to_nexus: str, name="scan") -> None:
"""write a NexueEntry instance to a NeXus file
Args:
path_to_nexus (str): path to a NeXus file with the extention .h5
"""
with h5py.File(path_to_nexus, "w") as nexus_file:
NexusEntry._write_recursively(self, nexus_file)
with h5py.File(path_to_nexus, "a") as nexus_file:
# TODO what if a group alreay exsit??
pass
scan_grp = nexus_file.create_group(name + "/")
NexusEntry._write_recursively(self, scan_grp)

# TODO need to catch errors when multiple IPTS are loaded in a tavi file
def get(self, key, ATTRS=False, default=None):
Expand Down
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0001.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0002.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0003.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0004.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0005.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0006.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0007.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0008.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0009.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0010.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0011.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0012.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0013.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0014.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0015.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0016.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0017.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0018.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0019.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0020.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0021.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0022.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0023.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0024.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0025.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0026.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0027.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0028.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0029.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0030.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0031.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0032.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0033.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0034.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0035.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0036.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0037.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0038.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0039.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0040.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0041.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0042.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0043.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0044.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0045.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0046.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0047.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0048.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0049.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0050.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0051.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0052.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0053.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0054.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0055.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0056.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0057.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0058.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0059.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0060.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0061.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0062.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0063.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0064.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0065.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0066.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0067.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0068.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0069.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0070.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0071.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0072.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0073.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0074.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0075.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0076.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0077.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0078.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0079.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0080.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0081.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0082.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0083.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0084.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0085.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0086.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0087.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0088.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0089.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0090.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0091.h5
Binary file not shown.
Binary file modified test_data/IPTS32124_CG4C_exp0424/scan0092.h5
Binary file not shown.
Binary file modified test_data/IPTS9865_HB1_exp0815/scan0001.h5
Binary file not shown.
Binary file modified test_data/IPTS9865_HB1_exp0815/scan0002.h5
Binary file not shown.
Binary file modified test_data/IPTS9865_HB1_exp0815/scan0003.h5
Binary file not shown.
Binary file modified test_data/IPTS9865_HB1_exp0815/scan0004.h5
Binary file not shown.
Binary file modified test_data/IPTS9865_HB1_exp0815/scan0005.h5
Binary file not shown.
Binary file modified test_data/IPTS9865_HB1_exp0815/scan0006.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/UBConf.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0001.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0002.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0003.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0004.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0005.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0006.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0007.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0008.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0009.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0010.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0011.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0012.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0013.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0014.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0015.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0016.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0017.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0018.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0019.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0020.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0021.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0022.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0023.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0024.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0025.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0026.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0027.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0028.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0029.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0030.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0031.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0032.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0033.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0034.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0035.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0036.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0037.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0038.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0039.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0040.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0041.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0042.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0043.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0044.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0045.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0046.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0047.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0048.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0049.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0050.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0051.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0052.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0053.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0054.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0055.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0056.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0057.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0058.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0059.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0060.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0061.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0062.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0063.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0064.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0065.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0066.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0067.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0068.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0069.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0070.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0071.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0072.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0073.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0074.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0075.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0076.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0077.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0078.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0079.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0080.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0081.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0082.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0083.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0084.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0085.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0086.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0087.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0088.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0089.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0090.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0091.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0092.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0093.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0094.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0095.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0096.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0097.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0098.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0099.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0100.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0101.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0102.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0103.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0104.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0105.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0106.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0107.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0108.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0109.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0110.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0111.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0112.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0113.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0114.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0115.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0116.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0117.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0118.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0119.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0120.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0121.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0122.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0123.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0124.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0125.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0126.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0127.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0128.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0129.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0130.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0131.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0132.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0133.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0134.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0135.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0136.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0137.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0138.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0139.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0140.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0141.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0142.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0143.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0144.h5
Binary file not shown.
Binary file removed test_data/nexus_exp1031.h5/scan0145.h5
Binary file not shown.
Binary file modified test_data/scan_to_nexus_test.h5
Binary file not shown.
Binary file modified test_data/tavi_test_exp424.h5
Binary file not shown.
138 changes: 66 additions & 72 deletions tests/test_nxentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,33 @@
from tavi.data.nxentry import NexusEntry


def test_get_dataset(nexus_entry):
assert nexus_entry.get("definition") == "NXtas"
assert np.allclose(nexus_entry.get("a2"), np.array([242.0, 242.1, 242.2]))
assert nexus_entry.get("data", ATTRS=True) == {
def test_get_dataset(nexus_entries):
scan0034 = nexus_entries["scan0034"]
assert scan0034.get("definition") == "NXtas"
assert scan0034.get("title") == "scan_title_34"
assert np.allclose(scan0034.get("a2"), np.array([242.0, 242.1, 242.2]))
assert scan0034.get("data", ATTRS=True) == {
"EX_required": "true",
"NX_class": "NXdata",
"axes": "en",
"signal": "detector",
}
assert nexus_entry.get("a3") is None
assert nexus_entry.get("detector") is None
assert nexus_entry.get("detector/data", ATTRS=True) == {"EX_required": "true", "type": "NX_INT", "units": "counts"}
assert np.allclose(nexus_entry.get("instrument/analyser/a2"), np.array([242.0, 242.1, 242.2]))
assert scan0034.get("a3") is None
assert scan0034.get("detector") is None
assert scan0034.get("detector/data", ATTRS=True) == {"EX_required": "true", "type": "NX_INT", "units": "counts"}
assert np.allclose(scan0034.get("instrument/analyser/a2"), np.array([242.0, 242.1, 242.2]))

scan0035 = nexus_entries["scan0035"]
assert scan0035.get("title") == "scan_title_35"


def test_to_nexus(nexus_entry):
def test_to_nexus(nexus_entries):
path_to_nexus_entry = "./test_data/scan_to_nexus_test.h5"
nexus_entry.to_nexus(path_to_nexus_entry)
for scan_num, nexus_entry in nexus_entries.items():
nexus_entry.to_nexus(path_to_nexus_entry, scan_num)

with h5py.File(path_to_nexus_entry, "r") as nexus_file:
assert str(nexus_file["scan0034"]["title"].asstr()[...]) == "scan_title"
assert str(nexus_file["scan0034"]["title"].asstr()[...]) == "scan_title_34"
assert nexus_file["scan0034"].attrs["NX_class"] == "NXentry"


Expand Down Expand Up @@ -56,42 +62,25 @@ def test_from_nexus_IPTS32124_CG4C_exp0424():


@pytest.fixture
def nexus_entry():
def nexus_entries():

analyser = {
"attrs": {
"EX_required": "true",
"NX_class": "NXcrystal",
"type": "NX_CHAR",
},
"attrs": {"EX_required": "true", "NX_class": "NXcrystal", "type": "NX_CHAR"},
"a1": {
"attrs": {
"EX_required": "true",
"units": "degrees",
},
"attrs": {"EX_required": "true", "units": "degrees"},
"dataset": np.array([142.0, 142.1, 142.2]),
},
"a2": {
"attrs": {
"EX_required": "true",
"units": "degrees",
},
"attrs": {"EX_required": "true", "units": "degrees"},
"dataset": np.array([242.0, 242.1, 242.2]),
},
"sense": {"dataset": "-"},
"type": {"dataset": "Pg002"},
}
detector = {
"attrs": {
"EX_required": "true",
"NX_class": "NXdetector",
},
"attrs": {"EX_required": "true", "NX_class": "NXdetector"},
"data": {
"attrs": {
"EX_required": "true",
"type": "NX_INT",
"units": "counts",
},
"attrs": {"EX_required": "true", "type": "NX_INT", "units": "counts"},
},
}

Expand All @@ -101,10 +90,7 @@ def nexus_entry():
}
monitor = {
"data": {
"attrs": {
"EX_required": "true",
"type": "NX_FLOAT",
},
"attrs": {"EX_required": "true", "type": "NX_FLOAT"},
"dataset": np.array([60, 60, 60]),
},
"attrs": {
Expand All @@ -113,37 +99,45 @@ def nexus_entry():
},
}

nexus_entry = NexusEntry(
[
(
"scan0034",
{
"attrs": {
"EX_required": "true",
"NX_class": "NXentry",
"dataset_name": "IPTS32124_CG4C_exp0424",
},
"definition": {
"attrs": {"EX_required": "true", "type": "NX_CHAR"},
"dataset": "NXtas",
},
"title": {
"attrs": {"EX_required": "true", "type": "NX_CHAR"},
"dataset": "scan_title",
},
"data": {
"attrs": {
"EX_required": "true",
"NX_class": "NXdata",
"axes": "en",
"signal": "detector",
}
},
"instrument": instrument,
"monitor": monitor,
},
)
]
)

return nexus_entry
entries = {
# "scan0034": {
# "attrs": {
# "EX_required": "true",
# "NX_class": "NXentry",
# "dataset_name": "IPTS32124_CG4C_exp0424",
# },
# "definition": {
# "attrs": {"EX_required": "true", "type": "NX_CHAR"},
# "dataset": "NXtas",
# },
# "title": {
# "attrs": {"EX_required": "true", "type": "NX_CHAR"},
# "dataset": "scan_title_34",
# },
# "data": {
# "attrs": {
# "EX_required": "true",
# "NX_class": "NXdata",
# "axes": "en",
# "signal": "detector",
# }
# },
# "instrument": instrument,
# "monitor": monitor,
# },
"scan0035": {
"title": {
"attrs": {"EX_required": "true", "type": "NX_CHAR"},
"dataset": "scan_title_35",
},
},
}

nexus_entres = {}
for scan_num, scan_content in entries.items():
content_list = []
for key, val in scan_content.items():
content_list.append((key, val))
nexus_entres.update({scan_num: NexusEntry(content_list)})

return nexus_entres

0 comments on commit 70b6551

Please sign in to comment.