Skip to content

Commit

Permalink
Improve dark layout of figures + minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
scholand committed Jul 23, 2024
1 parent 0fad70e commit 7d9df3d
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 42 deletions.
3 changes: 2 additions & 1 deletion 04_incoherence/create_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,5 @@ def gen_fib(n, ind):


fig.savefig(sysargs[3] + ".png", bbox_inches='tight', transparent=False)
fig.savefig(sysargs[3] + ".svg", bbox_inches='tight', transparent=False)
fig.savefig(sysargs[3] + ".svg", bbox_inches='tight', transparent=False)
fig.savefig(sysargs[3] + ".pdf", bbox_inches='tight', transparent=False)
1 change: 1 addition & 0 deletions 04_incoherence/create_figure2.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,4 @@

fig.savefig(filename + ".png", bbox_inches='tight', transparent=False)
fig.savefig(filename + ".svg", bbox_inches='tight', transparent=False)
fig.savefig(filename + ".pdf", bbox_inches='tight', transparent=False)
3 changes: 2 additions & 1 deletion 04_incoherence/create_figure3.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,5 @@ def gen_fib(n, ind):


fig.savefig(sysargs[3] + ".png", bbox_inches='tight', transparent=False)
fig.savefig(sysargs[3] + ".svg", bbox_inches='tight', transparent=False)
fig.savefig(sysargs[3] + ".svg", bbox_inches='tight', transparent=False)
fig.savefig(sysargs[3] + ".pdf", bbox_inches='tight', transparent=False)
61 changes: 34 additions & 27 deletions 05a_speedup_num_error/create_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@

FS = 15

BCOLOR='white' # Background color
TCOLOR='black' # Text color


COLOR1="red"
COLOR2="green"

if __name__ == "__main__":
#Error if wrong number of parameters
Expand Down Expand Up @@ -60,6 +63,10 @@

if(DARK):
plt.style.use(['dark_background'])
BCOLOR='black'
TCOLOR='white'
COLOR1="yellow"
COLOR2="cyan"
else:
plt.style.use(['default'])

Expand Down Expand Up @@ -137,38 +144,38 @@
x = np.arange(len(labels)) # the label locations
width = 0.35 # the width of the bars

rects1 =ax[ii].bar(x[0] - width/2, np.mean(time[0,:]), width, color="red", alpha=0.4)
ax[ii].errorbar(x[0] - width/2, np.mean(time[0,:]), yerr=np.std(time[0,:]), color="k", fmt='.', label='Std of '+str(int(np.shape(time)[1]))+' Runs')
rects1 =ax[ii].bar(x[0] - width/2, np.mean(time[0,:]), width, color=COLOR1, alpha=0.4)
ax[ii].errorbar(x[0] - width/2, np.mean(time[0,:]), yerr=np.std(time[0,:]), color=TCOLOR, fmt='.', label='Std of '+str(int(np.shape(time)[1]))+' Runs')

rects2 =ax[ii].bar(x[0] + width/2, np.mean(time[1,:]), width, color="red")
ax[ii].errorbar(x[0] + width/2, np.mean(time[1,:]), yerr=np.std(time[1,:]), color="k", fmt='.')
rects2 =ax[ii].bar(x[0] + width/2, np.mean(time[1,:]), width, color=COLOR1)
ax[ii].errorbar(x[0] + width/2, np.mean(time[1,:]), yerr=np.std(time[1,:]), color=TCOLOR, fmt='.')

rects1 =ax[ii].bar(x[1] - width/2, np.mean(time_GPU[0,:]), width, color="red", alpha=0.4,)
ax[ii].errorbar(x[1] - width/2, np.mean(time_GPU[0,:]), yerr=np.std(time_GPU[0,:]), color="k", fmt='.')
rects1 =ax[ii].bar(x[1] - width/2, np.mean(time_GPU[0,:]), width, color=COLOR1, alpha=0.4,)
ax[ii].errorbar(x[1] - width/2, np.mean(time_GPU[0,:]), yerr=np.std(time_GPU[0,:]), color=TCOLOR, fmt='.')

rects2 =ax[ii].bar(x[1] + width/2, np.mean(time_GPU[1,:]), width, color="red")
ax[ii].errorbar(x[1] + width/2, np.mean(time_GPU[1,:]), yerr=np.std(time_GPU[1,:]), color="k", fmt='.')
rects2 =ax[ii].bar(x[1] + width/2, np.mean(time_GPU[1,:]), width, color=COLOR1)
ax[ii].errorbar(x[1] + width/2, np.mean(time_GPU[1,:]), yerr=np.std(time_GPU[1,:]), color=TCOLOR, fmt='.')

