LCDM Sampling¶
cmb_lensing.sample_lcdm.sample_joint ¶
sample_joint(data_set, param_init, proposal_sigmas, param_ranges, should_sample, noise_level, advanced_logging, fixed_fields=False, phi_init='MAP', hmc_num_steps=DEFAULT_HMC_NUM_STEPS, hmc_step_size=DEFAULT_HMC_STEP_SIZE, iters_per_chain=10000, num_burn_in_fix_theta=100, num_burn_in_always_accept=0, resume_chain_dict=None, seed=None, map_idx=1, sub_chain_idx=1, lmax=DEFAULT_MAX_ELL, metropolis_num_steps=1, hpc_path=None)
Gibbs-sample the joint posterior P(f, phi, theta | d) of the field, the lensing potential and the five LCDM parameters.
Each iteration draws f from its conditional, takes one HMC step on the mixed phi, then one
random-walk Metropolis move per sampled parameter on the mixed logpdf, and recomputes the
covariance and mixing matrices at the accepted parameters. The parameters are named as in
constants.PARAM_ORDER: "theta_MC_100", "logA", "ns", "ombh2", "omch2". The spectra come
from the 5D CAMB grid spline (camb_splines/camb_grid_spline.npz, downloaded on first
use).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_set
|
The data, a |
required | |
param_init
|
{name: value} starting point, all five parameters. |
required | |
proposal_sigmas
|
{name: width} of the Gaussian Metropolis proposal per parameter. The parameters are updated in this dict's order. Tune toward ~44 % acceptance. |
required | |
param_ranges
|
{name: (low, high)}; proposals outside the range are rejected. |
required | |
should_sample
|
{name: bool}; parameters set to False stay at |
required | |
noise_level
|
White noise level of the data in uK-arcmin. |
required | |
advanced_logging
|
{"phi_acceptance", "lcdm_acceptance", "plot_log_pdf",
"plot_lcdm_sigmas": bool}. The first two print running acceptance rates, the
last two overwrite progress plots in |
required | |
fixed_fields
|
Debugging option: hold f and phi at the data set's true fields and sample theta only. |
False
|
|
phi_init
|
Starting phi: "MAP" (the |
'MAP'
|
|
hmc_num_steps
|
Leapfrog steps per phi HMC step. |
DEFAULT_HMC_NUM_STEPS
|
|
hmc_step_size
|
Leapfrog step size. Tune toward ~65 % phi acceptance. |
DEFAULT_HMC_STEP_SIZE
|
|
iters_per_chain
|
Number of Gibbs iterations. |
10000
|
|
num_burn_in_fix_theta
|
Iterations before the parameters start to move. |
100
|
|
num_burn_in_always_accept
|
Iterations for which every phi HMC step is accepted. |
0
|
|
resume_chain_dict
|
Restart a saved chain: a dict with one entry per parameter name,
"phi_map" and "sub_key" (e.g. |
None
|
|
seed
|
Seed of the chain's random numbers. None draws one at random. |
None
|
|
map_idx
|
Data-map index used in the history file names. |
1
|
|
sub_chain_idx
|
Chain index used in the history file names. |
1
|
|
lmax
|
Largest multipole of the spectra. |
DEFAULT_MAX_ELL
|
|
metropolis_num_steps
|
Metropolis moves per parameter per iteration. |
1
|
|
hpc_path
|
If set, every iteration appends each sampled parameter's latest value to
|
None
|
Returns:
| Type | Description |
|---|---|
(param_vals, phi, sub_key)
|
param_vals is a dict of per-parameter lists of the |
|
chain's values (starting with |
|
|
sub_key the final random key, which together with the last parameter values let a |
|
|
chain be resumed. |
Source code in cmb_lensing/sample_lcdm.py
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 | |