Skip to content

Commit

Permalink
Merge pull request #563 from OpenCOMPES/fig-width
Browse files Browse the repository at this point in the history
Update widths of figures
  • Loading branch information
zain-sohail authored Mar 5, 2025
2 parents 541d4c8 + 8b76c82 commit f1bb527
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 45 deletions.
1 change: 1 addition & 0 deletions .cspell/custom-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ coldist
colgrid
COLLECTIONCOLUMN
colname
colorbar
colsize
COMPES
coordmat
Expand Down
14 changes: 7 additions & 7 deletions tutorial/10_hextof_workflow_trXPS_bam_correction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
"metadata": {},
"outputs": [],
"source": [
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
"fig,ax = plt.subplots(1,2,figsize=(6,2.25), layout='constrained')\n",
"res.plot(robust=True, ax=ax[0], cmap='terrain')\n",
"fig.suptitle(f\"Run {run_number}: W 4f, side bands\")\n",
"ax[0].set_title('raw')\n",
Expand Down Expand Up @@ -338,7 +338,7 @@
"outputs": [],
"source": [
"\n",
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
"fig,ax = plt.subplots(1,2,figsize=(6,2.25), layout='constrained')\n",
"res_bam.sel(bam=slice(-6400,-5100)).sum('trainId').plot(ax=ax[0],robust=True, cmap='terrain')\n",
"res_bam.sel(bam=slice(-6400,-5100)).sum('pulseId').plot(ax=ax[1],robust=True, cmap='terrain')\n",
"plt.show()"
Expand Down Expand Up @@ -404,7 +404,7 @@
"metadata": {},
"outputs": [],
"source": [
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
"fig,ax = plt.subplots(1,2,figsize=(6,2.25), layout='constrained')\n",
"fig.suptitle(f\"Run {run_number}: W 4f, side bands\")\n",
"res_corr.plot(robust=True, ax=ax[0], cmap='terrain')\n",
"ax[0].set_title('raw')\n",
Expand Down Expand Up @@ -497,7 +497,7 @@
"metadata": {},
"outputs": [],
"source": [
"fig,ax=plt.subplots(2,2,figsize=(9,7),layout=\"constrained\")\n",
"fig,ax=plt.subplots(2,2,figsize=(6,6),layout=\"constrained\")\n",
"\n",
"plt.axes(ax[0,0])\n",
"res.plot(cmap='terrain', robust=True)\n",
Expand All @@ -523,7 +523,7 @@
"plt.legend(loc=1)\n",
"plt.title(\"Sidebands with bam correction\")\n",
"\n",
"fig.suptitle(f'Run {run_number}: Effect of BAM correction',fontsize='22')"
"fig.suptitle(f'Run {run_number}: Effect of BAM correction',fontsize='14')"
]
},
{
Expand All @@ -545,7 +545,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "sed-processor-7Jy-bAA8-py3.9",
"display_name": ".venv",
"language": "python",
"name": "python3"
},
Expand All @@ -559,7 +559,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.19"
"version": "3.12.8"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
"bins = [100,60]\n",
"res_corr = sp_44498.compute(bins=bins, axes=axes, ranges=ranges, normalize_to_acquisition_time=\"delayStage\")\n",
"\n",
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
"fig,ax = plt.subplots(1,2,figsize=(6,2.25), layout='constrained')\n",
"fig.suptitle(f\"Run {run_number}: W 4f, side bands\")\n",
"res_corr.plot(ax=ax[0], cmap='terrain')\n",
"ax[0].set_title('raw')\n",
Expand Down Expand Up @@ -443,7 +443,7 @@
"bins = [200,60]\n",
"res_corr = sp_44498.compute(bins=bins, axes=axes, ranges=ranges, normalize_to_acquisition_time=\"delayStage\")\n",
"\n",
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
"fig,ax = plt.subplots(1,2,figsize=(6,2.25), layout='constrained')\n",
"fig.suptitle(f\"Run {run_number}: W 4f, side bands\")\n",
"res_corr.plot(ax=ax[0], cmap='terrain')\n",
"ax[0].set_title('raw')\n",
Expand Down
11 changes: 4 additions & 7 deletions tutorial/1_binning_fake_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"metadata": {},
"outputs": [],
"source": [
"fig, axs = plt.subplots(1, 3, figsize=(8, 2.5), constrained_layout=True)\n",
"fig, axs = plt.subplots(1, 3, figsize=(6, 1.875), constrained_layout=True)\n",
"for i in range(3):\n",
" axs[i].imshow(res.sum(i))"
]
Expand Down Expand Up @@ -164,7 +164,7 @@
"metadata": {},
"outputs": [],
"source": [
"fig, axs = plt.subplots(1, 3, figsize=(8, 2.5), constrained_layout=True)\n",
"fig, axs = plt.subplots(1, 3, figsize=(6, 1.875), constrained_layout=True)\n",
"for dim, ax in zip(binAxes, axs):\n",
" res.sum(dim).plot(ax=ax)"
]
Expand All @@ -179,11 +179,8 @@
}
],
"metadata": {
"interpreter": {
"hash": "728003ee06929e5fa5ff815d1b96bf487266025e4b7440930c6bf4536d02d243"
},
"kernelspec": {
"display_name": "python3",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -197,7 +194,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
"version": "3.9.19"
}
},
"nbformat": 4,
Expand Down
20 changes: 10 additions & 10 deletions tutorial/4_hextof_workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,10 @@
"metadata": {},
"outputs": [],
"source": [
"fig,ax = plt.subplots(1,3,figsize=(8,2), layout='tight')\n",
"res_chessy.plot(ax=ax[0], robust=True)\n",
"res_t05.plot(ax=ax[1], robust=True)\n",
"res_t10.plot(ax=ax[2], robust=True)"
"fig,ax = plt.subplots(1,3,figsize=(6,2), layout='tight')\n",
"res_chessy.plot(ax=ax[0], robust=True, add_colorbar=False)\n",
"res_t05.plot(ax=ax[1], robust=True, add_colorbar=False)\n",
"res_t10.plot(ax=ax[2], robust=True, add_colorbar=False)"
]
},
{
Expand Down Expand Up @@ -759,7 +759,7 @@
"metadata": {},
"outputs": [],
"source": [
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
"fig,ax = plt.subplots(1,2,figsize=(6,2.25), layout='constrained')\n",
"res.plot(robust=True, ax=ax[0])\n",
"bg = res.isel(delayStage=slice(0,10)).mean('delayStage')\n",
"(res-bg).plot(robust=True, ax=ax[1])"
Expand Down Expand Up @@ -827,7 +827,7 @@
},
"outputs": [],
"source": [
"fig,ax = plt.subplots(1,2,figsize=(8,3))\n",
"fig,ax = plt.subplots(1,2,figsize=(6,2.25))\n",
"res.plot(robust=True, ax=ax[0])\n",
"bg = res.sel(delayStage=slice(-1,-0.2)).mean('delayStage')\n",
"(res-bg).plot(robust=True, ax=ax[1])\n",
Expand All @@ -848,7 +848,7 @@
"outputs": [],
"source": [
"res = sp.compute(bins=bins, axes=axes, ranges=ranges, normalize_to_acquisition_time=\"delayStage\")\n",
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
"fig,ax = plt.subplots(1,2,figsize=(6,2.25), layout='constrained')\n",
"res.plot(robust=True, ax=ax[0])\n",
"bg = res.sel(delayStage=slice(-1,-.2)).mean('delayStage')\n",
"(res-bg).plot(robust=True, ax=ax[1])"
Expand Down Expand Up @@ -966,7 +966,7 @@
"metadata": {},
"outputs": [],
"source": [
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
"fig,ax = plt.subplots(1,2,figsize=(6,2.25), layout='constrained')\n",
"res.plot(robust=True, ax=ax[0])\n",
"bg = res.sel(delayStage=slice(-1,-.2)).mean('delayStage')\n",
"(res-bg).plot(robust=True, ax=ax[1])"
Expand Down Expand Up @@ -1017,7 +1017,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "python3",
"display_name": ".venv",
"language": "python",
"name": "python3"
},
Expand All @@ -1031,7 +1031,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.19"
"version": "3.12.8"
}
},
"nbformat": 4,
Expand Down
38 changes: 19 additions & 19 deletions tutorial/9_hextof_workflow_trXPD.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
"metadata": {},
"outputs": [],
"source": [
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
"fig,ax = plt.subplots(1,2,figsize=(6,2.25), layout='constrained')\n",
"fig.suptitle(f\"Run {run_number}: W 4f, side bands\")\n",
"res_corr.plot(robust=True, ax=ax[0], cmap='terrain')\n",
"ax[0].set_title('raw')\n",
Expand Down Expand Up @@ -341,7 +341,7 @@
"plt.show()\n",
"\n",
"## XPD plots\n",
"fig,ax = plt.subplots(2,2,figsize=(9,7), layout='constrained')\n",
"fig,ax = plt.subplots(2,2,figsize=(6,4.7), layout='constrained')\n",
"res_kx_ky.sel(energy=slice(-30.3,-29.9)).mean('energy').plot(robust=True, ax=ax[0,0], cmap='terrain')\n",
"ax[0,0].set_title(\"XPD of $1^{st}$ order sidebands\")\n",
"res_kx_ky.sel(energy=slice(-31.4,-31.2)).mean('energy').plot(robust=True, ax=ax[0,1], cmap='terrain')\n",
Expand Down Expand Up @@ -381,7 +381,7 @@
"## Apply Gaussian Blur to background image\n",
"bgd_blur = xr.apply_ufunc(gaussian_filter, bgd, 15)\n",
"\n",
"fig,ax = plt.subplots(1,2,figsize=(9,4), layout='constrained')\n",
"fig,ax = plt.subplots(1,2,figsize=(6,2.7), layout='constrained')\n",
"bgd.plot(robust=True, cmap='terrain', ax=ax[0])\n",
"ax[0].set_title('Background image')\n",
"bgd_blur.plot(cmap='terrain', ax=ax[1])\n",
Expand All @@ -397,28 +397,28 @@
"outputs": [],
"source": [
"## XPD normalized by background image\n",
"fig,ax = plt.subplots(2,2,figsize=(9,7), layout='constrained')\n",
"fig,ax = plt.subplots(2,2,figsize=(6,4.7), layout='constrained')\n",
"(res_kx_ky/bgd).sel(energy=slice(-30.3,-29.9)).mean('energy').plot(robust=True, ax=ax[0,0], cmap='terrain')\n",
"(res_kx_ky/bgd).sel(energy=slice(-31.4,-31.2)).mean('energy').plot(robust=True, ax=ax[0,1], cmap='terrain')\n",
"(res_kx_ky/bgd).sel(energy=slice(-33.6,-33.4)).mean('energy').plot(robust=True, ax=ax[1,0], cmap='terrain')\n",
"(res_kx_ky/bgd).sel(energy=slice(-37.0,-36.0)).mean('energy').plot(robust=True, ax=ax[1,1], cmap='terrain')\n",
"fig.suptitle(f'Run {run_number}: XPD patterns after background normalization',fontsize='18')\n",
"fig.suptitle(f'Run {run_number}: XPD patterns after background normalization',fontsize='11')\n",
"\n",
"## XPD normalized by Gaussian-blurred background image\n",
"fig,ax = plt.subplots(2,2,figsize=(9,7), layout='constrained')\n",
"fig,ax = plt.subplots(2,2,figsize=(6,4.7), layout='constrained')\n",
"(res_kx_ky/bgd_blur).sel(energy=slice(-30.3,-29.9)).mean('energy').plot(robust=True, ax=ax[0,0], cmap='terrain')\n",
"(res_kx_ky/bgd_blur).sel(energy=slice(-31.4,-31.2)).mean('energy').plot(robust=True, ax=ax[0,1], cmap='terrain')\n",
"(res_kx_ky/bgd_blur).sel(energy=slice(-33.6,-33.4)).mean('energy').plot(robust=True, ax=ax[1,0], cmap='terrain')\n",
"(res_kx_ky/bgd_blur).sel(energy=slice(-37.0,-36.0)).mean('energy').plot(robust=True, ax=ax[1,1], cmap='terrain')\n",
"fig.suptitle(f'Run {run_number}: XPD patterns after Gaussian-blurred background normalization',fontsize='18')\n",
"fig.suptitle(f'Run {run_number}: XPD patterns after Gaussian-blurred background normalization',fontsize='11')\n",
"\n",
"## XPD normalized by Gaussian-blurred background image and blurred to improve contrast\n",
"fig,ax = plt.subplots(2,2,figsize=(9,7), layout='constrained')\n",
"fig,ax = plt.subplots(2,2,figsize=(6,4.7), layout='constrained')\n",
"(xr.apply_ufunc(gaussian_filter, res_kx_ky/bgd_blur, 1)).sel(energy=slice(-30.3,-29.9)).mean('energy').plot(robust=True, ax=ax[0,0], cmap='terrain')\n",
"(xr.apply_ufunc(gaussian_filter, res_kx_ky/bgd_blur, 1)).sel(energy=slice(-31.4,-31.2)).mean('energy').plot(robust=True, ax=ax[0,1], cmap='terrain')\n",
"(xr.apply_ufunc(gaussian_filter, res_kx_ky/bgd_blur, 1)).sel(energy=slice(-33.6,-33.4)).mean('energy').plot(robust=True, ax=ax[1,0], cmap='terrain')\n",
"(xr.apply_ufunc(gaussian_filter, res_kx_ky/bgd_blur, 1)).sel(energy=slice(-37.0,-36.0)).mean('energy').plot(robust=True, ax=ax[1,1], cmap='terrain')\n",
"fig.suptitle(f'Run {run_number}: resulting Gaussian-blurred XPD patterns',fontsize='18')"
"fig.suptitle(f'Run {run_number}: resulting Gaussian-blurred XPD patterns',fontsize='11')"
]
},
{
Expand Down Expand Up @@ -451,12 +451,12 @@
"W_5p_blur = xr.apply_ufunc(gaussian_filter, W_5p, 15)\n",
"\n",
"### Visualize results\n",
"fig,ax = plt.subplots(2,2,figsize=(9,7), layout='constrained')\n",
"fig,ax = plt.subplots(2,2,figsize=(6,4.7), layout='constrained')\n",
"(SB/SB_blur).plot(robust=True, ax=ax[0,0], cmap='terrain')\n",
"(W_4f_7/W_4f_7_blur).plot(robust=True, ax=ax[0,1], cmap='terrain')\n",
"(W_4f_5/W_4f_5_blur).plot(robust=True, ax=ax[1,0], cmap='terrain')\n",
"(W_5p/W_5p_blur).plot(robust=True, ax=ax[1,1], cmap='terrain')\n",
"fig.suptitle(f'Run {run_number}: XPD patterns after Gaussian Blur normalization',fontsize='18')\n",
"fig.suptitle(f'Run {run_number}: XPD patterns after Gaussian Blur normalization',fontsize='11')\n",
"\n",
"### Apply Gaussian Blur to resulted images to improve contrast\n",
"SB_norm = xr.apply_ufunc(gaussian_filter, SB/SB_blur, 1)\n",
Expand All @@ -465,12 +465,12 @@
"W_5p_norm = xr.apply_ufunc(gaussian_filter, W_5p/W_5p_blur, 1)\n",
"\n",
"### Visualize results\n",
"fig,ax = plt.subplots(2,2,figsize=(9,7), layout='constrained')\n",
"fig,ax = plt.subplots(2,2,figsize=(6,4.7), layout='constrained')\n",
"SB_norm.plot(robust=True, ax=ax[0,0], cmap='terrain')\n",
"W_4f_7_norm.plot(robust=True, ax=ax[0,1], cmap='terrain')\n",
"W_4f_5_norm.plot(robust=True, ax=ax[1,0], cmap='terrain')\n",
"W_5p_norm.plot(robust=True, ax=ax[1,1], cmap='terrain')\n",
"fig.suptitle(f'Run {run_number}: XPD patterns after Gauss Blur normalization',fontsize='18') "
"fig.suptitle(f'Run {run_number}: XPD patterns after Gauss Blur normalization',fontsize='11') "
]
},
{
Expand Down Expand Up @@ -503,15 +503,15 @@
"W_4f_7_nrm2_blur = xr.apply_ufunc(gaussian_filter, W_4f_7_nrm2, 1)\n",
"\n",
"### Visualize all steps\n",
"fig,ax = plt.subplots(4,2,figsize=(9,10), layout='constrained')\n",
"fig,ax = plt.subplots(4,2,figsize=(6,8), layout='constrained')\n",
"W_4f_7.plot(robust=True, ax=ax[0,0], cmap='terrain')\n",
"W_4f_7_bgd.plot(robust=True, ax=ax[0,1], cmap='terrain')\n",
"W_4f_7_nrm1.plot(robust=True, ax=ax[1,0], cmap='terrain')\n",
"W_4f_7_nrm1_blur.plot(robust=True, ax=ax[1,1], cmap='terrain')\n",
"W_4f_7_bgd_blur.plot(robust=True, ax=ax[2,0], cmap='terrain')\n",
"W_4f_7_nrm2.plot(robust=True, ax=ax[2,1], cmap='terrain')\n",
"W_4f_7_nrm2_blur.plot(robust=True, ax=ax[3,0], cmap='terrain')\n",
"fig.suptitle(f'Run {run_number}: XPD patterns of W4f7/2 with pre-core level normalization',fontsize='18') "
"fig.suptitle(f'Run {run_number}: XPD patterns of W4f7/2 with pre-core level normalization',fontsize='11') "
]
},
{
Expand All @@ -521,11 +521,11 @@
"metadata": {},
"outputs": [],
"source": [
"fig,ax = plt.subplots(1,3,figsize=(9,3), layout='constrained')\n",
"fig,ax = plt.subplots(1,3,figsize=(6,2), layout='constrained')\n",
"(xr.apply_ufunc(gaussian_filter, res_kx_ky/bgd_blur, 1)).sel(energy=slice(-31.4,-31.2)).mean('energy').plot(robust=True, ax=ax[0], cmap='terrain')\n",
"W_4f_7_norm.plot(robust=True, ax=ax[1], cmap='terrain')\n",
"W_4f_7_nrm2_blur.plot(robust=True, ax=ax[2], cmap='terrain')\n",
"fig.suptitle(f'Run {run_number}: comparison of different normalizations\\nof XPD pattern for W4f 7/2 peak with Gaussian Blur',fontsize='18')"
"fig.suptitle(f'Run {run_number}: comparison of different normalizations\\nof XPD pattern for W4f 7/2 peak with Gaussian Blur',fontsize='11')"
]
},
{
Expand All @@ -539,7 +539,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "python3",
"display_name": ".venv",
"language": "python",
"name": "python3"
},
Expand All @@ -553,7 +553,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.19"
"version": "3.12.8"
}
},
"nbformat": 4,
Expand Down

0 comments on commit f1bb527

Please sign in to comment.