Skip to content

Commit

Permalink
added script for HB1A resolution analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
Bing Li committed Dec 6, 2024
1 parent 3a0e757 commit 1b0febe
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
56 changes: 56 additions & 0 deletions scripts/rez_HB1A.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import matplotlib.pyplot as plt

from tavi.data.tavi import TAVI
from tavi.plotter import Plot2D

tavi = TAVI()

path_to_spice_folder = "./test_data/exp978/"
tavi.load_spice_data_from_disk(path_to_spice_folder)

# -------------- Si (111) 40'-40'-40'-80' -----------------

scans = list(range(824, 848 + 1))

sg1 = tavi.combine_scans(scans, name="Si (111) 40'-40'-40'-80'")
si_111_1 = sg1.get_data(
axes=("qh", "ql", "detector"),
norm_to=(1, "mcu"),
grid=((0.97, 1.03, 0.0025), (0.97, 1.03, 0.0025)),
)


p1 = Plot2D()
p1.add_contour(si_111_1, cmap="turbo", vmin=0, vmax=1.2e4)
p1.title = sg1.name
p1.ylim = [0.97, 1.03]
p1.xlim = [0.97, 1.03]

fig, ax = plt.subplots()
im1 = p1.plot(ax)
fig.colorbar(im1)


# -------------- Si (111) 40'-20'-20'-20' ------------

scans = list(range(792, 816 + 1))

sg2 = tavi.combine_scans(scans, name="Si (111) 40'-20'-20'-20'")
si_111_2 = sg2.get_data(
axes=("qh", "ql", "detector"),
norm_to=(1, "mcu"),
grid=((0.97, 1.03, 0.0025), (0.97, 1.03, 0.0025)),
)


p2 = Plot2D()
p2.add_contour(si_111_2, cmap="turbo", vmin=0, vmax=1300)
p2.title = sg2.name
# p2.ylim = [0.97, 1.03]
# p2.xlim = [0.97, 1.03]

fig, ax = plt.subplots()
im2 = p2.plot(ax)
fig.colorbar(im2)

plt.show()
1 change: 1 addition & 0 deletions src/tavi/data/nxentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ def _get_name(val_dict):
dataset_names.append(key)

dataset_names = []
# num_pts = len(pts) if (pts := self.get("Pt.")) is not None else 0
num_pts = len(self.get("Pt."))
instru = self["instrument"]

Expand Down

0 comments on commit 1b0febe

Please sign in to comment.