ax2 =ax[ii].twinx()

rects3 = ax2.bar(x[2] - width/2, np.mean(hwm[0,:]), width, color="green", alpha=0.4)
ax2.errorbar(x[2] - width/2, np.mean(hwm[0,:]), yerr=np.std(hwm[0,:]), color="k", fmt='.')
rects3 = ax2.bar(x[2] - width/2, np.mean(hwm[0,:]), width, color=COLOR2, alpha=0.4)
ax2.errorbar(x[2] - width/2, np.mean(hwm[0,:]), yerr=np.std(hwm[0,:]), color=TCOLOR, fmt='.')

rects4 = ax2.bar(x[2] + width/2, np.mean(hwm[1,:]), width, color="green", label='RAGA')
ax2.errorbar(x[2] + width/2, np.mean(hwm[1,:]), yerr=np.std(hwm[1,:]), color="k", fmt='.')
rects4 = ax2.bar(x[2] + width/2, np.mean(hwm[1,:]), width, color=COLOR2, label='RAGA')
ax2.errorbar(x[2] + width/2, np.mean(hwm[1,:]), yerr=np.std(hwm[1,:]), color=TCOLOR, fmt='.')

rects3 = ax2.bar(x[3] - width/2, gpu_mem_ga_mean, width, color="green", alpha=0.4)
ax2.errorbar(x[3] - width/2, gpu_mem_ga_mean, yerr=gpu_mem_ga_std, color="k", fmt='.')
rects3 = ax2.bar(x[3] - width/2, gpu_mem_ga_mean, width, color=COLOR2, alpha=0.4)
ax2.errorbar(x[3] - width/2, gpu_mem_ga_mean, yerr=gpu_mem_ga_std, color=TCOLOR, fmt='.')

rects4 = ax2.bar(x[3] + width/2, gpu_mem_raga_mean, width, color="green", label='RAGA')
ax2.errorbar(x[3] + width/2, gpu_mem_raga_mean, yerr=gpu_mem_raga_std, color="k", fmt='.')
rects4 = ax2.bar(x[3] + width/2, gpu_mem_raga_mean, width, color=COLOR2, label='RAGA')
ax2.errorbar(x[3] + width/2, gpu_mem_raga_mean, yerr=gpu_mem_raga_std, color=TCOLOR, fmt='.')

# x-ticks

ax[ii].set_xticks(x)
ax[ii].set_xticklabels(labels, fontsize = FS)

for l,i in zip(ax[ii].xaxis.get_ticklabels(),["red", "red", "green", "green"]):
for l,i in zip(ax[ii].xaxis.get_ticklabels(),[COLOR1, COLOR1, COLOR2, COLOR2]):
l.set_color(i)

# Rectangles
Expand All @@ -188,12 +195,12 @@
rect.get_x() + rect.get_width() / 2, 1.005*height, method, ha="center", va="bottom", fontsize = FS-3
)

ax[ii].set_title('nuFFT Reconstruction', color='k', fontsize=FS)
ax[ii].set_title('nuFFT Reconstruction', color=TCOLOR, fontsize=FS)

if (1 == ii):
ax[ii].text((x[1] - x[0]) / 2, -71, "Reconstruction\nTime / s", ha="center", va="center", fontsize = FS, color="red")
ax[ii].text((x[1] - x[0]) / 2, -71, "Reconstruction\nTime / s", ha="center", va="center", fontsize = FS, color=COLOR1)

ax[ii].text((x[3] + x[2]) / 2, -71, "Maximum\nMemory / Gbytes", ha="center", va="center", fontsize = FS, color="green")
ax[ii].text((x[3] + x[2]) / 2, -71, "Maximum\nMemory / Gbytes", ha="center", va="center", fontsize = FS, color=COLOR2)

ax[ii].legend(fancybox=True, framealpha=0.5, loc='upper left', fontsize = FS-2)

Expand All @@ -202,17 +209,17 @@
print(time)

ax[ii].set_ylim([0, 200]) #1.2*max(time)])
ax[ii].tick_params(axis='y', colors="red", labelsize=FS)
ax[ii].yaxis.label.set_color("red")
ax[ii].tick_params(axis='y', colors=COLOR1, labelsize=FS)
ax[ii].yaxis.label.set_color(COLOR1)

