Skip to content

Commit

Permalink
stashing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Belkner committed Jun 28, 2024
1 parent 6f622e9 commit 0b1f8f5
Show file tree
Hide file tree
Showing 4 changed files with 398 additions and 27 deletions.
2 changes: 1 addition & 1 deletion delensalot/core/power/pospace.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import healpy as hp
import numpy as np

from plancklens.wigners import wigners
# from plancklens.wigners import wigners
from plancklens import utils


Expand Down
10 changes: 9 additions & 1 deletion delensalot/sims/sims_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ def get_sim_phi(self, simidx, space):
if not self.cacher.is_cached(fn):
if self.libdir_phi == DNaV:
log.debug('generating phi from cl')
print('generating phi from cl')
Clpf = self.cls_lib.get_sim_clphi(simidx)
self.phi_field = self.cls_lib.phi_field
Clp = self.clpf2clppot(Clpf)
Expand All @@ -437,6 +438,7 @@ def get_sim_phi(self, simidx, space):
if space == 'map':
phi = self.geom_lib.alm2map(phi, lmax=self.phi_lmax, mmax=self.phi_lmax, nthreads=4)
self.cacher.cache(fn, phi)
print('found phi in cacher')
return self.cacher.load(fn)


Expand All @@ -459,18 +461,24 @@ def clpf2clppot(self, cl):


def cl2alm(self, cls, field, seed):
np.random.seed(int(seed)) # check if this starting point is random
# np.random.seed(int(seed)+100000)
np.random.seed(int(seed))
if field == 'polarization':
alms = hp.synalm(cls, self.lmax, new=True)
# np.random.seed(int(seed)+1000000)
return alms[1:]
elif field == 'temperature':
alm = hp.synalm(cls, self.lmax)
return alm[0]


def clp2plm(self, clp, seed):
# np.random.seed(int(seed)+1000)
np.random.seed(int(seed))
# Cls = self.cls_lib.get_TEBunl(seed)[:,self.phi_lmax+1]
# plm = hp.synalm(np.concatenate([Cls,clp]), self.phi_lmax)
plm = hp.synalm(clp, self.phi_lmax)
# np.random.seed(int(seed)+10000)
return plm


Expand Down
8 changes: 4 additions & 4 deletions first_steps/notebooks/conf_mwe_fullsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
"""

import numpy as np
import healpy
import os
from os.path import join as opj

import delensalot
import delensalot.core.power.pospace as pospace
# import delensalot.core.power.pospace as pospace
from delensalot.utility.utils_hp import gauss_beam
from delensalot.config.config_helper import LEREPI_Constants as lc
from delensalot.config.metamodel.dlensalot_mm import *
Expand All @@ -21,7 +22,7 @@
jobs = ["generate_sim", "QE_lensrec", "MAP_lensrec"]
),
analysis = DLENSALOT_Analysis(
key = 'p_p',
key = 'p',
simidxs = np.arange(0,1),
TEMP_suffix = 'my_first_dlensalot_analysis_fullsky',
beam = 1.0,
Expand All @@ -32,7 +33,6 @@
flavour = 'unl',
lmax = 4096,
phi_lmax = 5120,
phi_modifier = DnAV,
transfunction = gauss_beam(1.0/180/60 * np.pi, lmax=4096),
nlev = {'P': np.sqrt(2), 'T': np.sqrt(1)},
geominfo = ('healpix', {'nside': 2048}),
Expand Down Expand Up @@ -65,6 +65,6 @@
Cl_fid = 'ffp10',
libdir_it = None,
binning = 'binned',
spectrum_calculator = pospace,
spectrum_calculator = healpy,
)
)
405 changes: 384 additions & 21 deletions first_steps/notebooks/interactive_mwe.ipynb

Large diffs are not rendered by default.

0 comments on commit 0b1f8f5

Please sign in to comment.