{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Copyright (C) 2024 Richard Stiskalek\n", "# This program is free software; you can redistribute it and/or modify it\n", "# under the terms of the GNU General Public License as published by the\n", "# Free Software Foundation; either version 3 of the License, or (at your\n", "# option) any later version.\n", "#\n", "# This program is distributed in the hope that it will be useful, but\n", "# WITHOUT ANY WARRANTY; without even the implied warranty of\n", "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\n", "# Public License for more details.\n", "#\n", "# You should have received a copy of the GNU General Public License along\n", "# with this program; if not, write to the Free Software Foundation, Inc.,\n", "# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from corner import corner\n", "from getdist import plots\n", "import scienceplots\n", "from os.path import exists\n", "import seaborn as sns\n", "\n", "\n", "from reconstruction_comparison import *\n", "\n", "%load_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", "\n", "paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)\n", "fdir = \"/mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Quick checks" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "catalogue = \"CF4_TFR_i\"\n", "simname = \"Carrick2015\"\n", "zcmb_max=0.05\n", "sample_beta = None\n", "sample_alpha = True\n", "\n", "fname_bayes = paths.flow_validation(\n", " fdir, simname, catalogue, inference_method=\"bayes\",\n", " sample_alpha=sample_alpha, sample_beta=sample_beta,\n", " zcmb_max=zcmb_max)\n", "\n", "fname_mike = paths.flow_validation(\n", " fdir, simname, catalogue, inference_method=\"mike\",\n", " sample_alpha=sample_alpha, sample_beta=sample_beta,\n", " zcmb_max=zcmb_max)\n", "\n", "\n", "X = []\n", "labels = [\"Full posterior\", \"Delta posterior\"]\n", "for i, fname in enumerate([fname_bayes, fname_mike]):\n", " samples = get_samples(fname)\n", " if i == 1:\n", " print(samples.keys())\n", "\n", " X.append(samples_to_getdist(samples, labels[i]))\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "params = [f\"a_{catalogue}\", f\"b_{catalogue}\", f\"c_{catalogue}\", f\"e_mu_{catalogue}\",\n", " \"Vmag\", \"l\", \"b\", \"sigma_v\", \"beta\", f\"alpha_{catalogue}\"]\n", "# params = [\"beta\", f\"a_{catalogue}\", f\"b_{catalogue}\", f\"e_mu_{catalogue}\"]\n", "# params = [\"Vmag\", \"l\", \"b\", \"sigma_v\", \"beta\", f\"mag_cal_{catalogue}\", f\"alpha_cal_{catalogue}\", f\"beta_cal_{catalogue}\", f\"e_mu_{catalogue}\"]\n", "\n", "\n", "g = plots.get_subplot_plotter()\n", "g.settings.figure_legend_frame = False\n", "g.settings.alpha_filled_add = 0.75\n", "\n", "g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n", "plt.gcf().suptitle(catalogue_to_pretty(catalogue), y=1.025)\n", "plt.gcf().tight_layout()\n", "# plt.gcf().savefig(f\"../../plots/method_comparison_{simname}_{catalogue}.png\", dpi=500, bbox_inches='tight')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# catalogue = [\"LOSS\", \"Foundation\"]\n", "catalogue = \"CF4_TFR_i\"\n", "simname = \"IndranilVoid_exp\"\n", "zcmb_max = 0.05\n", "sample_alpha = False\n", "\n", "fname = paths.flow_validation(\n", " fdir, simname, catalogue, inference_method=\"mike\",\n", " sample_mag_dipole=True,\n", " sample_beta=False,\n", " sample_alpha=sample_alpha, zcmb_max=zcmb_max)\n", "\n", "\n", "samples = get_samples(fname, convert_Vext_to_galactic=True)\n", "\n", "samples, labels, keys = samples_for_corner(samples)\n", "fig = corner(samples, labels=labels, show_titles=True,\n", " title_kwargs={\"fontsize\": 12}, smooth=1)\n", "# fig.savefig(\"../../plots/test.png\", dpi=250)\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Paper plots" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1. Evidence comparison" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "zcmb_max = 0.05\n", "\n", "sims = [\"Carrick2015\", \"Lilow2024\", \"csiborg2_main\", \"csiborg2X\", \"CF4\"]\n", "catalogues = [\"LOSS\", \"Foundation\", \"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n", "\n", "y_BIC = np.full((len(catalogues), len(sims)), np.nan)\n", "y_lnZ = np.full_like(y_BIC, np.nan)\n", "\n", "for i, catalogue in enumerate(catalogues):\n", " for j, simname in enumerate(sims):\n", " fname = paths.flow_validation(\n", " fdir, simname, catalogue, inference_method=\"mike\",\n", " sample_alpha=simname != \"IndranilVoid_exp\",\n", " zcmb_max=zcmb_max)\n", "\n", " # y_BIC[i, j] = get_gof(\"BIC\", fname)\n", " y_lnZ[i, j] = get_gof(\"neg_lnZ_harmonic\", fname)\n", "\n", " y_lnZ[i] -= y_lnZ[i].min()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "with plt.style.context('science'):\n", " plt.rcParams.update({'font.size': 9})\n", " figwidth = 8.3\n", " fig, axs = plt.subplots(2, 3, figsize=(figwidth, 0.35 * figwidth))\n", " fig.subplots_adjust(hspace=0)\n", "\n", " x = np.arange(len(sims))\n", " y = y_lnZ\n", " for n in range(len(catalogues)):\n", " i, j = n // 3, n % 3\n", " ax = axs[i, j]\n", " ax.text(0.5, 0.875, catalogue_to_pretty(catalogues[n]),\n", " transform=ax.transAxes, fontsize=\"small\",\n", " verticalalignment='center', horizontalalignment='center',\n", " bbox=dict(facecolor='white', alpha=0.5))\n", " ax.scatter(x, y[n], c=\"k\", s=5)\n", "\n", " y_min, y_max = ax.get_ylim()\n", " y_offset = (y_max - y_min) * 0.075 # Adjust the fraction (0.05) as needed\n", "\n", " for k, txt in enumerate(y[n]):\n", " ax.text(x[k], y[n, k] + y_offset, f\"({y[n, k]:.1f})\",\n", " ha='center', fontsize=\"x-small\")\n", "\n", " ax.set_ylim(y_min, y_max + 2 * y_offset)\n", "\n", " for i in range(3):\n", " axs[1, i].set_xticks(\n", " np.arange(len(sims)),\n", " [simname_to_pretty(sim) for sim in sims], rotation=35,\n", " fontsize=\"small\")\n", " axs[0, i].set_xticks([], [])\n", "\n", " for i in range(2):\n", " for j in range(3):\n", " axs[i, j].set_xlim(-0.75, len(sims) - 0.25)\n", "\n", " axs[i, j].tick_params(axis='x', which='major', top=False)\n", " axs[i, j].tick_params(axis='x', which='minor', top=False, length=0)\n", " axs[i, j].tick_params(axis='y', which='minor', length=0)\n", "\n", " axs[i, 0].set_ylabel(r\"$-\\Delta \\ln \\mathcal{Z}$\")\n", "\n", " fig.tight_layout(h_pad=0)\n", " fig.savefig(f\"../../plots/lnZ_comparison.pdf\", dpi=500, bbox_inches='tight')\n", " fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2. Dependence of the evidence on smoothing scale" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "zcmb_max = 0.05\n", "\n", "ksmooth = [0, 1, 2, 3, 4]\n", "scales = [0, 2, 4, 6, 8]\n", "sims = [\"Carrick2015\", \"csiborg2_main\"]\n", "catalogues = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_i\"]\n", "\n", "y = np.full((len(sims), len(catalogues), len(ksmooth)), np.nan)\n", "for i, simname in enumerate(sims):\n", " for j, catalogue in enumerate(catalogues):\n", " for n, k in enumerate(ksmooth):\n", " fname = paths.flow_validation(\n", " fdir, simname, catalogue, inference_method=\"mike\",\n", " sample_alpha=True, smooth=k,\n", " zcmb_max=zcmb_max)\n", " if not exists(fname):\n", " raise FileNotFoundError(fname)\n", "\n", " y[i, j, n] = get_gof(\"neg_lnZ_harmonic\", fname)\n", "\n", " y[i, j, :] -= y[i, j, :].min()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "for i, simname in enumerate(sims):\n", " for j, catalogue in enumerate(catalogues):\n", " print(simname, catalogue, y[i, j, -1])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "with plt.style.context('science'):\n", " plt.rcParams.update({'font.size': 9})\n", " cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n", " plt.figure()\n", "\n", " ls = [\"-\", \"--\", \"-.\", \":\"]\n", " for i, simname in enumerate(sims):\n", " for j, catalogue in enumerate(catalogues):\n", " plt.plot(scales, y[i, j], marker='o', ms=2.5, ls=ls[i],\n", " label=catalogue_to_pretty(catalogue) if i == 0 else None, c=cols[j],)\n", "\n", " plt.xlabel(r\"$R_{\\rm smooth} ~ [\\mathrm{Mpc} / h]$\")\n", " plt.ylabel(r\"$-\\Delta \\ln \\mathcal{Z}$\")\n", " plt.legend()\n", "\n", " plt.tight_layout()\n", " plt.savefig(\"../../plots/smoothing_comparison.pdf\", dpi=450)\n", " plt.show()\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3. TFR intercept consistency" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n", "sims = [\"Carrick2015\", \"Lilow2024\", \"csiborg2_main\", \"csiborg2X\"]\n", "labels_x = [r\"$a_{\\rm TF}^{\\rm 2MTF}$\", r\"$a_{\\rm TF}^{\\rm SFI}$\", r\"$a_{\\rm TF}^{\\mathrm{CF4~TFR~}i}$\", r\"$a_{\\rm TF}^{\\mathrm{CF4~TFR~W1}}$\"]\n", "\n", "data = {}\n", "for cat in cats:\n", " for sim in sims:\n", " fname = paths.flow_validation(\n", " fdir, sim, cat, inference_method=\"bayes\",\n", " sample_alpha=True, zcmb_max=0.05)\n", " \n", " if not exists(fname):\n", " raise FileNotFoundError(fname)\n", " \n", " with File(fname, 'r') as f:\n", " data[f\"{sim}_{cat}\"] = f[f\"samples/a_{cat}\"][...]\n", " # samples = get_samples(fname)\n", " # samples = samples_to_getdist(samples, simname_to_pretty(sim))\n", " # X.append(samples)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "with plt.style.context('science'):\n", " plt.rcParams.update({'font.size': 9})\n", " figwidth = 8.3\n", " fig, axs = plt.subplots(1, 4, figsize=(figwidth, 0.75 * 2.65))\n", " fig.subplots_adjust(hspace=0)\n", " # plt.figure()\n", "\n", " for i, cat in enumerate(cats):\n", " for sim in sims:\n", " x = data[f\"{sim}_{cat}\"]\n", " sns.kdeplot(x, fill=True, bw_adjust=0.75, ax=axs[i],\n", " label=simname_to_pretty(sim) if i == 0 else None)\n", "\n", " axs[i].set_ylabel(None)\n", " axs[i].set_yticklabels([])\n", "\n", " axs[i].set_xlabel(labels_x[i])\n", "\n", " axs[0].set_ylabel(\"Normalised density\")\n", "\n", " handles, labels = axs[0].get_legend_handles_labels() # get the labels from the first axis\n", " fig.legend(handles, labels, loc='upper center', bbox_to_anchor=(0.5, 1.075), ncol=len(cats) + 2)\n", "\n", " fig.tight_layout(h_pad=0)\n", " fig.savefig(f\"../../plots/TFR_intercept.pdf\", dpi=450)\n", " fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4. External flow consistency" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sim = \"csiborg2_main\"\n", "# cats = [[\"LOSS\", \"Foundation\"], \"2MTF\", \"SFI_gals\", \"CF4_TFR_not2MTForSFI_i\"]\n", "# cats = [[\"LOSS\", \"Foundation\"], \"CF4_TFR_not2MTForSFI_i\", \"2MTF\", \"SFI_gals\"]\n", "# cats = [\"CF4_TFR_not2MTForSFI_i\", \"2MTF\", \"SFI_gals\"]\n", "cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n", "\n", "X = []\n", "for cat in cats:\n", " fname = paths.flow_validation(\n", " fdir, sim, cat, inference_method=\"bayes\",\n", " sample_alpha=True, zcmb_max=0.05)\n", "\n", " if not exists(fname):\n", " raise FileNotFoundError(fname)\n", "\n", " samples = get_samples(fname)\n", " if sim == \"csiborg2_main\":\n", " m = samples[\"l\"] > 250\n", " for key in samples.keys():\n", " samples[key] = samples[key][m]\n", " samples = samples_to_getdist(samples, catalogue_to_pretty(cat))\n", " X.append(samples)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "params = [\"Vmag\", \"l\", \"b\"]\n", "\n", "with plt.style.context('science'):\n", " g = plots.get_subplot_plotter()\n", " g.settings.figure_legend_frame = False\n", " g.settings.alpha_filled_add = 0.75\n", "\n", " g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n", " # plt.gcf().suptitle(simname_to_pretty(sim), y=1.025)\n", " plt.gcf().tight_layout()\n", " plt.gcf().savefig(f\"../../plots/flow_{sim}.pdf\", dpi=500, bbox_inches='tight')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 5. What $\\beta$ is preferred by the data? " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "key = \"beta\"\n", "sim = \"csiborg2X\"\n", "cats = [[\"LOSS\", \"Foundation\"], \"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n", "# cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_not2MTForSFI_i\"]\n", "\n", "X = []\n", "\n", "for cat in cats:\n", " fname = paths.flow_validation(\n", " fdir, sim, cat, inference_method=\"bayes\",\n", " sample_alpha=True, zcmb_max=0.05, sample_beta=True)\n", "\n", " if not exists(fname):\n", " raise FileNotFoundError(fname)\n", "\n", " with File(fname, 'r') as f:\n", " X.append(f[f\"samples/beta\"][...])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "with plt.style.context('science'):\n", " plt.figure()\n", "\n", " for i, cat in enumerate(cats):\n", " sns.kdeplot(X[i], label=catalogue_to_pretty(cat), fill=True)\n", "\n", " plt.xlabel(names_to_latex([key], True)[0])\n", " plt.ylabel(\"PDF\")\n", " plt.legend(ncols=1, fontsize=\"small\", loc=\"upper left\")\n", " if \"csiborg\" in sim:\n", " plt.axvline(1, color='k', linestyle='--')\n", " # plt.xlim(0.15, 0.6)\n", " plt.xlim(0.5, 1.5)\n", "\n", " plt.tight_layout()\n", " plt.savefig(f\"../../plots/what_beta_{sim}.pdf\", dpi=450)\n", " plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 6. Bulk flow in the simulation rest frame " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sims = [\"Carrick2015\", \"Lilow2024\", \"csiborg2_main\", \"csiborg2X\"]\n", "\n", "\n", "with plt.style.context('science'):\n", " plt.rcParams.update({'font.size': 9})\n", " cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n", "\n", " plt.figure()\n", " for i, sim in enumerate(sims):\n", " r, B = get_bulkflow_simulation(sim, convert_to_galactic=True)\n", " B = B[..., 0]\n", "\n", " if sim == \"Carrick2015\":\n", " B *= 0.43\n", "\n", " if sim in [\"Carrick2015\", \"Lilow2024\"]:\n", " plt.plot(r, B[0], label=simname_to_pretty(sim), color=cols[i])\n", " else:\n", " ylow, yhigh = np.percentile(B, [16, 84], axis=0)\n", " plt.fill_between(r, ylow, yhigh, alpha=0.5,\n", " label=simname_to_pretty(sim), color=cols[i])\n", "\n", " plt.xlabel(r\"$R ~ [\\mathrm{Mpc} / h]$\")\n", " plt.ylabel(r\"$|\\mathbf{B}| ~ [\\mathrm{km} / \\mathrm{s}]$\")\n", " plt.xlim(5, 200)\n", " plt.legend()\n", "\n", " plt.tight_layout()\n", " plt.savefig(\"../../plots/bulkflow_simulations_restframe.pdf\", dpi=450)\n", " plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 7. Bulk flow in the CMB frame" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sims = [\"Carrick2015\", \"Lilow2024\", \"csiborg2_main\", \"csiborg2X\"]\n", "# cats = [[\"LOSS\", \"Foundation\"], \"2MTF\", \"SFI_gals\", \"CF4_TFR_i\"]\n", "cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n", "\n", "\n", "data = {}\n", "for sim in sims:\n", " for cat in cats:\n", " fname = paths.flow_validation(\n", " fdir, sim, cat, inference_method=\"bayes\",\n", " sample_alpha=True, zcmb_max=0.05)\n", " \n", " data[f\"{sim}_{cat}\"] = get_bulkflow(fname, sim)\n", "\n", "def get_ax_centre(ax):\n", " # Get the bounding box of the specific axis in relative figure coordinates\n", " bbox = ax.get_position()\n", "\n", " # Extract the position and size of the axis\n", " x0, y0, width, height = bbox.x0, bbox.y0, bbox.width, bbox.height\n", "\n", " # Calculate the center of the axis\n", " center_x = x0 + width / 2\n", " center_y = y0 + height / 2\n", " return center_x, center_y" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "with plt.style.context('science'):\n", " plt.rcParams.update({'font.size': 9})\n", " nrows = len(sims)\n", " ncols = 3\n", "\n", " figwidth = 8.3\n", " fig, axs = plt.subplots(nrows, ncols, figsize=(figwidth, 0.75 * figwidth), sharex=True, sharey=\"col\")\n", " cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n", " # fig.suptitle(f\"Calibrated against {catalogue}\")\n", "\n", " for i, sim in enumerate(sims):\n", " for j, catalogue in enumerate(cats):\n", " r, B = data[f\"{sim}_{catalogue}\"]\n", " c = cols[j]\n", " for n in range(3):\n", " ylow, ymed, yhigh = np.percentile(B[..., n], [16, 50, 84], axis=-1)\n", " axs[i, n].fill_between(\n", " r, ylow, yhigh, alpha=0.5, color=c,\n", " label=catalogue_to_pretty(catalogue) if i == 1 else None)\n", "\n", "\n", " # CMB-LG velocity\n", " kwargs = {\"color\": \"mediumblue\", \"alpha\": 0.5, \"zorder\": 10, \"hatch\": \"x\"}\n", " for n in range(len(sims)):\n", " axs[n, 0].fill_between([r.min(), 15.], [627 - 22, 627 - 22], [627 + 22, 627 + 22], label=\"CMB-LG\" if n == 0 else None, **kwargs)\n", " axs[n, 1].fill_between([r.min(), 15.], [276 - 3, 276 - 3], [276 + 3, 276 + 3], **kwargs)\n", " axs[n, 2].fill_between([r.min(), 15.], [30 - 3, 30 - 3], [30 + 3, 30 + 3], **kwargs)\n", "\n", " # LCDM expectation\n", " Rs,mean,std,mode,p05,p16,p84,p95 = np.load(\"/mnt/users/rstiskalek/csiborgtools/data/BulkFlowPlot.npy\")\n", " m = Rs < 175\n", " kwargs = {\"color\": \"black\", \"zorder\": 0, \"hatch\": \"//\", \"alpha\": 0.25}\n", " for n in range(len(sims)):\n", " axs[n, 0].fill_between(\n", " Rs[m], p16[m], p84[m],\n", " label=r\"$\\Lambda\\mathrm{CDM}$\" if n == 0 else None, **kwargs)\n", "\n", " for n in range(3):\n", " axs[-1, n].set_xlabel(r\"$R ~ [\\mathrm{Mpc} / h]$\")\n", "\n", " for n in range(len(sims)):\n", " axs[n, 0].set_ylabel(r\"$|\\mathbf{B}| ~ [\\mathrm{km} / \\mathrm{s}]$\")\n", " axs[n, 1].set_ylabel(r\"$\\ell ~ [\\mathrm{deg}]$\")\n", " axs[n, 2].set_ylabel(r\"$b ~ [\\mathrm{deg}]$\")\n", "\n", " for i, sim in enumerate(sims):\n", " xpos, ypos = get_ax_centre(axs[i, 0])\n", " fig.text(0.95, ypos, simname_to_pretty(sim),\n", " va='center', ha='center', fontsize=9, rotation=270)\n", "\n", " axs[0, 0].set_xlim(r.min(), r.max())\n", "\n", " axs[0, 0].legend()\n", " handles, labels = axs[1, 0].get_legend_handles_labels() # get the labels from the first axis\n", " fig.legend(handles, labels, loc='upper center', bbox_to_anchor=(0.5, 1.00), ncol=len(cats) + 2)\n", "\n", " fig.tight_layout(rect=[0, 0, 0.95, 0.95])\n", " fig.savefig(f\"../../plots/bulkflow_CMB.pdf\", dpi=450)\n", " fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 8. Full vs Delta comparison" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "catalogue = \"CF4_TFR_i\"\n", "simname = \"csiborg2X\"\n", "zcmb_max=0.05\n", "sample_beta = True\n", "sample_alpha = True\n", "\n", "fname_bayes = paths.flow_validation(\n", " fdir, simname, catalogue, inference_method=\"bayes\",\n", " sample_alpha=sample_alpha, sample_beta=sample_beta,\n", " zcmb_max=zcmb_max)\n", "\n", "fname_mike = paths.flow_validation(\n", " fdir, simname, catalogue, inference_method=\"mike\",\n", " sample_alpha=sample_alpha, sample_beta=sample_beta,\n", " zcmb_max=zcmb_max)\n", "\n", "\n", "X = []\n", "labels = [\"Full posterior\", \"Delta posterior\"]\n", "for i, fname in enumerate([fname_bayes, fname_mike]):\n", " samples = get_samples(fname)\n", " if i == 1:\n", " print(samples.keys())\n", "\n", " X.append(samples_to_getdist(samples, labels[i]))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "params = [f\"a_{catalogue}\", f\"b_{catalogue}\", f\"c_{catalogue}\", f\"e_mu_{catalogue}\",\n", " \"Vmag\", \"l\", \"b\", \"sigma_v\", \"beta\", f\"alpha_{catalogue}\"]\n", "# params = [\"beta\", f\"a_{catalogue}\", f\"b_{catalogue}\", f\"e_mu_{catalogue}\"]\n", "# params = [\"Vmag\", \"l\", \"b\", \"sigma_v\", \"beta\", f\"mag_cal_{catalogue}\", f\"alpha_cal_{catalogue}\", f\"beta_cal_{catalogue}\", f\"e_mu_{catalogue}\"]\n", "\n", "with plt.style.context('science'):\n", " plt.rcParams.update({'font.size': 11})\n", " g = plots.get_subplot_plotter()\n", " g.settings.figure_legend_frame = False\n", " g.settings.alpha_filled_add = 0.75\n", " g.settings.fontsize = 12\n", "\n", " g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n", " # plt.gcf().suptitle(catalogue_to_pretty(catalogue), y=1.025)\n", " plt.gcf().tight_layout()\n", " plt.gcf().savefig(f\"../../plots/method_comparison_{simname}_{catalogue}.pdf\", dpi=300, bbox_inches='tight')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## All possible things" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Dipole magnitude" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n", "sim = \"IndranilVoid_gauss\"\n", "\n", "X = []\n", "for cat in cats:\n", " fname = paths.flow_validation(\n", " fdir, sim, cat, inference_method=\"mike\",\n", " sample_mag_dipole=False,\n", " sample_alpha=False, zcmb_max=0.05)\n", " \n", " if not exists(fname):\n", " raise FileNotFoundError(fname)\n", "\n", " samples = get_samples(fname, convert_Vext_to_galactic=False)\n", "\n", " # keys = list(samples.keys())\n", " # for key in keys:\n", " # if cat in key:\n", " # value = samples.pop(key)\n", " # samples[key.replace(f\"_{cat}\",'')] = value\n", " \n", " samples = samples_to_getdist(samples, catalogue_to_pretty(cat))\n", " X.append(samples)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# params = [\"Vmag\", \"l\", \"b\", \"a_dipole_mag\", \"a_dipole_l\", \"a_dipole_b\"]\n", "params = [\"Vx\", \"Vy\", \"Vz\"]\n", "# params = [\"Vmag\", \"l\", \"b\"]\n", "\n", "with plt.style.context('science'):\n", " g = plots.get_subplot_plotter()\n", " g.settings.figure_legend_frame = False\n", " g.settings.alpha_filled_add = 0.75\n", "\n", " g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n", " # plt.gcf().suptitle(catalogue_to_pretty(cat), y=1.025)\n", " plt.gcf().tight_layout()\n", " plt.gcf().savefig(f\"../../plots/vext_{sim}.png\", dpi=500, bbox_inches='tight')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Flow | catalogue" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "catalogues = [\"LOSS\", \"Foundation\", \"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n", "sims = [\"Carrick2015\", \"csiborg2_main\", \"csiborg2X\"]\n", "params = [\"Vmag\", \"beta\", \"sigma_v\"]\n", "\n", "for catalogue in catalogues:\n", " X = [samples_to_getdist(get_samples(sim, catalogue), sim)\n", " for sim in sims]\n", "\n", " g = plots.get_subplot_plotter()\n", " g.settings.figure_legend_frame = False\n", " g.settings.alpha_filled_add = 0.75\n", "\n", " g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n", " plt.gcf().suptitle(f'{catalogue}', y=1.025)\n", " plt.gcf().tight_layout()\n", " plt.gcf().savefig(f\"../../plots/calibration_{catalogue}.png\", dpi=500, bbox_inches='tight')\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Flow | simulation" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "catalogues = [\"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n", "sims = [\"Carrick2015\", \"csiborg2_main\", \"csiborg2X\"]\n", "params = [\"Vmag\", \"l\", \"b\", \"beta\", \"sigma_v\"]\n", "\n", "for sim in sims:\n", " X = [samples_to_getdist(get_samples(sim, catalogue), sim, catalogue)\n", " for catalogue in catalogues]\n", "\n", " g = plots.get_subplot_plotter()\n", " g.settings.figure_legend_frame = False\n", " g.settings.alpha_filled_add = 0.75\n", "\n", " g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n", " plt.gcf().suptitle(f'{sim}', y=1.025)\n", " plt.gcf().tight_layout()\n", " plt.gcf().savefig(f\"../../plots/calibration_{sim}.png\", dpi=500, bbox_inches='tight')\n", " plt.gcf().show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Stacking vs marginalising CB boxes\n", "\n", "#### $V_{\\rm ext}$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sim = \"csiborg2X\"\n", "catalogue = \"2MTF\"\n", "key = \"Vext\"\n", "\n", "X = [get_samples(sim, catalogue, nsim=nsim, convert_Vext_to_galactic=False)[key] for nsim in range(20)]\n", "Xmarg = get_samples(sim, catalogue, convert_Vext_to_galactic=False)[key]\n", "\n", "\n", "fig, axs = plt.subplots(1, 3, figsize=(15, 5), sharey=True)\n", "fig.suptitle(f\"{simname_to_pretty(sim)}, {catalogue}\")\n", "fig.subplots_adjust(wspace=0.0, hspace=0)\n", "\n", "for i in range(3):\n", " for n in range(20):\n", " axs[i].hist(X[n][:, i], bins=\"auto\", alpha=0.25, histtype='step',\n", " color='black', linewidth=0.5, density=1, zorder=0,\n", " label=\"Individual box\" if (n == 0 and i == 0) else None)\n", "\n", "axs[i].hist(np.hstack([X[n][:, i] for n in range(20)]), bins=\"auto\",\n", " histtype='step', color='blue', density=1,\n", " label=\"Stacked individual boxes\" if i == 0 else None)\n", "axs[i].hist(Xmarg[:, i], bins=\"auto\", histtype='step', color='red',\n", " density=1, label=\"Marginalised boxes\" if i == 0 else None)\n", " \n", "axs[0].legend(fontsize=\"small\", loc='upper left', frameon=False)\n", "\n", "axs[0].set_xlabel(r\"$V_{\\mathrm{ext}, x} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n", "axs[1].set_xlabel(r\"$V_{\\mathrm{ext}, y} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n", "axs[2].set_xlabel(r\"$V_{\\mathrm{ext}, z} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n", "axs[0].set_ylabel(\"Normalized PDF\")\n", "fig.tight_layout()\n", "fig.savefig(f\"../../plots/consistency_{sim}_{catalogue}_{key}.png\", dpi=450)\n", "fig.show()\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### $\\beta$ and others" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sim = \"csiborg2_main\"\n", "catalogue = \"Pantheon+\"\n", "key = \"alpha\"\n", "\n", "X = [get_samples(sim, catalogue, nsim=nsim, convert_Vext_to_galactic=False)[key] for nsim in range(20)]\n", "Xmarg = get_samples(sim, catalogue, convert_Vext_to_galactic=False)[key]\n", "\n", "\n", "plt.figure()\n", "plt.title(f\"{simname_to_pretty(sim)}, {catalogue}\")\n", "for n in range(20):\n", " plt.hist(X[n], bins=\"auto\", alpha=0.25, histtype='step',\n", " color='black', linewidth=0.5, density=1, zorder=0,\n", " label=\"Individual box\" if n == 0 else None)\n", "\n", "plt.hist(np.hstack([X[n] for n in range(20)]), bins=\"auto\",\n", " histtype='step', color='blue', density=1,\n", " label=\"Stacked individual boxes\")\n", "plt.hist(Xmarg, bins=\"auto\", histtype='step', color='red',\n", " density=1, label=\"Marginalised boxes\")\n", "\n", "plt.legend(fontsize=\"small\", frameon=False, loc='upper left', ncols=3)\n", "plt.xlabel(names_to_latex([key], True)[0])\n", "plt.ylabel(\"Normalized PDF\")\n", "\n", "plt.tight_layout()\n", "plt.savefig(f\"../../plots/consistency_{sim}_{catalogue}_{key}.png\", dpi=450)\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### SN/TFR Calibration consistency" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# catalogues = [\"LOSS\", \"Foundation\", \"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n", "catalogues = [\"Pantheon+\"]\n", "sims = [\"Carrick2015\", \"csiborg2_main\", \"csiborg2X\"]\n", "\n", "for catalogue in catalogues:\n", " X = [samples_to_getdist(get_samples(sim, catalogue), sim)\n", " for sim in sims]\n", "\n", " if \"Pantheon+\" in catalogue or catalogue in [\"Foundation\", \"LOSS\"]:\n", " params = [\"alpha_cal\", \"beta_cal\", \"mag_cal\", \"e_mu\"]\n", " else:\n", " params = [\"aTF\", \"bTF\", \"e_mu\"]\n", "\n", " g = plots.get_subplot_plotter()\n", " g.settings.figure_legend_frame = False\n", " g.settings.alpha_filled_add = 0.75\n", "\n", " g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n", " plt.gcf().suptitle(f'{catalogue}', y=1.025)\n", " plt.gcf().tight_layout()\n", " # plt.gcf().savefig(f\"../../plots/calibration_{catalogue}.png\", dpi=500, bbox_inches='tight')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### $V_{\\rm ext}$ comparison" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "catalogues = [\"LOSS\"]\n", "# sims = [\"Carrick2015\", \"csiborg2_main\", \"csiborg2X\"]\n", "sims = [\"Carrick2015\"]\n", "params = [\"Vmag\", \"l\", \"b\"]\n", "\n", "for sim in sims:\n", " X = [samples_to_getdist(get_samples(sim, catalogue), sim, catalogue)\n", " for catalogue in catalogues]\n", "\n", " g = plots.get_subplot_plotter()\n", " g.settings.figure_legend_frame = False\n", " g.settings.alpha_filled_add = 0.75\n", "\n", " g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n", " plt.gcf().suptitle(f'{simname_to_pretty(sim)}', y=1.025)\n", " plt.gcf().tight_layout()\n", " # plt.gcf().savefig(f\"../../plots/calibration_{sim}.png\", dpi=500, bbox_inches='tight')\n", " plt.gcf().show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Bulk flow in the simulation rest frame" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sims = [\"Carrick2015\", \"csiborg1\", \"csiborg2_main\", \"csiborg2X\"]\n", "convert_to_galactic = False\n", "\n", "fig, axs = plt.subplots(1, 3, figsize=(15, 5))\n", "cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n", "\n", "for i, sim in enumerate(sims):\n", " r, B = get_bulkflow_simulation(sim, convert_to_galactic=convert_to_galactic)\n", " if sim == \"Carrick2015\":\n", " if convert_to_galactic:\n", " B[..., 0] *= 0.43\n", " else:\n", " B *= 0.43\n", "\n", " for n in range(3):\n", " ylow, ymed, yhigh = np.percentile(B[..., n], [16, 50, 84], axis=0)\n", " axs[n].fill_between(r, ylow, yhigh, color=cols[i], alpha=0.5, label=simname_to_pretty(sim) if n == 0 else None)\n", "\n", "axs[0].legend()\n", "if convert_to_galactic:\n", " axs[0].set_ylabel(r\"$B ~ [\\mathrm{km} / \\mathrm{s}]$\")\n", " axs[1].set_ylabel(r\"$\\ell_B ~ [\\degree]$\")\n", " axs[2].set_ylabel(r\"$b_B ~ [\\degree]$\")\n", "else:\n", " axs[0].set_ylabel(r\"$B_{x} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n", " axs[1].set_ylabel(r\"$B_{y} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n", " axs[2].set_ylabel(r\"$B_{z} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n", "\n", "for n in range(3):\n", " axs[n].set_xlabel(r\"$R ~ [\\mathrm{Mpc}]$\")\n", "\n", "\n", "fig.tight_layout()\n", "fig.savefig(\"../../plots/bulkflow_simulations_restframe.png\", dpi=450)\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Bulk flow in the CMB rest frame" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sim = \"csiborg2_main\"\n", "catalogues = [\"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n", "\n", "\n", "fig, axs = plt.subplots(1, 3, figsize=(15, 5), sharex=True)\n", "cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n", "# fig.suptitle(f\"Calibrated against {catalogue}\")\n", "\n", "for i, catalogue in enumerate(catalogues):\n", " r, B = get_bulkflow(sim, catalogue, sample_beta=True, convert_to_galactic=True,\n", " weight_simulations=True, downsample=3)\n", " c = cols[i]\n", " for n in range(3):\n", " ylow, ymed, yhigh = np.percentile(B[..., n], [16, 50, 84], axis=-1)\n", " axs[n].plot(r, ymed, color=c)\n", " axs[n].fill_between(r, ylow, yhigh, alpha=0.5, color=c, label=catalogue)\n", "\n", "\n", "# CMB-LG velocity\n", "axs[0].fill_between([r.min(), 10.], [627 - 22, 627 - 22], [627 + 22, 627 + 22], color='black', alpha=0.5, zorder=0.5, label=\"CMB-LG\", hatch=\"x\")\n", "axs[1].fill_between([r.min(), 10.], [276 - 3, 276 - 3], [276 + 3, 276 + 3], color='black', alpha=0.5, zorder=0.5, hatch=\"x\")\n", "axs[2].fill_between([r.min(), 10.], [30 - 3, 30 - 3], [30 + 3, 30 + 3], color='black', alpha=0.5, zorder=0.5, hatch=\"x\")\n", "\n", "# LCDM expectation\n", "Rs,mean,std,mode,p05,p16,p84,p95 = np.load(\"/mnt/users/rstiskalek/csiborgtools/data/BulkFlowPlot.npy\")\n", "m = Rs < 175\n", "axs[0].plot(Rs[m], mode[m], color=\"violet\", zorder=0)\n", "axs[0].fill_between(Rs[m], p16[m], p84[m], alpha=0.25, color=\"violet\",\n", " zorder=0, hatch='//', label=r\"$\\Lambda\\mathrm{CDM}$\")\n", "\n", "for n in range(3):\n", " axs[n].set_xlabel(r\"$r ~ [\\mathrm{Mpc} / h]$\")\n", "\n", "axs[0].legend()\n", "axs[0].set_ylabel(r\"$B ~ [\\mathrm{km} / \\mathrm{s}]$\")\n", "axs[1].set_ylabel(r\"$\\ell_B ~ [\\mathrm{deg}]$\")\n", "axs[2].set_ylabel(r\"$b_B ~ [\\mathrm{deg}]$\")\n", "\n", "axs[0].set_xlim(r.min(), r.max())\n", "\n", "fig.tight_layout()\n", "fig.savefig(f\"../../plots/bulkflow_{sim}_{catalogue}.png\", dpi=450)\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Smoothing scale dependence" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "simname = \"Carrick2015\"\n", "catalogue = \"Pantheon+\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Goodness-of-fit" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "scales = [0, 4, 8, 16, 32]\n", "\n", "y = np.asarray([get_gof(\"BIC\", simname, catalogue, ksmooth=i)\n", " for i in range(len(scales))])\n", "ymin = y.min()\n", "\n", "y -= ymin\n", "y_CF4 = get_gof(\"BIC\", \"CF4\", catalogue) - ymin\n", "y_CF4gp = get_gof(\"BIC\", \"CF4gp\", catalogue) - ymin\n", "\n", "plt.figure()\n", "plt.axhline(y[0], color='blue', label=\"Carrick+2015, no smoothing\")\n", "plt.plot(scales[1:], y[1:], marker=\"o\", label=\"Carrick+2015, smoothed\")\n", "\n", "plt.axhline(y_CF4, color='red', label=\"CF4, no smoothing\")\n", "\n", "plt.xlabel(r\"$R_{\\rm smooth} ~ [\\mathrm{Mpc}]$\")\n", "plt.ylabel(r\"$\\Delta \\mathrm{BIC}$\")\n", "plt.legend(ncols=1)\n", "\n", "plt.tight_layout()\n", "plt.savefig(\"../../plots/test_smooth.png\", dpi=450)\n", "plt.show()\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sim = \"Carrick2015\"\n", "catalogue = \"Pantheon+\"\n", "\n", "\n", "X = [samples_to_getdist(get_samples(sim, catalogue, ksmooth=ksmooth), ksmooth)\n", " for ksmooth in [0, 1, 2]]\n", "\n", "params = [\"Vmag\", \"l\", \"b\", \"sigma_v\", \"beta\"]\n", "# if \"Pantheon+\" in catalogue or catalogue in [\"Foundation\", \"LOSS\"]:\n", "# params += [\"alpha_cal\", \"beta_cal\", \"mag_cal\", \"e_mu\"]\n", "# else:\n", "# params += [\"aTF\", \"bTF\", \"e_mu\"]\n", "\n", "\n", "\n", "g = plots.get_subplot_plotter()\n", "g.settings.figure_legend_frame = False\n", "g.settings.alpha_filled_add = 0.75\n", "\n", "g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n", "plt.gcf().suptitle(f'{catalogue}', y=1.025)\n", "plt.gcf().tight_layout()\n", "plt.gcf().savefig(f\"../../plots/calibration_{catalogue}.png\", dpi=500, bbox_inches='tight')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Indranil's void" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Evidence comparison" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "zcmb_max = 0.05\n", "\n", "sims = [\"no_field\", \"IndranilVoid_exp\"]\n", "cats = [\"LOSS\", \"Foundation\", \"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n", "\n", "neglnZ = {}\n", "for sim in sims:\n", " for cat in cats:\n", " sample_alpha = sim not in [\"IndranilVoid_exp\", \"no_field\"]\n", " fname = paths.flow_validation(\n", " fdir, sim, cat, inference_method=\"mike\",\n", " sample_alpha=sample_alpha, zcmb_max=zcmb_max)\n", "\n", " neglnZ[f\"{sim}_{cat}\"] = get_gof(\"neg_lnZ_harmonic\", fname)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "simA = sims[0]\n", "simB = sims[1]\n", "\n", "print(f\"lnZ_({simA}) - lnZ_({simB})\\n\")\n", "for cat in cats:\n", " lnZ_A = - neglnZ[f\"{simA}_{cat}\"]\n", " lnZ_B = - neglnZ[f\"{simB}_{cat}\"]\n", " print(f\"{cat:15s} {lnZ_A - lnZ_B:.1f}\")\n", "\n", "\n", "print(f\"\\n(Positive -> preference for {simA})\")" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(\"/mnt/extraspace/rstiskalek/catalogs/v_pec_EXP_IndranilVoid.dat\")\n", "\n", "r = np.arange(0, 251)\n", "phi = np.arange(0, 181)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure()\n", "plt.plot(phi, data[:, 100])\n", "plt.xlabel(r\"$\\phi ~ [\\mathrm{deg}]$\")\n", "plt.ylabel(r\"$V ~ [\\mathrm{km} / \\mathrm{s}]$\")\n", "\n", "plt.xlim(0, 180)\n", "plt.tight_layout()\n", "plt.savefig(\"../../plots/profile.png\", dpi=450)\n", "\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "venv_csiborg", "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.11.4" } }, "nbformat": 4, "nbformat_minor": 2 }