# ax[ii].text(0.9, 0.9*1.2*max([hwm[0], hwm[1], gpu_mem_ga_mean, gpu_mem_raga_mean]), reco_tech[ii], fontsize = FS, ha="right", va="top", bbox=dict(boxstyle="round,pad=0.1", facecolor='white', alpha=0.95))

ax[ii].set_ylabel(titles[ii], color='k', fontsize=FS)
ax[ii].set_ylabel(titles[ii], color=TCOLOR, fontsize=FS)

ax2.set_ylim([0, 13]) #1.2*max([hwm[0], hwm[1], gpu_mem_ga_mean, gpu_mem_raga_mean])])
ax2.tick_params(axis='y', colors="green", labelsize=FS)
ax2.spines["right"].set_edgecolor("green")
ax2.yaxis.label.set_color("green")
ax2.tick_params(axis='y', colors=COLOR2, labelsize=FS)
ax2.spines["right"].set_edgecolor(COLOR2)
ax2.yaxis.label.set_color(COLOR2)

plt.tight_layout()

Expand Down
1 change: 1 addition & 0 deletions 05a_speedup_num_error/run_figs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -eux

./run.sh

export DARK_LAYOUT=0

[[ -f methods.txt ]] && rm methods.txt
touch methods.txt
Expand Down
13 changes: 8 additions & 5 deletions 05b_speed_grog/create_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
FS = 20
MS = 10


BCOLOR='white' # Background color
TCOLOR='black' # Text color

if __name__ == "__main__":
#Error if wrong number of parameters
Expand All @@ -52,6 +53,8 @@

if(DARK):
plt.style.use(['dark_background'])
BCOLOR='black'
TCOLOR='white'
else:
plt.style.use(['default'])

Expand Down Expand Up @@ -79,19 +82,19 @@
width = 0.35 # the width of the bars

rects1 =ax.bar(x[0] - width/2, np.mean(tcal[0,:]), width, color="orange", alpha=0.4)
ax.errorbar(x[0] - width/2, np.mean(tcal[0,:]), yerr=np.std(tcal[0,:]), color="k", fmt='.', markersize=MS, label='Std of '+str(int(np.shape(tcal)[1]))+' Runs')
ax.errorbar(x[0] - width/2, np.mean(tcal[0,:]), yerr=np.std(tcal[0,:]), color=TCOLOR, fmt='.', markersize=MS, label='Std of '+str(int(np.shape(tcal)[1]))+' Runs')

rects2 =ax.bar(x[0] + width/2, np.mean(tcal[1,:]), width, color="orange")
ax.errorbar(x[0] + width/2, np.mean(tcal[1,:]), yerr=np.std(tcal[1,:]), color="k", fmt='.', markersize=MS)
ax.errorbar(x[0] + width/2, np.mean(tcal[1,:]), yerr=np.std(tcal[1,:]), color=TCOLOR, fmt='.', markersize=MS)

ax2 =ax.twinx()
ax3 =ax.twinx()

rects1 =ax2.bar(x[1] - width/2, np.mean(tgrid[0,:]), width, color="steelblue")
ax2.errorbar(x[1] - width/2, np.mean(tgrid[0,:]), yerr=np.std(tgrid[0,:]), color="k", fmt='.', markersize=MS)
ax2.errorbar(x[1] - width/2, np.mean(tgrid[0,:]), yerr=np.std(tgrid[0,:]), color=TCOLOR, fmt='.', markersize=MS)

rects2 =ax3.bar(x[1] + width/2, np.mean(tgrid[1,:]), width, color="blue")
ax3.errorbar(x[1] + width/2, np.mean(tgrid[1,:]), yerr=np.std(tgrid[1,:]), color="k", fmt='.', markersize=MS)
ax3.errorbar(x[1] + width/2, np.mean(tgrid[1,:]), yerr=np.std(tgrid[1,:]), color=TCOLOR, fmt='.', markersize=MS)

# x-ticks

Expand Down
2 changes: 2 additions & 0 deletions 05b_speed_grog/run_figs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -eux

./run.sh

export DARK_LAYOUT=0

# Visualization
python3 create_figure.py grog figure

Expand Down
6 changes: 3 additions & 3 deletions 06_phantom/create_figure_A.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@

ax[1,i].set_visible(False)

