From e3ce2fbc41231d9015ba6d2b81183a21e22fe3f9 Mon Sep 17 00:00:00 2001 From: Eleni Date: Fri, 9 Dec 2022 16:17:48 +0100 Subject: [PATCH] minimally invasive approach --- python/_cosmo_power.pyx | 4 ++-- src/cosmopower.cpp | 32 ++------------------------------ src/cosmopower.hpp | 6 +----- 3 files changed, 5 insertions(+), 37 deletions(-) diff --git a/python/_cosmo_power.pyx b/python/_cosmo_power.pyx index bf4bd4b..7889d17 100644 --- a/python/_cosmo_power.pyx +++ b/python/_cosmo_power.pyx @@ -43,6 +43,7 @@ cdef extern from "cosmopower.hpp" namespace "CosmoTool": CosmoPower() void setFunction(CosmoFunction) + void setFunction_BAO(CosmoFunction,double,double,double) void updateCosmology() void updatePhysicalCosmology() void normalize(double,double) @@ -101,8 +102,7 @@ cdef class CosmologyPower: """ self.power.SIGMA8 = s8 self.power.normalize(k_min, k_max) - - + def setFunction(self,funcname): """setFunction(self, funcname) diff --git a/src/cosmopower.cpp b/src/cosmopower.cpp index 7ecaf2d..9c50588 100644 --- a/src/cosmopower.cpp +++ b/src/cosmopower.cpp @@ -212,30 +212,6 @@ double CosmoPower::powerHuWiggles(double k) return normPower * pow(k,n) * T_k * T_k; } -double CosmoPower::BAO_Tk(double k){ - - double no_wiggle_tk = noWiggleTk(k); - - double A = 0; - double r_s = 10; - double k_D = 2 * M_PI / 100; - - //sqrt as we want to make the parameterization part of the transfer function - double param = sqrt(1 + A * sin(k * r_s) * exp(- k / k_D)); - return no_wiggle_tk * param; - -} - -double CosmoPower::sample_BAO(double k) -{ - // BAO wiggle parameterization for reconstruction - // Babic et al. 2022, https://arxiv.org/abs/2203.06177 - - double T_k = BAO_Tk(k); - - return normPower * pow(k,n) * T_k * T_k; - } - double CosmoPower::primordialPowerSpectrum(double k) { //Primordial power spectrum, needed for PNG @@ -481,18 +457,14 @@ void CosmoPower::setFunction(CosmoFunction f) case POWER_SUGIYAMA: eval = &CosmoPower::powerSugiyama; break; - case SAMPLE_WIGGLES: - eval = &CosmoPower::sample_BAO; - break; case POWER_BDM: eval = &CosmoPower::powerBDM; break; + case NOWIGGLE_TK: + eval = &CosmoPower::noWiggleTk; case POWER_TEST: eval = &CosmoPower::powerTest; break; - case BAO_TK: - eval = &CosmoPower::BAO_Tk; - break; default: abort(); } diff --git a/src/cosmopower.hpp b/src/cosmopower.hpp index 86ad8b1..ea36102 100644 --- a/src/cosmopower.hpp +++ b/src/cosmopower.hpp @@ -90,15 +90,13 @@ namespace CosmoTool { POWER_BDM, POWER_TEST, HU_WIGGLES_ORIGINAL, - SAMPLE_WIGGLES, - BAO_TK + NOWIGGLE_TK }; CosmoPower(); ~CosmoPower(); void setFunction(CosmoFunction f); - void updateCosmology(); void updatePhysicalCosmology(); void normalize(double k_min = -1, double k_max = -1); @@ -124,9 +122,7 @@ namespace CosmoTool { double powerBDM(double k); double powerTest(double k); double powerHuWigglesOriginal(double k); - double sample_BAO(double k); double noWiggleTk(double k); - double BAO_Tk(double k); }; };