Skip to content

Commit

Permalink
small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Belkner committed Mar 8, 2024
1 parent 3f57735 commit 85c9677
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion delensalot/config/config_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LEREPI_Constants:
cmbs4_edges = np.array([2, 30, 60, 90, 120, 150, 180, 200, 300, 500, 700, 1000, 1500, 2000, 3000, 4000, 5000])
SPDP_edges = np.concatenate([np.arange(2,200,50),np.logspace(np.log(2e2),np.log(4000),40, base=np.e, dtype=int)]) # these are used for calculating residual power spectra on SPDP patch.
SPDP2_edges = np.arange(2,4000,30) # these are used for calculating residual power spectra on SPDP patch.

AoA_edges = np.array([2, 40, 70, 110, 140, 170, 200, 300, 500, 700, 1000, 1500, 2000, 3000, 4000, 5000])

class data_functions:

Expand Down
4 changes: 4 additions & 0 deletions delensalot/config/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ def __init__(self, parser, config_model=None):
if self.configfile.dlensalot_model.noisemodel.OBD == 'OBD':
# Catch build_OBD, iff noisemodel.obd is True. Else don't calculate (mpi tasks should still be fixed.. but 'run-anyway' applies)
self.configfile.dlensalot_model.job.jobs.append(sortedjob)
elif sortedjob == 'analyse_phi':
## only add this job if input phi exists.
if self.configfile.dlensalot_model.simulationdata.flavour == 'unl':
self.configfile.dlensalot_model.job.jobs.append(sortedjob)
else:
self.configfile.dlensalot_model.job.jobs.append(sortedjob)
## adding 'analyse_phi' into every run as long as MAP_lensrec is part of the run and input phi exists
Expand Down
4 changes: 3 additions & 1 deletion delensalot/config/transformer/lerepi2dlensalot.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def process_Analysis(dl, an, cf):
dl.simidxs = an.simidxs
dl.simidxs_mf = np.array(an.simidxs_mf) if dl.version != 'noMF' else np.array([])
# dl.simidxs_mf = dl.simidxs if dl.simidxs_mf.size == 0 else dl.simidxs_mf
dl.Nmf = 0 if dl.version == 'noMF' else len(dl.simidxs_mf)
dl.Nmf = 0 if dl.version == 'noMF' else len(dl.simidxs_mf) # FIXME dont make intermediate parameters depend on each other...
if cf.itrec.mfvar.startswith('/'):
dl.Nmf = 10000 #give this a big number.. the actual number doesnt matter, as long as it is bigger than 1
dl.TEMP_suffix = an.TEMP_suffix
dl.TEMP = transform(cf, l2T_Transformer())
dl.cls_unl = camb_clfile(an.cls_unl)
Expand Down
13 changes: 7 additions & 6 deletions delensalot/core/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ def get_meanfield(self, simidx):
# Either return MC MF, filter.qlms_mf, or mfvar
ret = np.zeros_like(self.qlms_dd.get_sim_qlm(self.k, 0))
fn_mf = opj(self.libdir_QE, 'mf_allsims.npy')
if np.dtype(self.mfvar) == str:
if type(self.mfvar) == str:
if self.mfvar == 'qlms_mf':
# calculate MF estimate using Lewis&Carron trick
mchain = self.get_mchain(0, 'p')
Expand All @@ -844,11 +844,12 @@ def get_meanfield(self, simidx):
if simidx in self.simidxs_mf:
ret = (ret - self.qlms_dd.get_sim_qlm(self.k, int(simidx)) / self.Nmf) * (self.Nmf / (self.Nmf - 1))
else:
# mfvar, and exclude the current simidx from the mfvar simset (qlms_dd_mfvar)
ret = hp.read_alm(self.mfvar)
if simidx in self.simidxs_mf:
ret = (ret - self.qlms_dd_mfvar.get_sim_qlm(self.k, int(simidx)) / self.Nmf) * (self.Nmf / (self.Nmf - 1))

# mfvar, ..
# FIXME mfvar comes from different simulations, so can probably ignore excluding current simidx..
ret = np.load(self.mfvar)
# if simidx in self.simidxs_mf:
# ret = (ret - self.qlms_dd_mfvar.get_sim_qlm(self.k, int(simidx)) / self.Nmf) * (self.Nmf / (self.Nmf - 1))
log.info('returning mfvar meanfield')
return ret

return ret
Expand Down
3 changes: 0 additions & 3 deletions delensalot/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""run.py: Entry point for running delensalot
"""


import os, sys
import logging
import traceback
Expand All @@ -15,7 +14,6 @@
from delensalot.config.etc.abstract import parserclass
from delensalot.config.parser import lerepi_parser


datefmt = "%m-%d %H:%M:%S"
FORMAT = '%(levelname)s:: %(asctime)s:: %(name)s.%(funcName)s - %(message)s'
formatter = logging.Formatter(FORMAT, datefmt=datefmt)
Expand All @@ -31,7 +29,6 @@
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)


class run():
"""Entry point for the interactive mode
"""
Expand Down

0 comments on commit 85c9677

Please sign in to comment.