ax[0,i].text(0.99*dim[0], 0.99*dim[1], "Ref", horizontalalignment='right', verticalalignment='bottom', color=BCOLOR, rotation="horizontal", fontsize=FS-5, fontweight="bold")
ax[0,i].text(0.99*dim[0], 0.99*dim[1], "Ref", horizontalalignment='right', verticalalignment='bottom', color=TCOLOR, rotation="horizontal", fontsize=FS-5, fontweight="bold")

else:

Expand All @@ -115,7 +115,7 @@

im2 = ax[1,i].imshow(joined, cmap="gray", vmin=VMIN, vmax=VMAX)

ax[1,i].text(0.99*dim[0], 0.99*dim[1], "x"+str(int(DIFF_SCALE)), horizontalalignment='right', verticalalignment='bottom', color=BCOLOR, rotation="horizontal", fontsize=FS-5, fontweight="bold")
ax[1,i].text(0.99*dim[0], 0.99*dim[1], "x"+str(int(DIFF_SCALE)), horizontalalignment='right', verticalalignment='bottom', color=TCOLOR, rotation="horizontal", fontsize=FS-5, fontweight="bold")


ax[1,i].set_yticklabels([])
Expand All @@ -130,7 +130,7 @@

ax[1,i].set_ylabel(r"abs(Ref-Img)", fontsize=FS-10)

ax[0,i].text(0.99*dim[0], 0.99*dim[1], "Img", horizontalalignment='right', verticalalignment='bottom', color=BCOLOR, rotation="horizontal", fontsize=FS-5, fontweight="bold")
ax[0,i].text(0.99*dim[0], 0.99*dim[1], "Img", horizontalalignment='right', verticalalignment='bottom', color=TCOLOR, rotation="horizontal", fontsize=FS-5, fontweight="bold")

# Title
ax[0,0].text(0.99*dim[0] + dim[2]//2 * dim[0], -0.3*dim[1], "Spokes/Frame", horizontalalignment='center', verticalalignment='bottom', color=TCOLOR, rotation="horizontal", fontsize=FS+5, fontweight="bold")
Expand Down
4 changes: 2 additions & 2 deletions 06_phantom/create_figure_C.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@

im2 = ax[2,i].imshow(joined, cmap="gray", vmin=VMIN, vmax=VMAX)

ax[2,i].text(0.99*dim[0], 0.99*dim[1], "x"+str(int(DIFF_SCALING)), horizontalalignment='right', verticalalignment='bottom', color=BCOLOR, rotation="horizontal", fontsize=FS-5, fontweight="bold")
ax[2,i].text(0.99*dim[0], 0.99*dim[1], "x"+str(int(DIFF_SCALING)), horizontalalignment='right', verticalalignment='bottom', color=TCOLOR, rotation="horizontal", fontsize=FS-5, fontweight="bold")


ax[2,i].set_yticklabels([])
Expand All @@ -145,7 +145,7 @@
cbar = fig.colorbar(sm, cax=cbar_ax)
cbar.ax.tick_params(labelsize=FS)

ax[0,0].text(-0.2* dim[0], -0.2*dim[1], "C", fontsize=FS+10, horizontalalignment='center', verticalalignment='center', rotation='horizontal', weight='bold')
ax[0,0].text(-0.2* dim[0], -0.2*dim[1], "C", fontsize=FS+10, horizontalalignment='center', verticalalignment='center', rotation='horizontal', weight='bold', color=TCOLOR)

plt.subplots_adjust(wspace=0.02, hspace=0.05)

Expand Down
5 changes: 3 additions & 2 deletions 06_phantom/run_figs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ set -eux



# ./run.sh
./run.sh


# Visualization

export DARK_LAYOUT=0

## A: Resolution Subfigure
python3 create_figure_A.py spokes.txt joined_recos diff_recos figure_A


## B: Binning Presentation

#### Recos
Expand Down
3 changes: 2 additions & 1 deletion 07_motion/create_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
BCOLOR='white' # Background color
TCOLOR='black' # Text color

COLOR=['C0', 'C1', 'C2', 'C3', 'C4', 'C5']
COLOR=['C0', 'C1', 'C2']

TR = 2.9 # ms

Expand Down Expand Up @@ -110,6 +110,7 @@ def lin_interpol(values, data):
plt.style.use(['dark_background'])
BCOLOR='black'
TCOLOR='white'
COLOR=['C0', 'orange', 'cyan']
else:
plt.style.use(['default'])

Expand Down

0 comments on commit 7d9df3d

Please sign in to comment.