Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
460f86c
Some more optimisation in covariance constructor, more flexible file …
andrejdvornik Nov 18, 2025
98ac0f9
Include last element
andrejdvornik Nov 18, 2025
5943034
More changes to covariance constructor
andrejdvornik Nov 18, 2025
12e34cc
Some fixes
andrejdvornik Nov 19, 2025
60b9d07
Create separate make_cosmosis_nz for 3x2pt
andrejdvornik Nov 20, 2025
3125ef2
Merge remote-tracking branch 'upstream/master' into 3x2pt
andrejdvornik Nov 20, 2025
4da0590
Fixed capitalisation
andrejdvornik Nov 20, 2025
7539da0
Revert comment
andrejdvornik Nov 20, 2025
f368c83
Revert comment
andrejdvornik Nov 20, 2025
9771b88
Revert changes
andrejdvornik Nov 20, 2025
afdabe8
More fixes to covariance constructor
andrejdvornik Nov 20, 2025
1b9d5d3
Temp fix to psi_stats
andrejdvornik Nov 20, 2025
5891829
Fix blocklist
andrejdvornik Nov 21, 2025
477d2fa
Flexible stats selection given MODES
andrejdvornik Nov 21, 2025
4a9bb4e
Clearer error message
andrejdvornik Nov 21, 2025
00c695b
Better handling of nzs in make_cosmosis_nz_3x2pt
andrejdvornik Nov 21, 2025
c8d3724
Better logic in make_cosmosis_nz
andrejdvornik Nov 21, 2025
556090b
More fixes
andrejdvornik Nov 21, 2025
302c626
Remove message
andrejdvornik Nov 21, 2025
b7c232a
Fix patch message
andrejdvornik Nov 21, 2025
b7ccf10
Fix names of lens and obs nzs
andrejdvornik Nov 24, 2025
ced8fb2
More optimisation of prepare_cosmosis.sh
andrejdvornik Nov 24, 2025
866b72b
Implemented bin averaging for 1 point statistics
andrejdvornik Nov 27, 2025
02548be
Moved normalisation to sacc creation instead of likelihood code
andrejdvornik Dec 3, 2025
b024918
Fix covariance constructor
andrejdvornik Dec 5, 2025
fdfd749
Optimisation of cov filters handling
andrejdvornik Dec 9, 2025
5db397a
Update to onepower settings
andrejdvornik Jan 16, 2026
31e70ca
Rename variables
andrejdvornik Jan 16, 2026
d19abf0
Added check for zmin/zmax limits in calc_smf.py
andrejdvornik Jan 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion man/add_datavector.man.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ function _outputs {
then
output="obs_vec"
else
_message "BV:DATAVEC_TYPE is not set to a known value: ${DATAVEC_TYPE^^} is not one of {COSEBIS,PSI_STATS_GM,PSI_STATS_GG,BANDPOWERS_EE,BANDPOWERS_NE,BANDPOWERS_NN,XIPM,GT,WT}"
_message "BV:DATAVEC_TYPE is not set to a known value: ${DATAVEC_TYPE^^} is not one of {COSEBIS,PSI_STATS_GM,PSI_STATS_GG,BANDPOWERS_EE,BANDPOWERS_NE,BANDPOWERS_NN,XIPM,GT,WT,OBS}"
exit 1
fi
#}}}
_message "$output"
echo ${output}
}
#}}}
Expand Down
7 changes: 5 additions & 2 deletions man/calculate_psistats.man.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ function _inp_data {
# Output data {{{
function _outputs {
#Data outputs (leave blank if none)
output=`_parse_blockvars psi_stats_@BV:MODES@`
echo $output
# Need to fix this to output gg and gm instad of nn and ne
echo psi_stats_gm psi_stats_gg
#output=`_parse_blockvars psi_stats_@BV:MODES@`
#output=${output,,}
#echo $output
}
#}}}

Expand Down
144 changes: 144 additions & 0 deletions man/make_cosmosis_nz_3x2pt.man.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#
# make_cosmosis_nz.sh Documentation & Housekeeping functions
#

#Starting Prompt {{{
function _prompt {
#Check if we do want verbose output
if [ "$1" != "0" ]
then
_message "@BLU@========================================@DEF@\n"
_message "@BLU@== @RED@ Running make_cosmosis_nz_3x2pt.sh Mode @BLU@ ==@DEF@\n"
_message "@BLU@========================================@DEF@\n"
fi
}
#}}}

#Mode description {{{
function _description {
echo "#"
echo '# Construct an Nz file in the format expected by '
echo '# cosmosis'
echo "#"
echo "# Function takes input data:"
echo "# `_inp_data`"
echo "#"
}
#}}}

# Abort Message {{{
_abort()
{
#Message to print when script aborts
#$0 is the script that was running when this error occurred
_message "@BLU@ An error occured while running:\n@DEF@$0.\n" >&2
_message "@BLU@ Check the logging file for this step in:\n" >&2
_message "@DEF@@RUNROOT@/@LOGPATH@/\n" >&2
exit 1
}
trap '_abort' 0
set -e
#}}}

# Input variables {{{
function _inp_var {
#Variable inputs (leave blank if none)
echo ALLPATCH BLU BV:MODES BV:NLENSBINS BV:NSMFLENSBINS BV:PATCHLIST BV:TOMOLIMS DATABLOCK DEF PYTHON3BIN RED RUNROOT SCRIPTPATH STORAGEPATH
}
#}}}

# Input data {{{
function _inp_data {
#Data inputs (leave blank if none)
outlist=''
#input is dynamic, depending on the value of BV:COSMOSIS_PATCHLIST
patchvar="@BV:COSMOSIS_PATCHLIST@"
patchvar=`_parse_blockvars ${patchvar}`
MODES_IN=`_parse_blockvars @BV:MODES@`
modes=''
if [[ .*\ $MODES_IN\ .* =~ " EE " ]] || [[ .*\ $MODES_IN\ .* =~ " NE " ]]
then
modes="${modes} source"
fi
if [[ .*\ $MODES_IN\ .* =~ " NE " ]] || [[ .*\ $MODES_IN\ .* =~ " NN " ]]
then
modes="${modes} lens"
fi
if [[ .*\ $MODES_IN\ .* =~ " OBS " ]]
then
modes="${modes} obs"
fi
#Define the patches to loop over {{{
if [ "${patchvar}" == "ALL" ] || [ "${patchvar}" == "@BV:COSMOSIS_PATCHLIST@" ]
then
patchlist=`echo @BV:PATCHLIST@ @ALLPATCH@ @ALLPATCH@comb`
else
patchlist="${patchvar}"
fi
#}}}
for mode in ${modes}
do
for patch in ${patchlist}
do
#>&2 echo ${patch}
outlist="${outlist} cosmosis_neff_${mode} nz_${mode}_${patch}"
done
done
echo ${outlist}
}
#}}}

# Output data {{{
function _outputs {
#Data outputs (leave blank if none)
outlist=''
patchvar="@BV:COSMOSIS_PATCHLIST@"
patchvar=`_parse_blockvars ${patchvar}`
MODES_IN=`_parse_blockvars @BV:MODES@`
modes=''
if [[ .*\ $MODES_IN\ .* =~ " EE " ]] || [[ .*\ $MODES_IN\ .* =~ " NE " ]]
then
modes="${modes} source"
fi
if [[ .*\ $MODES_IN\ .* =~ " NE " ]] || [[ .*\ $MODES_IN\ .* =~ " NN " ]]
then
modes="${modes} lens"
fi
if [[ .*\ $MODES_IN\ .* =~ " OBS " ]]
then
modes="${modes} obs"
fi
#Define the patches to loop over {{{
if [ "${patchvar}" == "ALL" ] || [ "${patchvar}" == "@BV:COSMOSIS_PATCHLIST@" ]
then
patchlist=`echo @BV:PATCHLIST@ @ALLPATCH@ @ALLPATCH@comb`
else
patchlist="${patchvar}"
fi
for mode in ${modes}
do
for patch in ${patchlist}
do
outlist="${outlist} cosmosis_nz_${mode}_${patch}"
done
done
echo ${outlist}
}
#}}}

# Execution command {{{
function _runcommand {
#Command for running the script
echo bash @RUNROOT@/@SCRIPTPATH@/make_cosmosis_nz_3x2pt.sh
}
#}}}

# Unset Function command {{{
function _unset_functions {
#Remove these functions from the environment
unset -f _prompt _description _inp_data _inp_var _abort _outputs _runcommand _unset_functions
}
#}}}

#Additional Functions

2 changes: 1 addition & 1 deletion scripts/add_gt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ then
outlist=${file}
elif [ -d @BV:TREECORRGT@ ]
then
filelist=`ls @BV:TREECORRGT@/*.asc*`
filelist=`ls @BV:TREECORRGT@/*.txt*`
for file in ${filelist}
do
cp ${file} @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/gt/${file##*/}
Expand Down
2 changes: 1 addition & 1 deletion scripts/add_wt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ then
outlist=${file}
elif [ -d @BV:TREECORRWT@ ]
then
filelist=`ls @BV:TREECORRWT@/*.asc*`
filelist=`ls @BV:TREECORRWT@/*.txt*`
for file in ${filelist}
do
cp ${file} @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/wt/${file##*/}
Expand Down
2 changes: 1 addition & 1 deletion scripts/add_xipm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ then
outlist=${file}
elif [ -d @BV:TREECORRXIPM@ ]
then
filelist=`ls @BV:TREECORRXIPM@/*.asc*`
filelist=`ls @BV:TREECORRXIPM@/*.txt*`
for file in ${filelist}
do
cp ${file} @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/xipm/${file##*/}
Expand Down
5 changes: 4 additions & 1 deletion scripts/calc_smf.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@
stellar_mass_in = data[stellar_mass_column]
z_in = data[z_column]

# Check that data covers min_z, max_z
if not np.any((z_in >= min_z) & (z_in <= max_z)):
raise ValueError(f"No data in redshift range {min_z} < z < {max_z}")

# We set the possible minimum z to 0.001
z_min = np.maximum(0.001, min_z)
# max_z is given as an input, this is the maximum redshift in the stellar mass-redshift bin.
Expand All @@ -151,7 +155,6 @@
# or maximum redshift of the stellar mass-redshift bin
z_max_i = np.minimum(z_max_bin, z_max)


if estimator == 'simple':
# Comoving distance at z_min and z_max_i in units of Mpc h
# z_max_i is the maximum redshift at which galaxy i is visible in the sample
Expand Down
45 changes: 22 additions & 23 deletions scripts/cosmosis_constructor_3x2pt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ zmax_def = 1.2
nmass_def = 100 ; 200
logmassmin_def = 9.0
logmassmax_def = 18.0
beta_nl = True
mead2020_corrections = fit_feedback
nonlinear_mode = bnl
hmcode_ingredients = fit

SAMPLER_NAME = @BV:SAMPLER@
RUN_NAME = %(SAMPLER_NAME)s_%(blind)s${CHAINSUFFIX}
Expand Down Expand Up @@ -591,7 +591,7 @@ input_section_name = shear_cl
output_section_name = shear_xi

[xip_conv]
file = %(CSL_PATH)s/utility/convert_theta/convert_theta.py
file = %(HMPATH)s/cosmosis_modules/convert_theta/convert_theta.py
output_units = arcmin
section_name = shear_xi_plus

Expand Down Expand Up @@ -704,7 +704,7 @@ cat > @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/cosmosis_inputs/@SURVEY@_CosmoPipe_con
[multinest]
max_iterations=100000
multinest_outfile_root= %(OUTPUT_FOLDER)s/%(RUN_NAME)s_
resume=T
resume=F
tolerance = 0.01
constant_efficiency = F
live_points = 1000
Expand Down Expand Up @@ -738,13 +738,13 @@ fast_slow="F"
n_batch=`echo "@BV:NTHREADS@" | awk '{printf "%d", 4*$1}'`
cat > @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/cosmosis_inputs/@SURVEY@_CosmoPipe_constructed_sampler.ini <<- EOF
[nautilus]
live_points = 4000
n_live = 4000
enlarge_per_dim = 1.1
split_threshold = 100
n_networks = 8
n_batch = $n_batch
filepath = %(OUTPUT_FOLDER)s/run_nautilus.hdf5
resume = False ; True
resume = False ; True
f_live = 0.01
discard_exploration = True
verbose = True
Expand Down Expand Up @@ -1062,15 +1062,14 @@ EOF
fi
cat >> @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/cosmosis_inputs/@SURVEY@_CosmoPipe_constructed_pipe.ini <<- EOF
extra_output = ${extraparams} ${shifts} ${listparam} ${tpdparams}
quiet = T
timing = F ; T
debug = F
fast_slow = ${fast_slow}
first_fast_module = hod ; halo_model_ingredients_halomod

[runtime]
sampler = %(SAMPLER_NAME)s
verbosity = quiet
verbosity = quiet ; normal ; quiet
pool_stdout = F ; T

[output]
Expand Down Expand Up @@ -1215,15 +1214,15 @@ do
sets=""
if [[ .*\ $MODES\ .* =~ " EE " ]] || [[ .*\ $MODES\ .* =~ " NE " ]]
then
sets="${sets} %(redshift_name)s"
sets="${sets} %(redshift_name)s"
fi
if [[ .*\ $MODES\ .* =~ " NE " ]] || [[ .*\ $MODES\ .* =~ " NN " ]]
then
sets="${sets} %(redshift_name_lens)s"
sets="${sets} %(redshift_name_lens)s"
fi
if [[ .*\ $MODES\ .* =~ " OBS " ]]
then
sets="${sets} %(redshift_name_obs)s"
sets="${sets} %(redshift_name_obs)s"
fi
cat >> @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/cosmosis_inputs/@SURVEY@_CosmoPipe_constructed_other.ini <<- EOF
[$module]
Expand Down Expand Up @@ -1432,8 +1431,8 @@ do

if [ "$add_intrinsic" == "True" ]
then
cat >> @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/cosmosis_inputs/@SURVEY@_CosmoPipe_constructed_other.ini <<- EOF
[$module]
cat >> @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/cosmosis_inputs/@SURVEY@_CosmoPipe_constructed_other.ini <<- EOF
[$module]
file= %(HMPATH)s/cosmosis_modules/onepower_interface.py
p_mm = ${ee}
p_gg = ${nn}
Expand All @@ -1445,29 +1444,29 @@ do

EOF
else
cat >> @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/cosmosis_inputs/@SURVEY@_CosmoPipe_constructed_other.ini <<- EOF
[$module]
cat >> @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/cosmosis_inputs/@SURVEY@_CosmoPipe_constructed_other.ini <<- EOF
[$module]
file= %(HMPATH)s/cosmosis_modules/onepower_interface.py
p_mm = ${ee}
p_gg = ${nn}
p_gm = ${ne}
p_gI = False
p_mI = False
p_II = False
p_mm = ${ee}
p_gg = ${nn}
p_gm = ${ne}
p_gI = False
p_mI = False
p_II = False
split_ia = True

EOF
fi

cat >> @RUNROOT@/@STORAGEPATH@/@DATABLOCK@/cosmosis_inputs/@SURVEY@_CosmoPipe_constructed_other.ini <<- EOF
bnl = %(beta_nl)s
nonlinear_mode = %(nonlinear_mode)s
update_bnl = 10
poisson_type = constant
point_mass = True
dewiggle = True
response = False
output_suffix = onepower
use_mead2020_corrections = %(mead2020_corrections)s
hmcode_ingredients = %(hmcode_ingredients)s

log_mass_min = %(logmassmin_def)s
log_mass_max = %(logmassmax_def)s
Expand Down
Loading