{ "cells": [ { "cell_type": "markdown", "id": "eedf5b4a-041d-479e-8318-9f5a99a9f8ce", "metadata": {}, "source": [ "## Reading shear data from an existing file" ] }, { "cell_type": "markdown", "id": "0cbdffe7-9ce1-474d-98c8-ff926b9c8ffc", "metadata": {}, "source": [ "#### Standard imports" ] }, { "cell_type": "code", "execution_count": null, "id": "1e37aad0-92d1-4599-812a-371ec64c1c3d", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import hpmcm" ] }, { "cell_type": "markdown", "id": "125e8aeb-d3be-430e-81b3-5d2de89475b9", "metadata": {}, "source": [ "#### Set up the configuration" ] }, { "cell_type": "code", "execution_count": null, "id": "53e7b62d-ad51-46fd-880d-681cea1ceeca", "metadata": {}, "outputs": [], "source": [ "shear_value_strs = ['0p0025', '0p005', '0p01', '0p02', '0p04'] # Applied shears as a string\n", "shear_values = [0.0025, 0.005, 0.01, 0.02, 0.04] # Decimal versions of applied shear \n", "cat_types = ['wmom', 'gauss', 'pgauss'] # which object characterization to use \n", "tracts = [10463, 10705] # Tracts to loop over\n", "clean = True # Fully clean patches for de-duplication" ] }, { "cell_type": "code", "execution_count": null, "id": "140648fc-8598-49b8-90b9-2b420924354f", "metadata": {}, "outputs": [], "source": [ "st = cat_types[0]\n", "which_shear = 2\n", "shear_st_ = shear_value_strs[which_shear]\n", "shear = shear_values[which_shear]\n", "tract = tracts[0]" ] }, { "cell_type": "markdown", "id": "738eb6a0-8bae-4c69-af27-982a7442bbc1", "metadata": {}, "source": [ "#### Load the requested data" ] }, { "cell_type": "code", "execution_count": null, "id": "838c5e6a-688a-468b-9e05-8e7322df3d1e", "metadata": {}, "outputs": [], "source": [ "dd = hpmcm.ShearData.load(f\"test_data/shear_{st}_{shear_st_}_match_{tract}.pkl\")" ] }, { "cell_type": "markdown", "id": "2b90afa5-b15c-4269-a245-1dff210d8b4d", "metadata": {}, "source": [ "#### Make some plots" ] }, { "cell_type": "code", "execution_count": null, "id": "3995cfda-d829-41b8-963d-50c1f172098c", "metadata": {}, "outputs": [], "source": [ "_ = dd.makePlots(use_central=False) " ] }, { "cell_type": "code", "execution_count": null, "id": "6ea7e7b5-d212-4fff-b481-12f197652927", "metadata": {}, "outputs": [], "source": [ "_ = dd.makePlots(useCentral=True) " ] }, { "cell_type": "code", "execution_count": null, "id": "b0335d4a-95a4-4f12-80c8-44065473d69a", "metadata": {}, "outputs": [], "source": [ "if st in [\"pgauss\"]:\n", " central = slice(9800,10200)\n", " centralEdges = slice(9800,10201) \n", "elif st in [\"wmom\"]:\n", " central = slice(950,1050)\n", " centralEdges = slice(950,1051) \n", "else:\n", " central = slice(800,1200)\n", " centralEdges = slice(800,1201) \n", "\n", "for shear_st_ in shear_value_strs:\n", " dd = hpmcm.ShearData.load(f\"test_data/shear_{st}_{shear_st_}_match_{tract}.pkl\")\n", " #central = dd.hists.central\n", " #centralEdges = dd.hists.centralEdges\n", " binEdges = dd.hists.binEdges\n", " _ = plt.stairs(dd.hists.good_delta_g_1_1[central], binEdges[centralEdges], label=f\"{st} {shear_st_} 1\")\n", " _ = plt.stairs(dd.hists.good_delta_g_2_2[central], binEdges[centralEdges], label=f\"{st} {shear_st_} 2\")\n", " _ = plt.xlabel(r'$\\delta g$')\n", " _ = plt.ylabel(\"Objects [per 0.001]\")\n", "_ = plt.legend()" ] }, { "cell_type": "code", "execution_count": null, "id": "6a37276d-70bc-4017-98b4-c331b2dfbfeb", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.12" } }, "nbformat": 4, "nbformat_minor": 5 }