From 3c21db01e4ca35e8b5a0956d4684e404a63fc2df Mon Sep 17 00:00:00 2001 From: rettigl Date: Mon, 3 Mar 2025 20:51:34 +0100 Subject: [PATCH] fix aspect ratios --- ...hextof_workflow_trXPS_bam_correction.ipynb | 12 +++--- ...ow_trXPS_energy_calibration_using_SB.ipynb | 4 +- tutorial/1_binning_fake_data.ipynb | 11 ++---- tutorial/4_hextof_workflow.ipynb | 12 +++--- tutorial/9_hextof_workflow_trXPD.ipynb | 38 +++++++++---------- 5 files changed, 37 insertions(+), 40 deletions(-) diff --git a/tutorial/10_hextof_workflow_trXPS_bam_correction.ipynb b/tutorial/10_hextof_workflow_trXPS_bam_correction.ipynb index 53914395..3000155f 100644 --- a/tutorial/10_hextof_workflow_trXPS_bam_correction.ipynb +++ b/tutorial/10_hextof_workflow_trXPS_bam_correction.ipynb @@ -238,7 +238,7 @@ "metadata": {}, "outputs": [], "source": [ - "fig,ax = plt.subplots(1,2,figsize=(6,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", @@ -338,7 +338,7 @@ "outputs": [], "source": [ "\n", - "fig,ax = plt.subplots(1,2,figsize=(6,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()" @@ -404,7 +404,7 @@ "metadata": {}, "outputs": [], "source": [ - "fig,ax = plt.subplots(1,2,figsize=(6,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", @@ -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')" ] }, { @@ -545,7 +545,7 @@ ], "metadata": { "kernelspec": { - "display_name": "sed-processor-7Jy-bAA8-py3.9", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -559,7 +559,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.12.8" } }, "nbformat": 4, diff --git a/tutorial/11_hextof_workflow_trXPS_energy_calibration_using_SB.ipynb b/tutorial/11_hextof_workflow_trXPS_energy_calibration_using_SB.ipynb index b8be7a47..d5caf39f 100644 --- a/tutorial/11_hextof_workflow_trXPS_energy_calibration_using_SB.ipynb +++ b/tutorial/11_hextof_workflow_trXPS_energy_calibration_using_SB.ipynb @@ -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=(6,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", @@ -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=(6,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", diff --git a/tutorial/1_binning_fake_data.ipynb b/tutorial/1_binning_fake_data.ipynb index 01e987ae..baf70d6d 100644 --- a/tutorial/1_binning_fake_data.ipynb +++ b/tutorial/1_binning_fake_data.ipynb @@ -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))" ] @@ -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)" ] @@ -179,11 +179,8 @@ } ], "metadata": { - "interpreter": { - "hash": "728003ee06929e5fa5ff815d1b96bf487266025e4b7440930c6bf4536d02d243" - }, "kernelspec": { - "display_name": "python3", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -197,7 +194,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.19" } }, "nbformat": 4, diff --git a/tutorial/4_hextof_workflow.ipynb b/tutorial/4_hextof_workflow.ipynb index 847051f8..8bbeec84 100644 --- a/tutorial/4_hextof_workflow.ipynb +++ b/tutorial/4_hextof_workflow.ipynb @@ -759,7 +759,7 @@ "metadata": {}, "outputs": [], "source": [ - "fig,ax = plt.subplots(1,2,figsize=(6,3), layout='constrained')\n", + "fig,ax = plt.subplots(1,2,figsize=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])" @@ -827,7 +827,7 @@ }, "outputs": [], "source": [ - "fig,ax = plt.subplots(1,2,figsize=(6,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", @@ -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=(6,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])" @@ -966,7 +966,7 @@ "metadata": {}, "outputs": [], "source": [ - "fig,ax = plt.subplots(1,2,figsize=(6,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])" @@ -1017,7 +1017,7 @@ ], "metadata": { "kernelspec": { - "display_name": "python3", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -1031,7 +1031,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.12.8" } }, "nbformat": 4, diff --git a/tutorial/9_hextof_workflow_trXPD.ipynb b/tutorial/9_hextof_workflow_trXPD.ipynb index a526d5b1..69cdec2c 100644 --- a/tutorial/9_hextof_workflow_trXPD.ipynb +++ b/tutorial/9_hextof_workflow_trXPD.ipynb @@ -291,7 +291,7 @@ "metadata": {}, "outputs": [], "source": [ - "fig,ax = plt.subplots(1,2,figsize=(6,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", @@ -341,7 +341,7 @@ "plt.show()\n", "\n", "## XPD plots\n", - "fig,ax = plt.subplots(2,2,figsize=(6,6), 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", @@ -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=(6,3), 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", @@ -397,28 +397,28 @@ "outputs": [], "source": [ "## XPD normalized by background image\n", - "fig,ax = plt.subplots(2,2,figsize=(6,6), 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='14')\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=(6,6), 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='14')\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=(6,6), 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='14')" + "fig.suptitle(f'Run {run_number}: resulting Gaussian-blurred XPD patterns',fontsize='11')" ] }, { @@ -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=(6,6), 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='14')\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", @@ -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=(6,6), 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='14') " + "fig.suptitle(f'Run {run_number}: XPD patterns after Gauss Blur normalization',fontsize='11') " ] }, { @@ -503,7 +503,7 @@ "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=(6,12), 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", @@ -511,7 +511,7 @@ "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='14') " + "fig.suptitle(f'Run {run_number}: XPD patterns of W4f7/2 with pre-core level normalization',fontsize='11') " ] }, { @@ -521,11 +521,11 @@ "metadata": {}, "outputs": [], "source": [ - "fig,ax = plt.subplots(1,3,figsize=(6,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='14')" + "fig.suptitle(f'Run {run_number}: comparison of different normalizations\\nof XPD pattern for W4f 7/2 peak with Gaussian Blur',fontsize='11')" ] }, { @@ -539,7 +539,7 @@ ], "metadata": { "kernelspec": { - "display_name": "python3", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -553,7 +553,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.12.8" } }, "nbformat": 4,