From 7cb65744f3108cb5d5627253b4369ae901c9b537 Mon Sep 17 00:00:00 2001 From: hoellinger Date: Sun, 25 May 2025 19:15:55 +0200 Subject: [PATCH] minor --- .gitignore | 1 + notebooks/3_constants.ipynb | 101 ++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 notebooks/3_constants.ipynb diff --git a/.gitignore b/.gitignore index df040a3..997c7a4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ *.o *.so */build/* +*egg-info* ############ # Packages # diff --git a/notebooks/3_constants.ipynb b/notebooks/3_constants.ipynb new file mode 100644 index 0000000..6be57f3 --- /dev/null +++ b/notebooks/3_constants.ipynb @@ -0,0 +1,101 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "65c59396", + "metadata": {}, + "source": [ + "Tristan Hoellinger
\n", + "Institut d'Astrophysique de Paris
\n", + "tristan.hoellinger@iap.fr" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "5b0cf9e5", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "eae75fe1", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Min k (1D): 0.025 h/Mpc\n", + "Min k: 0.014 h/Mpc\n", + "Nyquist ('particles grid'): 3.14 h/Mpc\n", + "Nyquist (density grid): 6.28 h/Mpc\n", + "Nyquist (PM grid): 6.28 h/Mpc\n", + "Particle wavenumber: 104.72 h/Mpc\n", + "Split wavenumber: 10.05 h/Mpc\n", + "Short-range reach: 2.23 h/Mpc\n" + ] + } + ], + "source": [ + "L = 256\n", + "N = 512\n", + "Np = 256\n", + "Npm = 512\n", + "min_k_1D = 2 * np.pi / L\n", + "min_k = 2 * np.pi / L / np.sqrt(3)\n", + "nyquist = np.pi * N / L\n", + "nyquist_PM = np.pi * Npm / L\n", + "nyquist_particles = np.pi * Np / L\n", + "epsilon = 0.03 * L / Np\n", + "particle_length = 2*epsilon\n", + "xs = 1.25 * L / Npm\n", + "xr = 4.5 * xs\n", + "particle_wavenumber = 2*np.pi / particle_length\n", + "xs_inv = 2*np.pi / xs\n", + "xr_inv = 2*np.pi / xr\n", + "print(f\"Min k (1D): {min_k_1D:.3f} h/Mpc\")\n", + "print(f\"Min k: {min_k:.3f} h/Mpc\")\n", + "print(f\"Nyquist ('particles grid'): {nyquist_particles:.2f} h/Mpc\")\n", + "print(f\"Nyquist (density grid): {nyquist:.2f} h/Mpc\")\n", + "print(f\"Nyquist (PM grid): {nyquist_PM:.2f} h/Mpc\")\n", + "print(f\"Particle wavenumber: {particle_wavenumber:.2f} h/Mpc\")\n", + "print(f\"Split wavenumber: {xs_inv:.2f} h/Mpc\")\n", + "print(f\"Short-range reach: {xr_inv:.2f} h/Mpc\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "16e60561", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "p3m", + "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.13.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}