{ "cells": [ { "cell_type": "markdown", "id": "541c9336-e261-49e9-834e-f5a06ca0cc6f", "metadata": {}, "source": [ "## High-level meta analysis of shear calibration\n", "\n", "This shows a high-level meta-analysis using the output of various shear-calibration analyses" ] }, { "cell_type": "markdown", "id": "6f725fa8-b620-48ec-a6f1-144f401f8703", "metadata": {}, "source": [ "#### Standard imports" ] }, { "cell_type": "code", "execution_count": null, "id": "4f07fada-1346-435c-b97d-b587eaf9418c", "metadata": {}, "outputs": [], "source": [ "import tables_io\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "markdown", "id": "33687786-aec0-462c-8ee7-46f59ee05013", "metadata": {}, "source": [ "#### Set up the configuration" ] }, { "cell_type": "code", "execution_count": null, "id": "a128d372-787e-47f5-b0c7-5641627d74d7", "metadata": {}, "outputs": [], "source": [ "DATADIR = \"test_data\" # Input data directory\n", "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\n", "\n", "tract = tracts[0]" ] }, { "cell_type": "code", "execution_count": null, "id": "a627f438-b696-45c8-847d-8dd1b07023aa", "metadata": {}, "outputs": [], "source": [ "#### Read the input data" ] }, { "cell_type": "code", "execution_count": null, "id": "e806b080-5913-4f30-8eac-4cda7e86d92e", "metadata": {}, "outputs": [], "source": [ "dd = {st:tables_io.read(f\"{DATADIR}/meta_summary_{st}_{tract}.parq\") for st in cat_types}" ] }, { "cell_type": "markdown", "id": "a98bb596-e918-4280-8e48-31b317bde2f2", "metadata": {}, "source": [ "#### Plot the match efficiency" ] }, { "cell_type": "code", "execution_count": null, "id": "87ccf046-968c-4045-8d4d-72ecce307a4a", "metadata": {}, "outputs": [], "source": [ "for st, df in dd.items():\n", " _ = plt.errorbar(df.shear, df.efficiency, yerr=df.efficiency_err, marker=\".\", ls=\"\", label=st)\n", "_ = plt.legend()\n", "_ = plt.ylabel('match efficiency')\n", "_ = plt.xlabel('apolied shear')\n", "_ = plt.ylim(0.90, 1.0) \n", "_ = plt.xlim(0, 0.045)" ] }, { "cell_type": "markdown", "id": "c2cfcaa7-04c1-4d6c-b985-a2604622fdbb", "metadata": {}, "source": [ "#### Make some other plots\n", "\n", "Specifically:\n", "\n", "1. The average response as a function of applied shear, comparing the per-object and ensemble estimates\n", "2. The difference between the response when only good clusters are considered v. when all clusters are considered\n", "3. The relative difference between the response when only good clusters are considered v. when all clusters are considered\n" ] }, { "cell_type": "code", "execution_count": null, "id": "1eb77b2c-1d31-40e9-b7f2-d3e8673e6178", "metadata": {}, "outputs": [], "source": [ "def plotShear(df):\n", " _ = plt.errorbar(df.shear, df.mc_delta_g_1_1, yerr=df.mc_delta_g_1_1_err, marker=\"o\", ls=\"\", label=\"g1\")\n", " _ = plt.errorbar(df.shear, df.mc_delta_g_2_2, yerr=df.mc_delta_g_2_2_err, marker=\"o\", ls=\"\", label=\"g2\")\n", " _ = plt.errorbar(df.shear, 2*df.md_good_g_1_1, yerr=df.md_good_g_1_2_err, marker=\"o\", ls=\"\", label=\"md g1\")\n", " _ = plt.errorbar(df.shear, 2*df.md_good_g_2_2, yerr=df.md_good_g_2_2_err, marker=\"o\", ls=\"\", label=\"md g2\")\n", " _ = plt.xlabel(\"applied shear\")\n", " _ = plt.ylabel(r\"$$\")\n", " _ = plt.legend()" ] }, { "cell_type": "code", "execution_count": null, "id": "61c0de84-7648-4350-b46d-ab5a5208291a", "metadata": {}, "outputs": [], "source": [ "def plotDeltaShear(df):\n", " _ = plt.errorbar(df.shear, 2*df.md_all_g_1_1-df.mc_delta_g_1_1, yerr=df.mc_delta_g_1_1_err, marker=\"o\", ls=\"\", label=\"g1\")\n", " _ = plt.errorbar(df.shear, 2*df.md_all_g_2_2-df.mc_delta_g_2_2, yerr=df.mc_delta_g_2_2_err, marker=\"o\", ls=\"\", label=\"g2\")\n", " _ = plt.errorbar(df.shear, 2*df.md_all_g_1_1-2*df.md_good_g_1_1, yerr=df.md_good_g_1_1_err, marker=\"o\", ls=\"\", label=\"md g1\")\n", " _ = plt.errorbar(df.shear, 2*df.md_all_g_2_2-2*df.md_good_g_2_2, yerr=df.md_good_g_2_2_err, marker=\"o\", ls=\"\", label=\"md g2\")\n", " _ = plt.legend()\n", " _ = plt.xlabel(\"applied shear\")\n", " _ = plt.ylabel(r\"$ - $\")\n", " _ = plt.ylim(-0.01, 0.01)" ] }, { "cell_type": "code", "execution_count": null, "id": "0da8bd71-da44-4b8a-b0c8-50e77d8359f2", "metadata": {}, "outputs": [], "source": [ "def plotRelDeltaShear(df):\n", " _ = plt.errorbar(df.shear, (2*df.md_all_g_1_1-df.mc_delta_g_1_1)/df.mc_delta_g_1_1, yerr=df.mc_delta_g_1_1_err/df.mc_delta_g_1_1, marker=\"o\", ls=\"\", label=\"g1\")\n", " _ = plt.errorbar(df.shear, (2*df.md_all_g_2_2-df.mc_delta_g_2_2)/df.mc_delta_g_2_2, yerr=df.mc_delta_g_2_2_err/df.mc_delta_g_2_2, marker=\"o\", ls=\"\", label=\"g2\")\n", " _ = plt.errorbar(df.shear, (2*df.md_all_g_1_1-2*df.md_good_g_1_1)/(2*df.md_good_g_1_1), yerr=df.md_good_g_1_1_err/df.md_good_g_1_1, marker=\"o\", ls=\"\", label=\"md g1\")\n", " _ = plt.errorbar(df.shear, (2*df.md_all_g_2_2-2*df.md_good_g_2_2)/(2*df.md_good_g_2_2), yerr=df.md_good_g_2_2_err/df.md_good_g_2_2, marker=\"o\", ls=\"\", label=\"md g2\")\n", " _ = plt.ylim(-1.0, 1.0)\n", " _ = plt.xlabel(\"applied shear\") \n", " _ = plt.ylabel(r\"$( - )/$\") \n", " _ = plt.legend()" ] }, { "cell_type": "code", "execution_count": null, "id": "b6336331-9027-4846-8e34-922b9a147d85", "metadata": {}, "outputs": [], "source": [ "plotShear(dd['wmom'])" ] }, { "cell_type": "code", "execution_count": null, "id": "78a8a5db-0f24-4a4e-a51d-18bc48d5350b", "metadata": {}, "outputs": [], "source": [ "plotDeltaShear(dd['wmom'])" ] }, { "cell_type": "code", "execution_count": null, "id": "921f2135-953a-4524-ac8a-a7cc8cc7ddb6", "metadata": {}, "outputs": [], "source": [ "plotRelDeltaShear(dd['wmom'])" ] }, { "cell_type": "code", "execution_count": null, "id": "9657e86d-f278-4e67-8418-a3a2604747a6", "metadata": {}, "outputs": [], "source": [ "plotShear(dd['gauss'])" ] }, { "cell_type": "code", "execution_count": null, "id": "0f610fe9-d100-4e45-af41-37659e7bdc38", "metadata": {}, "outputs": [], "source": [ "plotDeltaShear(dd['gauss'])" ] }, { "cell_type": "code", "execution_count": null, "id": "8235d958-2310-4b6f-8959-32717df0ddf0", "metadata": {}, "outputs": [], "source": [ "plotRelDeltaShear(dd['gauss'])" ] }, { "cell_type": "code", "execution_count": null, "id": "dc240607-59ae-481f-8312-de11c080f406", "metadata": {}, "outputs": [], "source": [ "plotShear(dd['pgauss'])" ] }, { "cell_type": "code", "execution_count": null, "id": "e8f7567f-1e36-4206-8f94-ab462c230417", "metadata": {}, "outputs": [], "source": [ "plotDeltaShear(dd['pgauss']) " ] }, { "cell_type": "code", "execution_count": null, "id": "b57b12df-8331-439d-aab1-e7045c090b77", "metadata": {}, "outputs": [], "source": [ "plotRelDeltaShear(dd['pgauss'])" ] }, { "cell_type": "code", "execution_count": null, "id": "abdc3e54-e25d-470e-a078-7b68e2e8595e", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "0c106c34-2034-41e1-9483-f09a433a298f", "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.9" } }, "nbformat": 4, "nbformat_minor": 5 }