Skip to content

Commit

Permalink
Add detector orientation to figures
Browse files Browse the repository at this point in the history
  • Loading branch information
bwohlberg committed Jul 31, 2024
1 parent daac600 commit 0286083
Showing 1 changed file with 93 additions and 3 deletions.
96 changes: 93 additions & 3 deletions docs/source/pyfigures/xray_2d_geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
e = 1e-2
style = "Simple, tail_width=0.5, head_width=4, head_length=8"
fig, ax = plt.subplots(nrows=1, ncols=3, figsize=(21, 7))

# all plots
for n in range(3):
ax[n].set_aspect(1.0)
ax[n].set_xlim(-1.1, 1.1)
Expand All @@ -22,7 +24,9 @@
ax[n].set_xlabel("axis 1", fontsize=16)
ax[n].set_ylabel("axis 0", fontsize=16)


# scico
ax[0].set_title("scico", fontsize=18)
plist = [
patches.FancyArrowPatch((-1.0, 0.0), (-0.5, 0.0), arrowstyle=style, color="r"),
patches.FancyArrowPatch((-c, -c), (-c / 2.0, -c / 2.0), arrowstyle=style, color="r"),
Expand All @@ -40,12 +44,41 @@
]
for p in plist:
ax[0].add_patch(p)

ax[0].text(-0.88, 0.02, r"$\theta=0$", color="r", fontsize=16)
ax[0].text(-3 * c / 4 - 0.01, -3 * c / 4 - 0.1, r"$\theta=\frac{\pi}{4}$", color="r", fontsize=16)
ax[0].text(0.03, -0.8, r"$\theta=\frac{\pi}{2}$", color="r", fontsize=16)
ax[0].set_title("scico", fontsize=18)

ax[0].plot((1.0, 1.0), (-0.375, 0.375), color="orange", lw=2)
ax[0].arrow(
0.94,
0.375,
0.0,
-0.75,
color="orange",
lw=1.0,
ls="--",
head_width=0.03,
length_includes_head=True,
)
ax[0].text(0.7, 0.0, r"$\theta=0$", color="orange", ha="left", fontsize=16)
ax[0].plot((-0.375, 0.375), (1.0, 1.0), color="orange", lw=2)
ax[0].arrow(
-0.375,
0.94,
0.75,
0.0,
color="orange",
lw=1.0,
ls="--",
head_width=0.03,
length_includes_head=True,
)
ax[0].text(0.0, 0.82, r"$\theta=\frac{\pi}{2}$", color="orange", ha="center", fontsize=16)


# astra
ax[1].set_title("astra", fontsize=18)
plist = [
patches.FancyArrowPatch((0.0, -1.0), (0.0, -0.5), arrowstyle=style, color="r"),
patches.FancyArrowPatch((c, -c), (c / 2.0, -c / 2.0), arrowstyle=style, color="r"),
Expand All @@ -55,12 +88,41 @@
]
for p in plist:
ax[1].add_patch(p)

ax[1].text(0.02, -0.75, r"$\theta=0$", color="r", fontsize=16)
ax[1].text(3 * c / 4 + 0.01, -3 * c / 4 + 0.01, r"$\theta=\frac{\pi}{4}$", color="r", fontsize=16)
ax[1].text(0.65, 0.05, r"$\theta=\frac{\pi}{2}$", color="r", fontsize=16)
ax[1].set_title("astra", fontsize=18)

ax[1].plot((-0.375, 0.375), (1.0, 1.0), color="orange", lw=2)
ax[1].arrow(
-0.375,
0.94,
0.75,
0.0,
color="orange",
lw=1.0,
ls="--",
head_width=0.03,
length_includes_head=True,
)
ax[1].text(0.0, 0.82, r"$\theta=0$", color="orange", ha="center", fontsize=16)
ax[1].plot((-1.0, -1.0), (-0.375, 0.375), color="orange", lw=2)
ax[1].arrow(
-0.94,
-0.375,
0.0,
0.75,
color="orange",
lw=1.0,
ls="--",
head_width=0.03,
length_includes_head=True,
)
ax[1].text(-0.9, 0.0, r"$\theta=\frac{\pi}{2}$", color="orange", ha="left", fontsize=16)


# svmbir
ax[2].set_title("svmbir", fontsize=18)
plist = [
patches.FancyArrowPatch((-1.0, 0.0), (-0.5, 0.0), arrowstyle=style, color="r"),
patches.FancyArrowPatch((-c, c), (-c / 2.0, c / 2.0), arrowstyle=style, color="r"),
Expand All @@ -81,7 +143,35 @@
ax[2].text(-0.88, 0.02, r"$\theta=0$", color="r", fontsize=16)
ax[2].text(-3 * c / 4 + 0.01, 3 * c / 4 + 0.01, r"$\theta=\frac{\pi}{4}$", color="r", fontsize=16)
ax[2].text(0.03, 0.75, r"$\theta=\frac{\pi}{2}$", color="r", fontsize=16)
ax[2].set_title("svmbir", fontsize=18)

ax[2].plot((1.0, 1.0), (-0.375, 0.375), color="orange", lw=2)
ax[2].arrow(
0.94,
0.375,
0.0,
-0.75,
color="orange",
lw=1.0,
ls="--",
head_width=0.03,
length_includes_head=True,
)
ax[2].text(0.7, 0.0, r"$\theta=0$", color="orange", ha="left", fontsize=16)

ax[2].plot((-0.375, 0.375), (-1.0, -1.0), color="orange", lw=2)
ax[2].arrow(
0.375,
-0.94,
-0.75,
0.0,
color="orange",
lw=1.0,
ls="--",
head_width=0.03,
length_includes_head=True,
)
ax[2].text(0.0, -0.82, r"$\theta=\frac{\pi}{2}$", color="orange", ha="center", fontsize=16)


fig.tight_layout()
fig.show()

0 comments on commit 0286083

Please sign in to comment.