diff --git a/.gitignore b/.gitignore index f22dd87ad..11ccb9fe5 100644 --- a/.gitignore +++ b/.gitignore @@ -78,3 +78,4 @@ commander3/todscripts/quiet/quiet_qband_beam_instrumental_v1.fits #--------------------------------------------------------------- commander3/parameter_files/defaults/bands/DIRBE/old commander3/parameter_files/defaults/bands/DIRBE/old2 + diff --git a/Makefile b/Makefile index 5645c752f..b35c421f5 100644 --- a/Makefile +++ b/Makefile @@ -111,6 +111,8 @@ all : commander commander : @cd commander3/src; $(MAKE) +sharp_test: + @cd commander3/src; $(MAKE) sharp_test + clean : @cd commander3/src; $(MAKE) clean - diff --git a/cmake/compilers/intel.cmake b/cmake/compilers/intel.cmake index ae5b365c1..cf4d958f0 100644 --- a/cmake/compilers/intel.cmake +++ b/cmake/compilers/intel.cmake @@ -70,37 +70,28 @@ if (COMMANDER3_Fortran_COMPILER_FLAGS_RELEASE MATCHES "") "-xHost" "-fpe0" "-fPIC" - #"-fp-model=strict" "-traceback" "-qopenmp" #<= we are not using it at all, it is redundant "-assume" "byterecl" # for I/O operations - #"-qopt-matmul" #<= increases linking time but doesn't increase performance - #"-DNDEBUG" - #"-ipo" # - #"-parallel" "-heap-arrays" "16384" ) endif() if(COMMANDER3_Fortran_COMPILER_FLAGS_DEBUG MATCHES "") list(APPEND COMMANDER3_Fortran_COMPILER_FLAGS_DEBUG "-O0" - "-g" + "-g" "-xHost" - "-debug" "all" - "-check" "all,noarg_temp_created" - "-warn" "all,nounused,noexternal" - "-fp-stack-check" - "-fstack-protector-all" + "-debug" "all" + "-check" "all,nouninit" + "-warn" "all,nounused,noexternal" + "-fp-stack-check" + "-fstack-protector-all" "-traceback" - "-parallel" "-qopenmp" - "-C" "-assume" "byterecl" "-heap-arrays" "16384" "-fpe0" "-fPIC" - #"-ftrapuv" - #"-init=snan,arrays" ) endif() if(COMMANDER3_Fortran_COMPILER_FLAGS_RELWITHDEBINFO MATCHES "") @@ -110,24 +101,10 @@ if(COMMANDER3_Fortran_COMPILER_FLAGS_RELWITHDEBINFO MATCHES "") "-g" "-fpe0" "-fPIC" - #"-fp-model=strict" "-qopenmp" "-assume" "byterecl" # for I/O operations - #"-qopt-matmul" #<= increases linking time but doesn't increase performance "-traceback" "-heap-arrays" "16384" - # - #"-O2" - #"-g" - #"-traceback" - #"-DNDEBUG" - #"-parallel" - #"-qopenmp" - #"-qopt-matmul" - #"-C" - #"-assume" "byterecl" - #"-fpe0" - #"-fPIC" ) endif() if(COMMANDER3_Fortran_COMPILER_FLAGS_MINSIZEREL MATCHES "") @@ -135,9 +112,7 @@ if(COMMANDER3_Fortran_COMPILER_FLAGS_MINSIZEREL MATCHES "") "-Os" "-traceback" "-DNDEBUG" - "-parallel" "-qopenmp" - "-C" "-assume" "byterecl" "-heap-arrays" "16384" "-fpe0" diff --git a/cmake/projects/commander3.cmake b/cmake/projects/commander3.cmake index 3e75bb22c..6cc673ddc 100644 --- a/cmake/projects/commander3.cmake +++ b/cmake/projects/commander3.cmake @@ -59,11 +59,13 @@ set(sources # TOD processing modules ${COMMANDER3_SOURCE_DIR}/comm_tod_noise_psd_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_tod_mod.f90 + ${COMMANDER3_SOURCE_DIR}/comm_tod_pixhist_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_tod_driver_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_tod_mapmaking_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_tod_lfi_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_tod_lfi_smod.f90 ${COMMANDER3_SOURCE_DIR}/comm_tod_hfi_mod.f90 + ${COMMANDER3_SOURCE_DIR}/comm_tod_hfi_smod.f90 ${COMMANDER3_SOURCE_DIR}/comm_tod_gain_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_tod_gain_smod.f90 ${COMMANDER3_SOURCE_DIR}/comm_tod_noise_mod.f90 @@ -99,6 +101,7 @@ set(sources ${COMMANDER3_SOURCE_DIR}/comm_utils.f90 ${COMMANDER3_SOURCE_DIR}/comm_bp_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_f_mod.f90 + ${COMMANDER3_SOURCE_DIR}/comm_dust_extinction_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_ptsrc_comp_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_zodi_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_zodi_samp_mod.f90 @@ -130,8 +133,10 @@ set(sources ${COMMANDER3_SOURCE_DIR}/comm_status_mod.f90 ${COMMANDER3_SOURCE_DIR}/locate_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_conviqt_mod.f90 + ${COMMANDER3_SOURCE_DIR}/comm_tod_cray_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_map_mod.f90 ${COMMANDER3_SOURCE_DIR}/math_tools.f90 + ${COMMANDER3_SOURCE_DIR}/comm_sparse_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_cr_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_mbb_comp_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_mbbtab_comp_mod.f90 @@ -166,6 +171,7 @@ set(sources ${COMMANDER3_SOURCE_DIR}/comm_tod_adc_mod.f90 ${COMMANDER3_SOURCE_DIR}/comm_tod_adc_smod.f90 ${COMMANDER3_SOURCE_DIR}/comm_ame_lognormal_mod.f90 + ${COMMANDER3_SOURCE_DIR}/comm_tod_crosstalk_mod.f90 # CAMB #${COMMANDER3_SOURCE_DIR}/comm_camb_mod.f90 ) diff --git a/cmake/projects/healpix.cmake b/cmake/projects/healpix.cmake index 916b35203..045e0913d 100644 --- a/cmake/projects/healpix.cmake +++ b/cmake/projects/healpix.cmake @@ -44,28 +44,23 @@ if(COMPILE_HEALPIX) # Below flags used to configure Libsharp as part of HEALPix if(CMAKE_Fortran_COMPILER_ID MATCHES Intel) #set(healpix_sharp2_C_FLAGS "-static-intel -O3 -ffast-math -march=native -std=c99 -DUSE_MPI -qopenmp -D__PURE_INTEL_C99_HEADERS__") - #set(healpix_sharp2_C_FLAGS "-static-intel -O3 -ffast-math -std=c99 -DUSE_MPI -qopenmp -D__PURE_INTEL_C99_HEADERS__") - set(healpix_sharp2_C_FLAGS "-static-intel -O3 -ffast-math -mavx2 -std=c99 -DUSE_MPI -qopenmp -D__PURE_INTEL_C99_HEADERS__") - # MPI support, OpenMP, portable binary: - #set(healpix_sharp2_C_FLAGS "-DUSE_MPI -DMULTIARCH -std=c99 -O3 -ffast-math") + if(CMAKE_BUILD_TYPE MATCHES Release) + set(healpix_sharp2_C_FLAGS "-static-intel -O3 -fno-strict-aliasing -march=native -std=c99 -DUSE_MPI -qopenmp -D__PURE_INTEL_C99_HEADERS__") + elseif(CMAKE_BUILD_TYPE MATCHES Debug) + set(healpix_sharp2_C_FLAGS "-static-intel -O0 -g -fno-strict-aliasing -march=native -std=c99 -DUSE_MPI -qopenmp -D__PURE_INTEL_C99_HEADERS__") + endif() elseif(CMAKE_Fortran_COMPILER_ID MATCHES GNU) - #set(healpix_sharp2_C_FLAGS "-O3 -ffast-math -march=native -std=c99 -DUSE_MPI -fopenmp") - #set(healpix_sharp2_C_FLAGS "-DUSE_MPI -DMULTIARCH -std=c99 -O3 -ffast-math") set(healpix_sharp2_C_FLAGS "-O3 -ffast-math -mavx2 -std=c99 -DUSE_MPI -fopenmp") elseif(CMAKE_Fortran_COMPILER_ID MATCHES PGI) set(healpix_sharp2_C_FLAGS "-O4 -fast -Mipa=fast,inline -Msmartalloc -std=c99 -DUSE_MPI -mp") - #elseif(CMAKE_Fortran_COMPILER_ID MATCHES NVIDIA) - #set(healpix_sharp2_C_FLAGS "-O4 -fast -Mipa=fast,inline -Msmartalloc -std=c99 -DUSE_MPI -mp") elseif(CMAKE_Fortran_COMPILER_ID MATCHES Flang) - #set(healpix_sharp2_C_FLAGS "-O4 -fast -Mipa=fast,inline -Msmartalloc -std=c99 -DUSE_MPI -mp") set(healpix_sharp2_C_FLAGS "-DUSE_MPI -DMULTIARCH -std=c99 -O3 -ffast-math") endif() #------------------------------------------------------------------------------ - # Copying modyfied configure script to healpix root + # Copying modified configure script to healpix root list(APPEND healpix_copy_configure_script "${CMAKE_COMMAND}" "-E" "copy" "${CMAKE_SOURCE_DIR}/cmake/third_party/healpix/hpxconfig_functions.sh" - #"${CMAKE_DOWNLOAD_DIRECTORY}/${project}/src/${project}/hpxconfig_functions.sh" "${HEALPIX_SOURCE_DIR}/hpxconfig_functions.sh" #"&&" ) diff --git a/cmake/sources.cmake b/cmake/sources.cmake index 13adc538d..f406bc3a6 100644 --- a/cmake/sources.cmake +++ b/cmake/sources.cmake @@ -80,7 +80,7 @@ set(blas_md5 "5cd5df5a1541ad414f5874aaae17730f") # FFTW #------------------------------------------------------------------------------ #set(fftw_url "http://fftw.org/fftw-3.3.8.tar.gz") -set(fftw_url "http://fftw.org/fftw-3.3.9.tar.gz") +set(fftw_url "https://fftw.org/fftw-3.3.9.tar.gz") #set(fftw_md5 "8aac833c943d8e90d51b697b27d4384d") set(fftw_md5 "50145bb68a8510b5d77605f11cadf8dc") #------------------------------------------------------------------------------ @@ -104,7 +104,10 @@ set(hdf5_md5 "9e22217d22eb568e09f0cc15fb641d7c") #------------------------------------------------------------------------------ #set(cfitsio_url "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-3.47.tar.gz") #set(cfitsio_url "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-3.49.tar.gz") -set(cfitsio_url "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.0.0.tar.gz") +set(cfitsio_url "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.0.0.tar.gz") +#set(cfitsio_url "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.6.2.tar.gz") +# See https://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html for latest +# versions #------------------------------------------------------------------------------ # HEALPix #------------------------------------------------------------------------------ diff --git a/commander3/config/config.ita_oneapi b/commander3/config/config.ita_oneapi index dae9dc566..17394fdde 100644 --- a/commander3/config/config.ita_oneapi +++ b/commander3/config/config.ita_oneapi @@ -57,7 +57,6 @@ export MPCC := mpiicc export F90FLAGS := -fpe0 -mavx2 -fpp -g -O0 -traceback -assume byterecl -qopenmp -parallel -C #debug -# #export F90FLAGS := -O0 -g -C -traceback -assume byterecl -heap-arrays 16384 -qopenmp -parallel -fpe0 -check noarg_temp_created -ftrapuv diff --git a/commander3/parameter_files/defaults/HFI_tod.defaults b/commander3/parameter_files/defaults/HFI_tod.defaults index 7c590e3f7..4f3bb065d 100644 --- a/commander3/parameter_files/defaults/HFI_tod.defaults +++ b/commander3/parameter_files/defaults/HFI_tod.defaults @@ -9,8 +9,12 @@ SAMPLE_SIGNAL_AMPLITUDES = .true. SAMPLE_SPECTRAL_INDICES = .true. SAMPLE_POWSPEC = .false. +SAMPLE_SOLAR_MAPS = .false. +SAMPLE_MOON_MAPS = .false +SAMPLE_EARTH_MAPS = .false. # Only as a function of elongation + ENABLE_TOD_ANALYSIS = .true. -TOD_OUTPUT_4D_MAP_EVERY_NTH_ITER = 10 +TOD_OUTPUT_4D_MAP_EVERY_NTH_ITER = -1 TOD_OUTPUT_AUXILIARY_MAPS_EVERY_NTH_ITER = 10 TOD_INCLUDE_ZODI = .false. FFTW3_MAGIC_NUMBERS = fft3_magic_numbers_230810.txt diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_256.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_256.defaults index 664201885..3c215c09f 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_256.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_256.defaults @@ -65,3 +65,15 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_01.fits BAND_TOD_ZODI_EMISSIVITY&&& = 1.d0,1.d0,1.d0,1.d0,1.d0,1.d0 BAND_TOD_ZODI_ALBEDO&&& = 0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_512.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_512.defaults index 2ffcc5fc3..548f0e34a 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_512.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_512.defaults @@ -41,7 +41,7 @@ BAND_TOD_HALFRING&&& = 0 BAND_TOD_START_SCANID&&& = 1 BAND_TOD_END_SCANID&&& = 285 BAND_TOD_TOT_NUMSCAN&&& = 285 -BAND_TOD_FLAG&&& = 2047 # Don't mask Uranus and Neptune, 8191 +BAND_TOD_FLAG&&& = 10239 # All planets except Neptune/Uranus. Also comets BAND_TOD_ORBITAL_ONLY_ABSCAL&&& =.false. BAND_TOD_DETECTOR_LIST&&& = 01_A BAND_TOD_INIT_FROM_HDF&&& = default @@ -66,4 +66,16 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_01_n512.fits BAND_TOD_ZODI_EMISSIVITY&&& = 1.d0,1.d0,1.d0,1.d0,1.d0,1.d0 BAND_TOD_ZODI_ALBEDO&&& = 0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0 -BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. \ No newline at end of file +BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_512.defaults~ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_512.defaults~ index 1cd1e0b7e..6912efa4b 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_512.defaults~ +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_01_CIO_512.defaults~ @@ -66,3 +66,13 @@ BAND_TOD_SUBTRACT_ZODI&&& = .true. # if true, the following parameters must be BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_01.fits BAND_ZODI_EMISSIVITY&&& = 1.d0,1.d0,1.d0,1.d0,1.d0,1.d0 BAND_ZODI_ALBEDO&&& = 0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0,0.20411939612669797d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none \ No newline at end of file diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_256.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_256.defaults index ee36ae77c..c27af2903 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_256.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_256.defaults @@ -65,3 +65,15 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_02.fits BAND_TOD_ZODI_EMISSIVITY&&& = 1.d0,1.d0,1.d0,1.d0,1.d0,1.d0 BAND_TOD_ZODI_ALBEDO&&& = 0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_256.defaults~ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_256.defaults~ index 647063a74..a57352cc5 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_256.defaults~ +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_256.defaults~ @@ -66,3 +66,13 @@ BAND_TOD_SUBTRACT_ZODI&&& = .true. # if true, the following parameters must be BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_02_n512.fits BAND_ZODI_EMISSIVITY&&& = 1.d0,1.d0,1.d0,1.d0,1.d0,1.d0 BAND_ZODI_ALBEDO&&& = 0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none \ No newline at end of file diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_512.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_512.defaults index b5dffed7d..2aed54778 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_512.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_02_CIO_512.defaults @@ -41,7 +41,7 @@ BAND_TOD_HALFRING&&& = 0 BAND_TOD_START_SCANID&&& = 1 BAND_TOD_END_SCANID&&& = 285 BAND_TOD_TOT_NUMSCAN&&& = 285 -BAND_TOD_FLAG&&& = 2047 # Don't mask Uranus and Neptune, 8191 +BAND_TOD_FLAG&&& = 10239 # All planets except Neptune/Uranus. Also comets BAND_TOD_ORBITAL_ONLY_ABSCAL&&& =.false. BAND_TOD_DETECTOR_LIST&&& = 02_A BAND_TOD_INIT_FROM_HDF&&& = default @@ -66,4 +66,16 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_02_n512.fits BAND_TOD_ZODI_EMISSIVITY&&& = 1.d0,1.d0,1.d0,1.d0,1.d0,1.d0 BAND_TOD_ZODI_ALBEDO&&& = 0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0,0.25521132892052301d0 -BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. \ No newline at end of file +BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_256.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_256.defaults index c29b5554a..e10827ca0 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_256.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_256.defaults @@ -66,3 +66,15 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_03.fits BAND_TOD_ZODI_EMISSIVITY&&& = 1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0 BAND_TOD_ZODI_ALBEDO&&& = 0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_512.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_512.defaults index 09d6a5568..ee515f1e8 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_512.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_512.defaults @@ -42,7 +42,7 @@ BAND_TOD_HALFRING&&& = 0 BAND_TOD_START_SCANID&&& = 1 BAND_TOD_END_SCANID&&& = 285 BAND_TOD_TOT_NUMSCAN&&& = 285 -BAND_TOD_FLAG&&& = 2047 # Don't mask Uranus and Neptune, 8191 +BAND_TOD_FLAG&&& = 10239 # All planets except Neptune/Uranus. Also comets BAND_TOD_ORBITAL_ONLY_ABSCAL&&& =.false. BAND_TOD_DETECTOR_LIST&&& = 03_A BAND_TOD_INIT_FROM_HDF&&& = default @@ -67,4 +67,16 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_03_n512.fits BAND_TOD_ZODI_EMISSIVITY&&& = 1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0 BAND_TOD_ZODI_ALBEDO&&& = 0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0 -BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. \ No newline at end of file +BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_512.defaults~ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_512.defaults~ index 5ed17eac1..65e27a1ea 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_512.defaults~ +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_03_CIO_512.defaults~ @@ -68,3 +68,13 @@ BAND_TOD_SUBTRACT_ZODI&&& = .true. # if true, the following parameters must be BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_03.fits BAND_ZODI_EMISSIVITY&&& = 1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0,1.6598924040649741d0 BAND_ZODI_ALBEDO&&& = 0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0,0.21043660481632315d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none \ No newline at end of file diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_256.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_256.defaults index 85612895d..94d5d266d 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_256.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_256.defaults @@ -65,3 +65,15 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_04.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.99740908486652979d0,0.35926451958350442d0,0.35926451958350442d0,0.35926451958350442d0,1.0675116768340536d0,1.0675116768340536d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_512.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_512.defaults index f6c04a3bb..6ec1fd22f 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_512.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_512.defaults @@ -41,7 +41,7 @@ BAND_TOD_HALFRING&&& = 0 BAND_TOD_START_SCANID&&& = 1 BAND_TOD_END_SCANID&&& = 285 BAND_TOD_TOT_NUMSCAN&&& = 285 -BAND_TOD_FLAG&&& = 2047 # Don't mask Uranus and Neptune, 8191 +BAND_TOD_FLAG&&& = 26623 # All planets except Neptune/Uranus. Also comets and asteroids BAND_TOD_ORBITAL_ONLY_ABSCAL&&& =.false. BAND_TOD_DETECTOR_LIST&&& = 04_A BAND_TOD_INIT_FROM_HDF&&& = default @@ -66,4 +66,16 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_04_n512.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.99740908486652979d0,0.35926451958350442d0,0.35926451958350442d0,0.35926451958350442d0,1.0675116768340536d0,1.0675116768340536d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 -BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. \ No newline at end of file +BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_512.defaults~ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_512.defaults~ index 80ecd4967..17e1c9819 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_512.defaults~ +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_04_CIO_512.defaults~ @@ -67,3 +67,13 @@ BAND_TOD_SUBTRACT_ZODI&&& = .true. # if true, the following parameters must be BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_04.fits BAND_ZODI_EMISSIVITY&&& = 0.99740908486652979d0,0.35926451958350442d0,0.35926451958350442d0,0.35926451958350442d0,1.0675116768340536d0,1.0675116768340536d0 BAND_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none \ No newline at end of file diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_256.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_256.defaults index c2d038f97..863fafe64 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_256.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_256.defaults @@ -65,3 +65,15 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_05.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.95766914805948866d0,1.0127926948497732d0,1.0127926948497732d0,0.35926451958350442d0,1.0608768682182081d0,1.0608768682182081d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_512.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_512.defaults index ca9627649..c9a61ba2b 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_512.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_512.defaults @@ -41,7 +41,7 @@ BAND_TOD_HALFRING&&& = 0 BAND_TOD_START_SCANID&&& = 1 BAND_TOD_END_SCANID&&& = 285 BAND_TOD_TOT_NUMSCAN&&& = 285 -BAND_TOD_FLAG&&& = 2047 # Don't mask Uranus and Neptune, 8191 +BAND_TOD_FLAG&&& = 26623 # All planets except Neptune/Uranus. Also comets and asteroids BAND_TOD_ORBITAL_ONLY_ABSCAL&&& =.false. BAND_TOD_DETECTOR_LIST&&& = 05_A BAND_TOD_INIT_FROM_HDF&&& = default @@ -66,4 +66,16 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_06_n512_v2.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.95766914805948866d0,1.0127926948497732d0,1.0127926948497732d0,0.35926451958350442d0,1.0608768682182081d0,1.0608768682182081d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 -BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. \ No newline at end of file +BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_512.defaults~ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_512.defaults~ index ed3947179..eca2ddef6 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_512.defaults~ +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_05_CIO_512.defaults~ @@ -67,3 +67,13 @@ BAND_TOD_SUBTRACT_ZODI&&& = .true. # if true, the following parameters must be BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_05.fits BAND_ZODI_EMISSIVITY&&& = 0.95766914805948866d0,1.0127926948497732d0,1.0127926948497732d0,0.35926451958350442d0,1.0608768682182081d0,1.0608768682182081d0 BAND_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_256.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_256.defaults index dd5797b3b..7bebb12da 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_256.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_256.defaults @@ -65,3 +65,15 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_06.fits BAND_TOD_ZODI_EMISSIVITY&&& = 1.d0,1.d0,1.d0,1.d0,1.d0,1.d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_512.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_512.defaults index a5211f20a..69e4e4e8f 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_512.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_512.defaults @@ -41,7 +41,7 @@ BAND_TOD_HALFRING&&& = 0 BAND_TOD_START_SCANID&&& = 1 BAND_TOD_END_SCANID&&& = 285 BAND_TOD_TOT_NUMSCAN&&& = 285 -BAND_TOD_FLAG&&& = 2047 # Don't mask Uranus and Neptune, 8191 +BAND_TOD_FLAG&&& = 26623 # All planets except Neptune/Uranus. Also comets and asteroids BAND_TOD_ORBITAL_ONLY_ABSCAL&&& =.false. BAND_TOD_DETECTOR_LIST&&& = 06_A BAND_TOD_INIT_FROM_HDF&&& = default @@ -66,4 +66,16 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_06_n512_v2.fits BAND_TOD_ZODI_EMISSIVITY&&& = 1.d0,1.d0,1.d0,1.d0,1.d0,1.d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 -BAND_TOD_ZODI_REFERENCE_BAND&&&= .true. \ No newline at end of file +BAND_TOD_ZODI_REFERENCE_BAND&&&= .true. + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_512.defaults~ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_512.defaults~ index 9f173d2cb..fd2b75adc 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_512.defaults~ +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_06_CIO_512.defaults~ @@ -66,3 +66,13 @@ BAND_TOD_SUBTRACT_ZODI&&& = .true. # if true, the following parameters must be BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_06.fits BAND_ZODI_EMISSIVITY&&& = 1.d0,1.d0,1.d0,1.d0,1.d0,1.d0 BAND_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none \ No newline at end of file diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_256.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_256.defaults index 9450fdfcf..3e54d2f7d 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_256.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_256.defaults @@ -64,4 +64,16 @@ N_GIBBS_PER_TOD&&& = 1 BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_07.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.73338832616768868d0,1.2539242027824944d0,1.2539242027824944d0,1.2539242027824944d0,0.87266361378785184d0,0.87266361378785184d0 -BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 \ No newline at end of file +BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_512.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_512.defaults index cce1e4deb..6ddc3c333 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_512.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_512.defaults @@ -41,7 +41,7 @@ BAND_TOD_HALFRING&&& = 0 BAND_TOD_START_SCANID&&& = 1 BAND_TOD_END_SCANID&&& = 285 BAND_TOD_TOT_NUMSCAN&&& = 285 -BAND_TOD_FLAG&&& = 2047 # Don't mask Uranus and Neptune, 8191 +BAND_TOD_FLAG&&& = 157695 # All planets except Neptune/Uranus. Also comets and asteroids. Glitch-related flags included BAND_TOD_ORBITAL_ONLY_ABSCAL&&& =.false. BAND_TOD_DETECTOR_LIST&&& = 07_A BAND_TOD_INIT_FROM_HDF&&& = default @@ -66,4 +66,16 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_07_n512.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.73338832616768868d0,1.2539242027824944d0,1.2539242027824944d0,1.2539242027824944d0,0.87266361378785184d0,0.87266361378785184d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 -BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. \ No newline at end of file +BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_512.defaults~ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_512.defaults~ index 7a255c47d..3ec6daf31 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_512.defaults~ +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_07_CIO_512.defaults~ @@ -66,4 +66,14 @@ N_GIBBS_PER_TOD&&& = 1 BAND_TOD_SUBTRACT_ZODI&&& = .true. # if true, the following parameters must be set BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_07.fits BAND_ZODI_EMISSIVITY&&& = 0.73338832616768868d0,1.2539242027824944d0,1.2539242027824944d0,1.2539242027824944d0,0.87266361378785184d0,0.87266361378785184d0 -BAND_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 \ No newline at end of file +BAND_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none \ No newline at end of file diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_256.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_256.defaults index e83dbf867..3e9b65551 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_256.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_256.defaults @@ -65,3 +65,15 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_08.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.64789881802224070d0,1.5167023376593836d0,1.5167023376593836d0,1.5167023376593836d0,1.0985346556794289d0,1.0985346556794289d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_512.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_512.defaults index 6516310f1..1f0c17081 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_512.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_512.defaults @@ -41,7 +41,7 @@ BAND_TOD_HALFRING&&& = 0 BAND_TOD_START_SCANID&&& = 1 BAND_TOD_END_SCANID&&& = 285 BAND_TOD_TOT_NUMSCAN&&& = 285 -BAND_TOD_FLAG&&& = 2047 # Don't mask Uranus and Neptune, 8191 +BAND_TOD_FLAG&&& = 157695 # All planets except Neptune/Uranus. Also comets and asteroids. Glitch-related flags included BAND_TOD_ORBITAL_ONLY_ABSCAL&&& =.false. BAND_TOD_DETECTOR_LIST&&& = 08_A BAND_TOD_INIT_FROM_HDF&&& = default @@ -50,7 +50,7 @@ BAND_TOD_LEVEL&&& = L2 BAND_MAPFILE&&& = DIRBE_08_512_v1.fits BAND_NOISEFILE&&& = DIRBE_08_SIGMA_512_v1.fits -BAND_REG_NOISEFILE&&& = none +BAND_REG_NOISEFILE&&& = none DIRBE_08_regnoise_v1.fits BAND_NOISE_RMS&&&_SMOOTH01 = DIRBE_08_SIGMA_512_v1_1deg_n256_v2.fits BAND_NOISE_RMS&&&_SMOOTH02 = none BAND_NOISE_RMS&&&_SMOOTH03 = none @@ -67,3 +67,15 @@ BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_08_n512.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.64789881802224070d0,1.5167023376593836d0,1.5167023376593836d0,1.5167023376593836d0,1.0985346556794289d0,1.0985346556794289d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_512.defaults~ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_512.defaults~ index 153eeca6d..62e1bf62a 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_512.defaults~ +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_08_CIO_512.defaults~ @@ -66,3 +66,13 @@ BAND_TOD_SUBTRACT_ZODI&&& = .true. # if true, the following parameters must be BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_08.fits BAND_ZODI_EMISSIVITY&&& = 0.64789881802224070d0,1.5167023376593836d0,1.5167023376593836d0,1.5167023376593836d0,1.0985346556794289d0,1.0985346556794289d0 BAND_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none \ No newline at end of file diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_256.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_256.defaults index 31edfecee..39f8b1cd1 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_256.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_256.defaults @@ -67,3 +67,15 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_09.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.67694205881047387d0,1.1317240279481993d0,1.1317240279481993d0,1.1317240279481993d0,1.1515825707787077d0,1.1515825707787077d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_512.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_512.defaults index 16e71dac1..4ba148c14 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_512.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_512.defaults @@ -67,3 +67,15 @@ BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_09_n512.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.67694205881047387d0,1.1317240279481993d0,1.1317240279481993d0,1.1317240279481993d0,1.1515825707787077d0,1.1515825707787077d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_512.defaults~ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_512.defaults~ index 8056f8c62..ee9b7d0dc 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_512.defaults~ +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_09_CIO_512.defaults~ @@ -67,3 +67,13 @@ BAND_TOD_SUBTRACT_ZODI&&& = .true. # if true, the following parameters must be BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_09.fits BAND_ZODI_EMISSIVITY&&& = 0.67694205881047387d0,1.1317240279481993d0,1.1317240279481993d0,1.1317240279481993d0,1.1515825707787077d0,1.1515825707787077d0 BAND_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none \ No newline at end of file diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_256.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_256.defaults index 53ec08271..fe978921b 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_256.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_256.defaults @@ -65,3 +65,15 @@ BAND_TOD_ZODI_SUBTRACTION&&& = .true. BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_10.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.51912085401950736d0,1.3996145963796358d0,1.3996145963796358d0,1.3996145963796358d0,0.85763800994217443d0,0.85763800994217443d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_512.defaults b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_512.defaults index 10e284292..61714c84d 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_512.defaults +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_512.defaults @@ -67,3 +67,15 @@ BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_10_n512.fits BAND_TOD_ZODI_EMISSIVITY&&& = 0.51912085401950736d0,1.3996145963796358d0,1.3996145963796358d0,1.3996145963796358d0,0.85763800994217443d0,0.85763800994217443d0 BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_512.defaults~ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_512.defaults~ index 5309cf790..8566dd78e 100644 --- a/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_512.defaults~ +++ b/commander3/parameter_files/defaults/bands/DIRBE/DIRBE_10_CIO_512.defaults~ @@ -68,3 +68,13 @@ BAND_TOD_SUBTRACT_ZODI&&& = .true. # if true, the following parameters must be BAND_TOD_ZODI_MASK&&& = zodi_proc_mask_10.fits BAND_ZODI_EMISSIVITY&&& = 0.51912085401950736d0,1.3996145963796358d0,1.3996145963796358d0,1.3996145963796358d0,0.85763800994217443d0,0.85763800994217443d0 BAND_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none \ No newline at end of file diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H0857_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H0857_map.defaults index af9e5baf7..93088250d 100644 --- a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H0857_map.defaults +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H0857_map.defaults @@ -42,4 +42,3 @@ BAND_REG_NOISEFILE&&& = none BAND_NOISE_RMS&&&_SMOOTH01 = none BAND_NOISE_RMS&&&_SMOOTH02 = none BAND_NOISE_RMS&&&_SMOOTH03 = none - diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1251_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1251_map.defaults index b274a971d..2cd50e2ba 100644 --- a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1251_map.defaults +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1251_map.defaults @@ -43,3 +43,5 @@ BAND_NOISE_RMS&&&_SMOOTH01 = none BAND_NOISE_RMS&&&_SMOOTH02 = none BAND_NOISE_RMS&&&_SMOOTH03 = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1510_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1510_map.defaults new file mode 100644 index 000000000..51ad3f208 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1510_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1510 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1510 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1510 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1510 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1510GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1510GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1510GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1523_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1523_map.defaults new file mode 100644 index 000000000..742d57c2b --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1523_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1523 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1523 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1523 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1523 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1523GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1523GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1523GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1537_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1537_map.defaults new file mode 100644 index 000000000..74dc7746d --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1537_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1537 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1537 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1537 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1537 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1537GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1537GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1537GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1550_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1550_map.defaults new file mode 100644 index 000000000..23d4f6f5a --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1550_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1550 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1550 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1550 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1550 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1550GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1550GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1550GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1564_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1564_map.defaults new file mode 100644 index 000000000..03fff18e1 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1564_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1564 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1564 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1564 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1564 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1564GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1564GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1564GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1673_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1673_map.defaults new file mode 100644 index 000000000..67c1806ea --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1673_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1673 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1673 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1673 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1673 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1673GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1673GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1673GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1686_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1686_map.defaults new file mode 100644 index 000000000..2cfe3acf1 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1686_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1686 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1686 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1686 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1686 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1686GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1686GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1686GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1700_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1700_map.defaults new file mode 100644 index 000000000..4f7cc5454 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1700_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1700 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1700 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1700 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1700 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1700GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1700GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1700GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1714_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1714_map.defaults new file mode 100644 index 000000000..a1d2aa0af --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1714_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1714 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1714 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1714 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1714 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1714GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1714GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1714GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1727_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1727_map.defaults new file mode 100644 index 000000000..04839217d --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1727_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1727 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1727 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1727 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1727 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1727GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1727GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1727GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1741_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1741_map.defaults new file mode 100644 index 000000000..0a3be6a0d --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1741_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1741 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1741 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1741 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1741 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1741GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1741GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1741GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1754_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1754_map.defaults new file mode 100644 index 000000000..7e4af2b36 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1754_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1754 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1754 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1754 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1754 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1754GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1754GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1754GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1768_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1768_map.defaults new file mode 100644 index 000000000..29396f4db --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1768_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1768 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1768 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1768 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1768 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1768GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1768GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1768GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1782_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1782_map.defaults new file mode 100644 index 000000000..af313a8c3 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1782_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1782 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1782 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1782 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1782 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1782GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1782GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1782GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1795_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1795_map.defaults new file mode 100644 index 000000000..59973d658 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1795_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1795 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1795 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1795 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1795 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1795GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1795GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1795GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1822_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1822_map.defaults new file mode 100644 index 000000000..83283b534 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1822_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1822 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1822 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1822 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1822 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1822GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1822GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1822GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1836_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1836_map.defaults new file mode 100644 index 000000000..4b458f5e3 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1836_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1836 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1836 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1836 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1836 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1836GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1836GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1836GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1850_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1850_map.defaults new file mode 100644 index 000000000..96fac3ffd --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1850_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1850 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1850 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1850 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1850 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1850GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1850GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1850GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1863_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1863_map.defaults new file mode 100644 index 000000000..45929201e --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1863_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1863 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1863 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1863 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1863 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1863GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1863GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1863GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1877_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1877_map.defaults new file mode 100644 index 000000000..381c81a49 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1877_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1877 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1877 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1877 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1877 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1877GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1877GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1877GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1931_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1931_map.defaults new file mode 100644 index 000000000..9e7d04f1d --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1931_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1931 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1931 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1931 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1931 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1931GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1931GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1931GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1945_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1945_map.defaults new file mode 100644 index 000000000..f183f3aed --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1945_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1945 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1945 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1945 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1945 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1945GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1945GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1945GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1958_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1958_map.defaults new file mode 100644 index 000000000..23732c383 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1958_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1958 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1958 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1958 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1958 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1958GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1958GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1958GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1972_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1972_map.defaults new file mode 100644 index 000000000..a8d20002b --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1972_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1972 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1972 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1972 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1972 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1972GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1972GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1972GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1986_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1986_map.defaults new file mode 100644 index 000000000..47db1003f --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1986_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1986 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1986 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1986 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1986 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1986GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1986GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1986GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1999_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1999_map.defaults new file mode 100644 index 000000000..ad8ad8179 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H1999_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 1999 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H1999 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H1999 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 1999 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_1999GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_1999GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_1999GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2013_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2013_map.defaults new file mode 100644 index 000000000..e3737b71d --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2013_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2013 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2013 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2013 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2013 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2013GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2013GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2013GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2027_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2027_map.defaults new file mode 100644 index 000000000..a45671d64 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2027_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2027 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2027 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2027 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2027 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2027GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2027GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2027GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2040_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2040_map.defaults new file mode 100644 index 000000000..59fd36a42 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2040_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2040 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2040 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2040 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2040 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2040GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2040GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2040GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2054_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2054_map.defaults new file mode 100644 index 000000000..d468a7df4 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2054_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2054 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2054 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2054 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2054 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2054GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2054GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2054GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2067_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2067_map.defaults new file mode 100644 index 000000000..3c00ef9ba --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2067_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2067 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2067 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2067 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2067 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2067GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2067GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2067GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2095_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2095_map.defaults new file mode 100644 index 000000000..f360deeea --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2095_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2095 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2095 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2095 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2095 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2095GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2095GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2095GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2108_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2108_map.defaults new file mode 100644 index 000000000..011625e2b --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2108_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2108 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2108 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2108 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2108 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2108GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2108GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2108GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2122_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2122_map.defaults new file mode 100644 index 000000000..601ae92bc --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2122_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2122 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2122 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2122 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2122 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2122GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2122GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2122GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2149_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2149_map.defaults new file mode 100644 index 000000000..00d767624 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2149_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2149 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2149 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2149 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2149 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2149GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2149GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2149GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2163_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2163_map.defaults new file mode 100644 index 000000000..b284a09c5 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2163_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2163 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2163 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2163 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2163 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2163GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2163GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2163GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2176_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2176_map.defaults new file mode 100644 index 000000000..466536efa --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2176_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2176 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2176 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2176 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2176 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2176GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2176GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2176GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2190_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2190_map.defaults new file mode 100644 index 000000000..29c80df79 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2190_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2190 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2190 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2190 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2190 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2190GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2190GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2190GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2203_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2203_map.defaults new file mode 100644 index 000000000..448180a30 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2203_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2203 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2203 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2203 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2203 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2203GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2203GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2203GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2217_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2217_map.defaults new file mode 100644 index 000000000..8903aea3f --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2217_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2217 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2217 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2217 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2217GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2217GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2217GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2231_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2231_map.defaults new file mode 100644 index 000000000..ce0139fc2 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2231_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2231 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2231 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2231 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2231 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2231GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2231GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2231GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2244_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2244_map.defaults new file mode 100644 index 000000000..f60d7d263 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2244_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2244 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2244 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2244 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2244 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2244GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2244GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2244GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2258_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2258_map.defaults new file mode 100644 index 000000000..942968b47 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2258_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2258 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2258 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2258 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2258 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2258GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2258GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2258GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2271_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2271_map.defaults new file mode 100644 index 000000000..affd7d953 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2271_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2271 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2271 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2271 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2271 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2271GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2271GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2271GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2285_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2285_map.defaults new file mode 100644 index 000000000..62092fee2 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2285_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2285 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2285 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2285 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2285 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2285GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2285GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2285GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2299_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2299_map.defaults new file mode 100644 index 000000000..71e48de6a --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2299_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2299 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2299 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2299 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2299 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2299GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2299GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2299GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2312_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2312_map.defaults new file mode 100644 index 000000000..2ef10654d --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2312_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2312 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2312 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2312 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2312 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2312GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2312GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2312GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2326_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2326_map.defaults new file mode 100644 index 000000000..f3005e8a1 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2326_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2326 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2326 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2326 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2326 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2326GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2326GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2326GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2339_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2339_map.defaults new file mode 100644 index 000000000..9b1bfc661 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2339_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2339 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2339 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2339 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2339 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2339GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2339GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2339GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2353_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2353_map.defaults new file mode 100644 index 000000000..67d5d6ad8 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2353_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2353 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2353 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2353 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2353GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2353GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2353GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2367_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2367_map.defaults new file mode 100644 index 000000000..3f0d5d783 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2367_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2367 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2367 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2367 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2367 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2367GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2367GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2367GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2380_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2380_map.defaults new file mode 100644 index 000000000..c5708ac86 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2380_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2380 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2380 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2380 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2380 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2380GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2380GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2380GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2394_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2394_map.defaults new file mode 100644 index 000000000..e85731043 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2394_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2394 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2394 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2394 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2394 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2394GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2394GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2394GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2407_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2407_map.defaults new file mode 100644 index 000000000..376fda849 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2407_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2407 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2407 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2407 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2407 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2407GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2407GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2407GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2421_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2421_map.defaults new file mode 100644 index 000000000..09fa75f06 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2421_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2421 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2421 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2421 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2421 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2421GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2421GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2421GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2435_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2435_map.defaults new file mode 100644 index 000000000..f52d3a574 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2435_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2435 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2435 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2435 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2435 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2435GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2435GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2435GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2448_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2448_map.defaults new file mode 100644 index 000000000..73c123ccd --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2448_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2448 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2448 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2448 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2448 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2448GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2448GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2448GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2462_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2462_map.defaults new file mode 100644 index 000000000..32fc0e7d0 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2462_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2462 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2462 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2462 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2462 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2462GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2462GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2462GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2475_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2475_map.defaults new file mode 100644 index 000000000..caaf80d28 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2475_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2475 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2475 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2475 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2475 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2475GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2475GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2475GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2489_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2489_map.defaults new file mode 100644 index 000000000..ba37d2ce9 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2489_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2489 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2489 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2489 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2489 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2489GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2489GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2489GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2503_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2503_map.defaults new file mode 100644 index 000000000..361e55df2 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2503_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2503 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2503 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2503 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2503 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2503GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2503GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2503GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2516_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2516_map.defaults new file mode 100644 index 000000000..542ae6a64 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2516_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2516 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2516 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2516 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2516 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2516GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2516GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2516GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2530_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2530_map.defaults new file mode 100644 index 000000000..b6f829f30 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2530_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2530 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2530 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2530 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2530 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2530GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2530GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2530GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2543_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2543_map.defaults new file mode 100644 index 000000000..dbe86eb24 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2543_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2543 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2543 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2543 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2543 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2543GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2543GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2543GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2557_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2557_map.defaults new file mode 100644 index 000000000..02523ab2b --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2557_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2557 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2557 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2557 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2557 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2557GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2557GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2557GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2571_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2571_map.defaults new file mode 100644 index 000000000..26d628e82 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2571_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2571 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2571 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2571 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2571 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2571GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2571GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2571GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2584_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2584_map.defaults new file mode 100644 index 000000000..8a2d0ce50 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2584_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2584 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2584 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2584 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2584 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2584GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2584GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2584GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2598_map.defaults b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2598_map.defaults new file mode 100644 index 000000000..41cbab06f --- /dev/null +++ b/commander3/parameter_files/defaults/bands/FIRAS/FIRAS_H2598_map.defaults @@ -0,0 +1,45 @@ +# FIRAS 2598 GHz default parameters +# NOTE: data dir in parameter file + +BAND_LABEL&&& = FIRAS_H2598 +BAND_INSTRUMENT_LABEL&&& = FIRAS_H2598 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 16 +BAND_LMAX&&& = 192 +BAND_UNIT&&& = MJy/sr # Need to implement micron -> GHz in bp_mod and scale weights +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = FIRAS_mask.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = FIRAS # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_7deg.fits +BAND_BEAM_B_PTSRC_FILE&&& = FIRAS_beam_spline.dat +BAND_PIXEL_WINDOW&&& = pixel_window_n0016.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 2598 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = FIRAS_bp_2598GHz_highf_v2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none +BAND_MAPFILE&&& = FIRAS_map_2598GHz_highf.fits +BAND_NOISEFILE&&& = FIRAS_rms_2598GHz_highf.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none + diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_100-1_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_100-1_HFI.defaults new file mode 100644 index 000000000..9bfd981f8 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_100-1_HFI.defaults @@ -0,0 +1,41 @@ +# 100-1 GHz map parameters +BAND_LABEL&&& = 100-1 +BAND_INSTRUMENT_LABEL&&& = 100-1 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 6000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_100-1_npipe_02048_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_100-1_npipe_02048_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_100-1_npipe_02048_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_100-1x100-1_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 100 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_100-1_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_100-2_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_100-2_DIRBE.defaults index 95712d2a6..35e3d8533 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_100-2_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_100-2_DIRBE.defaults @@ -1,5 +1,6 @@ # 100-2 single-horn map parameters BAND_LABEL&&& = 100-2 +BAND_INSTRUMENT_LABEL&&& = 100-2 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_100-2_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_100-2_HFI.defaults new file mode 100644 index 000000000..a4a02dd57 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_100-2_HFI.defaults @@ -0,0 +1,41 @@ +# 100-2 GHz map parameters +BAND_LABEL&&& = 100-2 +BAND_INSTRUMENT_LABEL&&& = 100-2 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 6000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_100-2_npipe_02048_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_100-2_npipe_02048_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_100-2_npipe_02048_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_100-2x100-2_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 100 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_100-2_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_100-3_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_100-3_DIRBE.defaults index c0a2fb989..f3f6307c3 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_100-3_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_100-3_DIRBE.defaults @@ -1,5 +1,6 @@ # 100-3 single-horn map parameters BAND_LABEL&&& = 100-3 +BAND_INSTRUMENT_LABEL&&& = 100-3 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_100-3_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_100-3_HFI.defaults new file mode 100644 index 000000000..402b3ece5 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_100-3_HFI.defaults @@ -0,0 +1,41 @@ +# 100-3 GHz map parameters +BAND_LABEL&&& = 100-3 +BAND_INSTRUMENT_LABEL&&& = 100-3 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 6000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_100-3_npipe_02048_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_100-3_npipe_02048_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_100-3_npipe_02048_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_100-3x100-3_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 100 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_100-3_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_100-4_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_100-4_DIRBE.defaults index d95557cea..99188930b 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_100-4_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_100-4_DIRBE.defaults @@ -1,5 +1,6 @@ # 100-4 single-horn map parameters BAND_LABEL&&& = 100-4 +BAND_INSTRUMENT_LABEL&&& = 100-4 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_100-4_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_100-4_HFI.defaults new file mode 100644 index 000000000..3d2a14352 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_100-4_HFI.defaults @@ -0,0 +1,41 @@ +# 100-4 GHz map parameters +BAND_LABEL&&& = 100-4 +BAND_INSTRUMENT_LABEL&&& = 100-4 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 6000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_100-4_npipe_02048_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_100-4_npipe_02048_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_100-4_npipe_02048_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_100-4x100-4_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 100 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_100-4_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_100_TOD.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_100_TOD.defaults new file mode 100644 index 000000000..736121f05 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_100_TOD.defaults @@ -0,0 +1,83 @@ +#HFI 100 GHz TOD default parameters + +BAND_LABEL&&& = 100 +BAND_INSTRUMENT_LABEL&&& = HFI +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .true. +BAND_NSIDE&&& = 1024 +BAND_LMAX&&& = 3000 +BAND_UNIT&&& = K_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 1 +BAND_MASKFILE&&& = fullsky +BAND_MASKFILE_CALIB&&& = mask_common_dx12_n1024_TQU.fits fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = Bl_TEB_npipe6v19_100-ds2x100-ds2.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n1024.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 100 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = HFI_instrument_v3.h5 +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0.1 +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_LEVEL&&& = L1 + +BAND_TOD_TYPE&&& = HFI +BAND_TOD_BP_INIT_PROP&&& = none +BAND_TOD_HALFRING&&& = 0 +BAND_TOD_START_SCANID&&& = 700 # 3 +BAND_TOD_END_SCANID&&& = 18300 #53724 +BAND_TOD_TOT_NUMSCAN&&& = 18338 #53724 +BAND_TOD_FLAG&&& = 0 +BAND_TOD_ABSCAL_COMP&&& = full +#BAND_TOD_DETECTOR_LIST&&& = 100-1a,100-1b,100-2a,100-2b,100-3a,100-3b,100-4a,100-4b +BAND_TOD_DETECTOR_LIST&&& = 100-1a,100-1b,100-4a,100-4b +BAND_TOD_ORBITAL_ONLY_ABSCAL&&& =.false. +BAND_TOD_INIT_FROM_HDF&&& = default + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + + +#TODO: make these paths into real defaults in the Oslo legacy archive +BAND_MAPFILE&&& = HFI_SkyMap_100-BPassCorrected_1024_R4.00_full.fits +BAND_NOISEFILE&&& = HFI_SkyMap_100-BPassCorrected_1024_R4.00_full_rms_uK.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none +BAND_BANDPASSFILE&&& = HFI_instrument_v3.h5 + +BAND_TOD_MAIN_PROCMASK&&& = npipe6v20_100_n1024_mask.fits +BAND_TOD_SMALL_PROCMASK&&& = npipe6v20_100_n1024_mask.fits +N_GIBBS_PER_TOD&&& = 1 +BAND_TOD_RIMO&&& = HFI_instrument_v3.h5 +BAND_TOD_FILELIST&&& = filelist_100.txt + +BAND_TOD_ZODI_SUBTRACTION&&& = .false. +BAND_TOD_ZODI_MASK&&& = mask_common_dx12_n1024_TQU.fits +BAND_TOD_ZODI_EMISSIVITY&&& = 1.d0,1.d0,1.d0,1.d0,1.d0,1.d0 +BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 +BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_143-1_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_143-1_HFI.defaults new file mode 100644 index 000000000..54a3d60e0 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_143-1_HFI.defaults @@ -0,0 +1,41 @@ +# 143-1 GHz map parameters +BAND_LABEL&&& = 143-1 +BAND_INSTRUMENT_LABEL&&& = 143-1 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 6000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_143-1_npipe_02048_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_143-1_npipe_02048_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_143-1_npipe_02048_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_143-1x143-1_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 143 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_143-1_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_143-2_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_143-2_HFI.defaults new file mode 100644 index 000000000..e4d7fc507 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_143-2_HFI.defaults @@ -0,0 +1,41 @@ +# 143-2 GHz map parameters +BAND_LABEL&&& = 143-2 +BAND_INSTRUMENT_LABEL&&& = 143-2 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 6000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_143-2_npipe_02048_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_143-2_npipe_02048_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_143-2_npipe_02048_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_143-2x143-2_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 143 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_143-2_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_143-3_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_143-3_HFI.defaults new file mode 100644 index 000000000..44f3cc262 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_143-3_HFI.defaults @@ -0,0 +1,41 @@ +# 143-3 GHz map parameters +BAND_LABEL&&& = 143-3 +BAND_INSTRUMENT_LABEL&&& = 143-3 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 6000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_143-3_npipe_02048_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_143-3_npipe_02048_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_143-3_npipe_02048_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_143-3x143-3_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 143 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_143-3_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_143-4_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_143-4_HFI.defaults new file mode 100644 index 000000000..fe2696233 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_143-4_HFI.defaults @@ -0,0 +1,41 @@ +# 143-4 GHz map parameters +BAND_LABEL&&& = 143-4 +BAND_INSTRUMENT_LABEL&&& = 143-4 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 6000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_143-4_npipe_02048_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_143-4_npipe_02048_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_143-4_npipe_02048_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_143-4x143-4_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 143 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_143-4_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_143-5_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_143-5_HFI.defaults new file mode 100644 index 000000000..318e7a6bd --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_143-5_HFI.defaults @@ -0,0 +1,41 @@ +# 143-5 GHz map parameters +BAND_LABEL&&& = 143-5 +BAND_INSTRUMENT_LABEL&&& = 143-5 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 6000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_143-5_npipe_02048_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_143-5_npipe_02048_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_143-5_npipe_02048_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_143-5x143-5_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 143 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_143-5.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_143-6_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_143-6_HFI.defaults new file mode 100644 index 000000000..44c35c3a1 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_143-6_HFI.defaults @@ -0,0 +1,41 @@ +# 143-6 GHz map parameters +BAND_LABEL&&& = 143-6 +BAND_INSTRUMENT_LABEL&&& = 143-6 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 6000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_143-6_npipe_02048_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_143-6_npipe_02048_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_143-6_npipe_02048_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_143-6x143-6_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 143 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_143-6.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_143-7_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_143-7_HFI.defaults new file mode 100644 index 000000000..2f7607a91 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_143-7_HFI.defaults @@ -0,0 +1,41 @@ +# 143-7 GHz map parameters +BAND_LABEL&&& = 143-7 +BAND_INSTRUMENT_LABEL&&& = 143-7 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 6000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_143-7_npipe_02048_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_143-7_npipe_02048_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_143-7_npipe_02048_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_143-7x143-7_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 143 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_143-7.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-1_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-1_DIRBE_n4096.defaults new file mode 100644 index 000000000..13aa6a156 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-1_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 217-1 single-horn map parameters +BAND_LABEL&&& = 217-1 +BAND_INSTRUMENT_LABEL&&& = 217-1 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_217-1_bmap_n4096_uK_noDipole_zodicorr.fits +BAND_NOISEFILE&&& = npipe6v20_217-1_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_217-1_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_217x217_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-1.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_217-1_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-1_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-1_HFI.defaults new file mode 100644 index 000000000..7c7cbb9cb --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-1_HFI.defaults @@ -0,0 +1,41 @@ +# 217-1 GHz map parameters +BAND_LABEL&&& = 217-1 +BAND_INSTRUMENT_LABEL&&& = 217-1 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_217-1_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_217-1_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_217-1_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_217-1x217-1_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-1.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-2_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-2_DIRBE_n4096.defaults new file mode 100644 index 000000000..867b332d9 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-2_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 217-2 single-horn map parameters +BAND_LABEL&&& = 217-2 +BAND_INSTRUMENT_LABEL&&& = 217-2 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_217-2_bmap_n4096_uK_noDipole_zodicorr.fits +BAND_NOISEFILE&&& = npipe6v20_217-1_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_217-2_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_217x217_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_217-2_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-2_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-2_HFI.defaults new file mode 100644 index 000000000..60fbe00b9 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-2_HFI.defaults @@ -0,0 +1,41 @@ +# 217-2 GHz map parameters +BAND_LABEL&&& = 217-2 +BAND_INSTRUMENT_LABEL&&& = 217-2 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_217-2_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_217-2_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_217-2_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_217-2x217-2_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-3_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-3_DIRBE_n4096.defaults new file mode 100644 index 000000000..9d26b6f9a --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-3_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 217-3 single-horn map parameters +BAND_LABEL&&& = 217-3 +BAND_INSTRUMENT_LABEL&&& = 217-3 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_217-3_bmap_n4096_uK_noDipole_zodicorr.fits +BAND_NOISEFILE&&& = npipe6v20_217-1_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_217-3_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_217x217_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-3.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_217-3_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-3_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-3_HFI.defaults new file mode 100644 index 000000000..8a6c443c7 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-3_HFI.defaults @@ -0,0 +1,41 @@ +# 217-3 GHz map parameters +BAND_LABEL&&& = 217-3 +BAND_INSTRUMENT_LABEL&&& = 217-3 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_217-3_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_217-3_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_217-3_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_217-3x217-3_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-3.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-4_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-4_DIRBE_n4096.defaults new file mode 100644 index 000000000..3be8a4d2c --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-4_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 217-4 single-horn map parameters +BAND_LABEL&&& = 217-4 +BAND_INSTRUMENT_LABEL&&& = 217-4 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_217-4_bmap_n4096_uK_noDipole_zodicorr.fits +BAND_NOISEFILE&&& = npipe6v20_217-1_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_217-4_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_217x217_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-4.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_217-4_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-4_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-4_HFI.defaults new file mode 100644 index 000000000..af94547ce --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-4_HFI.defaults @@ -0,0 +1,41 @@ +# 217-4 GHz map parameters +BAND_LABEL&&& = 217-4 +BAND_INSTRUMENT_LABEL&&& = 217-4 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_217-4_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_217-4_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_217-4_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_217-4x217-4_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-4.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-5_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-5_DIRBE.defaults index 033f7e3b1..10128f200 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_217-5_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-5_DIRBE.defaults @@ -1,5 +1,6 @@ # 217-5 single-horn map parameters BAND_LABEL&&& = 217-5 +BAND_INSTRUMENT_LABEL&&& = 217-5 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-5_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-5_DIRBE_n4096.defaults new file mode 100644 index 000000000..09cd72dc0 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-5_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 217-5 single-horn map parameters +BAND_LABEL&&& = 217-5 +BAND_INSTRUMENT_LABEL&&& = 217-5 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_217-5_bmap_n4096_uK_noDipole_zodicorr.fits +BAND_NOISEFILE&&& = npipe6v20_217-1_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_217-5_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_217x217_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-5_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_217-5_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-5_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-5_HFI.defaults new file mode 100644 index 000000000..e2b35c304 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-5_HFI.defaults @@ -0,0 +1,41 @@ +# 217-5 GHz map parameters +BAND_LABEL&&& = 217-5 +BAND_INSTRUMENT_LABEL&&& = 217-5 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_217-5_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_217-5_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_217-5_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_217-5x217-5_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-5_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-6_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-6_DIRBE.defaults index abd0ace37..a0333cde4 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_217-6_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-6_DIRBE.defaults @@ -1,5 +1,6 @@ # 217-6 single-horn map parameters BAND_LABEL&&& = 217-6 +BAND_INSTRUMENT_LABEL&&& = 217-6 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-6_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-6_DIRBE_n4096.defaults new file mode 100644 index 000000000..40ddabad1 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-6_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 217-6 single-horn map parameters +BAND_LABEL&&& = 217-6 +BAND_INSTRUMENT_LABEL&&& = 217-6 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_217-6_bmap_n4096_uK_noDipole_zodicorr.fits +BAND_NOISEFILE&&& = npipe6v20_217-1_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_217-6_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_217x217_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-6_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_217-6_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-6_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-6_HFI.defaults new file mode 100644 index 000000000..792594497 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-6_HFI.defaults @@ -0,0 +1,41 @@ +# 217-6 GHz map parameters +BAND_LABEL&&& = 217-6 +BAND_INSTRUMENT_LABEL&&& = 217-6 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_217-6_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_217-6_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_217-6_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_217-6x217-6_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-6_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-7_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-7_DIRBE.defaults index cc7227eea..9d07cb909 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_217-7_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-7_DIRBE.defaults @@ -1,5 +1,6 @@ # 217-7 single-horn map parameters BAND_LABEL&&& = 217-7 +BAND_INSTRUMENT_LABEL&&& = 217-7 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-7_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-7_DIRBE_n4096.defaults new file mode 100644 index 000000000..78f1dd46a --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-7_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 217-7 single-horn map parameters +BAND_LABEL&&& = 217-7 +BAND_INSTRUMENT_LABEL&&& = 217-7 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_217-7_bmap_n4096_uK_noDipole_zodicorr.fits +BAND_NOISEFILE&&& = npipe6v20_217-1_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_217-7_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_217x217_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-7_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_217-7_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-7_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-7_HFI.defaults new file mode 100644 index 000000000..d75da31f5 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-7_HFI.defaults @@ -0,0 +1,41 @@ +# 217-7 GHz map parameters +BAND_LABEL&&& = 217-7 +BAND_INSTRUMENT_LABEL&&& = 217-7 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_217-7_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_217-7_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_217-7_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_217-7x217-7_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-7_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-8_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-8_DIRBE.defaults index a3ed4aa5c..eef833da9 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_217-8_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-8_DIRBE.defaults @@ -1,5 +1,6 @@ # 217-8 single-horn map parameters BAND_LABEL&&& = 217-8 +BAND_INSTRUMENT_LABEL&&& = 217-8 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-8_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-8_DIRBE_n4096.defaults new file mode 100644 index 000000000..84288ebf4 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-8_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 217-8 single-horn map parameters +BAND_LABEL&&& = 217-8 +BAND_INSTRUMENT_LABEL&&& = 217-8 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_217-8_bmap_n4096_uK_noDipole_zodicorr.fits +BAND_NOISEFILE&&& = npipe6v20_217-1_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_217-8_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_217x217_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-8_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_217-8_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_217-8_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_217-8_HFI.defaults new file mode 100644 index 000000000..bc8e5af1d --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_217-8_HFI.defaults @@ -0,0 +1,41 @@ +# 217-8 GHz map parameters +BAND_LABEL&&& = 217-8 +BAND_INSTRUMENT_LABEL&&& = 217-8 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_217-8_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_217-8_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_217-8_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_217-8x217-8_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 217 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_217-8_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-1_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-1_DIRBE.defaults index e749b7d67..401c68276 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_353-1_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-1_DIRBE.defaults @@ -19,7 +19,7 @@ BAND_BEAM_B_PTSRC_FILE&&& = none BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits BAND_SAMP_NOISE_AMP&&& = .false. BAND_BANDPASS_TYPE&&& = HFI_cmb -BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} BAND_NOMINAL_FREQ&&& = 353 BAND_SAMP_BANDPASS&&& = .false. BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-1.dat diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-1_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-1_DIRBE_n4096.defaults new file mode 100644 index 000000000..3ff924a91 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-1_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 353-1 single-horn map parameters +BAND_LABEL&&& = 353-1 +BAND_INSTRUMENT_LABEL&&& = 353-1 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_353-1_bmap_n4096_uK_noDipole_zodicorr_CIBcorr.fits +BAND_NOISEFILE&&& = npipe6v20_353-1_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_353-1_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_353x353_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-1.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_353-1_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-1_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-1_HFI.defaults new file mode 100644 index 000000000..c5286da02 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-1_HFI.defaults @@ -0,0 +1,41 @@ +# 353-1 GHz map parameters +BAND_LABEL&&& = 353-1 +BAND_INSTRUMENT_LABEL&&& = 353-1 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_353-1_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_353-1_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_353-1_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_353-1x353-1_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-1.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-2_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-2_DIRBE.defaults index 61de1c3b3..27592d7a2 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_353-2_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-2_DIRBE.defaults @@ -19,7 +19,7 @@ BAND_BEAM_B_PTSRC_FILE&&& = none BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits BAND_SAMP_NOISE_AMP&&& = .false. BAND_BANDPASS_TYPE&&& = HFI_cmb -BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} BAND_NOMINAL_FREQ&&& = 353 BAND_SAMP_BANDPASS&&& = .false. BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-2.dat diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-2_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-2_DIRBE_n4096.defaults new file mode 100644 index 000000000..34d491a92 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-2_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 353-2 single-horn map parameters +BAND_LABEL&&& = 353-2 +BAND_INSTRUMENT_LABEL&&& = 353-2 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_353-2_bmap_n4096_uK_noDipole_zodicorr_CIBcorr.fits +BAND_NOISEFILE&&& = npipe6v20_353-2_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_353-2_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_353x353_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_353-2_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-2_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-2_HFI.defaults new file mode 100644 index 000000000..bb7ba14ca --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-2_HFI.defaults @@ -0,0 +1,41 @@ +# 353-2 GHz map parameters +BAND_LABEL&&& = 353-2 +BAND_INSTRUMENT_LABEL&&& = 353-2 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_353-2_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_353-2_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_353-2_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_353-2x353-2_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-3_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-3_DIRBE.defaults index feb3613cf..dc36afd65 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_353-3_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-3_DIRBE.defaults @@ -1,5 +1,6 @@ # 353-3 single-horn map parameters BAND_LABEL&&& = 353-3 +BAND_INSTRUMENT_LABEL&&& = 353-3 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 @@ -18,7 +19,7 @@ BAND_BEAM_B_PTSRC_FILE&&& = none BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits BAND_SAMP_NOISE_AMP&&& = .false. BAND_BANDPASS_TYPE&&& = HFI_cmb -BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} BAND_NOMINAL_FREQ&&& = 353 BAND_SAMP_BANDPASS&&& = .false. BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-3_SHORN.dat diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-3_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-3_DIRBE_n4096.defaults new file mode 100644 index 000000000..6eb14cdda --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-3_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 353-3 single-horn map parameters +BAND_LABEL&&& = 353-3 +BAND_INSTRUMENT_LABEL&&& = 353-3 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_353-3_bmap_n4096_uK_noDipole_zodicorr_CIBcorr.fits +BAND_NOISEFILE&&& = npipe6v20_353-3_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_353-3_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_353x353_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-3_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_353-3_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-3_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-3_HFI.defaults new file mode 100644 index 000000000..d6b1b89b2 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-3_HFI.defaults @@ -0,0 +1,41 @@ +# 353-3 GHz map parameters +BAND_LABEL&&& = 353-3 +BAND_INSTRUMENT_LABEL&&& = 353-3 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_353-3_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_353-3_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_353-3_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_353-3x353-3_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-3_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-4_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-4_DIRBE.defaults index 599262989..a94edc340 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_353-4_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-4_DIRBE.defaults @@ -1,5 +1,6 @@ # 353-4 single-horn map parameters BAND_LABEL&&& = 353-4 +BAND_INSTRUMENT_LABEL&&& = 353-4 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 @@ -18,7 +19,7 @@ BAND_BEAM_B_PTSRC_FILE&&& = none BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits BAND_SAMP_NOISE_AMP&&& = .false. BAND_BANDPASS_TYPE&&& = HFI_cmb -BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} BAND_NOMINAL_FREQ&&& = 353 BAND_SAMP_BANDPASS&&& = .false. BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-4_SHORN.dat diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-4_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-4_DIRBE_n4096.defaults new file mode 100644 index 000000000..7a9d5c6a7 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-4_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 353-4 single-horn map parameters +BAND_LABEL&&& = 353-4 +BAND_INSTRUMENT_LABEL&&& = 353-4 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_353-4_bmap_n4096_uK_noDipole_zodicorr_CIBcorr.fits +BAND_NOISEFILE&&& = npipe6v20_353-4_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_353-4_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_353x353_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-4_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_353-4_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-4_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-4_HFI.defaults new file mode 100644 index 000000000..0e9aa1693 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-4_HFI.defaults @@ -0,0 +1,41 @@ +# 353-4 GHz map parameters +BAND_LABEL&&& = 353-4 +BAND_INSTRUMENT_LABEL&&& = 353-4 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_353-4_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_353-4_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_353-4_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_353-4x353-4_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-4_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-5_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-5_DIRBE.defaults index 2eaced8b0..a512a54ff 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_353-5_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-5_DIRBE.defaults @@ -1,5 +1,6 @@ # 353-5 single-horn map parameters BAND_LABEL&&& = 353-5 +BAND_INSTRUMENT_LABEL&&& = 353-5 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 @@ -18,7 +19,7 @@ BAND_BEAM_B_PTSRC_FILE&&& = none BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits BAND_SAMP_NOISE_AMP&&& = .false. BAND_BANDPASS_TYPE&&& = HFI_cmb -BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} BAND_NOMINAL_FREQ&&& = 353 BAND_SAMP_BANDPASS&&& = .false. BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-5_SHORN.dat diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-5_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-5_DIRBE_n4096.defaults new file mode 100644 index 000000000..be4d66426 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-5_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 353-5 single-horn map parameters +BAND_LABEL&&& = 353-5 +BAND_INSTRUMENT_LABEL&&& = 353-5 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_353-5_bmap_n4096_uK_noDipole_zodicorr_CIBcorr.fits +BAND_NOISEFILE&&& = npipe6v20_353-5_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_353-5_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_353x353_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-5_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_353-5_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-5_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-5_HFI.defaults new file mode 100644 index 000000000..f8522dda7 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-5_HFI.defaults @@ -0,0 +1,41 @@ +# 353-5 GHz map parameters +BAND_LABEL&&& = 353-5 +BAND_INSTRUMENT_LABEL&&& = 353-5 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_353-5_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_353-5_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_353-5_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_353-5x353-5_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-5_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-6_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-6_DIRBE.defaults index 8f572b2df..2d6da93ee 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_353-6_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-6_DIRBE.defaults @@ -1,5 +1,6 @@ # 353-6 single-horn map parameters BAND_LABEL&&& = 353-6 +BAND_INSTRUMENT_LABEL&&& = 353-6 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 @@ -18,7 +19,7 @@ BAND_BEAM_B_PTSRC_FILE&&& = none BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits BAND_SAMP_NOISE_AMP&&& = .false. BAND_BANDPASS_TYPE&&& = HFI_cmb -BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} BAND_NOMINAL_FREQ&&& = 353 BAND_SAMP_BANDPASS&&& = .false. BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-6_SHORN.dat diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-6_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-6_DIRBE_n4096.defaults new file mode 100644 index 000000000..ca9699304 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-6_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 353-6 single-horn map parameters +BAND_LABEL&&& = 353-6 +BAND_INSTRUMENT_LABEL&&& = 353-6 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_353-6_bmap_n4096_uK_noDipole_zodicorr_CIBcorr.fits +BAND_NOISEFILE&&& = npipe6v20_353-6_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_353-6_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_353x353_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-6_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_353-6_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-6_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-6_HFI.defaults new file mode 100644 index 000000000..88b207b7c --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-6_HFI.defaults @@ -0,0 +1,41 @@ +# 353-6 GHz map parameters +BAND_LABEL&&& = 353-6 +BAND_INSTRUMENT_LABEL&&& = 353-6 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_353-6_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_353-6_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_353-6_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_353-6x353-6_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-6_SHORN.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-7_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-7_DIRBE.defaults index 73a0e7608..466c8d602 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_353-7_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-7_DIRBE.defaults @@ -19,7 +19,7 @@ BAND_BEAM_B_PTSRC_FILE&&& = none BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits BAND_SAMP_NOISE_AMP&&& = .false. BAND_BANDPASS_TYPE&&& = HFI_cmb -BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} BAND_NOMINAL_FREQ&&& = 353 BAND_SAMP_BANDPASS&&& = .false. BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-7.dat diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-7_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-7_DIRBE_n4096.defaults new file mode 100644 index 000000000..268a7b2b9 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-7_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 353-7 single-horn map parameters +BAND_LABEL&&& = 353-7 +BAND_INSTRUMENT_LABEL&&& = 353-7 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_353-7_bmap_n4096_uK_noDipole_zodicorr_CIBcorr.fits +BAND_NOISEFILE&&& = npipe6v20_353-7_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_353-7_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_353x353_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-7.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_353-7_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-7_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-7_HFI.defaults new file mode 100644 index 000000000..4cca6b0cf --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-7_HFI.defaults @@ -0,0 +1,41 @@ +# 353-7 GHz map parameters +BAND_LABEL&&& = 353-7 +BAND_INSTRUMENT_LABEL&&& = 353-7 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_353-7_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_353-7_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_353-7_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_353-7x353-7_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-7.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-8_DIRBE.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-8_DIRBE.defaults index 5ffd27adf..bb2604926 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_353-8_DIRBE.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-8_DIRBE.defaults @@ -19,7 +19,7 @@ BAND_BEAM_B_PTSRC_FILE&&& = none BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits BAND_SAMP_NOISE_AMP&&& = .false. BAND_BANDPASS_TYPE&&& = HFI_cmb -BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} BAND_NOMINAL_FREQ&&& = 353 BAND_SAMP_BANDPASS&&& = .false. BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-8.dat diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-8_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-8_DIRBE_n4096.defaults new file mode 100644 index 000000000..dea11efc5 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-8_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 353-8 single-horn map parameters +BAND_LABEL&&& = 353-8 +BAND_INSTRUMENT_LABEL&&& = 353-8 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = npipe6v20_353-8_bmap_n4096_uK_noDipole_zodicorr_CIBcorr.fits +BAND_NOISEFILE&&& = npipe6v20_353-8_bmap_n4096_uK_rms_hack.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = npipe6v20_353-8_misspix.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_353x353_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = powlaw_tilt # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-8.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_353-8_bmap_n2048_uK_rms_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353-8_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353-8_HFI.defaults new file mode 100644 index 000000000..816b14b50 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353-8_HFI.defaults @@ -0,0 +1,41 @@ +# 353-8 GHz map parameters +BAND_LABEL&&& = 353-8 +BAND_INSTRUMENT_LABEL&&& = 353-8 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_353-8_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_353-8_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_353-8_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_353-8x353-8_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 353 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_353-8.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_353_map_pol_only.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_353_map_pol_only.defaults index cd6bf33ab..dbb84915b 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_353_map_pol_only.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_353_map_pol_only.defaults @@ -1,5 +1,6 @@ # 353 GHz (full frequency) parameters; only polarization, not temperature BAND_LABEL&&& = 353 +BAND_INSTRUMENT_LABEL&&& = 353 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 1024 diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_545-1_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_545-1_HFI.defaults new file mode 100644 index 000000000..656beabf5 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_545-1_HFI.defaults @@ -0,0 +1,41 @@ +# 545-1 GHz map parameters +BAND_LABEL&&& = 545-1 +BAND_INSTRUMENT_LABEL&&& = 545-1 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_545-1_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_545-1_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_545-1_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_545-1x545-1_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 545 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_545-1.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_545-1_TOD.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_545-1_TOD.defaults new file mode 100644 index 000000000..e673600a1 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_545-1_TOD.defaults @@ -0,0 +1,83 @@ +#HFI 545 GHz TOD default parameters +BAND_LABEL&&& = 545-1 +BAND_INSTRUMENT_LABEL&&& = 545-1 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 2048 +BAND_LMAX&&& = 4000 +BAND_UNIT&&& = K_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 1 +BAND_MASKFILE&&& = fullsky +BAND_MASKFILE_CALIB&&& = mask_common_dx12_n2048_TQU.fits fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v19_545GHzx545GHz.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 545 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = HFI_instrument_v2.h5 +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0.1 +BAND_GAIN_CALIB_COMP&&& = all cmb +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_LEVEL&&& = L1 + +BAND_TOD_TYPE&&& = HFI +BAND_TOD_BP_INIT_PROP&&& = none +BAND_TOD_HALFRING&&& = 0 +BAND_TOD_START_SCANID&&& = 700 # 3 +BAND_TOD_END_SCANID&&& = 18300 #53724 +BAND_TOD_TOT_NUMSCAN&&& = 18338 #53724 +BAND_TOD_FLAG&&& = 0 +BAND_TOD_ABSCAL_COMP&&& = full +BAND_TOD_DETECTOR_LIST&&& = 545-1 +BAND_TOD_ORBITAL_ONLY_ABSCAL&&& =.false. +BAND_TOD_INIT_FROM_HDF&&& = default +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none + +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + +#TODO: make these paths into real defaults in the Oslo legacy archive +BAND_MAPFILE&&& = npipe6v20_545_map_K.fits +BAND_NOISEFILE&&& = npipe6v20_545_wcov.fits +BAND_REG_NOISEFILE&&& = npipe6v20_545_wcov.fits +BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_545_wcov.fits +BAND_NOISE_RMS&&&_SMOOTH02 = npipe6v20_545_wcov.fits +BAND_NOISE_RMS&&&_SMOOTH03 = npipe6v20_545_wcov.fits +BAND_BANDPASSFILE&&& = HFI_instrument_v2.h5 + +BAND_TOD_MAIN_PROCMASK&&& = npipe6v20_545-1_n2048_mask.fits +BAND_TOD_SMALL_PROCMASK&&& = npipe6v20_545-1_n2048_mask.fits +N_GIBBS_PER_TOD&&& = 1 +BAND_TOD_RIMO&&& = HFI_instrument_v2.h5 +BAND_TOD_FILELIST&&& = filelist_545_Artem_full_pointing_DPC.txt #filelist_545_Artem_full.txt + +BAND_TOD_ZODI_SUBTRACTION&&& = .true. +BAND_TOD_ZODI_MASK&&& = mask_common_dx12_n2048_TQU.fits +BAND_TOD_ZODI_EMISSIVITY&&& = 1.d0,1.d0,1.d0,1.d0,1.d0,1.d0 +BAND_TOD_ZODI_ALBEDO&&& = 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0 +BAND_TOD_ZODI_REFERENCE_BAND&&&= .false. + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_545-2_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_545-2_HFI.defaults new file mode 100644 index 000000000..b7ea987f1 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_545-2_HFI.defaults @@ -0,0 +1,41 @@ +# 545-2 GHz map parameters +BAND_LABEL&&& = 545-2 +BAND_INSTRUMENT_LABEL&&& = 545-2 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_545-2_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_545-2_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_545-2_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_545-2x545-2_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 545 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_545-2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_545-4_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_545-4_HFI.defaults new file mode 100644 index 000000000..fbe65df3d --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_545-4_HFI.defaults @@ -0,0 +1,41 @@ +# 545-4 GHz map parameters +BAND_LABEL&&& = 545-4 +BAND_INSTRUMENT_LABEL&&& = 545-4 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_545-4_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_545-4_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_545-4_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_545-4x545-4_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 545 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_545-4.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_545_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_545_DIRBE_n4096.defaults new file mode 100644 index 000000000..57a8bd016 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_545_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 545 GHz (full frequency) parameters +BAND_LABEL&&& = 545 +BAND_INSTRUMENT_LABEL&&& = 545 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10009 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = none #Must be set +BAND_NOISEFILE&&& = none #Must be set +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = none #Must be set +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_545x545_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 545 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_545-1.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = firas all cmb +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = HFI_SkyMap_545-BPassCorrected_2048_R4.00_full_rms_uK_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_545_TOD.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_545_TOD.defaults index ae9e7b9d7..e179db093 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_545_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_545_TOD.defaults @@ -1,11 +1,11 @@ #HFI 545 GHz TOD default parameters - BAND_LABEL&&& = 545 +BAND_INSTRUMENT_LABEL&&& = 545 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 2048 BAND_LMAX&&& = 4000 -BAND_UNIT&&& = uK_cmb +BAND_UNIT&&& = K_cmb BAND_NOISE_FORMAT&&& = rms BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 1 BAND_MASKFILE&&& = fullsky @@ -15,11 +15,11 @@ BAND_BEAM_B_L_FILE&&& = Bl_npipe6v19_545GHzx545GHz.fits BAND_BEAM_B_PTSRC_FILE&&& = none BAND_PIXEL_WINDOW&&& = pixel_window_n2048.fits BAND_SAMP_NOISE_AMP&&& = .false. -BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_BANDPASS_TYPE&&& = HFI_cmb BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} BAND_NOMINAL_FREQ&&& = 545 BAND_SAMP_BANDPASS&&& = .false. -BAND_BANDPASSFILE&&& = HFI_instrument_v1.h5 +BAND_BANDPASSFILE&&& = HFI_instrument_v2.h5 BAND_SAMP_GAIN&&& = .false. BAND_GAIN_PRIOR_MEAN&&& = 1. BAND_GAIN_PRIOR_RMS&&& = 0.1 @@ -32,18 +32,30 @@ BAND_DEFAULT_GAIN&&& = 1. BAND_DEFAULT_BP_DELTA&&& = 0. BAND_DEFAULT_NOISEAMP&&& = 1. BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_LEVEL&&& = L1 BAND_TOD_TYPE&&& = HFI BAND_TOD_BP_INIT_PROP&&& = none BAND_TOD_HALFRING&&& = 0 -BAND_TOD_START_SCANID&&& = 3 -BAND_TOD_END_SCANID&&& = 53724 -BAND_TOD_TOT_NUMSCAN&&& = 53721 +BAND_TOD_START_SCANID&&& = 700 # 3 +BAND_TOD_END_SCANID&&& = 18300 #53724 +BAND_TOD_TOT_NUMSCAN&&& = 18338 #53724 BAND_TOD_FLAG&&& = 0 BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = 545-1,545-2,545-4 +BAND_TOD_ORBITAL_ONLY_ABSCAL&&& =.false. BAND_TOD_INIT_FROM_HDF&&& = default +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + #TODO: make these paths into real defaults in the Oslo legacy archive BAND_MAPFILE&&& = npipe6v20_545_map_K.fits BAND_NOISEFILE&&& = npipe6v20_545_wcov.fits @@ -51,11 +63,13 @@ BAND_REG_NOISEFILE&&& = npipe6v20_545_wcov.fits BAND_NOISE_RMS&&&_SMOOTH01 = npipe6v20_545_wcov.fits BAND_NOISE_RMS&&&_SMOOTH02 = npipe6v20_545_wcov.fits BAND_NOISE_RMS&&&_SMOOTH03 = npipe6v20_545_wcov.fits -BAND_BANDPASSFILE&&& = HFI_instrument_v1.h5 +BAND_BANDPASSFILE&&& = HFI_instrument_v2.h5 BAND_TOD_MAIN_PROCMASK&&& = npipe6v20_545-1_n2048_mask.fits BAND_TOD_SMALL_PROCMASK&&& = npipe6v20_545-1_n2048_mask.fits -BAND_TOD_RIMO&&& = HFI_instrument_v1.h5 -BAND_TOD_FILELIST&&& = filelist_545_v1.txt N_GIBBS_PER_TOD&&& = 1 +BAND_TOD_RIMO&&& = HFI_instrument_v2.h5 +BAND_TOD_FILELIST&&& = filelist_545_Artem_full_pointing_DPC.txt #filelist_545_Artem_full.txt + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_857-1_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_857-1_HFI.defaults new file mode 100644 index 000000000..745d6dc3d --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_857-1_HFI.defaults @@ -0,0 +1,41 @@ +# 857-1 GHz map parameters +BAND_LABEL&&& = 857-1 +BAND_INSTRUMENT_LABEL&&& = 857-1 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_857-1_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_857-1_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_857-1_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_857-1x857-1_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 857 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_857-1.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_857-2_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_857-2_HFI.defaults new file mode 100644 index 000000000..67819cb48 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_857-2_HFI.defaults @@ -0,0 +1,41 @@ +# 857-2 GHz map parameters +BAND_LABEL&&& = 857-2 +BAND_INSTRUMENT_LABEL&&& = 857-2 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_857-2_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_857-2_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_857-2_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_857-2x857-2_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 857 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_857-2.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_857-3_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_857-3_HFI.defaults new file mode 100644 index 000000000..6799282c6 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_857-3_HFI.defaults @@ -0,0 +1,41 @@ +# 857-3 GHz map parameters +BAND_LABEL&&& = 857-3 +BAND_INSTRUMENT_LABEL&&& = 857-3 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_857-3_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_857-3_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_857-3_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_857-3x857-3_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 857 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_857-3.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_857-4_HFI.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_857-4_HFI.defaults new file mode 100644 index 000000000..80e39daf6 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_857-4_HFI.defaults @@ -0,0 +1,41 @@ +# 857-4 GHz map parameters +BAND_LABEL&&& = 857-4 +BAND_INSTRUMENT_LABEL&&& = 857-4 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/map/map_planck_857-4_npipe_04096_fullres_full_T.fits +BAND_NOISEFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/rms/rms_planck_857-4_npipe_04096_fullres_full_T.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = /mn/stornext/d23/cmbco/globe/fullres/planck/mask/hitmask_planck_857-4_npipe_04096_fullres_full_T.fits +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l +BAND_BEAM_B_L_FILE&&& = Bl_npipe6v20_857-4x857-4_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift +BAND_NOMINAL_FREQ&&& = 857 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_857-4.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 1. +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = 25 +BAND_GAIN_LMAX&&& = 100 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_857_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_857_DIRBE_n4096.defaults new file mode 100644 index 000000000..58793e838 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_857_DIRBE_n4096.defaults @@ -0,0 +1,41 @@ +# 857 GHz (full frequency) parameters +BAND_LABEL&&& = 857 +BAND_INSTRUMENT_LABEL&&& = 857 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 4096 +BAND_LMAX&&& = 10000 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_MAPFILE&&& = none #Must be set +BAND_NOISEFILE&&& = none #Must be set +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.01 +BAND_MASKFILE&&& = none #Must be set +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_dx12v2_857x857_extended.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n4096.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 857 +BAND_SAMP_BANDPASS&&& = .false. +BAND_BANDPASSFILE&&& = bp_RIMO_v2.0_857-1.dat +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0. +BAND_GAIN_CALIB_COMP&&& = firas all cmb +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband +BAND_TOD_TYPE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = HFI_SkyMap_857-BPassCorrected_2048_R4.00_full_rms_uK_1deg_n256_v2.fits +BAND_NOISE_RMS&&&_SMOOTH02 = none +BAND_NOISE_RMS&&&_SMOOTH03 = none diff --git a/commander3/parameter_files/defaults/bands/HFI/HFI_857_map.defaults b/commander3/parameter_files/defaults/bands/HFI/HFI_857_map.defaults index c8c8fb060..004aca959 100644 --- a/commander3/parameter_files/defaults/bands/HFI/HFI_857_map.defaults +++ b/commander3/parameter_files/defaults/bands/HFI/HFI_857_map.defaults @@ -2,6 +2,7 @@ # Come up with a name, an nside, a beam, a noise rms, the mask, the beams, but # most things can be left at their defaults. BAND_LABEL&&& = 857 # A descriptive label +BAND_INSTRUMENT_LABEL&&& = 857 # A descriptive label BAND_OBS_PERIOD&&& = 1 # A placeholder BAND_POLARIZATION&&& = .false. # Is it polarized or not? BAND_NSIDE&&& = 1024 # Which healpix Nisde? diff --git a/commander3/parameter_files/defaults/bands/LFI/LFI_030_TOD.defaults b/commander3/parameter_files/defaults/bands/LFI/LFI_030_TOD.defaults index 8ac3bce96..1739a9cb2 100644 --- a/commander3/parameter_files/defaults/bands/LFI/LFI_030_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LFI/LFI_030_TOD.defaults @@ -1,6 +1,7 @@ #LFI 30 GHz TOD default parameters BAND_LABEL&&& = 030 +BAND_INSTRUMENT_LABEL&&& = 030 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -44,6 +45,17 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = 27M,27S,28M,28S BAND_TOD_INIT_FROM_HDF&&& = default +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none + + #TODO: make these paths into real defaults in the Oslo legacy archive BAND_MAPFILE&&& = init_tod_map_030_n512_BP8.1_v1.fits BAND_NOISEFILE&&& = init_tod_rms_030_n512_BP8.1_v1.fits @@ -59,3 +71,14 @@ BAND_TOD_RIMO&&& = LFI_instrument_v4.h5 BAND_TOD_FILELIST&&& = filelist_30_v17.txt N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/LFI/LFI_044_TOD.defaults b/commander3/parameter_files/defaults/bands/LFI/LFI_044_TOD.defaults index 645641961..cc8369e37 100644 --- a/commander3/parameter_files/defaults/bands/LFI/LFI_044_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LFI/LFI_044_TOD.defaults @@ -1,4 +1,5 @@ BAND_LABEL&&& = 044 +BAND_INSTRUMENT_LABEL&&& = 044 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -53,3 +54,14 @@ BAND_TOD_DETECTOR_LIST&&& = 24M,24S,25M,25S,26M,26S BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/LFI/LFI_070_TOD.defaults b/commander3/parameter_files/defaults/bands/LFI/LFI_070_TOD.defaults index ca5565d22..39f81d611 100644 --- a/commander3/parameter_files/defaults/bands/LFI/LFI_070_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LFI/LFI_070_TOD.defaults @@ -1,5 +1,6 @@ # 70 GHz parameters BAND_LABEL&&& = 070 +BAND_INSTRUMENT_LABEL&&& = 070 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 1024 @@ -54,3 +55,14 @@ BAND_TOD_DETECTOR_LIST&&& = 18M,18S,19M,19S,20M,20S,21M,21S,22M,22S,23M,23S BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_040_L1_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_040_L1_TOD.defaults index a744edcd6..f8d3888c5 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_040_L1_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_040_L1_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_050_L2_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_050_L2_TOD.defaults index e54cd0cfd..90518537f 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_050_L2_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_050_L2_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_060_L1_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_060_L1_TOD.defaults index 925748bf5..3d7a5e100 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_060_L1_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_060_L1_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_068_L2_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_068_L2_TOD.defaults index a4ec14259..cf692ec9e 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_068_L2_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_068_L2_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_068_L3_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_068_L3_TOD.defaults index dba04aa18..4d3251312 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_068_L3_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_068_L3_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_078_L1_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_078_L1_TOD.defaults index 10631121c..834c5ac28 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_078_L1_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_078_L1_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_078_L4_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_078_L4_TOD.defaults index 21e1e9aa1..dfec61a49 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_078_L4_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_078_L4_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_089_L2_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_089_L2_TOD.defaults index 3c45464b1..125060799 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_089_L2_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_089_L2_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_089_L3_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_089_L3_TOD.defaults index 166abf8cd..bc1e89782 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_089_L3_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_089_L3_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_100_L4_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_100_L4_TOD.defaults index c55a33875..d07731b8a 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_100_L4_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_100_L4_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_100_M1_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_100_M1_TOD.defaults index 382b26476..145674f70 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_100_M1_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_100_M1_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_119_L3_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_119_L3_TOD.defaults index 7dc670ada..a4df1fb31 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_119_L3_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_119_L3_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_119_M2_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_119_M2_TOD.defaults index 816d64b25..447e6f790 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_119_M2_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_119_M2_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_140_L4_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_140_L4_TOD.defaults index a6130eefa..f1ba623f8 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_140_L4_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_140_L4_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_140_M1_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_140_M1_TOD.defaults index e8c83b6f5..261694eec 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_140_M1_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_140_M1_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_166_M2_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_166_M2_TOD.defaults index e2490062f..ff7b24804 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_166_M2_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_166_M2_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_195_H1_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_195_H1_TOD.defaults index 71c6ada40..94b318bdc 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_195_H1_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_195_H1_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_195_M1_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_195_M1_TOD.defaults index aeebe56ce..81349c93d 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_195_M1_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_195_M1_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_235_H2_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_235_H2_TOD.defaults index 84e61337f..46390b7ee 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_235_H2_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_235_H2_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_280_H1_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_280_H1_TOD.defaults index f1be55023..46f5fed7c 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_280_H1_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_280_H1_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_337_H2_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_337_H2_TOD.defaults index 8979d5bb4..5f52bcf74 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_337_H2_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_337_H2_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_402_H3_TOD.defaults b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_402_H3_TOD.defaults index 9f235222f..cb4424fce 100644 --- a/commander3/parameter_files/defaults/bands/LiteBIRD/LB_402_H3_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/LiteBIRD/LB_402_H3_TOD.defaults @@ -52,3 +52,5 @@ BAND_TOD_INIT_FROM_HDF&&& = default BAND_TOD_LEVEL&&& = L1 BAND_TOD_ZODI_SUBTRACTION&&& = .false. N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/QUIET/QUIET_Q_GC_TOD.defaults b/commander3/parameter_files/defaults/bands/QUIET/QUIET_Q_GC_TOD.defaults index 74eccc0e2..6dc672d6e 100644 --- a/commander3/parameter_files/defaults/bands/QUIET/QUIET_Q_GC_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/QUIET/QUIET_Q_GC_TOD.defaults @@ -54,3 +54,5 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = 01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19 BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/WMAP/WMAP_K_TOD.defaults b/commander3/parameter_files/defaults/bands/WMAP/WMAP_K_TOD.defaults index 8255e3b86..c567a10ab 100644 --- a/commander3/parameter_files/defaults/bands/WMAP/WMAP_K_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/WMAP/WMAP_K_TOD.defaults @@ -1,5 +1,6 @@ #WMAP K TOD default parameters BAND_LABEL&&& = 023-WMAP_K +BAND_INSTRUMENT_LABEL&&& = 023-WMAP_K BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -53,3 +54,14 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = K113,K114,K123,K124 BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/WMAP/WMAP_Ka_TOD.defaults b/commander3/parameter_files/defaults/bands/WMAP/WMAP_Ka_TOD.defaults index e41d13a87..5265cf146 100644 --- a/commander3/parameter_files/defaults/bands/WMAP/WMAP_Ka_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/WMAP/WMAP_Ka_TOD.defaults @@ -1,6 +1,7 @@ #WMAP Ka TOD default parameters BAND_LABEL&&& = 030-WMAP_Ka +BAND_INSTRUMENT_LABEL&&& = 030-WMAP_Ka BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -54,3 +55,14 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = Ka113,Ka114,Ka123,Ka124 BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/WMAP/WMAP_Q1_TOD.defaults b/commander3/parameter_files/defaults/bands/WMAP/WMAP_Q1_TOD.defaults index f3a69e246..f1376c219 100644 --- a/commander3/parameter_files/defaults/bands/WMAP/WMAP_Q1_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/WMAP/WMAP_Q1_TOD.defaults @@ -1,6 +1,7 @@ #WMAP Q1 TOD default parameters BAND_LABEL&&& = 040-WMAP_Q1 +BAND_INSTRUMENT_LABEL&&& = 040-WMAP_Q1 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -54,3 +55,14 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = Q113,Q114,Q123,Q124 BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/WMAP/WMAP_Q2_TOD.defaults b/commander3/parameter_files/defaults/bands/WMAP/WMAP_Q2_TOD.defaults index 6e2e7dd21..484e356f0 100644 --- a/commander3/parameter_files/defaults/bands/WMAP/WMAP_Q2_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/WMAP/WMAP_Q2_TOD.defaults @@ -1,6 +1,7 @@ #WMAP Q2 TOD default parameters BAND_LABEL&&& = 040-WMAP_Q2 +BAND_INSTRUMENT_LABEL&&& = 040-WMAP_Q2 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -54,3 +55,14 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = Q213,Q214,Q223,Q224 BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/WMAP/WMAP_V1_TOD.defaults b/commander3/parameter_files/defaults/bands/WMAP/WMAP_V1_TOD.defaults index 0d28ebb47..d2c4bf71a 100644 --- a/commander3/parameter_files/defaults/bands/WMAP/WMAP_V1_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/WMAP/WMAP_V1_TOD.defaults @@ -1,6 +1,7 @@ #WMAP V1 TOD default parameters BAND_LABEL&&& = 060-WMAP_V1 +BAND_INSTRUMENT_LABEL&&& = 060-WMAP_V1 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -54,3 +55,14 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = V113,V114,V123,V124 BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/WMAP/WMAP_V2_TOD.defaults b/commander3/parameter_files/defaults/bands/WMAP/WMAP_V2_TOD.defaults index 6c2b3bbb0..0c5ecb41d 100644 --- a/commander3/parameter_files/defaults/bands/WMAP/WMAP_V2_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/WMAP/WMAP_V2_TOD.defaults @@ -1,6 +1,7 @@ #WMAP V2 TOD default parameters BAND_LABEL&&& = 060-WMAP_V2 +BAND_INSTRUMENT_LABEL&&& = 060-WMAP_V2 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -54,3 +55,14 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = V213,V214,V223,V224 BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/WMAP/WMAP_W1_TOD.defaults b/commander3/parameter_files/defaults/bands/WMAP/WMAP_W1_TOD.defaults index 32e4fdf69..1aec7ee27 100644 --- a/commander3/parameter_files/defaults/bands/WMAP/WMAP_W1_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/WMAP/WMAP_W1_TOD.defaults @@ -1,6 +1,7 @@ #WMAP Ka TOD default parameters BAND_LABEL&&& = 090-WMAP_W1 +BAND_INSTRUMENT_LABEL&&& = 090-WMAP_W1 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -54,3 +55,14 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = W113,W114,W123,W124 BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/WMAP/WMAP_W2_TOD.defaults b/commander3/parameter_files/defaults/bands/WMAP/WMAP_W2_TOD.defaults index 28caccffb..11248e13e 100644 --- a/commander3/parameter_files/defaults/bands/WMAP/WMAP_W2_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/WMAP/WMAP_W2_TOD.defaults @@ -1,6 +1,7 @@ #WMAP Ka TOD default parameters BAND_LABEL&&& = 090-WMAP_W2 +BAND_INSTRUMENT_LABEL&&& = 090-WMAP_W2 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -54,3 +55,14 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = W213,W214,W223,W224 BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/WMAP/WMAP_W3_TOD.defaults b/commander3/parameter_files/defaults/bands/WMAP/WMAP_W3_TOD.defaults index 9b2dad089..15bc529ee 100644 --- a/commander3/parameter_files/defaults/bands/WMAP/WMAP_W3_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/WMAP/WMAP_W3_TOD.defaults @@ -1,6 +1,7 @@ #WMAP Ka TOD default parameters BAND_LABEL&&& = 090-WMAP_W3 +BAND_INSTRUMENT_LABEL&&& = 090-WMAP_W3 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -54,3 +55,14 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = W313,W314,W323,W324 BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/WMAP/WMAP_W4_TOD.defaults b/commander3/parameter_files/defaults/bands/WMAP/WMAP_W4_TOD.defaults index 149c1dfe8..206e2ff55 100644 --- a/commander3/parameter_files/defaults/bands/WMAP/WMAP_W4_TOD.defaults +++ b/commander3/parameter_files/defaults/bands/WMAP/WMAP_W4_TOD.defaults @@ -1,6 +1,7 @@ #WMAP Ka TOD default parameters BAND_LABEL&&& = 090-WMAP_W4 +BAND_INSTRUMENT_LABEL&&& = 090-WMAP_W4 BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .true. BAND_NSIDE&&& = 512 @@ -54,3 +55,14 @@ BAND_TOD_ABSCAL_COMP&&& = full BAND_TOD_DETECTOR_LIST&&& = W413,W414,W423,W424 BAND_TOD_INIT_FROM_HDF&&& = default N_GIBBS_PER_TOD&&& = 1 + +BAND_TOD_MAPMAKE_TYPE&&& = binned +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none diff --git a/commander3/parameter_files/defaults/bands/haslam/haslam_0.4_map.defaults b/commander3/parameter_files/defaults/bands/haslam/haslam_0.4_map.defaults index 0b713769e..1d74cefa3 100644 --- a/commander3/parameter_files/defaults/bands/haslam/haslam_0.4_map.defaults +++ b/commander3/parameter_files/defaults/bands/haslam/haslam_0.4_map.defaults @@ -1,5 +1,6 @@ # Haslam 0.4 GHz BAND_LABEL&&& = 0.4-Haslam +BAND_INSTRUMENT_LABEL&&& = 0.4-Haslam BAND_OBS_PERIOD&&& = 1 BAND_POLARIZATION&&& = .false. BAND_NSIDE&&& = 512 @@ -38,3 +39,5 @@ BAND_DEFAULT_BP_DELTA&&& = 0. BAND_DEFAULT_NOISEAMP&&& = 1. BAND_COMPONENT_SENSITIVITY&&& = broadband BAND_TOD_TYPE&&& = none + +BAND_TOD_MAPMAKE_TYPE&&& = binned diff --git a/commander3/parameter_files/defaults/bands/planck2015_1deg.defaults b/commander3/parameter_files/defaults/bands/planck2015_1deg.defaults new file mode 100644 index 000000000..d444ba7e3 --- /dev/null +++ b/commander3/parameter_files/defaults/bands/planck2015_1deg.defaults @@ -0,0 +1,42 @@ +#Generic Planck 2015 1deg default parameters + +BAND_LABEL&&& = 030 +BAND_INSTRUMENT_LABEL&&& = 030 +BAND_OBS_PERIOD&&& = 1 +BAND_POLARIZATION&&& = .false. +BAND_NSIDE&&& = 256 +BAND_LMAX&&& = 750 +BAND_UNIT&&& = uK_cmb +BAND_NOISE_FORMAT&&& = rms +BAND_NOISE_UNIFORMIZE_FSKY&&& = 0.0 +BAND_MASKFILE&&& = fullsky +BAND_MASKFILE_CALIB&&& = fullsky +BAND_BEAMTYPE&&& = b_l # {b_l, febecop} +BAND_BEAM_B_L_FILE&&& = beam_60arcmin.fits +BAND_BEAM_B_PTSRC_FILE&&& = none +BAND_PIXEL_WINDOW&&& = pixel_window_n0256.fits +BAND_SAMP_NOISE_AMP&&& = .false. +BAND_BANDPASS_TYPE&&& = LFI +BAND_BANDPASS_MODEL&&& = additive_shift # {powlaw_tilt, additive_shift} +BAND_NOMINAL_FREQ&&& = 28.4 +BAND_SAMP_BANDPASS&&& = .false. +BAND_SAMP_GAIN&&& = .false. +BAND_GAIN_PRIOR_MEAN&&& = 1. +BAND_GAIN_PRIOR_RMS&&& = 0.1 +BAND_GAIN_CALIB_COMP&&& = all +BAND_GAIN_LMIN&&& = -1 +BAND_GAIN_LMAX&&& = -1 +BAND_GAIN_APOD_MASK&&& = fullsky +BAND_GAIN_APOD_FWHM&&& = 120. +BAND_DEFAULT_GAIN&&& = 1. +BAND_DEFAULT_BP_DELTA&&& = 0. +BAND_DEFAULT_NOISEAMP&&& = 1. +BAND_COMPONENT_SENSITIVITY&&& = broadband + +BAND_TOD_TYPE&&& = none + +BAND_MAPFILE&&& = init_tod_map_030_n512_BP8.1_v1.fits +BAND_NOISEFILE&&& = init_tod_rms_030_n512_BP8.1_v1.fits +BAND_REG_NOISEFILE&&& = none +BAND_NOISE_RMS&&&_SMOOTH01 = none +BAND_BANDPASSFILE&&& = LFI_instrument_v4.h5 diff --git a/commander3/parameter_files/defaults/components/ame/ame_DIRBE.defaults b/commander3/parameter_files/defaults/components/ame/ame_DIRBE.defaults index e7db0e969..a3524205a 100644 --- a/commander3/parameter_files/defaults/components/ame/ame_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/ame/ame_DIRBE.defaults @@ -13,7 +13,7 @@ COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0016_600arcmin_rescaled_TQU #COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0064_120arcmin_rescaled_TQU.fits,64,120.d0,2.0,2.5,3.0,3.5,4.0,10 #,,, COMP_DEFLATION_MASK&& = fullsky COMP_L_APOD&& = 1000 - +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_OUTPUT_FWHM&& = 60 # arcmin COMP_UNIT&& = uK_RJ COMP_NU_MIN&& = 0.d0 diff --git a/commander3/parameter_files/defaults/components/ame/ame_planck2015_1deg.defaults b/commander3/parameter_files/defaults/components/ame/ame_planck2015_1deg.defaults new file mode 100644 index 000000000..b4739b12b --- /dev/null +++ b/commander3/parameter_files/defaults/components/ame/ame_planck2015_1deg.defaults @@ -0,0 +1,96 @@ +# AME component +COMP_LABEL&& = ame1 +COMP_TYPE&& = spindust +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 256 +COMP_MONOPOLE_PRIOR&& = none +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 750 +COMP_OUTPUT_FWHM&& = 60 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 22.8 +COMP_NU_REF_P&& = 22.8 +COMP_MASK&& = fullsky +COMP_INDMASK&& = fullsky + +COMP_CL_TYPE&& = none gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 50 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1e7 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 500 +COMP_CL_DEFAULT_AMP_B&& = 500 +COMP_CL_DEFAULT_BETA_T&& = 5.d0 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 750 +COMP_AMP_INPUT_MAP&& = init_ame1_rc2_n256_v03.fits +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = 750 + +COMP_NU_P_NU_MIN&& = 20 # Lowest frequency for index estimation in GHz +COMP_NU_P_NU_MAX&& = 1000 # Highest frequency for index estimation in GHz +COMP_NU_P_INPUT_MAP&& = init_ame1_nup_rc2_n256_v03.fits +COMP_NU_P_DEFAULT&& = 19 +COMP_NU_P_PRIOR_UNI_LOW&& = 10 +COMP_NU_P_PRIOR_UNI_HIGH&& = 70 +COMP_NU_P_PRIOR_GAUSS_MEAN&& = 19 +COMP_NU_P_PRIOR_GAUSS_RMS&& = 0. # 0.1 +COMP_NU_P_SMOOTHING_SCALE&& = 0 +COMP_NU_P_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + + +# New Local sampling parameters, 'ame' +COMP_NU_P_INT_LMAX&& = -1 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_NU_P_POL_LMAX&& = 0 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_NU_P_INT_LNLTYPE&& = prior # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_NU_P_POL_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_NU_P_INT_PIXREG&& = fullsky # pixel region type, local sampling, {fullsky,single_pix,pixreg,prior}. +COMP_NU_P_INT_PRIOR_MEAN&& = 19 # prior sampler mean; Planck 2015 +COMP_NU_P_INT_PRIOR_RMS&& = 0.0 # prior sampler RMS; Planck 2015 +COMP_NU_P_INT_PIXREG_PRIORS&& = none +COMP_NU_P_POL_PIXREG_PRIORS&& = none +COMP_NU_P_POL_PIXREG&& = pixreg # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_NU_P_INT_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=1 of poltype). Sample correlation length of proposals +COMP_NU_P_POL_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=2 of poltype). Sample correlation length of proposals +COMP_NU_P_INT_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=1 of poltype). Sample proposal length (std. dev.) of proposals +COMP_NU_P_POL_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=2 of poltype). Sample proposal length (std. dev.) of proposals +COMP_NU_P_INT_NPROP_INIT&& = 500 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_NU_P_POL_NPROP_INIT&& = 500 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_NU_P_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region +COMP_NU_P_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region +COMP_NU_P_ALMSAMP_INIT&& = init_alm_dust_beta.dat +COMP_NU_P_MASK&& = fullsky mask_monopoles_BP10_chisq_dx12_n1024_specpar_sampling.fits mask_dust_beta_BP8_10deg.fits # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_NU_P_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) +COMP_NU_P_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) +COMP_NU_P_INT_PROPLEN_INIT&& = 0.0003 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_NU_P_POL_PROPLEN_INIT&& = 0.0003 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_NU_P_INT_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_NU_P_INT_FIX_PIXREG&& = none +COMP_NU_P_POL_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_NU_P_POL_FIX_PIXREG&& = none +COMP_NU_P_PIXREG_MAP&& = fullsky # Pixel region map (from 1 -> N). 'fullsky' -> all pixels = 1 +COMP_NU_P_PIXREG_INITVALUE_MAP&& = none +COMP_NU_P_COMBINED_MONOPOLE_SAMPLING&& = .true. +COMP_NU_P_COMBINED_MONOPOLE_TYPE&& = monopole-dipole +COMP_NU_P_COMBINED_MONOPOLE_FREEZE&& = none #write band labels of band to not sample monopoles from during combined sampling. separate with comma ',' +COMP_NU_P_COMBINED_MONOPOLE_MASK&& = fullsky mask_band_monopoles_bp10_chisq_comp_radio_commonDX12_n1024_TQU.fits +COMP_NU_P_CORRELATION_CONVERGENCE_SAMPLING&& = .false. +COMP_NU_P_CORRELATION_CONVERGENCE_LIMIT&& = 0.1d0 + diff --git a/commander3/parameter_files/defaults/components/cmb/cmb_DIRBE.defaults b/commander3/parameter_files/defaults/components/cmb/cmb_DIRBE.defaults new file mode 100644 index 000000000..649162df9 --- /dev/null +++ b/commander3/parameter_files/defaults/components/cmb/cmb_DIRBE.defaults @@ -0,0 +1,41 @@ +# CMB for LFI TOD study +COMP_LABEL&& = cmb +COMP_TYPE&& = cmb +COMP_CLASS&& = diffuse # {diffuse, ptsrc, template} +COMP_POLARIZATION&& = .true. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 1 +COMP_NSIDE&& = 2048 +COMP_MONOPOLE_PRIOR&& = monopole-dipole:mask_band_monopoles_bp10_chisq_comp_radio_commonDX12_n2048_TQU.fits +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 4000 +COMP_APPLY_DUST_EXTINCTION&& = .false. + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 4000 +COMP_AMP_INPUT_MAP&& = init_cmb_amp_BP8.1_v1_n2048.fits +COMP_AMP_PRIOR_MAP&& = none + +COMP_LMAX_IND&& = 0 +COMP_OUTPUT_FWHM&& = 5 # arcmin +COMP_UNIT&& = uK_cmb +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 700 +COMP_NU_REF_T&& = 1 100. +COMP_NU_REF_P&& = 1 100. +COMP_CL_TYPE&& = none power_law # {none, single_l, binned, power_law} +COMP_CL_POLTYPE&& = 1 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = 0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.1 +COMP_CL_L_PIVOT&& = 20 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1000000 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 1000 +COMP_CL_DEFAULT_AMP_B&& = 1000 +COMP_CL_DEFAULT_BETA_T&& = 0.d0 +COMP_CL_DEFAULT_BETA_E&& = -0.5d0 +COMP_CL_DEFAULT_BETA_B&& = -0.5d0 +COMP_MASK&& = fullsky +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + diff --git a/commander3/parameter_files/defaults/components/cmb/cmb_planck2015_1deg.defaults b/commander3/parameter_files/defaults/components/cmb/cmb_planck2015_1deg.defaults new file mode 100644 index 000000000..569ae1fd6 --- /dev/null +++ b/commander3/parameter_files/defaults/components/cmb/cmb_planck2015_1deg.defaults @@ -0,0 +1,30 @@ +# CMB for Planck 2015 1deg +COMP_LABEL&& = cmb +COMP_TYPE&& = cmb +COMP_CLASS&& = diffuse # {diffuse, ptsrc, template} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 1 +COMP_NSIDE&& = 256 +COMP_MONOPOLE_PRIOR&& = none +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 750 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 750 +COMP_AMP_INPUT_MAP&& = none +COMP_AMP_PRIOR_MAP&& = none + +COMP_LMAX_IND&& = 0 +COMP_OUTPUT_FWHM&& = 60 # arcmin +COMP_UNIT&& = uK_cmb +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 1 100. +COMP_NU_REF_P&& = 1 100. +COMP_CL_TYPE&& = none power_law # {none, single_l, binned, power_law} +COMP_MASK&& = fullsky +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = none default + diff --git a/commander3/parameter_files/defaults/components/cmb/cmb_relquad_planck2015_1deg.defaults b/commander3/parameter_files/defaults/components/cmb/cmb_relquad_planck2015_1deg.defaults new file mode 100644 index 000000000..f339a4f2c --- /dev/null +++ b/commander3/parameter_files/defaults/components/cmb/cmb_relquad_planck2015_1deg.defaults @@ -0,0 +1,14 @@ +# CMB relativistic quadrupole correction +COMP_LABEL&& = relquad +COMP_TYPE&& = cmb_relquad +COMP_CLASS&& = template +COMP_POLARIZATION&& = .false. +#COMP_CG_SCALE&& = 1.d0 +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_CG_SAMPLE_GROUP&& = 0 +COMP_PRIOR_GAUSS_MEAN&& = 1.d0 +COMP_PRIOR_GAUSS_RMS&& = 0.d0 +COMP_DEFAULT_AMPLITUDE&& = 1.d0 +COMP_TEMPLATE_DEFINITION_FILE&& = cmb_relquad_def.txt +COMP_INIT_FROM_HDF&& = none diff --git a/commander3/parameter_files/defaults/components/cmb/cmb_relquad_rs.defaults b/commander3/parameter_files/defaults/components/cmb/cmb_relquad_rs.defaults new file mode 100644 index 000000000..eec91af2a --- /dev/null +++ b/commander3/parameter_files/defaults/components/cmb/cmb_relquad_rs.defaults @@ -0,0 +1,14 @@ +# CMB relativistic quadrupole correction +COMP_LABEL&& = relquad +COMP_TYPE&& = cmb_relquad +COMP_CLASS&& = template +COMP_POLARIZATION&& = .false. +#COMP_CG_SCALE&& = 1.d0 +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_CG_SAMPLE_GROUP&& = 0 +COMP_PRIOR_GAUSS_MEAN&& = 1.d0 +COMP_PRIOR_GAUSS_RMS&& = 0.d0 +COMP_DEFAULT_AMPLITUDE&& = 1.d0 +COMP_TEMPLATE_DEFINITION_FILE&& = cmb_relquad_def_rs.txt +COMP_INIT_FROM_HDF&& = none \ No newline at end of file diff --git a/commander3/parameter_files/defaults/components/co/cii_DIRBE_v3.defaults b/commander3/parameter_files/defaults/components/co/cii_DIRBE_v3.defaults index 768694765..bd54e7e90 100644 --- a/commander3/parameter_files/defaults/components/co/cii_DIRBE_v3.defaults +++ b/commander3/parameter_files/defaults/components/co/cii_DIRBE_v3.defaults @@ -9,6 +9,7 @@ COMP_CG_SAMPLE_GROUP&& = 1 COMP_CG_SAMP_GROUP_MAXITER&& = 200 COMP_NSIDE&& = 512 COMP_L_APOD&& = 500 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_AMP_LMIN&& = 0 COMP_AMP_LMAX&& = 500 COMP_OUTPUT_FWHM&& = 42 # arcmin diff --git a/commander3/parameter_files/defaults/components/co/co100_DIRBE.defaults b/commander3/parameter_files/defaults/components/co/co100_DIRBE.defaults index 2de3433c4..f66eb3457 100644 --- a/commander3/parameter_files/defaults/components/co/co100_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/co/co100_DIRBE.defaults @@ -9,6 +9,7 @@ COMP_CG_SAMPLE_GROUP&& = 1 COMP_CG_SAMP_GROUP_MAXITER&& = 35 COMP_NSIDE&& = 2048 COMP_L_APOD&& = 6000 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_AMP_LMIN&& = 0 COMP_AMP_LMAX&& = 6000 COMP_OUTPUT_FWHM&& = 9.5 # arcmin diff --git a/commander3/parameter_files/defaults/components/co/co100_HFI.defaults b/commander3/parameter_files/defaults/components/co/co100_HFI.defaults new file mode 100644 index 000000000..b3b74327b --- /dev/null +++ b/commander3/parameter_files/defaults/components/co/co100_HFI.defaults @@ -0,0 +1,39 @@ +# CO component +COMP_LABEL&& = co100 +COMP_TYPE&& = line +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 2048 +COMP_L_APOD&& = 6000 +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 6000 +COMP_OUTPUT_FWHM&& = 9.5 # arcmin +COMP_UNIT&& = Kkm/s +COMP_NU_REF_T&& = 115.27 +COMP_NU_REF_P&& = 115.27 +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_BAND_REF&& = 100-1 +COMP_MASK&& = fullsky +COMP_INDMASK&& = mask_co_lineratio_v3_n2048.fits +COMP_MONOPOLE_PRIOR&& = none +COMP_CL_TYPE&& = gauss # {none, single_l, binned, power_law} +COMP_CL_POLTYPE&& = 1 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.5 +COMP_CL_BETA_PRIOR_RMS&& = 0.1 +COMP_CL_L_PIVOT&& = 100 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 10000 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 1.d0 +COMP_CL_DEFAULT_AMP_B&& = 1.d0 +COMP_CL_DEFAULT_BETA_T&& = 9.5d0 +COMP_CL_DEFAULT_BETA_E&& = -0.5d0 +COMP_CL_DEFAULT_BETA_B&& = -0.5d0 +COMP_LINE_TEMPLATE&& = /mn/stornext/d23/cmbco/cg/hfi/compsep/co100_line_template_HFI_v1.dat +COMP_APPLY_JEFFREYS_PRIOR&& = .false. +COMP_AMP_INPUT_MAP&& = lambda_wco_dht2001_n2048.fits +COMP_AMP_PRIOR_MAP&& = none +COMP_INIT_FROM_HDF&& = default diff --git a/commander3/parameter_files/defaults/components/co/co217_DIRBE.defaults b/commander3/parameter_files/defaults/components/co/co217_DIRBE.defaults index 2bd84e88e..f7965fac1 100644 --- a/commander3/parameter_files/defaults/components/co/co217_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/co/co217_DIRBE.defaults @@ -9,6 +9,7 @@ COMP_CG_SAMPLE_GROUP&& = 1 COMP_CG_SAMP_GROUP_MAXITER&& = 35 COMP_NSIDE&& = 2048 COMP_L_APOD&& = 6000 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_AMP_LMIN&& = 0 COMP_AMP_LMAX&& = 6000 COMP_OUTPUT_FWHM&& = 5.0 # arcmin diff --git a/commander3/parameter_files/defaults/components/co/co217_HFI.defaults b/commander3/parameter_files/defaults/components/co/co217_HFI.defaults new file mode 100644 index 000000000..6b58918f1 --- /dev/null +++ b/commander3/parameter_files/defaults/components/co/co217_HFI.defaults @@ -0,0 +1,39 @@ +# CO component +COMP_LABEL&& = co217 +COMP_TYPE&& = line +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 2048 +COMP_L_APOD&& = 6000 +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 6000 +COMP_OUTPUT_FWHM&& = 5.0 # arcmin +COMP_UNIT&& = Kkm/s +COMP_NU_REF_T&& = 230.54 +COMP_NU_REF_P&& = 230.54 +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_BAND_REF&& = 217-1 +COMP_MASK&& = fullsky +COMP_INDMASK&& = mask_co_lineratio_v3_n2048.fits +COMP_MONOPOLE_PRIOR&& = none +COMP_CL_TYPE&& = gauss # {none, single_l, binned, power_law} +COMP_CL_POLTYPE&& = 1 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.5 +COMP_CL_BETA_PRIOR_RMS&& = 0.1 +COMP_CL_L_PIVOT&& = 100 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 10000 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 1.d0 +COMP_CL_DEFAULT_AMP_B&& = 1.d0 +COMP_CL_DEFAULT_BETA_T&& = 9.5d0 +COMP_CL_DEFAULT_BETA_E&& = -0.5d0 +COMP_CL_DEFAULT_BETA_B&& = -0.5d0 +COMP_LINE_TEMPLATE&& = /mn/stornext/d23/cmbco/cg/hfi/compsep/co217_line_template_HFI_v1.dat +COMP_APPLY_JEFFREYS_PRIOR&& = .false. +COMP_AMP_INPUT_MAP&& = COM_CompMap_CO21-commander_2048_R2.00.fits +COMP_AMP_PRIOR_MAP&& = none +COMP_INIT_FROM_HDF&& = default diff --git a/commander3/parameter_files/defaults/components/co/co353_DIRBE.defaults b/commander3/parameter_files/defaults/components/co/co353_DIRBE.defaults index 1a3950733..a72bacb8a 100644 --- a/commander3/parameter_files/defaults/components/co/co353_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/co/co353_DIRBE.defaults @@ -9,6 +9,7 @@ COMP_CG_SAMPLE_GROUP&& = 1 COMP_CG_SAMP_GROUP_MAXITER&& = 35 COMP_NSIDE&& = 2048 COMP_L_APOD&& = 6000 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_AMP_LMIN&& = 0 COMP_AMP_LMAX&& = 6000 COMP_OUTPUT_FWHM&& = 5.0 # arcmin diff --git a/commander3/parameter_files/defaults/components/co/co353_HFI.defaults b/commander3/parameter_files/defaults/components/co/co353_HFI.defaults new file mode 100644 index 000000000..4b8408ac2 --- /dev/null +++ b/commander3/parameter_files/defaults/components/co/co353_HFI.defaults @@ -0,0 +1,39 @@ +# CO component +COMP_LABEL&& = co353 +COMP_TYPE&& = line +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 2048 +COMP_L_APOD&& = 6000 +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 6000 +COMP_OUTPUT_FWHM&& = 5.0 # arcmin +COMP_UNIT&& = Kkm/s +COMP_NU_REF_T&& = 345.81 +COMP_NU_REF_P&& = 345.81 +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_BAND_REF&& = 353-1 +COMP_MASK&& = fullsky +COMP_INDMASK&& = mask_co_lineratio_v3_n2048.fits +COMP_MONOPOLE_PRIOR&& = none +COMP_CL_TYPE&& = gauss # {none, single_l, binned, power_law} +COMP_CL_POLTYPE&& = 1 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.5 +COMP_CL_BETA_PRIOR_RMS&& = 0.1 +COMP_CL_L_PIVOT&& = 100 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 10000 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 1.d0 +COMP_CL_DEFAULT_AMP_B&& = 1.d0 +COMP_CL_DEFAULT_BETA_T&& = 9.5d0 +COMP_CL_DEFAULT_BETA_E&& = -0.5d0 +COMP_CL_DEFAULT_BETA_B&& = -0.5d0 +COMP_LINE_TEMPLATE&& = /mn/stornext/d23/cmbco/cg/hfi/compsep/co353_line_template_HFI_v1.dat +COMP_APPLY_JEFFREYS_PRIOR&& = .false. +COMP_AMP_INPUT_MAP&& = none +COMP_AMP_PRIOR_MAP&& = none +COMP_INIT_FROM_HDF&& = default diff --git a/commander3/parameter_files/defaults/components/co/co_DIRBE.defaults b/commander3/parameter_files/defaults/components/co/co_DIRBE.defaults index 671116e62..8d1c6a5dc 100644 --- a/commander3/parameter_files/defaults/components/co/co_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/co/co_DIRBE.defaults @@ -9,6 +9,7 @@ COMP_CG_SAMPLE_GROUP&& = 1 COMP_CG_SAMP_GROUP_MAXITER&& = 35 COMP_NSIDE&& = 2048 COMP_L_APOD&& = 6000 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_AMP_LMIN&& = 0 COMP_AMP_LMAX&& = 6000 COMP_OUTPUT_FWHM&& = 5 # arcmin diff --git a/commander3/parameter_files/defaults/components/co/co_planck2015_1deg.defaults b/commander3/parameter_files/defaults/components/co/co_planck2015_1deg.defaults new file mode 100644 index 000000000..6febcff97 --- /dev/null +++ b/commander3/parameter_files/defaults/components/co/co_planck2015_1deg.defaults @@ -0,0 +1,29 @@ +# Line emission component +COMP_LABEL&& = co100 +COMP_TYPE&& = line +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 256 +COMP_L_APOD&& = 750 +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 750 +COMP_OUTPUT_FWHM&& = 60 # arcmin +COMP_UNIT&& = Kkm/s +COMP_NU_REF_T&& = 115.27 +COMP_NU_REF_P&& = 115.27 +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_BAND_REF&& = 100-1 +COMP_MASK&& = fullsky +COMP_INDMASK&& = fullsky +COMP_MONOPOLE_PRIOR&& = none +COMP_CL_TYPE&& = none +COMP_LINE_TEMPLATE&& = /mn/stornext/d5/data/metins/dirbe/data/co100_line_template_DIRBE_v1.dat +COMP_APPLY_JEFFREYS_PRIOR&& = .false. +COMP_AMP_INPUT_MAP&& = lambda_wco_dht2001_n2048.fits +COMP_AMP_PRIOR_MAP&& = none +COMP_INIT_FROM_HDF&& = none diff --git a/commander3/parameter_files/defaults/components/co/co_tot_DIRBE.defaults b/commander3/parameter_files/defaults/components/co/co_tot_DIRBE.defaults index f812a41d3..50c2be535 100644 --- a/commander3/parameter_files/defaults/components/co/co_tot_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/co/co_tot_DIRBE.defaults @@ -9,6 +9,7 @@ COMP_CG_SAMPLE_GROUP&& = 1 COMP_CG_SAMP_GROUP_MAXITER&& = 35 COMP_NSIDE&& = 2048 COMP_L_APOD&& = 6000 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_AMP_LMIN&& = 0 COMP_AMP_LMAX&& = 6000 COMP_OUTPUT_FWHM&& = 9.5 # arcmin diff --git a/commander3/parameter_files/defaults/components/dust/dust_DIRBE_localsampler.defaults b/commander3/parameter_files/defaults/components/dust/dust_DIRBE_localsampler.defaults index d6c8c33e5..7500e07be 100644 --- a/commander3/parameter_files/defaults/components/dust/dust_DIRBE_localsampler.defaults +++ b/commander3/parameter_files/defaults/components/dust/dust_DIRBE_localsampler.defaults @@ -18,7 +18,7 @@ COMP_BETA_POL_NPROP_INIT&& = 500 # {> 0, < 0 to disable}. overwrites n COMP_BETA_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region COMP_BETA_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region COMP_BETA_ALMSAMP_INIT&& = init_alm_dust_beta_hke.dat -COMP_BETA_MASK&& = mask_DIRBE_colddust_chisq_n2048_v2.fits fullsky mask_monopoles_BP10_chisq_dx12_n1024_specpar_sampling.fits mask_dust_beta_BP8_10deg.fits # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_BETA_MASK&& = fullsky mask_DIRBE_colddust_chisq_n2048_v2.fits fullsky mask_monopoles_BP10_chisq_dx12_n1024_specpar_sampling.fits mask_dust_beta_BP8_10deg.fits # index sampling mask for smoothed log-likelihood eval. local sampler. COMP_BETA_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) COMP_BETA_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) COMP_BETA_INT_PROPLEN_INIT&& = 0.0003 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler @@ -37,7 +37,7 @@ COMP_BETA_CORRELATION_CONVERGENCE_SAMPLING&& = .false. COMP_BETA_CORRELATION_CONVERGENCE_LIMIT&& = 0.1d0 COMP_T_INT_LMAX&& = 0 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat -COMP_T_POL_LMAX&& = -1 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_T_POL_LMAX&& = 0 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat COMP_T_INT_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling COMP_T_POL_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling COMP_T_INT_PIXREG&& = fullsky # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment @@ -53,7 +53,7 @@ COMP_T_POL_NPROP_INIT&& = 1000 # {> 0, < 0 to disable}. overwrites npro COMP_T_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region COMP_T_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region COMP_T_ALMSAMP_INIT&& = init_alm_dust_T_hke.dat -COMP_T_MASK&& = mask_DIRBE_colddust_chisq_n2048_v2.fits fullsky # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_T_MASK&& = fullsky mask_DIRBE_colddust_chisq_n2048_v2.fits fullsky # index sampling mask for smoothed log-likelihood eval. local sampler. COMP_T_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) COMP_T_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) COMP_T_INT_PROPLEN_INIT&& = 5.d-2 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler diff --git a/commander3/parameter_files/defaults/components/dust/dust_HFI.defaults b/commander3/parameter_files/defaults/components/dust/dust_HFI.defaults index 946d0b249..40a1513cc 100644 --- a/commander3/parameter_files/defaults/components/dust/dust_HFI.defaults +++ b/commander3/parameter_files/defaults/components/dust/dust_HFI.defaults @@ -27,34 +27,35 @@ COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} COMP_CL_BETA_PRIOR_MEAN&& = -0.0 COMP_CL_BETA_PRIOR_RMS&& = 0.0 COMP_CL_L_PIVOT&& = 50 # Pivot multipole -COMP_CL_DEFAULT_AMP_T&& = 1e7 # D_l = amp * (l/lpivot)**beta -COMP_CL_DEFAULT_AMP_E&& = 500 -COMP_CL_DEFAULT_AMP_B&& = 500 -COMP_CL_DEFAULT_BETA_T&& = 5.d0 -COMP_CL_DEFAULT_BETA_E&& = 10.d0 -COMP_CL_DEFAULT_BETA_B&& = 10.d0 -COMP_DEFAULT_BETA&& = 1.56 1.68 1.55 -COMP_PRIOR_UNI_BETA_LOW&& = 1.0 -COMP_PRIOR_UNI_BETA_HIGH&& = 3.0 -COMP_PRIOR_GAUSS_BETA_MEAN&& = 1.56 -COMP_PRIOR_GAUSS_BETA_RMS&& = 0.1 # 0.1 +<<<<<<< HEAD +COMP_CL_DEFAULT_AMP_T&& = 1e7 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 500 +COMP_CL_DEFAULT_AMP_B&& = 500 +COMP_CL_DEFAULT_BETA_T&& = 5.d0 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 +COMP_DEFAULT_BETA&& = 1.56 1.68 1.55 +COMP_PRIOR_UNI_BETA_LOW&& = 0.4 +COMP_PRIOR_UNI_BETA_HIGH&& = 3.0 +COMP_PRIOR_GAUSS_BETA_MEAN&& = 1.56 +COMP_PRIOR_GAUSS_BETA_RMS&& = 0.1 # 0.1 COMP_BETA_SMOOTHING_SCALE&& = 3 COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} -COMP_DEFAULT_T&& = 20. +COMP_DEFAULT_T&& = 18. COMP_PRIOR_UNI_T_LOW&& = 10. COMP_PRIOR_UNI_T_HIGH&& = 35. -COMP_PRIOR_GAUSS_T_MEAN&& = 20. -COMP_PRIOR_GAUSS_T_RMS&& = 1. -COMP_T_SMOOTHING_SCALE&& = 2 +COMP_PRIOR_GAUSS_T_MEAN&& = 18.5 +COMP_PRIOR_GAUSS_T_RMS&& = 0. +COMP_T_SMOOTHING_SCALE&& = 0 COMP_T_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} -COMP_INPUT_AMP_MAP&& = init_dust_amp_BP8.1_v1.fits +COMP_INPUT_AMP_MAP&& = dust_c0001_k000008_n1024.fits COMP_PRIOR_AMP_MAP&& = none -COMP_INPUT_BETA_MAP&& = init_dust_beta_BP8.1_v1.fits -COMP_INPUT_T_MAP&& = init_dust_T_BP8.1_v1.fits +COMP_INPUT_BETA_MAP&& = dust_beta_c0001_k000008_n1024.fits +COMP_INPUT_T_MAP&& = dust_T_c0001_k000008_n1024.fits COMP_BETA_NU_MIN&& = 20 # Lowest frequency for index estimation in GHz -COMP_BETA_NU_MAX&& = 5000 # Highest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 1000 # Highest frequency for index estimation in GHz COMP_T_NU_MIN&& = 150 # Lowest frequency for index estimation in GHz -COMP_T_NU_MAX&& = 5000 # Highest frequency for index estimation in GHz +COMP_T_NU_MAX&& = 1000 # Highest frequency for index estimation in GHz COMP_APPLY_JEFFREYS_PRIOR&& = .true. COMP_OUTPUT_EB_MAP&& = .false. -COMP_INIT_FROM_HDF&& = none +COMP_INIT_FROM_HDF&& = default diff --git a/commander3/parameter_files/defaults/components/dust/dust_coldcores_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/components/dust/dust_coldcores_DIRBE_n4096.defaults new file mode 100644 index 000000000..375c67184 --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_coldcores_DIRBE_n4096.defaults @@ -0,0 +1,70 @@ +# Cold thermal dust component +COMP_LABEL&& = dust_cores +COMP_TYPE&& = MBBtab +COMP_MBBTAB_TYPE = binned +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 4096 +COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0064_60arcmin_rescaled_TQU.fits,64,60.d0,1.5,2.0,2.5,3.0,3.5,4.0 #,,, +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 6000 +COMP_APPLY_DUST_EXTINCTION&& = .false. +COMP_OUTPUT_FWHM&& = 5 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 545 +COMP_NU_REF_P&& = 545 +COMP_MASK&& = fullsky +COMP_INDMASK&& = fullsky mask_DIRBE_chisq_n2048_v2.fits fullsky + +COMP_CL_TYPE&& = power_law gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 500 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1e6 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 500 +COMP_CL_DEFAULT_AMP_B&& = 500 +COMP_CL_DEFAULT_BETA_T&& = 0.5 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 6000 +COMP_AMP_INPUT_MAP&& = none init_colddust_n2048_v1.fits +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = -1 + +COMP_BETA_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 1000 2540 # Highest frequency for index estimation in GHz +COMP_BETA_INPUT_MAP&& = none init_dust_beta_BP8.1_v1.fits +COMP_BETA_DEFAULT&& = 1.56 +COMP_BETA_PRIOR_UNI_LOW&& = 0.4 +COMP_BETA_PRIOR_UNI_HIGH&& = 3.0 +COMP_BETA_PRIOR_GAUSS_MEAN&& = 1.4 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.1 # 0.1 +COMP_BETA_SMOOTHING_SCALE&& = 1 +COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + +COMP_T_DEFAULT&& = 6. +COMP_T_PRIOR_UNI_LOW&& = 5 +COMP_T_PRIOR_UNI_HIGH&& = 9. +COMP_T_PRIOR_GAUSS_MEAN&& = 6 +COMP_T_PRIOR_GAUSS_RMS&& = 0.1 +COMP_T_SMOOTHING_SCALE&& = 1 +COMP_T_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_T_INPUT_MAP&& = none init_dust_T_BP8.1_v1.fits +COMP_T_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_T_NU_MAX&& = 1000 2540 # Highest frequency for index estimation in GHz + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + +COMP_SED_PRIOR&& = 0 diff --git a/commander3/parameter_files/defaults/components/dust/dust_coldtab_DIRBE.defaults b/commander3/parameter_files/defaults/components/dust/dust_coldtab_DIRBE.defaults index 7147c561a..d2f8203cc 100644 --- a/commander3/parameter_files/defaults/components/dust/dust_coldtab_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/dust/dust_coldtab_DIRBE.defaults @@ -1,6 +1,7 @@ # Cold thermal dust component COMP_LABEL&& = dust COMP_TYPE&& = MBBtab +COMP_MBBTAB_TYPE = binned COMP_CLASS&& = diffuse # {diffuse, ptsrc} COMP_POLARIZATION&& = .false. COMP_CG_SCALE_T&& = 1.d0 @@ -11,6 +12,7 @@ COMP_NSIDE&& = 2048 COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0064_60arcmin_rescaled_TQU.fits,64,60.d0,1.5,2.0,2.5,3.0,3.5,4.0 #,,, COMP_DEFLATION_MASK&& = fullsky COMP_L_APOD&& = 6000 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_OUTPUT_FWHM&& = 10 # arcmin COMP_UNIT&& = uK_RJ COMP_NU_MIN&& = 0.d0 @@ -28,7 +30,7 @@ COMP_CL_L_PIVOT&& = 50 # Pivot multipole COMP_CL_DEFAULT_AMP_T&& = 1e7 # D_l = amp * (l/lpivot)**beta COMP_CL_DEFAULT_AMP_E&& = 500 COMP_CL_DEFAULT_AMP_B&& = 500 -COMP_CL_DEFAULT_BETA_T&& = 5.d0 +COMP_CL_DEFAULT_BETA_T&& = 10.d0 COMP_CL_DEFAULT_BETA_E&& = 10.d0 COMP_CL_DEFAULT_BETA_B&& = 10.d0 @@ -51,8 +53,8 @@ COMP_BETA_SMOOTHING_SCALE&& = 1 COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} COMP_T_DEFAULT&& = 16. -COMP_T_PRIOR_UNI_LOW&& = 10. -COMP_T_PRIOR_UNI_HIGH&& = 35. +COMP_T_PRIOR_UNI_LOW&& = 7.5 +COMP_T_PRIOR_UNI_HIGH&& = 20. COMP_T_PRIOR_GAUSS_MEAN&& = 18 COMP_T_PRIOR_GAUSS_RMS&& = 1. COMP_T_SMOOTHING_SCALE&& = 1 diff --git a/commander3/parameter_files/defaults/components/dust/dust_coldtab_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/components/dust/dust_coldtab_DIRBE_n4096.defaults new file mode 100644 index 000000000..6cb5776b1 --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_coldtab_DIRBE_n4096.defaults @@ -0,0 +1,70 @@ +# Cold thermal dust component +COMP_LABEL&& = dust +COMP_TYPE&& = MBBtab +COMP_MBBTAB_TYPE = binned +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 4096 +COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0064_60arcmin_rescaled_TQU.fits,64,60.d0,1.5,2.0,2.5,3.0,3.5,4.0 #,,, +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 6000 +COMP_APPLY_DUST_EXTINCTION&& = .false. +COMP_OUTPUT_FWHM&& = 5 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 857 +COMP_NU_REF_P&& = 857 +COMP_MASK&& = fullsky +COMP_INDMASK&& = fullsky mask_DIRBE_chisq_n2048_v2.fits fullsky + +COMP_CL_TYPE&& = power_law gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 500 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1e6 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 500 +COMP_CL_DEFAULT_AMP_B&& = 500 +COMP_CL_DEFAULT_BETA_T&& = -0.5 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 6000 +COMP_AMP_INPUT_MAP&& = none init_colddust_n2048_v1.fits +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = -1 + +COMP_BETA_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 1000 2540 # Highest frequency for index estimation in GHz +COMP_BETA_INPUT_MAP&& = none init_dust_beta_BP8.1_v1.fits +COMP_BETA_DEFAULT&& = 1.56 +COMP_BETA_PRIOR_UNI_LOW&& = 0.4 +COMP_BETA_PRIOR_UNI_HIGH&& = 3.0 +COMP_BETA_PRIOR_GAUSS_MEAN&& = 1.4 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.1 # 0.1 +COMP_BETA_SMOOTHING_SCALE&& = 1 +COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + +COMP_T_DEFAULT&& = 16. +COMP_T_PRIOR_UNI_LOW&& = 7.5 +COMP_T_PRIOR_UNI_HIGH&& = 20. +COMP_T_PRIOR_GAUSS_MEAN&& = 18 +COMP_T_PRIOR_GAUSS_RMS&& = 1. +COMP_T_SMOOTHING_SCALE&& = 1 +COMP_T_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_T_INPUT_MAP&& = none init_dust_T_BP8.1_v1.fits +COMP_T_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_T_NU_MAX&& = 1000 2540 # Highest frequency for index estimation in GHz + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + +COMP_SED_PRIOR&& = 0 diff --git a/commander3/parameter_files/defaults/components/dust/dust_hotPAH.defaults b/commander3/parameter_files/defaults/components/dust/dust_hotPAH.defaults index 15a3fd375..d9f6c7d9b 100644 --- a/commander3/parameter_files/defaults/components/dust/dust_hotPAH.defaults +++ b/commander3/parameter_files/defaults/components/dust/dust_hotPAH.defaults @@ -11,6 +11,7 @@ COMP_NSIDE&& = 2048 COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0064_60arcmin_rescaled_TQU.fits,64,60.d0,1.5,2.0,2.5,3.0,3.5,4.0 #,,, COMP_DEFLATION_MASK&& = fullsky COMP_L_APOD&& = 6000 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_OUTPUT_FWHM&& = 10 # arcmin COMP_UNIT&& = uK_RJ COMP_NU_MIN&& = 0.d0 @@ -20,7 +21,7 @@ COMP_NU_REF_P&& = 857 COMP_MASK&& = fullsky COMP_INDMASK&& = mask_DIRBE_chisq_n2048_v2.fits fullsky -COMP_CL_TYPE&& = power_law gauss # {none, single_l, binned,power_law, exp} +COMP_CL_TYPE&& = gauss power_law gauss # {none, single_l, binned,power_law, exp} COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} COMP_CL_BETA_PRIOR_MEAN&& = -0.0 COMP_CL_BETA_PRIOR_RMS&& = 0.0 @@ -28,7 +29,7 @@ COMP_CL_L_PIVOT&& = 50 # Pivot multipole COMP_CL_DEFAULT_AMP_T&& = 1e7 # D_l = amp * (l/lpivot)**beta COMP_CL_DEFAULT_AMP_E&& = 500 COMP_CL_DEFAULT_AMP_B&& = 500 -COMP_CL_DEFAULT_BETA_T&& = 0.d0 +COMP_CL_DEFAULT_BETA_T&& = 10.d0 COMP_CL_DEFAULT_BETA_E&& = 10.d0 COMP_CL_DEFAULT_BETA_B&& = 10.d0 diff --git a/commander3/parameter_files/defaults/components/dust/dust_hotPAH2.defaults b/commander3/parameter_files/defaults/components/dust/dust_hotPAH2.defaults new file mode 100644 index 000000000..15a3fd375 --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_hotPAH2.defaults @@ -0,0 +1,68 @@ +# Thermal dust component +COMP_LABEL&& = dust +COMP_TYPE&& = MBBtab +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 2048 +COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0064_60arcmin_rescaled_TQU.fits,64,60.d0,1.5,2.0,2.5,3.0,3.5,4.0 #,,, +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 6000 +COMP_OUTPUT_FWHM&& = 10 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 857 +COMP_NU_REF_P&& = 857 +COMP_MASK&& = fullsky +COMP_INDMASK&& = mask_DIRBE_chisq_n2048_v2.fits fullsky + +COMP_CL_TYPE&& = power_law gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 50 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1e7 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 500 +COMP_CL_DEFAULT_AMP_B&& = 500 +COMP_CL_DEFAULT_BETA_T&& = 0.d0 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 6000 +COMP_AMP_INPUT_MAP&& = init_hotPAH_n2048_v1.fits +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = -1 + +COMP_BETA_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 1000 2540 # Highest frequency for index estimation in GHz +COMP_BETA_INPUT_MAP&& = none init_dust_beta_BP8.1_v1.fits +COMP_BETA_DEFAULT&& = 1.8 1.68 1.55 +COMP_BETA_PRIOR_UNI_LOW&& = 0.4 +COMP_BETA_PRIOR_UNI_HIGH&& = 5.0 +COMP_BETA_PRIOR_GAUSS_MEAN&& = 2.2 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.1 # 0.1 +COMP_BETA_SMOOTHING_SCALE&& = 1 +COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + +COMP_T_DEFAULT&& = 32. +COMP_T_PRIOR_UNI_LOW&& = 10. +COMP_T_PRIOR_UNI_HIGH&& = 100. +COMP_T_PRIOR_GAUSS_MEAN&& = 25. +COMP_T_PRIOR_GAUSS_RMS&& = 1. +COMP_T_SMOOTHING_SCALE&& = 1 +COMP_T_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_T_INPUT_MAP&& = none init_dust_T_BP8.1_v1.fits +COMP_T_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_T_NU_MAX&& = 1000 2540 # Highest frequency for index estimation in GHz + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + +COMP_SED_PRIOR&& = 0 diff --git a/commander3/parameter_files/defaults/components/dust/dust_hotPAH_localsampler.defaults b/commander3/parameter_files/defaults/components/dust/dust_hotPAH_localsampler.defaults index 7431687cd..7c05d587b 100644 --- a/commander3/parameter_files/defaults/components/dust/dust_hotPAH_localsampler.defaults +++ b/commander3/parameter_files/defaults/components/dust/dust_hotPAH_localsampler.defaults @@ -18,7 +18,7 @@ COMP_BETA_POL_NPROP_INIT&& = 500 # {> 0, < 0 to disable}. overwrites n COMP_BETA_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region COMP_BETA_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region COMP_BETA_ALMSAMP_INIT&& = init_alm_hotPAH_beta_hke.dat -COMP_BETA_MASK&& = mask_DIRBE_hotdust_chisq_n2048_v2.fits fullsky mask_monopoles_BP10_chisq_dx12_n1024_specpar_sampling.fits mask_dust_beta_BP8_10deg.fits # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_BETA_MASK&& = fullsky mask_DIRBE_hotdust_chisq_n2048_v2.fits fullsky mask_monopoles_BP10_chisq_dx12_n1024_specpar_sampling.fits mask_dust_beta_BP8_10deg.fits # index sampling mask for smoothed log-likelihood eval. local sampler. COMP_BETA_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) COMP_BETA_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) COMP_BETA_INT_PROPLEN_INIT&& = 0.0003 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler @@ -53,7 +53,7 @@ COMP_T_POL_NPROP_INIT&& = 1000 # {> 0, < 0 to disable}. overwrites npro COMP_T_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region COMP_T_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region COMP_T_ALMSAMP_INIT&& = init_alm_hotPAH_T_hke.dat -COMP_T_MASK&& = mask_DIRBE_hotdust_chisq_n2048_v2.fits fullsky # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_T_MASK&& = fullsky mask_DIRBE_hotdust_chisq_n2048_v2.fits fullsky # index sampling mask for smoothed log-likelihood eval. local sampler. COMP_T_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) COMP_T_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) COMP_T_INT_PROPLEN_INIT&& = 5.d-2 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler diff --git a/commander3/parameter_files/defaults/components/dust/dust_hotPAH_n4096.defaults b/commander3/parameter_files/defaults/components/dust/dust_hotPAH_n4096.defaults new file mode 100644 index 000000000..ba4e1495d --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_hotPAH_n4096.defaults @@ -0,0 +1,69 @@ +# Thermal dust component +COMP_LABEL&& = dust +COMP_TYPE&& = MBBtab +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 4096 +COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0064_60arcmin_rescaled_TQU.fits,64,60.d0,1.5,2.0,2.5,3.0,3.5,4.0 #,,, +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 6000 +COMP_APPLY_DUST_EXTINCTION&& = .false. +COMP_OUTPUT_FWHM&& = 5 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 857 +COMP_NU_REF_P&& = 857 +COMP_MASK&& = fullsky +COMP_INDMASK&& = fullsky mask_DIRBE_chisq_n2048_v2.fits fullsky + +COMP_CL_TYPE&& = power_law gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 500 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1e6 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 500 +COMP_CL_DEFAULT_AMP_B&& = 500 +COMP_CL_DEFAULT_BETA_T&& = -0.5 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 6000 +COMP_AMP_INPUT_MAP&& = none init_hotPAH_n2048_v1.fits +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = -1 + +COMP_BETA_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 1000 2540 # Highest frequency for index estimation in GHz +COMP_BETA_INPUT_MAP&& = none init_dust_beta_BP8.1_v1.fits +COMP_BETA_DEFAULT&& = 1.8 1.68 1.55 +COMP_BETA_PRIOR_UNI_LOW&& = 0.4 +COMP_BETA_PRIOR_UNI_HIGH&& = 5.0 +COMP_BETA_PRIOR_GAUSS_MEAN&& = 2.2 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.1 # 0.1 +COMP_BETA_SMOOTHING_SCALE&& = 1 +COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + +COMP_T_DEFAULT&& = 32. +COMP_T_PRIOR_UNI_LOW&& = 10. +COMP_T_PRIOR_UNI_HIGH&& = 100. +COMP_T_PRIOR_GAUSS_MEAN&& = 25. +COMP_T_PRIOR_GAUSS_RMS&& = 1. +COMP_T_SMOOTHING_SCALE&& = 1 +COMP_T_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_T_INPUT_MAP&& = none init_dust_T_BP8.1_v1.fits +COMP_T_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_T_NU_MAX&& = 1000 2540 # Highest frequency for index estimation in GHz + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + +COMP_SED_PRIOR&& = 0 diff --git a/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE.defaults b/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE.defaults new file mode 100644 index 000000000..b78395001 --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE.defaults @@ -0,0 +1,70 @@ +# Infrared thermal dust component +COMP_LABEL&& = dust_ir +COMP_TYPE&& = MBBtab +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 200 +COMP_NSIDE&& = 512 +COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0064_60arcmin_rescaled_TQU.fits,64,60.d0,1.5,2.0,2.5,3.0,3.5,4.0 #,,, +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 200 +COMP_APPLY_DUST_EXTINCTION&& = .false. +COMP_OUTPUT_FWHM&& = 42 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 5000 +COMP_NU_REF_P&& = 5000 +COMP_MASK&& = fullsky +COMP_INDMASK&& = mask_DIRBE_chisq_n0512_v2.fits fullsky + +COMP_CL_TYPE&& = gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 50 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 30000 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 500 +COMP_CL_DEFAULT_AMP_B&& = 500 +COMP_CL_DEFAULT_BETA_T&& = 40.d0 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 557 +COMP_AMP_INPUT_MAP&& = none +COMP_AMP_PRIOR_MAP&& = none +COMP_AMP_PRIOR_LMAX&& = 1500 + +COMP_IND_LMAX&& = -1 + +COMP_BETA_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 2540 # Highest frequency for index estimation in GHz +COMP_BETA_INPUT_MAP&& = none init_dust_beta_BP8.1_v1.fits +COMP_BETA_DEFAULT&& = 1.56 +COMP_BETA_PRIOR_UNI_LOW&& = 1 +COMP_BETA_PRIOR_UNI_HIGH&& = 3.0 +COMP_BETA_PRIOR_GAUSS_MEAN&& = 1.4 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.1 # 0.1 +COMP_BETA_SMOOTHING_SCALE&& = 1 +COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + +COMP_T_DEFAULT&& = 80. +COMP_T_PRIOR_UNI_LOW&& = 20. +COMP_T_PRIOR_UNI_HIGH&& = 50. +COMP_T_PRIOR_GAUSS_MEAN&& = 20 +COMP_T_PRIOR_GAUSS_RMS&& = 10. +COMP_T_SMOOTHING_SCALE&& = 1 +COMP_T_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_T_INPUT_MAP&& = none init_dust_T_BP8.1_v1.fits +COMP_T_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_T_NU_MAX&& = 2540 # Highest frequency for index estimation in GHz + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + +COMP_SED_PRIOR&& = 0 \ No newline at end of file diff --git a/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE_n0512.defaults b/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE_n0512.defaults new file mode 100644 index 000000000..1cf5acc2b --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE_n0512.defaults @@ -0,0 +1,68 @@ +# Cold thermal dust component +COMP_LABEL&& = dust_ir +COMP_TYPE&& = MBBtab +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 200 +COMP_NSIDE&& = 512 +COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0064_60arcmin_rescaled_TQU.fits,64,60.d0,1.5,2.0,2.5,3.0,3.5,4.0 #,,, +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 1500 +COMP_OUTPUT_FWHM&& = 45 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 5000 +COMP_NU_REF_P&& = 5000 +COMP_MASK&& = fullsky +COMP_INDMASK&& = mask_DIRBE_chisq_n2048_v2.fits fullsky + +COMP_CL_TYPE&& = gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 50 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 100 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 400 +COMP_CL_DEFAULT_AMP_B&& = 400 +COMP_CL_DEFAULT_BETA_T&& = 45 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 1500 +COMP_AMP_INPUT_MAP&& = none +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = -1 + +COMP_BETA_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 2540 # Highest frequency for index estimation in GHz +COMP_BETA_INPUT_MAP&& = none init_dust_beta_BP8.1_v1.fits +COMP_BETA_DEFAULT&& = 1.56 +COMP_BETA_PRIOR_UNI_LOW&& = 1 +COMP_BETA_PRIOR_UNI_HIGH&& = 3.0 +COMP_BETA_PRIOR_GAUSS_MEAN&& = 1.4 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.1 # 0.1 +COMP_BETA_SMOOTHING_SCALE&& = 1 +COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + +COMP_T_DEFAULT&& = 80. +COMP_T_PRIOR_UNI_LOW&& = 20. +COMP_T_PRIOR_UNI_HIGH&& = 50. +COMP_T_PRIOR_GAUSS_MEAN&& = 20 +COMP_T_PRIOR_GAUSS_RMS&& = 10. +COMP_T_SMOOTHING_SCALE&& = 1 +COMP_T_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_T_INPUT_MAP&& = none init_dust_T_BP8.1_v1.fits +COMP_T_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_T_NU_MAX&& = 2540 # Highest frequency for index estimation in GHz + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + +COMP_SED_PRIOR&& = 0 \ No newline at end of file diff --git a/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE_n2048.defaults b/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE_n2048.defaults new file mode 100644 index 000000000..a4089a77b --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE_n2048.defaults @@ -0,0 +1,68 @@ +# Cold thermal dust component +COMP_LABEL&& = dust_ir +COMP_TYPE&& = MBBtab +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 200 +COMP_NSIDE&& = 2048 +COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0064_60arcmin_rescaled_TQU.fits,64,60.d0,1.5,2.0,2.5,3.0,3.5,4.0 #,,, +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 1000 +COMP_OUTPUT_FWHM&& = 42 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 5000 +COMP_NU_REF_P&& = 5000 +COMP_MASK&& = fullsky +COMP_INDMASK&& = mask_DIRBE_chisq_n2048_v2.fits fullsky + +COMP_CL_TYPE&& = gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 50 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1000 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 400 +COMP_CL_DEFAULT_AMP_B&& = 400 +COMP_CL_DEFAULT_BETA_T&& = 42.d0 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 1000 +COMP_AMP_INPUT_MAP&& = none +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = -1 + +COMP_BETA_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 2540 # Highest frequency for index estimation in GHz +COMP_BETA_INPUT_MAP&& = none init_dust_beta_BP8.1_v1.fits +COMP_BETA_DEFAULT&& = 1.56 +COMP_BETA_PRIOR_UNI_LOW&& = 1 +COMP_BETA_PRIOR_UNI_HIGH&& = 3.0 +COMP_BETA_PRIOR_GAUSS_MEAN&& = 1.4 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.1 # 0.1 +COMP_BETA_SMOOTHING_SCALE&& = 1 +COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + +COMP_T_DEFAULT&& = 80. +COMP_T_PRIOR_UNI_LOW&& = 20. +COMP_T_PRIOR_UNI_HIGH&& = 50. +COMP_T_PRIOR_GAUSS_MEAN&& = 20 +COMP_T_PRIOR_GAUSS_RMS&& = 10. +COMP_T_SMOOTHING_SCALE&& = 1 +COMP_T_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_T_INPUT_MAP&& = none init_dust_T_BP8.1_v1.fits +COMP_T_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_T_NU_MAX&& = 2540 # Highest frequency for index estimation in GHz + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + +COMP_SED_PRIOR&& = 0 \ No newline at end of file diff --git a/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE_n4096.defaults b/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE_n4096.defaults new file mode 100644 index 000000000..65556619c --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_ir_DIRBE_n4096.defaults @@ -0,0 +1,69 @@ +# Cold thermal dust component +COMP_LABEL&& = dust_ir +COMP_TYPE&& = MBBtab +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 200 +COMP_NSIDE&& = 4096 +COMP_MONOPOLE_PRIOR&& = crosscorr:HI4PI_NHI_n0064_60arcmin_rescaled_TQU.fits,64,60.d0,1.5,2.0,2.5,3.0,3.5,4.0 #,,, +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 800 +COMP_APPLY_DUST_EXTINCTION&& = .false. +COMP_OUTPUT_FWHM&& = 45 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 5000 +COMP_NU_REF_P&& = 5000 +COMP_MASK&& = fullsky +COMP_INDMASK&& = mask_DIRBE_chisq_n2048_v2.fits fullsky + +COMP_CL_TYPE&& = gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 50 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 10000 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 400 +COMP_CL_DEFAULT_AMP_B&& = 400 +COMP_CL_DEFAULT_BETA_T&& = 45 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 800 +COMP_AMP_INPUT_MAP&& = none +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = -1 + +COMP_BETA_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 2540 # Highest frequency for index estimation in GHz +COMP_BETA_INPUT_MAP&& = none init_dust_beta_BP8.1_v1.fits +COMP_BETA_DEFAULT&& = 1.56 +COMP_BETA_PRIOR_UNI_LOW&& = 1 +COMP_BETA_PRIOR_UNI_HIGH&& = 3.0 +COMP_BETA_PRIOR_GAUSS_MEAN&& = 1.4 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.1 # 0.1 +COMP_BETA_SMOOTHING_SCALE&& = 1 +COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + +COMP_T_DEFAULT&& = 80. +COMP_T_PRIOR_UNI_LOW&& = 20. +COMP_T_PRIOR_UNI_HIGH&& = 50. +COMP_T_PRIOR_GAUSS_MEAN&& = 20 +COMP_T_PRIOR_GAUSS_RMS&& = 10. +COMP_T_SMOOTHING_SCALE&& = 1 +COMP_T_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_T_INPUT_MAP&& = none init_dust_T_BP8.1_v1.fits +COMP_T_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_T_NU_MAX&& = 2540 # Highest frequency for index estimation in GHz + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + +COMP_SED_PRIOR&& = 0 \ No newline at end of file diff --git a/commander3/parameter_files/defaults/components/dust/dust_nearby_DIRBE.defaults b/commander3/parameter_files/defaults/components/dust/dust_nearby_DIRBE.defaults index d3a7e53c5..8596066e4 100644 --- a/commander3/parameter_files/defaults/components/dust/dust_nearby_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/dust/dust_nearby_DIRBE.defaults @@ -11,6 +11,7 @@ COMP_NSIDE&& = 2048 COMP_MONOPOLE_PRIOR&& = none COMP_DEFLATION_MASK&& = fullsky COMP_L_APOD&& = 1000 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_OUTPUT_FWHM&& = 14 # arcmin COMP_UNIT&& = uK_RJ COMP_NU_MIN&& = 0.d0 diff --git a/commander3/parameter_files/defaults/components/dust/dust_nearby_DIRBE_alm.defaults b/commander3/parameter_files/defaults/components/dust/dust_nearby_DIRBE_alm.defaults new file mode 100644 index 000000000..4c2695fcb --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_nearby_DIRBE_alm.defaults @@ -0,0 +1,67 @@ +# Nearby dust component +COMP_LABEL&& = dust_near +COMP_TYPE&& = MBB +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 2048 +COMP_MONOPOLE_PRIOR&& = none +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 1000 +COMP_OUTPUT_FWHM&& = 14 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 857 +COMP_NU_REF_P&& = 857 +COMP_MASK&& = fullsky +COMP_INDMASK&& = mask_DIRBE_chisq_n2048_v2.fits fullsky + +COMP_CL_TYPE&& = none gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 50 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1e7 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 500 +COMP_CL_DEFAULT_AMP_B&& = 500 +COMP_CL_DEFAULT_BETA_T&& = 5.d0 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 1000 +COMP_AMP_INPUT_MAP&& = dust_nearby_edenhofer_total_scaled.fits +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = 10 + +COMP_BETA_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 1000 2540 # Highest frequency for index estimation in GHz +COMP_BETA_INPUT_MAP&& = none init_dust_beta_BP8.1_v1.fits +COMP_BETA_DEFAULT&& = 1.56 +COMP_BETA_PRIOR_UNI_LOW&& = 0.4 +COMP_BETA_PRIOR_UNI_HIGH&& = 3.0 +COMP_BETA_PRIOR_GAUSS_MEAN&& = 1.4 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.1 # 0.1 +COMP_BETA_SMOOTHING_SCALE&& = 1 +COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + +COMP_T_DEFAULT&& = 16. +COMP_T_PRIOR_UNI_LOW&& = 10. +COMP_T_PRIOR_UNI_HIGH&& = 35. +COMP_T_PRIOR_GAUSS_MEAN&& = 18 +COMP_T_PRIOR_GAUSS_RMS&& = 1. +COMP_T_SMOOTHING_SCALE&& = 1 +COMP_T_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_T_INPUT_MAP&& = none init_dust_T_BP8.1_v1.fits +COMP_T_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz +COMP_T_NU_MAX&& = 1000 2540 # Highest frequency for index estimation in GHz + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + diff --git a/commander3/parameter_files/defaults/components/dust/dust_nearby_DIRBE_alm_localsampler.defaults b/commander3/parameter_files/defaults/components/dust/dust_nearby_DIRBE_alm_localsampler.defaults new file mode 100644 index 000000000..2281ba39a --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_nearby_DIRBE_alm_localsampler.defaults @@ -0,0 +1,68 @@ +# New Local sampling parameters, 'dust' +COMP_BETA_INT_LMAX&& = 10 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_BETA_POL_LMAX&& = 0 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_BETA_INT_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_BETA_POL_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_BETA_INT_PIXREG&& = fullsky # pixel region type, local sampling, {fullsky,single_pix,pixreg,prior}. +COMP_BETA_INT_PRIOR_MEAN&& = 1.56 # prior sampler mean; Planck 2015 +COMP_BETA_INT_PRIOR_RMS&& = 0.03 # prior sampler RMS; Planck 2015 +COMP_BETA_INT_PIXREG_PRIORS&& = none +COMP_BETA_POL_PIXREG_PRIORS&& = none +COMP_BETA_POL_PIXREG&& = pixreg # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_BETA_INT_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=1 of poltype). Sample correlation length of proposals +COMP_BETA_POL_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=2 of poltype). Sample correlation length of proposals +COMP_BETA_INT_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=1 of poltype). Sample proposal length (std. dev.) of proposals +COMP_BETA_POL_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=2 of poltype). Sample proposal length (std. dev.) of proposals +COMP_BETA_INT_NPROP_INIT&& = 500 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_BETA_POL_NPROP_INIT&& = 500 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_BETA_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region +COMP_BETA_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region +COMP_BETA_ALMSAMP_INIT&& = init_alm_dust_beta_hke.dat +COMP_BETA_MASK&& = fullsky mask_DIRBE_colddust_chisq_n2048_v2.fits fullsky mask_monopoles_BP10_chisq_dx12_n1024_specpar_sampling.fits mask_dust_beta_BP8_10deg.fits # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_BETA_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) +COMP_BETA_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) +COMP_BETA_INT_PROPLEN_INIT&& = 0.0003 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_BETA_POL_PROPLEN_INIT&& = 0.0003 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_BETA_INT_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_BETA_INT_FIX_PIXREG&& = none +COMP_BETA_POL_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_BETA_POL_FIX_PIXREG&& = none +COMP_BETA_PIXREG_MAP&& = fullsky # Pixel region map (from 1 -> N). 'fullsky' -> all pixels = 1 +COMP_BETA_PIXREG_INITVALUE_MAP&& = none +COMP_BETA_COMBINED_MONOPOLE_SAMPLING&& = .false. +COMP_BETA_COMBINED_MONOPOLE_TYPE&& = monopole-dipole +COMP_BETA_COMBINED_MONOPOLE_FREEZE&& = none #write band labels of band to not sample monopoles from during combined sampling. separate with comma ',' +COMP_BETA_COMBINED_MONOPOLE_MASK&& = fullsky mask_band_monopoles_bp10_chisq_comp_radio_commonDX12_n1024_TQU.fits +COMP_BETA_CORRELATION_CONVERGENCE_SAMPLING&& = .false. +COMP_BETA_CORRELATION_CONVERGENCE_LIMIT&& = 0.1d0 + +COMP_T_INT_LMAX&& = 10 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_T_POL_LMAX&& = -1 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_T_INT_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_T_POL_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_T_INT_PIXREG&& = fullsky # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_T_POL_PIXREG&& = pixreg # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_T_INT_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=1 of poltype). Sample correlation length of proposals +COMP_T_POL_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=2 of poltype). Sample correlation length of proposals +COMP_T_INT_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=1 of poltype). Sample proposal length (std. dev.) of proposals +COMP_T_POL_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=2 of poltype). Sample proposal length (std. dev.) of proposals +COMP_T_INT_PIXREG_PRIORS&& = none +COMP_T_POL_PIXREG_PRIORS&& = none +COMP_T_INT_NPROP_INIT&& = 1000 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_T_POL_NPROP_INIT&& = 1000 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_T_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region +COMP_T_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region +COMP_T_ALMSAMP_INIT&& = init_alm_dust_T_hke.dat +COMP_T_MASK&& = fullsky mask_DIRBE_colddust_chisq_n2048_v2.fits fullsky # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_T_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) +COMP_T_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) +COMP_T_INT_PROPLEN_INIT&& = 5.d-2 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_T_POL_PROPLEN_INIT&& = 5.d-2 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_T_INT_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_T_POL_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_T_INT_FIX_PIXREG&& = none +COMP_T_POL_FIX_PIXREG&& = none +COMP_T_PIXREG_MAP&& = fullsky # Pixel region map (from 1 -> N). 'fullsky' -> all pixels = 1 +COMP_T_PIXREG_INITVALUE_MAP&& = none +COMP_T_COMBINED_MONOPOLE_SAMPLING&& = .false. +COMP_T_CORRELATION_CONVERGENCE_SAMPLING&& = .false. diff --git a/commander3/parameter_files/defaults/components/dust/dust_planck2015_1deg.defaults b/commander3/parameter_files/defaults/components/dust/dust_planck2015_1deg.defaults new file mode 100644 index 000000000..67058c461 --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_planck2015_1deg.defaults @@ -0,0 +1,67 @@ +# Thermal dust component +COMP_LABEL&& = dust +COMP_TYPE&& = MBB +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 256 +COMP_MONOPOLE_PRIOR&& = none +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 750 +COMP_OUTPUT_FWHM&& = 60 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 545 +COMP_NU_REF_P&& = 545 +COMP_MASK&& = fullsky +COMP_INDMASK&& = none + +COMP_CL_TYPE&& = none gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 50 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1e7 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 500 +COMP_CL_DEFAULT_AMP_B&& = 500 +COMP_CL_DEFAULT_BETA_T&& = 5.d0 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 750 +COMP_AMP_INPUT_MAP&& = init_dust_amp_BP8.1_v1.fits +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = 750 + +COMP_BETA_NU_MIN&& = 20 # Lowest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 1000 # Highest frequency for index estimation in GHz +COMP_BETA_INPUT_MAP&& = init_dust_beta_BP8.1_v1.fits +COMP_BETA_DEFAULT&& = 1.56 1.68 1.55 +COMP_BETA_PRIOR_UNI_LOW&& = 0.4 +COMP_BETA_PRIOR_UNI_HIGH&& = 3.0 +COMP_BETA_PRIOR_GAUSS_MEAN&& = 1.56 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.1 # 0.1 +COMP_BETA_SMOOTHING_SCALE&& = 0 +COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + +COMP_T_DEFAULT&& = 18. +COMP_T_PRIOR_UNI_LOW&& = 10. +COMP_T_PRIOR_UNI_HIGH&& = 35. +COMP_T_PRIOR_GAUSS_MEAN&& = 18.5 +COMP_T_PRIOR_GAUSS_RMS&& = 0. +COMP_T_SMOOTHING_SCALE&& = 0 +COMP_T_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_T_INPUT_MAP&& = init_dust_T_BP8.1_v1.fits +COMP_T_NU_MIN&& = 150 # Lowest frequency for index estimation in GHz +COMP_T_NU_MAX&& = 1000 # Highest frequency for index estimation in GHz + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + diff --git a/commander3/parameter_files/defaults/components/dust/dust_planck2015_1deg_localsampler.defaults b/commander3/parameter_files/defaults/components/dust/dust_planck2015_1deg_localsampler.defaults new file mode 100644 index 000000000..e360e96e5 --- /dev/null +++ b/commander3/parameter_files/defaults/components/dust/dust_planck2015_1deg_localsampler.defaults @@ -0,0 +1,68 @@ +# New Local sampling parameters, 'dust' +COMP_BETA_INT_LMAX&& = -1 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_BETA_POL_LMAX&& = 0 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_BETA_INT_LNLTYPE&& = prior # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_BETA_POL_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_BETA_INT_PIXREG&& = fullsky # pixel region type, local sampling, {fullsky,single_pix,pixreg,prior}. +COMP_BETA_INT_PRIOR_MEAN&& = 1.56 # prior sampler mean; Planck 2015 +COMP_BETA_INT_PRIOR_RMS&& = 0.03 # prior sampler RMS; Planck 2015 +COMP_BETA_INT_PIXREG_PRIORS&& = none +COMP_BETA_POL_PIXREG_PRIORS&& = none +COMP_BETA_POL_PIXREG&& = pixreg # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_BETA_INT_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=1 of poltype). Sample correlation length of proposals +COMP_BETA_POL_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=2 of poltype). Sample correlation length of proposals +COMP_BETA_INT_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=1 of poltype). Sample proposal length (std. dev.) of proposals +COMP_BETA_POL_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=2 of poltype). Sample proposal length (std. dev.) of proposals +COMP_BETA_INT_NPROP_INIT&& = 500 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_BETA_POL_NPROP_INIT&& = 500 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_BETA_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region +COMP_BETA_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region +COMP_BETA_ALMSAMP_INIT&& = init_alm_dust_beta.dat +COMP_BETA_MASK&& = fullsky mask_monopoles_BP10_chisq_dx12_n1024_specpar_sampling.fits mask_dust_beta_BP8_10deg.fits # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_BETA_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) +COMP_BETA_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) +COMP_BETA_INT_PROPLEN_INIT&& = 0.0003 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_BETA_POL_PROPLEN_INIT&& = 0.0003 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_BETA_INT_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_BETA_INT_FIX_PIXREG&& = none +COMP_BETA_POL_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_BETA_POL_FIX_PIXREG&& = none +COMP_BETA_PIXREG_MAP&& = fullsky # Pixel region map (from 1 -> N). 'fullsky' -> all pixels = 1 +COMP_BETA_PIXREG_INITVALUE_MAP&& = none +COMP_BETA_COMBINED_MONOPOLE_SAMPLING&& = .true. +COMP_BETA_COMBINED_MONOPOLE_TYPE&& = monopole-dipole +COMP_BETA_COMBINED_MONOPOLE_FREEZE&& = none #write band labels of band to not sample monopoles from during combined sampling. separate with comma ',' +COMP_BETA_COMBINED_MONOPOLE_MASK&& = fullsky mask_band_monopoles_bp10_chisq_comp_radio_commonDX12_n1024_TQU.fits +COMP_BETA_CORRELATION_CONVERGENCE_SAMPLING&& = .false. +COMP_BETA_CORRELATION_CONVERGENCE_LIMIT&& = 0.1d0 + +COMP_T_INT_LMAX&& = -1 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_T_POL_LMAX&& = -1 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_T_INT_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_T_POL_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_T_INT_PIXREG&& = pixreg # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_T_POL_PIXREG&& = pixreg # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_T_INT_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=1 of poltype). Sample correlation length of proposals +COMP_T_POL_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=2 of poltype). Sample correlation length of proposals +COMP_T_INT_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=1 of poltype). Sample proposal length (std. dev.) of proposals +COMP_T_POL_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=2 of poltype). Sample proposal length (std. dev.) of proposals +COMP_T_INT_PIXREG_PRIORS&& = none +COMP_T_POL_PIXREG_PRIORS&& = none +COMP_T_INT_NPROP_INIT&& = 1000 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_T_POL_NPROP_INIT&& = 1000 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_T_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region +COMP_T_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region +COMP_T_ALMSAMP_INIT&& = none +COMP_T_MASK&& = fullsky # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_T_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) +COMP_T_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) +COMP_T_INT_PROPLEN_INIT&& = 5.d-2 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_T_POL_PROPLEN_INIT&& = 5.d-2 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_T_INT_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_T_POL_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_T_INT_FIX_PIXREG&& = none +COMP_T_POL_FIX_PIXREG&& = none +COMP_T_PIXREG_MAP&& = fullsky # Pixel region map (from 1 -> N). 'fullsky' -> all pixels = 1 +COMP_T_PIXREG_INITVALUE_MAP&& = none +COMP_T_COMBINED_MONOPOLE_SAMPLING&& = .false. +COMP_T_CORRELATION_CONVERGENCE_SAMPLING&& = .false. diff --git a/commander3/parameter_files/defaults/components/dust/dust_stars_n512.defaults b/commander3/parameter_files/defaults/components/dust/dust_stars_n512.defaults index 132dc64d2..280c3b05b 100644 --- a/commander3/parameter_files/defaults/components/dust/dust_stars_n512.defaults +++ b/commander3/parameter_files/defaults/components/dust/dust_stars_n512.defaults @@ -1,5 +1,5 @@ # Stars component -COMP_LABEL&& = stars_diff +COMP_LABEL&& = stars_dust COMP_TYPE&& = MBB COMP_CLASS&& = diffuse # {diffuse, ptsrc} COMP_POLARIZATION&& = .false. @@ -34,6 +34,7 @@ COMP_CL_DEFAULT_BETA_B&& = 30.d0 COMP_AMP_LMIN&& = 0 COMP_AMP_LMAX&& = 500 COMP_L_APOD&& = 200 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_AMP_INPUT_MAP&& = zero_n512.fits COMP_AMP_PRIOR_MAP&& = none diff --git a/commander3/parameter_files/defaults/components/freefree/freefree_DIRBE.defaults b/commander3/parameter_files/defaults/components/freefree/freefree_DIRBE.defaults index 43bb68358..453b49cfe 100644 --- a/commander3/parameter_files/defaults/components/freefree/freefree_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/freefree/freefree_DIRBE.defaults @@ -12,6 +12,7 @@ COMP_MONOPOLE_PRIOR&& = monopole-dipole:mask_ff_monoprior_bp10_n1024_TQU COMP_DEFLATION_MASK&& = fullsky COMP_L_APOD&& = 1500 COMP_LMAX_IND&& = 0 -1 # Use input map as is +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_OUTPUT_FWHM&& = 30 # arcmin COMP_UNIT&& = uK_RJ COMP_NU_MIN&& = 0.d0 diff --git a/commander3/parameter_files/defaults/components/freefree/freefree_DIRBE2.defaults b/commander3/parameter_files/defaults/components/freefree/freefree_DIRBE2.defaults index af13dd478..b6e70f19f 100644 --- a/commander3/parameter_files/defaults/components/freefree/freefree_DIRBE2.defaults +++ b/commander3/parameter_files/defaults/components/freefree/freefree_DIRBE2.defaults @@ -12,7 +12,8 @@ COMP_MONOPOLE_PRIOR&& = monopole-dipole:mask_ff_monoprior_bp10_n1024_TQU COMP_DEFLATION_MASK&& = fullsky COMP_L_APOD&& = 1500 COMP_LMAX_IND&& = 0 -1 # Use input map as is -COMP_OUTPUT_FWHM&& = 30 # arcmin +COMP_APPLY_DUST_EXTINCTION&& = .false. +COMP_OUTPUT_FWHM&& = 15 # arcmin COMP_UNIT&& = uK_RJ COMP_NU_MIN&& = 0.d0 COMP_NU_MAX&& = 1d30 @@ -25,20 +26,20 @@ COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} COMP_CL_BETA_PRIOR_MEAN&& = -0.0 COMP_CL_BETA_PRIOR_RMS&& = 0.0 COMP_CL_L_PIVOT&& = 50 1 # Pivot multipole -COMP_CL_DEFAULT_AMP_T&& = 1e3 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_T&& = 1e8 # D_l = amp * (l/lpivot)**beta COMP_CL_DEFAULT_AMP_E&& = 50 COMP_CL_DEFAULT_AMP_B&& = 50 -COMP_CL_DEFAULT_BETA_T&& = 2.0d0 -0.5d0 +COMP_CL_DEFAULT_BETA_T&& = 0. 2.0d0 -0.5d0 COMP_CL_DEFAULT_BETA_E&& = -0.5d0 COMP_CL_DEFAULT_BETA_B&& = -0.5d0 -COMP_CL_DEFAULT_THETA_T&& = 30.d0 # equivalent to BETA for CL_TYPE = gauss (see synch), BP8.0 used 90.d0 +COMP_CL_DEFAULT_THETA_T&& = 19.d0 # equivalent to BETA for CL_TYPE = gauss (see synch), BP8.0 used 90.d0 COMP_CL_DEFAULT_THETA_E&& = 90.d0 COMP_CL_DEFAULT_THETA_B&& = 90.d0 COMP_AMP_LMIN&& = 0 COMP_AMP_LMAX&& = 1500 COMP_AMP_INPUT_MAP&& = init_ff_amp_BP8.1_v1.fits -COMP_AMP_PRIOR_MAP&& = ff_prior_mean_2015_median_90arc.fits none +COMP_AMP_PRIOR_MAP&& = none ff_prior_mean_2015_median_90arc.fits none COMP_AMP_PRIOR_LMAX&& = -1 COMP_EM_POLTYPE&& = 1 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} diff --git a/commander3/parameter_files/defaults/components/freefree/freefree_planck2015_1deg.defaults b/commander3/parameter_files/defaults/components/freefree/freefree_planck2015_1deg.defaults new file mode 100644 index 000000000..4f932cd09 --- /dev/null +++ b/commander3/parameter_files/defaults/components/freefree/freefree_planck2015_1deg.defaults @@ -0,0 +1,72 @@ +# freefree component --------------------------------------------------------------------- +COMP_LABEL&& = ff +COMP_TYPE&& = freefreeEM +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 150 +COMP_NSIDE&& = 256 +COMP_MONOPOLE_PRIOR&& = none +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 750 +COMP_LMAX_IND&& = -1 # Use input map as is +COMP_OUTPUT_FWHM&& = 60 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 22.8 +COMP_NU_REF_P&& = 22.8 +COMP_MASK&& = fullsky +COMP_INDMASK&& = fullsky +COMP_CL_TYPE&& = none +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 50 1 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1e3 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 50 +COMP_CL_DEFAULT_AMP_B&& = 50 +COMP_CL_DEFAULT_BETA_T&& = 2.0d0 -0.5d0 +COMP_CL_DEFAULT_BETA_E&& = -0.5d0 +COMP_CL_DEFAULT_BETA_B&& = -0.5d0 +COMP_CL_DEFAULT_THETA_T&& = 30.d0 # equivalent to BETA for CL_TYPE = gauss (see synch), BP8.0 used 90.d0 +COMP_CL_DEFAULT_THETA_E&& = 90.d0 +COMP_CL_DEFAULT_THETA_B&& = 90.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 1500 +COMP_AMP_INPUT_MAP&& = init_ff_rc2_n256_v03.fits +COMP_AMP_PRIOR_MAP&& = init_ff_rc2_n256_v03.fits +COMP_AMP_PRIOR_LMAX&& = -1 + +COMP_EM_POLTYPE&& = 1 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_EM_INPUT_MAP&& = init_ff_EM_rc2_n256_v03.fits +COMP_EM_SMOOTHING_SCALE&& = 0 +COMP_EM_DEFAULT&& = 1. +COMP_EM_PRIOR_UNI_LOW&& = 1.d-6 +COMP_EM_PRIOR_UNI_HIGH&& = 1.d6 +COMP_EM_PRIOR_GAUSS_MEAN&& = 1. +COMP_EM_PRIOR_GAUSS_RMS&& = 0. +COMP_EM_NU_MIN&& = 0. # Lowest frequency for index estimation in GHz +COMP_EM_NU_MAX&& = 80. # Highest frequency for index estimation in GHz + +COMP_T_E_POLTYPE&& = 1 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_T_E_INPUT_MAP&& = init_ff_T_e_rc2_n256_v03.fits +COMP_T_E_SMOOTHING_SCALE&& = 0 +COMP_T_E_DEFAULT&& = 7000. +COMP_T_E_PRIOR_UNI_LOW&& = 1200. +COMP_T_E_PRIOR_UNI_HIGH&& = 12000. +COMP_T_E_PRIOR_GAUSS_MEAN&& = 7000. +COMP_T_E_PRIOR_GAUSS_RMS&& = 000. +COMP_T_E_NU_MIN&& = 0. # Lowest frequency for index estimation in GHz +COMP_T_E_NU_MAX&& = 217. # Highest frequency for index estimation in GHz +COMP_T_E_INT_PIXREG_PRIORS&& = none +COMP_T_E_POL_PIXREG_PRIORS&& = none + +COMP_T_E_ALMSAMP_INIT&& = none + +COMP_APPLY_JEFFREYS_PRIOR&& = .false. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default diff --git a/commander3/parameter_files/defaults/components/freefree/freefree_planck2015_1deg_localsampler.defaults b/commander3/parameter_files/defaults/components/freefree/freefree_planck2015_1deg_localsampler.defaults new file mode 100644 index 000000000..6db104749 --- /dev/null +++ b/commander3/parameter_files/defaults/components/freefree/freefree_planck2015_1deg_localsampler.defaults @@ -0,0 +1,57 @@ +# New Local sampling parameters. 'freefree, ff' +COMP_EM_INT_LMAX&& = -1 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_EM_POL_LMAX&& = -1 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_EM_INT_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_EM_POL_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_EM_INT_PIXREG&& = single_pix # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_EM_POL_PIXREG&& = single_pix # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_EM_INT_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=1 of poltype). Sample correlation length of proposals +COMP_EM_POL_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=2 of poltype). Sample correlation length of proposals +COMP_EM_INT_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=1 of poltype). Sample proposal length (std. dev.) of proposals +COMP_EM_POL_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=2 of poltype). Sample proposal length (std. dev.) of proposals +COMP_EM_INT_NPROP_INIT&& = 1000 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_EM_POL_NPROP_INIT&& = 1000 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_EM_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region +COMP_EM_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region +COMP_EM_MASK&& = fullsky # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_EM_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) +COMP_EM_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) +COMP_EM_INT_PROPLEN_INIT&& = 5.d-2 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_EM_POL_PROPLEN_INIT&& = 5.d-2 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_EM_INT_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_EM_POL_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_EM_INT_FIX_PIXREG&& = none +COMP_EM_POL_FIX_PIXREG&& = none +COMP_EM_PIXREG_MAP&& = fullsky # Pixel region map (from 1 -> N). 'fullsky' -> all pixels = 1 +COMP_EM_PIXREG_INITVALUE_MAP&& = none +COMP_EM_CORRELATION_CONVERGENCE_SAMPLING&& = .false. +COMP_EM_COMBINED_MONOPOLE_SAMPLING&& = .false. + +COMP_T_E_INT_LMAX&& = -1 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_T_E_POL_LMAX&& = -1 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_T_E_INT_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_T_E_POL_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_T_E_INT_PIXREG&& = single_pix # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_T_E_POL_PIXREG&& = single_pix # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_T_E_INT_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=1 of poltype). Sample correlation length of proposals +COMP_T_E_POL_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=2 of poltype). Sample correlation length of proposals +COMP_T_E_INT_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=1 of poltype). Sample proposal length (std. dev.) of proposals +COMP_T_E_POL_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=2 of poltype). Sample proposal length (std. dev.) of proposals +COMP_T_E_INT_NPROP_INIT&& = 1000 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_T_E_POL_NPROP_INIT&& = 1000 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_T_E_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region +COMP_T_E_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region +COMP_T_E_MASK&& = fullsky # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_T_E_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) +COMP_T_E_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) +COMP_T_E_INT_PROPLEN_INIT&& = 5.d-2 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_T_E_POL_PROPLEN_INIT&& = 5.d-2 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_T_E_INT_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_T_E_POL_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_T_E_INT_FIX_PIXREG&& = none +COMP_T_E_POL_FIX_PIXREG&& = none +COMP_T_E_PIXREG_MAP&& = fullsky # Pixel region map (from 1 -> N). 'fullsky' -> all pixels = 1 +COMP_T_E_PIXREG_INITVALUE_MAP&& = none +COMP_T_E_CORRELATION_CONVERGENCE_SAMPLING&& = .false. +COMP_T_E_COMBINED_MONOPOLE_SAMPLING&& = .false. + diff --git a/commander3/parameter_files/defaults/components/monodipole/md_planck2015_1deg.defaults b/commander3/parameter_files/defaults/components/monodipole/md_planck2015_1deg.defaults new file mode 100644 index 000000000..87db6139e --- /dev/null +++ b/commander3/parameter_files/defaults/components/monodipole/md_planck2015_1deg.defaults @@ -0,0 +1,9 @@ +# Mono- and dipole component +COMP_LABEL&& = md +COMP_TYPE&& = md +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SAMPLE_GROUP&& = 0 +COMP_MD_MONO_FROM_PRIOR&& = none +COMP_MD_DEFINITION_FILE&& = init_md_BP10_v1.dat +COMP_INIT_FROM_HDF&& = none diff --git a/commander3/parameter_files/defaults/components/pah/pah_DIRBE.defaults b/commander3/parameter_files/defaults/components/pah/pah_DIRBE.defaults index 9f35b0f5e..33bc84fc5 100644 --- a/commander3/parameter_files/defaults/components/pah/pah_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/pah/pah_DIRBE.defaults @@ -11,6 +11,7 @@ COMP_NSIDE&& = 256 COMP_AMP_LMIN&& = 0 COMP_AMP_LMAX&& = 750 COMP_L_APOD&& = 750 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_UNIT&& = MJy/sr COMP_NU_MIN&& = 0.d0 COMP_NU_MAX&& = 1d30 diff --git a/commander3/parameter_files/defaults/components/stars/faint_WISE_DIRBE.defaults b/commander3/parameter_files/defaults/components/stars/faint_WISE_DIRBE.defaults index 2e2c4f604..df09e519a 100644 --- a/commander3/parameter_files/defaults/components/stars/faint_WISE_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/stars/faint_WISE_DIRBE.defaults @@ -7,11 +7,11 @@ COMP_CG_SCALE_T&& = 1.d0 COMP_CG_SCALE_P&& = 1.d0 COMP_CG_SAMPLE_GROUP&& = 0 1 COMP_CG_SAMP_GROUP_MAXITER&& = 35 -COMP_NSIDE&& = 512 +COMP_NSIDE&& = 2048 COMP_MONOPOLE_PRIOR&& = none COMP_DEFLATION_MASK&& = fullsky COMP_L_APOD&& = 1500 -COMP_OUTPUT_FWHM&& = 42 # arcmin +COMP_OUTPUT_FWHM&& = 0 42 # arcmin COMP_UNIT&& = MJy/sr COMP_NU_MIN&& = 10000.d0 # Cut off below Band 6 (25um) COMP_NU_MAX&& = 1d30 @@ -19,6 +19,7 @@ COMP_NU_REF_T&& = 239833.966 COMP_NU_REF_P&& = 239833.966 COMP_MASK&& = fullsky COMP_INDMASK&& = fullsky +COMP_APPLY_DUST_EXTINCTION&& = .true. COMP_CL_TYPE&& = none # {none, single_l, binned,power_law, exp} COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} @@ -37,7 +38,7 @@ COMP_AMP_LMAX&& = 1500 COMP_AMP_INPUT_MAP&& = diffuse_star_template_DIRBE01_smoothe_n512_x2000.fits COMP_AMP_PRIOR_MAP&& = none -COMP_IND_LMAX&& = -1 +COMP_IND_LMAX&& = 0 COMP_BETA_NU_MIN&& = 30 # Lowest frequency for index estimation in GHz COMP_BETA_NU_MAX&& = 1000 2540 # Highest frequency for index estimation in GHz diff --git a/commander3/parameter_files/defaults/components/synch/synch_CHIPASS.defaults b/commander3/parameter_files/defaults/components/synch/synch_CHIPASS.defaults new file mode 100644 index 000000000..b3e4c6f2b --- /dev/null +++ b/commander3/parameter_files/defaults/components/synch/synch_CHIPASS.defaults @@ -0,0 +1,57 @@ +# Synchrotron component for LFI TOD analysis +COMP_LABEL&& = synch +COMP_TYPE&& = power_law +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .true. +COMP_CG_SCALE_T&& = 5.d5 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 1 +COMP_CG_SAMP_GROUP_MAXITER&& = 100 #50, increased to 100 due to prior sampling convergence +COMP_NSIDE&& = 1024 +COMP_MONOPOLE_PRIOR&& = bandmono:0.4-Haslam # +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 2900 +COMP_OUTPUT_FWHM&& = 15 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 0.408 +COMP_NU_REF_P&& = 30 +COMP_MASK&& = fullsky +COMP_INDMASK&& = mask_synch_beta_sampling_BP10_n1024_TQU.fits mask_clean_synch_tr40_others_tr40_radio_tr30_chisq_tr5_n1024_udgraded_tr75ptc_TQU.fits + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 2900 +COMP_AMP_INPUT_MAP&& = init_synch_amp_BP8.1_v1.fits +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = 0 + +COMP_CL_TYPE&& = gauss # {none, single_l, binned, power_law} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.5 +COMP_CL_BETA_PRIOR_RMS&& = 0.1 +COMP_CL_L_PIVOT&& = 100 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1e14 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 200 +COMP_CL_DEFAULT_AMP_B&& = 100 +COMP_CL_DEFAULT_BETA_T&& = 15d0 +COMP_CL_DEFAULT_BETA_E&& = 30d0 +COMP_CL_DEFAULT_BETA_B&& = 30d0 + +COMP_BETA_PRIOR_UNI_LOW&& = -4.5 +COMP_BETA_PRIOR_UNI_HIGH&& = -1.5 +COMP_BETA_PRIOR_GAUSS_MEAN&& = -3.1 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.1 #0.1 +COMP_BETA_SMOOTHING_SCALE&& = 3 +COMP_BETA_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} +COMP_BETA_NU_MIN&& = 0. # Lowest frequency for index estimation in GHz +COMP_BETA_NU_MAX&& = 98. # Highest frequency for index estimation in GHz +COMP_BETA_INPUT_MAP&& = init_synch_beta_BP8.1_v1.fits +COMP_BETA_DEFAULT&& = -3.1 + +COMP_APPLY_JEFFREYS_PRIOR&& = .false. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + + diff --git a/commander3/parameter_files/defaults/components/synch/synch_DIRBE.defaults b/commander3/parameter_files/defaults/components/synch/synch_DIRBE.defaults index 544e4d91f..a805c96a9 100644 --- a/commander3/parameter_files/defaults/components/synch/synch_DIRBE.defaults +++ b/commander3/parameter_files/defaults/components/synch/synch_DIRBE.defaults @@ -11,6 +11,7 @@ COMP_NSIDE&& = 1024 COMP_MONOPOLE_PRIOR&& = bandmono:0.4-Haslam # COMP_DEFLATION_MASK&& = fullsky COMP_L_APOD&& = 1500 +COMP_APPLY_DUST_EXTINCTION&& = .false. COMP_OUTPUT_FWHM&& = 60 # arcmin COMP_UNIT&& = uK_RJ COMP_NU_MIN&& = 0.d0 diff --git a/commander3/parameter_files/defaults/components/synch/synch_planck2015_1deg.defaults b/commander3/parameter_files/defaults/components/synch/synch_planck2015_1deg.defaults new file mode 100644 index 000000000..9ff961019 --- /dev/null +++ b/commander3/parameter_files/defaults/components/synch/synch_planck2015_1deg.defaults @@ -0,0 +1,96 @@ +# Synch component +COMP_LABEL&& = synch +COMP_TYPE&& = spindust +COMP_CLASS&& = diffuse # {diffuse, ptsrc} +COMP_POLARIZATION&& = .false. +COMP_CG_SCALE_T&& = 1.d0 +COMP_CG_SCALE_P&& = 1.d0 +COMP_CG_SAMPLE_GROUP&& = 0 +COMP_CG_SAMP_GROUP_MAXITER&& = 35 +COMP_NSIDE&& = 256 +COMP_MONOPOLE_PRIOR&& = none +COMP_DEFLATION_MASK&& = fullsky +COMP_L_APOD&& = 750 +COMP_OUTPUT_FWHM&& = 60 # arcmin +COMP_UNIT&& = uK_RJ +COMP_NU_MIN&& = 0.d0 +COMP_NU_MAX&& = 1d30 +COMP_NU_REF_T&& = 0.408 +COMP_NU_REF_P&& = 0.408 +COMP_MASK&& = fullsky +COMP_INDMASK&& = fullsky + +COMP_CL_TYPE&& = none gauss # {none, single_l, binned,power_law, exp} +COMP_CL_POLTYPE&& = 2 # {1 = {T+E+B}, 2 = {T,E+B}, 3 = {T,E,B}} +COMP_CL_BETA_PRIOR_MEAN&& = -0.0 +COMP_CL_BETA_PRIOR_RMS&& = 0.0 +COMP_CL_L_PIVOT&& = 50 # Pivot multipole +COMP_CL_DEFAULT_AMP_T&& = 1e7 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 500 +COMP_CL_DEFAULT_AMP_B&& = 500 +COMP_CL_DEFAULT_BETA_T&& = 5.d0 +COMP_CL_DEFAULT_BETA_E&& = 10.d0 +COMP_CL_DEFAULT_BETA_B&& = 10.d0 + +COMP_AMP_LMIN&& = 0 +COMP_AMP_LMAX&& = 750 +COMP_AMP_INPUT_MAP&& = init_synch_rc2_n256_v03.fits +COMP_AMP_PRIOR_MAP&& = none + +COMP_IND_LMAX&& = 750 + +COMP_NU_P_NU_MIN&& = 0 # Lowest frequency for index estimation in GHz +COMP_NU_P_NU_MAX&& = 100 # Highest frequency for index estimation in GHz +COMP_NU_P_INPUT_MAP&& = init_synch_nup_rc2_n256_v03.fits +COMP_NU_P_DEFAULT&& = 0.015407022 +COMP_NU_P_PRIOR_UNI_LOW&& = 0.001 +COMP_NU_P_PRIOR_UNI_HIGH&& = 0.10 +COMP_NU_P_PRIOR_GAUSS_MEAN&& = 0.015407022 +COMP_NU_P_PRIOR_GAUSS_RMS&& = 0. # 0.1 +COMP_NU_P_SMOOTHING_SCALE&& = 0 +COMP_NU_P_POLTYPE&& = 2 # index {1 = {T+Q+U}, 2 = {T,Q+U}, 3 = {T,Q,U}} + + +COMP_APPLY_JEFFREYS_PRIOR&& = .true. +COMP_OUTPUT_EB_MAP&& = .false. +COMP_INIT_FROM_HDF&& = default + + +# New Local sampling parameters, 'synch' +COMP_NU_P_INT_LMAX&& = -1 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_NU_P_POL_LMAX&& = 0 # alm sampling (>=0), local sampling (-1). NOTE!! Also sets alm/pix-by-pix updateMixmat +COMP_NU_P_INT_LNLTYPE&& = prior # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_NU_P_POL_LNLTYPE&& = chisq # log-likelihood type {chisq,ridge,marginal}. All evaluated at smoothing scale, local sampling +COMP_NU_P_INT_PIXREG&& = fullsky # pixel region type, local sampling, {fullsky,single_pix,pixreg,prior}. +COMP_NU_P_INT_PRIOR_MEAN&& = 19 # prior sampler mean; Planck 2015 +COMP_NU_P_INT_PRIOR_RMS&& = 0.0 # prior sampler RMS; Planck 2015 +COMP_NU_P_INT_PIXREG_PRIORS&& = none +COMP_NU_P_POL_PIXREG_PRIORS&& = none +COMP_NU_P_POL_PIXREG&& = pixreg # pixel region type, local sampling, {fullsky,single_pix,pixreg}. 'Pixreg' only one supported at the moment +COMP_NU_P_INT_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=1 of poltype). Sample correlation length of proposals +COMP_NU_P_POL_SAMPLE_NPROP&& = .false. # sample nprop, local sampling (p=2 of poltype). Sample correlation length of proposals +COMP_NU_P_INT_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=1 of poltype). Sample proposal length (std. dev.) of proposals +COMP_NU_P_POL_SAMPLE_PROPLEN&& = .true. # sample proposal length, local sampling (p=2 of poltype). Sample proposal length (std. dev.) of proposals +COMP_NU_P_INT_NPROP_INIT&& = 500 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_NU_P_POL_NPROP_INIT&& = 500 # {> 0, < 0 to disable}. overwrites nprop init values from nprop map. local sampler +COMP_NU_P_UNI_NPROP_LOW&& = 10 # {>= 0} local sampling. minimum number of proposals per pixel region +COMP_NU_P_UNI_NPROP_HIGH&& = 2000 # {> 0} local sampling. minimum number of proposals per pixel region +COMP_NU_P_ALMSAMP_INIT&& = init_alm_dust_beta.dat +COMP_NU_P_MASK&& = fullsky mask_monopoles_BP10_chisq_dx12_n1024_specpar_sampling.fits mask_dust_beta_BP8_10deg.fits # index sampling mask for smoothed log-likelihood eval. local sampler. +COMP_NU_P_NPROP&& = fullsky # nprop map, local sampling (fullsky = 1) +COMP_NU_P_PROPLEN&& = fullsky # proposal length map, local sampling (fullsky = 1.d0) +COMP_NU_P_INT_PROPLEN_INIT&& = 0.0003 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_NU_P_POL_PROPLEN_INIT&& = 0.0003 # {> 0.d0, -1.d0 to disable}. overwrites proplen init values from nprop map. local sampler +COMP_NU_P_INT_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_NU_P_INT_FIX_PIXREG&& = none +COMP_NU_P_POL_NUM_PIXREG&& = 1 # number of pixel regions to sample (from 1 to N), all regions above N set to 0 (and prior value for spec ind) +COMP_NU_P_POL_FIX_PIXREG&& = none +COMP_NU_P_PIXREG_MAP&& = fullsky # Pixel region map (from 1 -> N). 'fullsky' -> all pixels = 1 +COMP_NU_P_PIXREG_INITVALUE_MAP&& = none +COMP_NU_P_COMBINED_MONOPOLE_SAMPLING&& = .true. +COMP_NU_P_COMBINED_MONOPOLE_TYPE&& = monopole-dipole +COMP_NU_P_COMBINED_MONOPOLE_FREEZE&& = none #write band labels of band to not sample monopoles from during combined sampling. separate with comma ',' +COMP_NU_P_COMBINED_MONOPOLE_MASK&& = fullsky mask_band_monopoles_bp10_chisq_comp_radio_commonDX12_n1024_TQU.fits +COMP_NU_P_CORRELATION_CONVERGENCE_SAMPLING&& = .false. +COMP_NU_P_CORRELATION_CONVERGENCE_LIMIT&& = 0.1d0 + diff --git a/commander3/parameter_files/defaults/planck2015_1deg.defaults b/commander3/parameter_files/defaults/planck2015_1deg.defaults new file mode 100644 index 000000000..843e1f398 --- /dev/null +++ b/commander3/parameter_files/defaults/planck2015_1deg.defaults @@ -0,0 +1,114 @@ +# Monte Carlo options +BASE_SEED = 163425 # Seed for random number generator + +NUM_GIBBS_STEPS_PER_TOD_SAMPLE = 0 + +SAMPLE_ONLY_TEMPERATURE = .true. +SAMPLE_ONLY_POLARIZATION = .false. +SAMPLE_SIGNAL_AMPLITUDES = .true. +SAMPLE_SPECTRAL_INDICES = .false. +SAMPLE_POWSPEC = .false. + +ENABLE_TOD_ANALYSIS = .false. +TOD_OUTPUT_4D_MAP_EVERY_NTH_ITER = 10 +TOD_OUTPUT_AUXILIARY_MAPS_EVERY_NTH_ITER = 10 +TOD_INCLUDE_ZODI = .false. +FFTW3_MAGIC_NUMBERS = fft3_magic_numbers_230810.txt + +ENABLE_TOD_SIMULATIONS = .false. +SIMS_OUTPUT_DIRECTORY = none + +# Options for CMB resampling (for constrained realization production) +RESAMPLE_CMB = .false. +FIRST_SAMPLE_FOR_CMB_RESAMP = 1 +LAST_SAMPLE_FOR_CMB_RESAMP = 15 +NUM_SUBSAMP_PER_MAIN_SAMPLE = 10 + +# Numerical accuracy settings +CG_CONVERGENCE_CRITERION = fixed_iter chisq # {residual, chisquare} +CG_LMAX_PRECOND = -1 # lmax for low-l preconditioner +CG_MAXITER = 300 # Conjugate gradients time out limit +CG_MINITER = 5 +CG_TOLERANCE = 1.d-8 # Fractional CG convergence criterion +CG_CONV_CHECK_FREQUENCY = 1 # Check convergence every n'th iteration +CG_PRECOND_TYPE = diagonal pseudoinv +CG_INIT_AMPS_ON_ZERO = .false. +SET_ALL_NOISE_MAPS_TO_MEAN = .false. +NUM_INDEX_CYCLES_PER_ITERATION = 1 +IGNORE_GAIN_AND_BANDPASS_CORR = .false. + +############################################################## +## Output options # +############################################################### + +THINNING_FACTOR = 1 +NSIDE_CHISQ = 16 +POLARIZATION_CHISQ = .true. +OUTPUT_MIXING_MATRIX = .false. +OUTPUT_RESIDUAL_MAPS = .true. +OUTPUT_CHISQ_MAP = .true. +OUTPUT_EVERY_NTH_CG_ITERATION = 0 +OUTPUT_CG_PRECOND_EIGENVALS = .false. +OUTPUT_INPUT_MODEL = .false. +OUTPUT_DEBUG_SEDS = .false. +OUTPUT_SIGNALS_PER_BAND = .false. + + +SOURCE_MASKFILE = none #bright_sources.txt +PROCESSING_MASKFILE = none #mask_cmb_v1_n0256_apod_v2_clean.fits +PROC_SMOOTH_SCALE = 30. #arcmin; smoothing inside processing mask + +# Spectral index sampling options + NUM_SMOOTHING_SCALES = 0 + + SMOOTHING_SCALE_FWHM01 = 300. # Arcmin; 0 = native resolution + SMOOTHING_SCALE_LMAX01 = 96 + SMOOTHING_SCALE_NSIDE01 = 32 # Must match NSIDE of component it is used for + SMOOTHING_SCALE_PIXWIN01 = pixel_window_n0032.fits + SMOOTHING_SCALE_FWHM_POSTPROC01 = 600. # Smoothing FWHM after pixel-by-pixel fit + + SMOOTHING_SCALE_FWHM02 = 600. # Arcmin; 0 = native resolution + SMOOTHING_SCALE_LMAX02 = 64 + SMOOTHING_SCALE_NSIDE02 = 16 # Must match NSIDE of component it is used for + SMOOTHING_SCALE_PIXWIN02 = pixel_window_n0016.fits + SMOOTHING_SCALE_FWHM_POSTPROC02 = 600. # Smoothing FWHM after pixel-by-pixel fit + + #fullsky spec. ind. parameters sampling (per say no smoothing in skymaps, but smoothing in postproc) + SMOOTHING_SCALE_FWHM03 = 60. # Arcmin; 0 = native resolution + SMOOTHING_SCALE_LMAX03 = 64 + SMOOTHING_SCALE_NSIDE03 = 16 # Must match NSIDE of component it is used for + SMOOTHING_SCALE_PIXWIN03 = pixel_window_n0016.fits + SMOOTHING_SCALE_FWHM_POSTPROC03 = 600. # Smoothing FWHM after pixel-by-pixel fit + + # TOD sampling options + TOD_NUM_BP_PROPOSALS_PER_ITER = 1 # 1 for sampling; >= 1 for optimize + + NUMITER_RESAMPLE_HARD_GAIN_PRIORS = 3 + + +CMB_DIPOLE_PRIOR = none + +OUTPUT_COMPS_TO_CHAINDIR = all + +# Alm sampler settings +ALMSAMP_NSAMP_ALM = 100 # of mcmc samples per gibbs +ALMSAMP_BURN_IN = 2 # of gibbs iterations with steplength adjustment +ALMSAMP_NSIDE_CHISQ_LOWRES = 16 +ALMSAMP_PRIOR_FWHM = 0 +ALMSAMP_OPTIMIZE_ALM = .false. # save chisq from prev gibbs iter +ALMSAMP_APPLY_PRIOR = .true. # apply prior to alms +ALMSAMP_PIXREG = .true. +ALMSAMP_PRIORSAMP_FROZEN_REGIONS = .true. + +#local sampler settings +LOCALSAMP_BURN_IN = 2 # of gibbs iterations with steplength adjustment +LOCALSAMP_OUTPUT_MAPS = .false. # {.true., .false.} output extra maps from local sampler + +############################################################## +## Conventions and global parameters # +############################################################### + + +MJYSR_CONVENTION = IRAS +T_CMB = 2.7255d0 + diff --git a/commander3/parameter_files/param_AST9240_planck2015_1deg.txt b/commander3/parameter_files/param_AST9240_planck2015_1deg.txt new file mode 100644 index 000000000..9b1be1ecc --- /dev/null +++ b/commander3/parameter_files/param_AST9240_planck2015_1deg.txt @@ -0,0 +1,704 @@ +************************************************************** +* Commander parameter file * +************************************************************** +@DEFAULT planck2015_1deg.defaults + +OPERATION = sample # {sample,optimize} +#OPERATION = optimize # {sample,optimize} +VERBOSITY = 3 # [0,...,3] + +############################################################## +# Algorithm specification # +############################################################## + +# Monte Carlo options +NUMCHAIN = 1 # Number of independent chains +NUM_GIBBS_ITER = 250 # Length of each Markov chain +CHAIN_STATUS = new +NUM_INIT_CHAINS = 1 + +INIT_CHAIN01 = none + +OUTPUT_MIXING_MATRIX = .true. +OUTPUT_INPUT_MODEL = .true. +OUTPUT_SIGNALS_PER_BAND = .true. +NSIDE_CHISQ = 256 + +############################################################## +# Output options # +############################################################## + +OUTPUT_DIRECTORY = chains + +############################################################## +# Data sets # +############################################################## + +DATA_DIRECTORY = /mn/stornext/d16/cmbco/AST9240/2024/planck2015_comm3/data +NUMBAND = 32 + +# HFI +INCLUDE_BAND001 = .true. # 857-2 +INCLUDE_BAND002 = .true. # 545-2 +INCLUDE_BAND003 = .true. # 545-4 +INCLUDE_BAND004 = .true. # 353-ds2 +INCLUDE_BAND005 = .true. # 353-1 +INCLUDE_BAND006 = .true. # 217-1 +INCLUDE_BAND007 = .true. # 217-2 +INCLUDE_BAND008 = .true. # 217-3 +INCLUDE_BAND009 = .true. # 217-4 +INCLUDE_BAND010 = .true. # 143-ds1 +INCLUDE_BAND011 = .true. # 143-ds2 +INCLUDE_BAND012 = .true. # 143-5 +INCLUDE_BAND013 = .true. # 143-6 +INCLUDE_BAND014 = .true. # 143-7 +INCLUDE_BAND015 = .true. # 100-ds1 +INCLUDE_BAND016 = .true. # 100-ds2 + +# LFI +INCLUDE_BAND017 = .true. # 30 GHz +INCLUDE_BAND018 = .true. # 44 GHz +INCLUDE_BAND019 = .true. # 70-ds1 +INCLUDE_BAND020 = .true. # 70-ds2 +INCLUDE_BAND021 = .true. # 70-ds3 + +# WMAP +INCLUDE_BAND022 = .true. # K +INCLUDE_BAND023 = .true. # Ka +INCLUDE_BAND024 = .true. # Q1 +INCLUDE_BAND025 = .true. # Q2 +INCLUDE_BAND026 = .true. # V1 +INCLUDE_BAND027 = .true. # V2 +INCLUDE_BAND028 = .true. # W1 +INCLUDE_BAND029 = .true. # W2 +INCLUDE_BAND030 = .true. # W3 +INCLUDE_BAND031 = .true. # W4 + +# Haslam +INCLUDE_BAND032 = .true. # Haslam + + +# 857-2 +@START 001 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 857-2 +BAND_INSTRUMENT_LABEL&&& = 857-2 +BAND_UNIT&&& = MJy/sr +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_NOMINAL_FREQ&&& = 857. +BAND_MAPFILE&&& = map_dx11d_r2_zc_857-2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_857-2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_857-2.dat +@END 001 + +# 545-2 +@START 002 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 545-2 +BAND_INSTRUMENT_LABEL&&& = 545-2 +BAND_UNIT&&& = MJy/sr +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_NOMINAL_FREQ&&& = 545. +BAND_MAPFILE&&& = map_dx11d_r2_zc_545-2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_545-2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_545-2.dat +@END 002 + +# 545-4 +@START 003 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 545-4 +BAND_INSTRUMENT_LABEL&&& = 545-4 +BAND_UNIT&&& = MJy/sr +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_NOMINAL_FREQ&&& = 545. +BAND_MAPFILE&&& = map_dx11d_r2_zc_545-4_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_545-4_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_545-4.dat +@END 003 + +# 353-ds2 +@START 004 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 353-ds2 +BAND_INSTRUMENT_LABEL&&& = 353-ds2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 353. +BAND_MAPFILE&&& = map_dx11d_r2_zbpcg_353-ds2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_353-ds2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_353-ds2.dat +@END 004 + +# 353-1 +@START 005 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 353-1 +BAND_INSTRUMENT_LABEL&&& = 353-1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 353. +BAND_MAPFILE&&& = map_dx11d_r2_zc_353-1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_353-1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_353-1.dat +@END 005 + +# 217-1 +@START 006 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 217-1 +BAND_INSTRUMENT_LABEL&&& = 217-1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 217. +BAND_MAPFILE&&& = map_dx11d_r2_zc_217-1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_217-1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_217-1.dat +@END 006 + +# 217-2 +@START 007 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 217-2 +BAND_INSTRUMENT_LABEL&&& = 217-2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 217. +BAND_MAPFILE&&& = map_dx11d_r2_zc_217-2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_217-2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_217-2.dat +@END 007 + +# 217-3 +@START 008 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 217-3 +BAND_INSTRUMENT_LABEL&&& = 217-3 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 217. +BAND_MAPFILE&&& = map_dx11d_r2_zc_217-3_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_217-3_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_217-3.dat +@END 008 + +# 217-1 +@START 009 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 217-4 +BAND_INSTRUMENT_LABEL&&& = 217-4 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 217. +BAND_MAPFILE&&& = map_dx11d_r2_zc_217-4_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_217-4_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_217-4.dat +@END 009 + +# 143-ds1 +@START 010 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 143-ds1 +BAND_INSTRUMENT_LABEL&&& = 143-ds1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 143. +BAND_MAPFILE&&& = map_dx11d_r2_zbpcg_143-ds1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_143-ds1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_143-ds1.dat +@END 010 + +# 143-ds2 +@START 011 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 143-ds2 +BAND_INSTRUMENT_LABEL&&& = 143-ds2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 143. +BAND_MAPFILE&&& = map_dx11d_r2_zbpcg_143-ds2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_143-ds2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_143-ds2.dat +@END 011 + +# 143-5 +@START 012 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 143-5 +BAND_INSTRUMENT_LABEL&&& = 143-5 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 143. +BAND_MAPFILE&&& = map_dx11d_r2_zc_143-5_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_143-5_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_143-5.dat +@END 012 + +# 143-6 +@START 013 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 143-6 +BAND_INSTRUMENT_LABEL&&& = 143-6 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 143. +BAND_MAPFILE&&& = map_dx11d_r2_zc_143-6_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_143-6_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_143-6.dat +@END 013 + +# 143-7 +@START 014 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 143-7 +BAND_INSTRUMENT_LABEL&&& = 143-7 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 143. +BAND_MAPFILE&&& = map_dx11d_r2_zc_143-7_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_143-7_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_143-7.dat +@END 014 + +# 100-ds1 +@START 015 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 100-ds1 +BAND_INSTRUMENT_LABEL&&& = 100-ds1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 100. +BAND_MAPFILE&&& = map_dx11d_r2_zbpcg_100-ds1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_100-ds1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_100-ds1.dat +@END 015 + +# 100-ds2 +@START 016 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 100-ds2 +BAND_INSTRUMENT_LABEL&&& = 100-ds2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 100. +BAND_MAPFILE&&& = map_dx11d_r2_zbpcg_100-ds2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_100-ds2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_100-ds2.dat +@END 016 + +# 30 GHz +@START 017 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 030 +BAND_INSTRUMENT_LABEL&&& = 030 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = LFI +BAND_NOMINAL_FREQ&&& = 28.4 +BAND_MAPFILE&&& = map_dx11d_r2_nobpc_030_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_030_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_030.dat +@END 017 + +# 44 GHz +@START 018 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 044 +BAND_INSTRUMENT_LABEL&&& = 044 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = LFI +BAND_NOMINAL_FREQ&&& = 44.1 +BAND_MAPFILE&&& = map_dx11d_r2_nobpc_044_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_044_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_044.dat +@END 018 + +# 70-ds1 +@START 019 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 070-ds1 +BAND_INSTRUMENT_LABEL&&& = 070-ds1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = LFI +BAND_NOMINAL_FREQ&&& = 70.3 +BAND_MAPFILE&&& = map_dx11d_r2_nobpc_070-18_23_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_070-18_23_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v2_070-18_23.dat +@END 019 + +# 70-ds2 +@START 020 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 070-ds2 +BAND_INSTRUMENT_LABEL&&& = 070-ds2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = LFI +BAND_NOMINAL_FREQ&&& = 70.3 +BAND_MAPFILE&&& = map_dx11d_r2_nobpc_070-19_22_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_070-19_22_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v2_070-19_22.dat +@END 020 + +# 70-ds3 +@START 021 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 070-ds3 +BAND_INSTRUMENT_LABEL&&& = 070-ds3 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = LFI +BAND_NOMINAL_FREQ&&& = 70.3 +BAND_MAPFILE&&& = map_dx11d_r2_nobpc_070-20_21_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_070-20_21_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v2_070-20_21.dat +@END 021 + +# WMAP K +@START 022 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_K +BAND_INSTRUMENT_LABEL&&& = WMAP_K +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 22.8 +BAND_MAPFILE&&& = map_wmap9_K_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_K_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_K_v3.dat +@END 022 + +# WMAP Ka +@START 023 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_Ka +BAND_INSTRUMENT_LABEL&&& = WMAP_Ka +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 33.0 +BAND_MAPFILE&&& = map_wmap9_Ka_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_Ka_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_Ka_v3.dat +@END 023 + +# WMAP Q1 +@START 024 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_Q1 +BAND_INSTRUMENT_LABEL&&& = WMAP_Q1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 40.6 +BAND_MAPFILE&&& = map_wmap9_Q1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_Q1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_Q1_v3.dat +@END 024 + +# WMAP Q2 +@START 025 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_Q2 +BAND_INSTRUMENT_LABEL&&& = WMAP_Q2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 40.6 +BAND_MAPFILE&&& = map_wmap9_Q2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_Q2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_Q2_v3.dat +@END 025 + +# WMAP V1 +@START 026 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_V1 +BAND_INSTRUMENT_LABEL&&& = WMAP_V1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 60.8 +BAND_MAPFILE&&& = map_wmap9_V1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_V1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_V1_v3.dat +@END 026 + +# WMAP V2 +@START 027 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_V2 +BAND_INSTRUMENT_LABEL&&& = WMAP_V2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 60.8 +BAND_MAPFILE&&& = map_wmap9_V2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_V2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_V2_v3.dat +@END 027 + +# WMAP W1 +@START 028 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_W1 +BAND_INSTRUMENT_LABEL&&& = WMAP_W1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 93.5 +BAND_MAPFILE&&& = map_wmap9_W1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_W1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_W1_v3.dat +@END 028 + +# WMAP W2 +@START 029 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_W2 +BAND_INSTRUMENT_LABEL&&& = WMAP_W2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 93.5 +BAND_MAPFILE&&& = map_wmap9_W2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_W2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_W2_v3.dat +@END 029 + +# WMAP W3 +@START 030 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_W3 +BAND_INSTRUMENT_LABEL&&& = WMAP_W3 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 93.5 +BAND_MAPFILE&&& = map_wmap9_W3_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_W3_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_W3_v3.dat +@END 030 + +# WMAP W4 +@START 031 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_W4 +BAND_INSTRUMENT_LABEL&&& = WMAP_W4 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 93.5 +BAND_MAPFILE&&& = map_wmap9_W4_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_W4_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_W4_v3.dat +@END 031 + +# Haslam +@START 032 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = Haslam +BAND_INSTRUMENT_LABEL&&& = Haslam +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = delta +BAND_NOMINAL_FREQ&&& = 0.408 +BAND_MAPFILE&&& = map_haslam408_ds_Remazeilles2014_1deg_n256_uK_TQU.fits +BAND_NOISEFILE&&& = rms_haslam408_ds_Remazeilles2014_1deg_n256_uK_0.8K_1pct_TQU.fits +BAND_BANDPASSFILE&&& = haslam_bp.dat +@END 032 + + +############################################################## +# Model parameters # +############################################################## + +INSTRUMENT_PARAM_FILE = init_instpar_planck2015_v1.dat +INIT_INSTRUMENT_FROM_HDF = none + +NUM_SIGNAL_COMPONENTS = 13 +INCLUDE_COMP01 = .true. # CMB +INCLUDE_COMP02 = .true. # Relativistic CMB correction +INCLUDE_COMP03 = .true. # Dust +INCLUDE_COMP04 = .true. # Synch +INCLUDE_COMP05 = .true. # Free-free +INCLUDE_COMP06 = .true. # AME1 +INCLUDE_COMP07 = .true. # AME2 +INCLUDE_COMP08 = .true. # CO10 +INCLUDE_COMP09 = .true. # CO21 +INCLUDE_COMP10 = .true. # CO32 +INCLUDE_COMP11 = .false. # HCN +INCLUDE_COMP12 = .false. # SZ +INCLUDE_COMP13 = .true. # Monopole + +# CMB +@START 01 +@DEFAULT components/cmb/cmb_planck2015_1deg.defaults +COMP_AMP_INPUT_MAP&& = init_cmb_rc2_n256_v03.fits +COMP_MONOPOLE_PRIOR&& = none +@END 01 + +# CMB relativistic quadrupole correction +@START 02 +@DEFAULT components/cmb/cmb_relquad_planck2015_1deg.defaults +COMP_TEMPLATE_DEFINITION_FILE&& = cmb_relquad_planck2015_1deg.txt +@END 02 + +# Thermal dust component +@START 03 +@DEFAULT components/dust/dust_planck2015_1deg.defaults +COMP_NU_REF_T&& = 545 +COMP_NU_REF_P&& = 545 +COMP_INDMASK&& = fullsky +COMP_AMP_INPUT_MAP&& = init_dust_rc2_n256_v03.fits +COMP_BETA_INPUT_MAP&& = init_dust_beta_rc2_n256_v03.fits +COMP_T_INPUT_MAP&& = init_dust_Td_rc2_n256_v03.fits +COMP_BETA_SMOOTHING_SCALE&& = 0 +COMP_AMP_LMAX&& = 750 +@DEFAULT components/dust/dust_LFI_localsampler.defaults +# New Local sampling parameters, 'dust' +COMP_IND_LMAX&& = 750 +COMP_BETA_DEFAULT&& = 1.50 +COMP_T_DEFAULT&& = 19.5 +COMP_BETA_COMBINED_MONOPOLE_SAMPLING&& = .false. +COMP_BETA_ALMSAMP_INIT&& = none +COMP_BETA_MASK&& = fullsky +COMP_INIT_FROM_HDF&& = default +COMP_BETA_INT_LNLTYPE&& = prior chisq +COMP_BETA_INT_LMAX&& = -1 +COMP_BETA_INT_PIXREG&& = pixreg +COMP_BETA_POL_LNLTYPE&& = prior +COMP_BETA_INT_PRIOR_MEAN&& = 1.50 +COMP_BETA_POL_PRIOR_MEAN&& = 1.50 +COMP_BETA_POL_PRIOR_RMS&& = 0.03 0.03 +COMP_BETA_INT_PRIOR_RMS&& = 0.03 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.05 +COMP_BETA_POL_LMAX&& = -1 +COMP_CL_DEFAULT_AMP_T&& = 1e4 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 100 +COMP_CL_DEFAULT_AMP_B&& = 100 +COMP_CL_DEFAULT_BETA_T&& = 14.d0 +COMP_CL_DEFAULT_BETA_E&& = 14.d0 +COMP_CL_DEFAULT_BETA_B&& = 14.d0 +@END 03 + +# Synchrotron component +@START 04 +@DEFAULT components/synch/synch_planck2015_1deg.defaults +COMP_LABEL&& = synch +COMP_TYPE&& = spindust +COMP_NU_REF_T&& = 0.408 +COMP_NU_P_INPUT_MAP&& = init_synch_nup_rc2_n256_v03.fits +COMP_SED_TEMPLATE&& = Synchrotron_template_GHz_extended.txt +COMP_AMP_INPUT_MAP&& = init_synch_rc2_n256_v03.fits +COMP_INIT_FROM_HDF&& = none +@END 04 + +# freefree component --------------------------------------------------------------------- +@START 05 +@DEFAULT components/freefree/freefree_planck2015_1deg.defaults +@DEFAULT components/freefree/freefree_planck2015_1deg_localsampler.defaults +COMP_EM_INPUT_MAP&& = init_ff_EM_rc2_n256_v03.fits +COMP_T_E_INPUT_MAP&& = init_ff_T_e_rc2_n256_v03.fits +@END 05 + +# AME1 component ------------------------------------------------------------------ +@START 06 +@DEFAULT components/ame/ame_planck2015_1deg.defaults +COMP_LABEL&& = ame1 +COMP_TYPE&& = spindust +COMP_NU_REF_T&& = 22.8 +COMP_NU_P_INPUT_MAP&& = init_ame1_nup_rc2_n256_v03.fits +COMP_SED_TEMPLATE&& = spdust2_cnm.dat +COMP_AMP_INPUT_MAP&& = init_ame1_rc2_n256_v03.fits +COMP_INIT_FROM_HDF&& = none +@END 06 + +# AME1 component ------------------------------------------------------------------ +@START 07 +@DEFAULT components/ame/ame_planck2015_1deg.defaults +COMP_LABEL&& = ame2 +COMP_TYPE&& = spindust +COMP_NU_REF_T&& = 41 +COMP_NU_P_INPUT_MAP&& = init_ame2_nup_rc2_n256_v03.fits +COMP_SED_TEMPLATE&& = spdust2_cnm.dat +COMP_AMP_INPUT_MAP&& = init_ame2_rc2_n256_v03.fits +COMP_INIT_FROM_HDF&& = none +@END 07 + + +# CO10 line emission +@START 08 +@DEFAULT components/co/co_planck2015_1deg.defaults +COMP_LABEL&& = co100 +COMP_NU_REF_T&& = 115.27 +COMP_BAND_REF&& = 100-ds1 +COMP_LINE_TEMPLATE&& = co100_line_template_planck2015_1deg_v1.dat +COMP_AMP_INPUT_MAP&& = init_co10_rc2_n256_v03.fits +@END 08 + +# CO21 line emission +@START 09 +@DEFAULT components/co/co_planck2015_1deg.defaults +COMP_LABEL&& = co217 +COMP_NU_REF_T&& = 230.54 +COMP_BAND_REF&& = 217-1 +COMP_LINE_TEMPLATE&& = co217_line_template_planck2015_1deg_v1.dat +COMP_AMP_INPUT_MAP&& = init_co21_rc2_n256_v03.fits +@END 09 + +# CO32 line emission +@START 10 +@DEFAULT components/co/co_planck2015_1deg.defaults +COMP_LABEL&& = co353 +COMP_NU_REF_T&& = 345.81 +COMP_BAND_REF&& = 353-ds2 +COMP_LINE_TEMPLATE&& = co353_line_template_planck2015_1deg_v1.dat +COMP_AMP_INPUT_MAP&& = init_co32_rc2_n256_v03.fits +@END 10 + +# HCN line emission +@START 11 +@DEFAULT components/co/co_planck2015_1deg.defaults +COMP_LABEL&& = hcn +COMP_NU_REF_T&& = 88.6 +COMP_BAND_REF&& = 100-ds1 +COMP_LINE_TEMPLATE&& = /mn/stornext/d5/data/metins/dirbe/data/hcn_line_template_DIRBE_v1.dat +COMP_AMP_INPUT_MAP&& = lambda_wco_dht2001_n2048.fits +@END 11 + +# SZ placeholder -- not implemented yet +@START 12 +@DEFAULT components/cmb/cmb_planck2015_1deg.defaults +COMP_LABEL&& = sz +COMP_AMP_INPUT_MAP&& = init_cmb_rc2_n256_v03.fits +COMP_MONOPOLE_PRIOR&& = none +@END 12 + +# Mono- and dipole component +@START 13 +@DEFAULT components/monodipole/md_LFI.defaults +COMP_MD_MONO_FROM_PRIORS&& = none +COMP_MD_DEFINITION_FILE&& = init_md_planck2015_1deg.dat +COMP_INIT_FROM_HDF&& = none +@END 13 + + + + + + + + + +NUM_CG_SAMPLING_GROUPS = 2 +NUM_MCMC_SAMPLING_GROUPS = 0 + +@START 01 +CG_SAMPLING_GROUP&& = cmb,ff,ame,synch,dust +CG_SAMPLING_GROUP_MASK&& = fullsky +CG_SAMPLING_GROUP_MAXITER&& = 60 +CG_SAMPLING_GROUP_BANDS&& = all +@END 01 + +@START 02 +CG_SAMPLING_GROUP&& = md +CG_SAMPLING_GROUP_MASK&& = mask_chisq_15band_n256_v2_ptsrc.fits +CG_SAMPLING_GROUP_MAXITER&& = 7 +CG_SAMPLING_GROUP_BANDS&& = all +@END 02 + + + +NUM_SMOOTHING_SCALES = 1 +SMOOTHING_SCALE_FWHM01 = 60. # Arcmin; 0 = native resolution +SMOOTHING_SCALE_LMAX01 = 750 +SMOOTHING_SCALE_NSIDE01 = 256 # Must match NSIDE of component it is used for +SMOOTHING_SCALE_PIXWIN01 = pixel_window_n0256.fits +SMOOTHING_SCALE_FWHM_POSTPROC01 = 60. # Smoothing FWHM after pixel-by-pixel fit diff --git a/commander3/parameter_files/param_continuous_integration.txt b/commander3/parameter_files/param_continuous_integration.txt new file mode 100644 index 000000000..9cdf849ce --- /dev/null +++ b/commander3/parameter_files/param_continuous_integration.txt @@ -0,0 +1,960 @@ +************************************************************** +* Commander parameter file * +************************************************************** +@DEFAULT planck2015_1deg.defaults + +OPERATION = sample # {sample,optimize} +#OPERATION = optimize # {sample,optimize} +VERBOSITY = 3 # [0,...,3] + +############################################################## +# Algorithm specification # +############################################################## + +# Monte Carlo options +NUMCHAIN = 1 # Number of independent chains +NUM_GIBBS_ITER = 1 # Length of each Markov chain +CHAIN_STATUS = new +NUM_INIT_CHAINS = 1 + +INIT_CHAIN01 = none + +OUTPUT_MIXING_MATRIX = .false. +OUTPUT_INPUT_MODEL = .false. +OUTPUT_SIGNALS_PER_BAND = .false. +NSIDE_CHISQ = 256 + +ENABLE_TOD_ANALYSIS = .true. +TOD_INCLUDE_ZODI = .true. +SAMPLE_ZODI = .false. + +SAMPLE_SOLAR_MAPS = .true. +SAMPLE_MOON_MAPS = .true. +SAMPLE_EARTH_MAPS = .true. # Only as a function of elongation + + +############################################################## +# Output options # +############################################################## + +OUTPUT_DIRECTORY = chains + +############################################################## +# Data sets # +############################################################## + +DATA_DIRECTORY = /mn/stornext/d23/cmbco/cg/dirbe/data +NUMBAND = 33 + +# HFI +INCLUDE_BAND001 = .true. # 857-2 +INCLUDE_BAND002 = .true. # 545-2 +INCLUDE_BAND003 = .true. # 545-4 +INCLUDE_BAND004 = .true. # 353-ds2 +INCLUDE_BAND005 = .true. # 353-1 +INCLUDE_BAND006 = .true. # 217-1 +INCLUDE_BAND007 = .true. # 217-2 +INCLUDE_BAND008 = .true. # 217-3 +INCLUDE_BAND009 = .true. # 217-4 +INCLUDE_BAND010 = .true. # 143-ds1 +INCLUDE_BAND011 = .true. # 143-ds2 +INCLUDE_BAND012 = .true. # 143-5 +INCLUDE_BAND013 = .true. # 143-6 +INCLUDE_BAND014 = .true. # 143-7 +INCLUDE_BAND015 = .true. # 100-ds1 +INCLUDE_BAND016 = .true. # 100-ds2 + +# LFI +INCLUDE_BAND017 = .true. # 30 GHz +INCLUDE_BAND018 = .true. # 44 GHz +INCLUDE_BAND019 = .true. # 70-ds1 +INCLUDE_BAND020 = .true. # 70-ds2 +INCLUDE_BAND021 = .true. # 70-ds3 + +# WMAP +INCLUDE_BAND022 = .true. # K +INCLUDE_BAND023 = .true. # Ka +INCLUDE_BAND024 = .true. # Q1 +INCLUDE_BAND025 = .true. # Q2 +INCLUDE_BAND026 = .true. # V1 +INCLUDE_BAND027 = .true. # V2 +INCLUDE_BAND028 = .true. # W1 +INCLUDE_BAND029 = .true. # W2 +INCLUDE_BAND030 = .true. # W3 +INCLUDE_BAND031 = .true. # W4 + +# Haslam +INCLUDE_BAND032 = .true. # Haslam + +# DIRBE +INCLUDE_BAND033 = .true. # 240 micron T 10 first half + +# 857-2 +@START 001 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 857-2 +BAND_INSTRUMENT_LABEL&&& = 857-2 +BAND_UNIT&&& = MJy/sr +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_NOMINAL_FREQ&&& = 857. +BAND_MAPFILE&&& = map_dx11d_r2_zc_857-2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_857-2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_857-2.dat +@END 001 + +# 545-2 +@START 002 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 545-2 +BAND_INSTRUMENT_LABEL&&& = 545-2 +BAND_UNIT&&& = MJy/sr +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_NOMINAL_FREQ&&& = 545. +BAND_MAPFILE&&& = map_dx11d_r2_zc_545-2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_545-2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_545-2.dat +@END 002 + +# 545-4 +@START 003 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 545-4 +BAND_INSTRUMENT_LABEL&&& = 545-4 +BAND_UNIT&&& = MJy/sr +BAND_BANDPASS_TYPE&&& = HFI_submm +BAND_NOMINAL_FREQ&&& = 545. +BAND_MAPFILE&&& = map_dx11d_r2_zc_545-4_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_545-4_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_545-4.dat +@END 003 + +# 353-ds2 +@START 004 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 353-ds2 +BAND_INSTRUMENT_LABEL&&& = 353-ds2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 353. +BAND_MAPFILE&&& = map_dx11d_r2_zbpcg_353-ds2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_353-ds2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_353-ds2.dat +@END 004 + +# 353-1 +@START 005 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 353-1 +BAND_INSTRUMENT_LABEL&&& = 353-1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 353. +BAND_MAPFILE&&& = map_dx11d_r2_zc_353-1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_353-1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_353-1.dat +@END 005 + +# 217-1 +@START 006 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 217-1 +BAND_INSTRUMENT_LABEL&&& = 217-1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 217. +BAND_MAPFILE&&& = map_dx11d_r2_zc_217-1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_217-1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_217-1.dat +@END 006 + +# 217-2 +@START 007 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 217-2 +BAND_INSTRUMENT_LABEL&&& = 217-2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 217. +BAND_MAPFILE&&& = map_dx11d_r2_zc_217-2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_217-2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_217-2.dat +@END 007 + +# 217-3 +@START 008 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 217-3 +BAND_INSTRUMENT_LABEL&&& = 217-3 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 217. +BAND_MAPFILE&&& = map_dx11d_r2_zc_217-3_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_217-3_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_217-3.dat +@END 008 + +# 217-1 +@START 009 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 217-4 +BAND_INSTRUMENT_LABEL&&& = 217-4 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 217. +BAND_MAPFILE&&& = map_dx11d_r2_zc_217-4_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_217-4_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_217-4.dat +@END 009 + +# 143-ds1 +@START 010 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 143-ds1 +BAND_INSTRUMENT_LABEL&&& = 143-ds1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 143. +BAND_MAPFILE&&& = map_dx11d_r2_zbpcg_143-ds1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_143-ds1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_143-ds1.dat +@END 010 + +# 143-ds2 +@START 011 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 143-ds2 +BAND_INSTRUMENT_LABEL&&& = 143-ds2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 143. +BAND_MAPFILE&&& = map_dx11d_r2_zbpcg_143-ds2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_143-ds2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_143-ds2.dat +@END 011 + +# 143-5 +@START 012 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 143-5 +BAND_INSTRUMENT_LABEL&&& = 143-5 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 143. +BAND_MAPFILE&&& = map_dx11d_r2_zc_143-5_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_143-5_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_143-5.dat +@END 012 + +# 143-6 +@START 013 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 143-6 +BAND_INSTRUMENT_LABEL&&& = 143-6 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 143. +BAND_MAPFILE&&& = map_dx11d_r2_zc_143-6_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_143-6_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_143-6.dat +@END 013 + +# 143-7 +@START 014 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 143-7 +BAND_INSTRUMENT_LABEL&&& = 143-7 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 143. +BAND_MAPFILE&&& = map_dx11d_r2_zc_143-7_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_143-7_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_143-7.dat +@END 014 + +# 100-ds1 +@START 015 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 100-ds1 +BAND_INSTRUMENT_LABEL&&& = 100-ds1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 100. +BAND_MAPFILE&&& = map_dx11d_r2_zbpcg_100-ds1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_100-ds1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_100-ds1.dat +@END 015 + +# 100-ds2 +@START 016 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 100-ds2 +BAND_INSTRUMENT_LABEL&&& = 100-ds2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = HFI_cmb +BAND_NOMINAL_FREQ&&& = 100. +BAND_MAPFILE&&& = map_dx11d_r2_zbpcg_100-ds2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_100-ds2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v307_100-ds2.dat +@END 016 + +# 30 GHz +@START 017 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 030 +BAND_INSTRUMENT_LABEL&&& = 030 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = LFI +BAND_NOMINAL_FREQ&&& = 28.4 +BAND_MAPFILE&&& = map_dx11d_r2_nobpc_030_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_030_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_030.dat +@END 017 + +# 44 GHz +@START 018 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 044 +BAND_INSTRUMENT_LABEL&&& = 044 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = LFI +BAND_NOMINAL_FREQ&&& = 44.1 +BAND_MAPFILE&&& = map_dx11d_r2_nobpc_044_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_044_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_044.dat +@END 018 + +# 70-ds1 +@START 019 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 070-ds1 +BAND_INSTRUMENT_LABEL&&& = 070-ds1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = LFI +BAND_NOMINAL_FREQ&&& = 70.3 +BAND_MAPFILE&&& = map_dx11d_r2_nobpc_070-18_23_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_070-18_23_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v2_070-18_23.dat +@END 019 + +# 70-ds2 +@START 020 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 070-ds2 +BAND_INSTRUMENT_LABEL&&& = 070-ds2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = LFI +BAND_NOMINAL_FREQ&&& = 70.3 +BAND_MAPFILE&&& = map_dx11d_r2_nobpc_070-19_22_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_070-19_22_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v2_070-19_22.dat +@END 020 + +# 70-ds3 +@START 021 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = 070-ds3 +BAND_INSTRUMENT_LABEL&&& = 070-ds3 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = LFI +BAND_NOMINAL_FREQ&&& = 70.3 +BAND_MAPFILE&&& = map_dx11d_r2_nobpc_070-20_21_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_dx11d_r2_resc_070-20_21_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_dx11d_v2_070-20_21.dat +@END 021 + +# WMAP K +@START 022 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_K +BAND_INSTRUMENT_LABEL&&& = WMAP_K +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 22.8 +BAND_MAPFILE&&& = map_wmap9_K_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_K_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_K_v3.dat +@END 022 + +# WMAP Ka +@START 023 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_Ka +BAND_INSTRUMENT_LABEL&&& = WMAP_Ka +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 33.0 +BAND_MAPFILE&&& = map_wmap9_Ka_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_Ka_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_Ka_v3.dat +@END 023 + +# WMAP Q1 +@START 024 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_Q1 +BAND_INSTRUMENT_LABEL&&& = WMAP_Q1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 40.6 +BAND_MAPFILE&&& = map_wmap9_Q1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_Q1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_Q1_v3.dat +@END 024 + +# WMAP Q2 +@START 025 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_Q2 +BAND_INSTRUMENT_LABEL&&& = WMAP_Q2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 40.6 +BAND_MAPFILE&&& = map_wmap9_Q2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_Q2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_Q2_v3.dat +@END 025 + +# WMAP V1 +@START 026 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_V1 +BAND_INSTRUMENT_LABEL&&& = WMAP_V1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 60.8 +BAND_MAPFILE&&& = map_wmap9_V1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_V1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_V1_v3.dat +@END 026 + +# WMAP V2 +@START 027 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_V2 +BAND_INSTRUMENT_LABEL&&& = WMAP_V2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 60.8 +BAND_MAPFILE&&& = map_wmap9_V2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_V2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_V2_v3.dat +@END 027 + +# WMAP W1 +@START 028 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_W1 +BAND_INSTRUMENT_LABEL&&& = WMAP_W1 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 93.5 +BAND_MAPFILE&&& = map_wmap9_W1_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_W1_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_W1_v3.dat +@END 028 + +# WMAP W2 +@START 029 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_W2 +BAND_INSTRUMENT_LABEL&&& = WMAP_W2 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 93.5 +BAND_MAPFILE&&& = map_wmap9_W2_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_W2_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_W2_v3.dat +@END 029 + +# WMAP W3 +@START 030 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_W3 +BAND_INSTRUMENT_LABEL&&& = WMAP_W3 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 93.5 +BAND_MAPFILE&&& = map_wmap9_W3_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_W3_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_W3_v3.dat +@END 030 + +# WMAP W4 +@START 031 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = WMAP_W4 +BAND_INSTRUMENT_LABEL&&& = WMAP_W4 +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = WMAP +BAND_NOMINAL_FREQ&&& = 93.5 +BAND_MAPFILE&&& = map_wmap9_W4_0256_60arcmin_full.fits +BAND_NOISEFILE&&& = rms_wmap9_W4_0256_60arcmin_full.fits +BAND_BANDPASSFILE&&& = bp_wmap9_W4_v3.dat +@END 031 + +# Haslam +@START 032 +@DEFAULT bands/planck2015_1deg.defaults +BAND_LABEL&&& = Haslam +BAND_INSTRUMENT_LABEL&&& = Haslam +BAND_UNIT&&& = uK_cmb +BAND_BANDPASS_TYPE&&& = delta +BAND_NOMINAL_FREQ&&& = 0.408 +BAND_MAPFILE&&& = map_haslam408_ds_Remazeilles2014_1deg_n256_uK_TQU.fits +BAND_NOISEFILE&&& = rms_haslam408_ds_Remazeilles2014_1deg_n256_uK_0.8K_1pct_TQU.fits +BAND_BANDPASSFILE&&& = haslam_bp.dat +@END 032 + +# DIRBE +@START 033 +@DEFAULT bands/DIRBE/DIRBE_10_CIO_512.defaults +BAND_LABEL&&& = 10a +BAND_MAPFILE&&& = DIRBE_10a_512_prod_v1.fits +BAND_NOISEFILE&&& = DIRBE_10a_SIGMA_512_prod_v1.fits +BAND_TOD_FILELIST&&& = filelist_DIRBE_10_nside512_V22a.txt +BAND_SAMP_GAIN&&& = .false. +BAND_TOD_TYPE&&& = DIRBE +BAND_TOD_SOLAR_CENTRIC_MODEL&&& = none +BAND_TOD_SOLAR_CENTRIC_MASK&&& = none +BAND_TOD_SOLAR_CENTRIC_INITMAP&&& = none +BAND_TOD_MOON_CENTRIC_MODEL&&& = none +BAND_TOD_MOON_CENTRIC_MASK&&& = none +BAND_TOD_MOON_CENTRIC_INITMAP&&& = none +BAND_TOD_EARTH_CENTRIC_MODEL&&& = none +BAND_TOD_EARTH_CENTRIC_MASK&&& = none +BAND_TOD_EARTH_CENTRIC_INITMAP&&& = none +#BAND_TOD_START_SCANID&&& = 8 31 +#BAND_TOD_END_SCANID&&& = 285 +BAND_TOD_START_SCANID&&& = 1 +BAND_TOD_END_SCANID&&& = 285 +BAND_TOD_MAIN_PROCMASK&&& = mask_dust_galecl15_v3.fits +BAND_TOD_ZODI_MASK&&& = mask_dust_gal15_v3.fits +BAND_TOD_INIT_FROM_HDF&&& = default none +@END 033 + +############################################################## +# Model parameters # +############################################################## + +INSTRUMENT_PARAM_FILE = init_instpar_planck2015_v1.dat +INIT_INSTRUMENT_FROM_HDF = none + +NUM_SIGNAL_COMPONENTS = 13 +INCLUDE_COMP01 = .true. # CMB +INCLUDE_COMP02 = .true. # Relativistic CMB correction +INCLUDE_COMP03 = .true. # Dust +INCLUDE_COMP04 = .true. # Synch +INCLUDE_COMP05 = .true. # Free-free +INCLUDE_COMP06 = .true. # AME1 +INCLUDE_COMP07 = .true. # AME2 +INCLUDE_COMP08 = .true. # CO10 +INCLUDE_COMP09 = .true. # CO21 +INCLUDE_COMP10 = .true. # CO32 +INCLUDE_COMP11 = .false. # HCN +INCLUDE_COMP12 = .false. # SZ +INCLUDE_COMP13 = .true. # Monopole + +# CMB +@START 01 +@DEFAULT components/cmb/cmb_planck2015_1deg.defaults +COMP_AMP_INPUT_MAP&& = init_cmb_rc2_n256_v03.fits +COMP_MONOPOLE_PRIOR&& = none +@END 01 + +# CMB relativistic quadrupole correction +@START 02 +@DEFAULT components/cmb/cmb_relquad_planck2015_1deg.defaults +COMP_TEMPLATE_DEFINITION_FILE&& = cmb_relquad_ci.txt +@END 02 + +# Thermal dust component +@START 03 +@DEFAULT components/dust/dust_planck2015_1deg.defaults +COMP_NU_REF_T&& = 545 +COMP_NU_REF_P&& = 545 +COMP_INDMASK&& = fullsky +COMP_AMP_INPUT_MAP&& = init_dust_rc2_n256_v03.fits +COMP_BETA_INPUT_MAP&& = init_dust_beta_rc2_n256_v03.fits +COMP_T_INPUT_MAP&& = init_dust_Td_rc2_n256_v03.fits +COMP_BETA_SMOOTHING_SCALE&& = 0 +COMP_AMP_LMAX&& = 750 +@DEFAULT components/dust/dust_LFI_localsampler.defaults +# New Local sampling parameters, 'dust' +COMP_IND_LMAX&& = 750 +COMP_BETA_DEFAULT&& = 1.50 +COMP_T_DEFAULT&& = 19.5 +COMP_BETA_COMBINED_MONOPOLE_SAMPLING&& = .false. +COMP_BETA_ALMSAMP_INIT&& = none +COMP_BETA_MASK&& = fullsky +COMP_INIT_FROM_HDF&& = default +COMP_BETA_INT_LNLTYPE&& = prior chisq +COMP_BETA_INT_LMAX&& = -1 +COMP_BETA_INT_PIXREG&& = pixreg +COMP_BETA_POL_LNLTYPE&& = prior +COMP_BETA_INT_PRIOR_MEAN&& = 1.50 +COMP_BETA_POL_PRIOR_MEAN&& = 1.50 +COMP_BETA_POL_PRIOR_RMS&& = 0.03 0.03 +COMP_BETA_INT_PRIOR_RMS&& = 0.03 +COMP_BETA_PRIOR_GAUSS_RMS&& = 0.05 +COMP_BETA_POL_LMAX&& = -1 +COMP_CL_DEFAULT_AMP_T&& = 1e4 # D_l = amp * (l/lpivot)**beta +COMP_CL_DEFAULT_AMP_E&& = 100 +COMP_CL_DEFAULT_AMP_B&& = 100 +COMP_CL_DEFAULT_BETA_T&& = 14.d0 +COMP_CL_DEFAULT_BETA_E&& = 14.d0 +COMP_CL_DEFAULT_BETA_B&& = 14.d0 +@END 03 + +# Synchrotron component +@START 04 +@DEFAULT components/synch/synch_planck2015_1deg.defaults +COMP_LABEL&& = synch +COMP_TYPE&& = spindust +COMP_NU_REF_T&& = 0.408 +COMP_NU_P_INPUT_MAP&& = init_synch_nup_rc2_n256_v03.fits +COMP_SED_TEMPLATE&& = Synchrotron_template_GHz_extended.txt +COMP_AMP_INPUT_MAP&& = init_synch_rc2_n256_v03.fits +COMP_INIT_FROM_HDF&& = none +@END 04 + +# freefree component --------------------------------------------------------------------- +@START 05 +@DEFAULT components/freefree/freefree_planck2015_1deg.defaults +@DEFAULT components/freefree/freefree_planck2015_1deg_localsampler.defaults +COMP_EM_INPUT_MAP&& = init_ff_EM_rc2_n256_v03.fits +COMP_T_E_INPUT_MAP&& = init_ff_T_e_rc2_n256_v03.fits +@END 05 + +# AME1 component ------------------------------------------------------------------ +@START 06 +@DEFAULT components/ame/ame_planck2015_1deg.defaults +COMP_LABEL&& = ame1 +COMP_TYPE&& = spindust +COMP_NU_REF_T&& = 22.8 +COMP_NU_P_INPUT_MAP&& = init_ame1_nup_rc2_n256_v03.fits +COMP_SED_TEMPLATE&& = spdust2_cnm.dat +COMP_AMP_INPUT_MAP&& = init_ame1_rc2_n256_v03.fits +COMP_INIT_FROM_HDF&& = none +@END 06 + +# AME1 component ------------------------------------------------------------------ +@START 07 +@DEFAULT components/ame/ame_planck2015_1deg.defaults +COMP_LABEL&& = ame2 +COMP_TYPE&& = spindust +COMP_NU_REF_T&& = 41 +COMP_NU_P_INPUT_MAP&& = init_ame2_nup_rc2_n256_v03.fits +COMP_SED_TEMPLATE&& = spdust2_cnm.dat +COMP_AMP_INPUT_MAP&& = init_ame2_rc2_n256_v03.fits +COMP_INIT_FROM_HDF&& = none +@END 07 + + +# CO10 line emission +@START 08 +@DEFAULT components/co/co_planck2015_1deg.defaults +COMP_LABEL&& = co100 +COMP_NU_REF_T&& = 115.27 +COMP_BAND_REF&& = 100-ds1 +COMP_LINE_TEMPLATE&& = co100_line_template_planck2015_1deg_v1.dat +COMP_AMP_INPUT_MAP&& = init_co10_rc2_n256_v03.fits +@END 08 + +# CO21 line emission +@START 09 +@DEFAULT components/co/co_planck2015_1deg.defaults +COMP_LABEL&& = co217 +COMP_NU_REF_T&& = 230.54 +COMP_BAND_REF&& = 217-1 +COMP_LINE_TEMPLATE&& = co217_line_template_planck2015_1deg_v1.dat +COMP_AMP_INPUT_MAP&& = init_co21_rc2_n256_v03.fits +@END 09 + +# CO32 line emission +@START 10 +@DEFAULT components/co/co_planck2015_1deg.defaults +COMP_LABEL&& = co353 +COMP_NU_REF_T&& = 345.81 +COMP_BAND_REF&& = 353-ds2 +COMP_LINE_TEMPLATE&& = co353_line_template_planck2015_1deg_v1.dat +COMP_AMP_INPUT_MAP&& = init_co32_rc2_n256_v03.fits +@END 10 + +# HCN line emission +@START 11 +@DEFAULT components/co/co_planck2015_1deg.defaults +COMP_LABEL&& = hcn +COMP_NU_REF_T&& = 88.6 +COMP_BAND_REF&& = 100-ds1 +COMP_LINE_TEMPLATE&& = /mn/stornext/d5/data/metins/dirbe/data/hcn_line_template_DIRBE_v1.dat +COMP_AMP_INPUT_MAP&& = lambda_wco_dht2001_n2048.fits +@END 11 + +# SZ placeholder -- not implemented yet +@START 12 +@DEFAULT components/cmb/cmb_planck2015_1deg.defaults +COMP_LABEL&& = sz +COMP_AMP_INPUT_MAP&& = init_cmb_rc2_n256_v03.fits +COMP_MONOPOLE_PRIOR&& = none +@END 12 + +# Mono- and dipole component +@START 13 +@DEFAULT components/monodipole/md_LFI.defaults +COMP_MD_MONO_FROM_PRIORS&& = none +COMP_MD_DEFINITION_FILE&& = init_md_ci.dat +COMP_INIT_FROM_HDF&& = none +@END 13 + + + + + + + + + +NUM_CG_SAMPLING_GROUPS = 2 +NUM_MCMC_SAMPLING_GROUPS = 0 + + +@START 01 +CG_SAMPLING_GROUP&& = co100,co217,co353 +CG_SAMPLING_GROUP_MASK&& = fullsky +CG_SAMPLING_GROUP_MAXITER&& = 60 +CG_SAMPLING_GROUP_BANDS&& = all +@END 01 + +@START 02 +CG_SAMPLING_GROUP&& = cmb,ff,ame,synch,dust +CG_SAMPLING_GROUP_MASK&& = fullsky +CG_SAMPLING_GROUP_MAXITER&& = 60 +CG_SAMPLING_GROUP_BANDS&& = all + +@END 02 + +#@START 02 +#CG_SAMPLING_GROUP&& = md +#CG_SAMPLING_GROUP_MASK&& = mask_chisq_15band_n256_v2_ptsrc.fits +#CG_SAMPLING_GROUP_MAXITER&& = 7 +#CG_SAMPLING_GROUP_BANDS&& = all +#@END 02 + + + +NUM_SMOOTHING_SCALES = 1 +SMOOTHING_SCALE_FWHM01 = 60. # Arcmin; 0 = native resolution +SMOOTHING_SCALE_LMAX01 = 750 +SMOOTHING_SCALE_NSIDE01 = 256 # Must match NSIDE of component it is used for +SMOOTHING_SCALE_PIXWIN01 = pixel_window_n0256.fits +SMOOTHING_SCALE_FWHM_POSTPROC01 = 60. # Smoothing FWHM after pixel-by-pixel fit + + + +# ------------------------------------------------------------------ +# ZODI +# ------------------------------------------------------------------ +@DEFAULT components/zodi/sampling.defaults +@DEFAULT components/zodi/components.defaults + +# HYPER PARAMETERS +# ------------------------------------------------------------------ +ZODI_DELTA_T_RESET = 1 +ZODI_INIT_CHAIN = none /mn/stornext/d5/data/metins/dirbe/data/zodi_init_chain_test.h5:0 +ZODI_N_LOS_STEP = 15 +ZODI_OUTPUT_COMP_MAPS = .false. + + +# ------------------------------------------------------------------ +# ZODI +# ------------------------------------------------------------------ +@DEFAULT components/zodi/sampling.defaults +@DEFAULT components/zodi/components.defaults + +# HYPER PARAMETERS +# ------------------------------------------------------------------ +ZODI_DELTA_T_RESET = 0.1 +ZODI_TOD_THINNING_FACTOR = 0.005 # Fraction of TOD samples to include in fitting +ZODI_TOD_THINNING_THRESHOLD = 8 # Only neglect samples with lower deviation than this (in sigma) +ZODI_OUTPUT_COMP_MAPS = .false. +ZODI_OUTPUT_ASCII = .true. +ZODI_OPERATION = powell # {sample,powell} +ZODI_INIT_FROM_ASCII = /mn/stornext/d23/cmbco/cg/dirbe/data/init_zodi_dirbe_prod_v16.dat +ZODI_RMS_RANDOMIZE_BETWEEN_STEPS = 0.3 +ZODI_SAMP_METHOD = powell +ZODI_REFERENCE_BAND = 05a +ZODI_GLOBAL_EMISSIVITY_COMPONENT = none cloud +ZODI_GLOBAL_ALBEDO_COMPONENT = cloud +ZODI_JOINT_MONOPOLE_SAMPLING = .false. +ZODI_MIN_SOLAR_ELONGATION = 90 68 +ZODI_MAX_SOLAR_ELONGATION = 120 +ZODI_OUTPUT_TOD_RESIDUALS = .false. +ZODI_USE_SOLAR_CENTRIC_COMP = .true. +ZODI_STATIC_COMP_NSIDE = 512 +ZODI_STATIC_COMP_INITMAP = init_zodi_static_v18.fits +ZODI_STATIC_MAP_BANDS = 05a,05b + +# Only emissivity wires support right now +#ZODI_PARAMETER_WIRING = band1:em@03a>cloud:em@03a,band1:em@03b>cloud:em@03b,band2:em>band1:em,band3:em>band1:em,ring:em@03a>cloud:em@03a,ring:em@03b>cloud:em@03b,feature:em>ring:em +#ZODI_PARAMETER_WIRING = band2:em>band1:em,band3:em>band1:em,feature:em>ring:em +ZODI_PARAMETER_WIRING = band2:em>band1:em,band3:em>band1:em + +# COMPONENTS +# ------------------------------------------------------------------ +NUM_ZODI_COMPS = 7 + +! PARAMETER VALUE FORMAT: comma separated list of values and priors +! valid examples: ZODI_T_0 = 286.0 (no prior) +! ZODI_T_0 = 286.0,none,1,uniform (interprets the prior as a uniform prior smaller than 1) +! ZODI_T_0 = 286.0,0,none,uniform (interprets the prior as a uniform prior greater than 0) +! ZODI_T_0 = 286.0,0,1,uniform (interprets the prior as a uniform prior between 0 and 1) +! ZODI_T_0 = 286.0,3,0.4,gauss (interprets the prior as a gaussian with mean 3 and sigma 0.4) +ZODI_T_0 = 286.0 +ZODI_T_DELTA = 0.4668626 + +@START 01 +ZODI_COMP_TYPE&& = cloud +ZODI_COMP_LABEL&& = cloud +ZODI_COMP_INCLUDE&& = .true. +ZODI_COMP_N_LOS_STEP&& = 50 +ZODI_COMP_R_MIN&& = 0.0 +ZODI_COMP_R_MAX&& = 5.2 + +ZODI_COMP_N_0&& = 1.1344373881427960d-07 +ZODI_COMP_X_0&& = 0.011887800744346281 +ZODI_COMP_Y_0&& = 0.0054765064662263777 +ZODI_COMP_Z_0&& = -0.0021530908020710744 +ZODI_COMP_I&& = 2.0335188072390769 +ZODI_COMP_OMEGA&& = 77.657955554097114 +ZODI_COMP_ALPHA&& = 1.3370696705930281 +ZODI_COMP_BETA&& = 4.1415004157586637 +ZODI_COMP_GAMMA&& = 0.94206179393358036 +ZODI_COMP_MU&& = 0.18873176489090190 +ZODI_COMP_INIT_FROM_HDF&& = none /mn/stornext/u3/hke/data_d5/dirbe/zodi/data/init_chain_hke_v91.h5:8 +@END 01 + +@START 02 +ZODI_COMP_TYPE&& = band +ZODI_COMP_LABEL&& = band1 +ZODI_COMP_INCLUDE&& = .true. +ZODI_COMP_N_LOS_STEP&& = 50 +ZODI_COMP_R_MIN&& = 0.0 +ZODI_COMP_R_MAX&& = 5.2 + +ZODI_COMP_N_0&& = 5.5890290403228370d-10 +ZODI_COMP_X_0&& = 0.0 +ZODI_COMP_Y_0&& = 0.0 +ZODI_COMP_Z_0&& = 0.0 +ZODI_COMP_I&& = 0.56438265154389733 +ZODI_COMP_OMEGA&& = 80.0 +ZODI_COMP_DELTA_ZETA&& = 8.7850534408713035 +ZODI_COMP_V&& = 0.10000000149011612 +ZODI_COMP_P&& = 4.0 +ZODI_COMP_DELTA_R&& = 1.5 +ZODI_COMP_INIT_FROM_HDF&& = none /mn/stornext/u3/hke/data_d5/dirbe/zodi/data/init_chain_hke_v91.h5:8 +@END 02 + +@START 03 +ZODI_COMP_TYPE&& = band +ZODI_COMP_N_LOS_STEP&& = 50 +ZODI_COMP_LABEL&& = band2 +ZODI_COMP_INCLUDE&& = .true. +ZODI_COMP_R_MIN&& = 0.0 +ZODI_COMP_R_MAX&& = 5.2 + +ZODI_COMP_N_0&& = 1.9877609422590801d-09 +ZODI_COMP_X_0&& = 0.0 +ZODI_COMP_Y_0&& = 0.0 +ZODI_COMP_Z_0&& = 0.0 +ZODI_COMP_I&& = 1.2000000476837158 +ZODI_COMP_OMEGA&& = 30.347475578624532 +ZODI_COMP_DELTA_ZETA&& = 1.9917032425777641 +ZODI_COMP_V&& = 0.89999997615814209 +ZODI_COMP_P&& = 4.0 +ZODI_COMP_DELTA_R&& = 0.94121881201651147 +ZODI_COMP_INIT_FROM_HDF&& = none /mn/stornext/u3/hke/data_d5/dirbe/zodi/data/init_chain_hke_v91.h5:8 +@END 03 + +@START 04 +ZODI_COMP_TYPE&& = band +ZODI_COMP_LABEL&& = band3 +ZODI_COMP_INCLUDE&& = .true. +ZODI_COMP_N_LOS_STEP&& = 50 +ZODI_COMP_R_MIN&& = 0.0 +ZODI_COMP_R_MAX&& = 5.2 + +ZODI_COMP_N_0&& = 1.4369827283512384d-10 +ZODI_COMP_X_0&& = 0.0 +ZODI_COMP_Y_0&& = 0.0 +ZODI_COMP_Z_0&& = 0.0 +ZODI_COMP_I&& = 0.80000001192092896 +ZODI_COMP_OMEGA&& = 80.0 +ZODI_COMP_DELTA_ZETA&& = 15 +ZODI_COMP_V&& = 0.050000000745058060 +ZODI_COMP_P&& = 4.0 +ZODI_COMP_DELTA_R&& = 1.5 +ZODI_COMP_INIT_FROM_HDF&& = none +@END 04 + +@START 05 +ZODI_COMP_TYPE&& = ring +ZODI_COMP_LABEL&& = ring +ZODI_COMP_INCLUDE&& = .true. +ZODI_COMP_N_LOS_STEP&& = 50 +ZODI_COMP_R_MIN&& = 0.0 +ZODI_COMP_R_MAX&& = 1.5 + +ZODI_COMP_N_0&& = 1.8260527826501675d-08 +ZODI_COMP_X_0&& = 0.0 +ZODI_COMP_Y_0&& = 0.0 +ZODI_COMP_Z_0&& = 0.0 +ZODI_COMP_I&& = 0.48707166006819241 +ZODI_COMP_OMEGA&& = 22.278979678854448 +ZODI_COMP_R&& = 1.0281924326308751 +ZODI_COMP_SIGMA_R&& = 0.025000000372529030 +ZODI_COMP_SIGMA_Z&& = 0.054068037356978099 +ZODI_COMP_THETA&& = 0.0 +ZODI_COMP_SIGMA_THETA&& = 0.0001 +ZODI_COMP_INIT_FROM_HDF&& = none /mn/stornext/u3/hke/data_d5/dirbe/zodi/data/init_chain_hke_v91.h5:8 +@END 05 + +@START 06 +ZODI_COMP_TYPE&& = feature +ZODI_COMP_LABEL&& = feature +ZODI_COMP_INCLUDE&& = .true. +ZODI_COMP_N_LOS_STEP&& = 50 +ZODI_COMP_R_MIN&& = 0.0 +ZODI_COMP_R_MAX&& = 1.5 + +ZODI_COMP_N_0&& = 2.0094267183590947d-08 +ZODI_COMP_X_0&& = 0.0 +ZODI_COMP_Y_0&& = 0.0 +ZODI_COMP_Z_0&& = 0.0 +ZODI_COMP_I&& = 0.48707166006819241 +ZODI_COMP_OMEGA&& = 22.278979678854448 +ZODI_COMP_R&& = 1.0579182694524214 +ZODI_COMP_SIGMA_R&& = 0.10287314662396611 +ZODI_COMP_SIGMA_Z&& = 0.091442963768716023 +ZODI_COMP_THETA&& = -10.0 +ZODI_COMP_SIGMA_THETA&& = 12.115210933938741 +ZODI_COMP_INIT_FROM_HDF&& = none /mn/stornext/u3/hke/data_d5/dirbe/zodi/data/init_chain_hke_v88.h5:7 +@END 06 + +@START 07 +ZODI_COMP_TYPE&& = interstellar +ZODI_COMP_LABEL&& = interstellar +ZODI_COMP_INCLUDE&& = .false. +ZODI_COMP_N_LOS_STEP&& = 50 +ZODI_COMP_R_MIN&& = 0.0 +ZODI_COMP_R_MAX&& = 30 + +ZODI_COMP_N_0&& = 1.1344373881427960d-10 +ZODI_COMP_X_0&& = 0. +ZODI_COMP_Y_0&& = 0. +ZODI_COMP_Z_0&& = 0. +ZODI_COMP_I&& = 0 +ZODI_COMP_OMEGA&& = 0 +ZODI_COMP_R&& = 0. +ZODI_COMP_ALPHA&& = 0. +ZODI_COMP_INIT_FROM_HDF&& = none /mn/stornext/u3/hke/data_d5/dirbe/zodi/data/init_chain_hke_v91.h5:8 +@END 07 diff --git a/commander3/parameter_files/run_comm3_AST9240 b/commander3/parameter_files/run_comm3_AST9240 new file mode 100755 index 000000000..8b68118de --- /dev/null +++ b/commander3/parameter_files/run_comm3_AST9240 @@ -0,0 +1,47 @@ +#!/bin/bash +list1=owl{17..24}.uio.no +list2=owl{25..28}.uio.no +list3=owl{29..30}.uio.no +list4=owl{31..35}.uio.no +list5=owl{36..37}.uio.no +list6=hyades{2..3}.uio.no +list7=hyades4.uio.no +list8=hyades5.uio.no +list9=hyades6.uio.no +list10=hyades{7..9}.uio.no +list11=hyades{10..16}.uio.no +lists=(list1 list2 list3 list4 list5 list6 list7 list8 list9 list10 list11) +ns=(24 72 64 64 128 86 64 24 64) +tLen=${#lists[@]} +builds=("owl1724" "owl2528" "owl2930" "owl3135" "owl3637" "hya13" "hya4" "hya5" "hya6" "hya79" "hya1016") +module purge +module load intel/oneapi mpi/2021.11 compiler-rt/2023.2.1 mkl/2023.2.0 icc/2023.2.1 + +build=0 +for (( i=0; i<${tLen}; i++ )); +do + c=${!lists[$i]} + v=$(eval "echo $c") + if [[ "$v" == *"$HOSTNAME"* ]] + then + build=$((i+1)) + build=${builds[$i]} + n=${ns[$i]} + fi +done +echo $build + +seed=$RANDOM + + +#killall -9 commander +COMM_ROOT="/mn/stornext/u3/hke/git/Commander_AST9240_2024" +export COMMANDER_PARAMS_DEFAULT=$COMM_ROOT"/commander3/parameter_files/defaults" +export COMM_EXEC=$COMM_ROOT"/build_${build}_oneapi_Release/install/bin/commander3" +export HEALPIX=${COMM_ROOT}"/build_${build}_oneapi_Release/install/healpix" +export LD_LIBRARY_PATH=${COMM_ROOT}/install/lib:${COMM_ROOT}/install/healpix/lib:$LD_LIBRARY_PATH +pfile=param_AST9240_planck2015_1deg.txt +dir="chains" +cp $pfile $dir/${pfile}_orig_v1 +n=64 +export OMP_NUM_THREADS=1; mpirun -env I_MPI_FABRICS shm -n $n $COMM_EXEC $pfile 2>&1| tee -a $dir/slurm.txt diff --git a/commander3/python/HFIDefaultsGenerator.py b/commander3/python/HFIDefaultsGenerator.py new file mode 100644 index 000000000..3eb869c7f --- /dev/null +++ b/commander3/python/HFIDefaultsGenerator.py @@ -0,0 +1,241 @@ +import os + +### Function definitions +def checkFileExists(files, folder=''): + """Check if a single file or a list of files exist in the specified folder.""" + if isinstance(files, str): + files = [files] + for file in files: + if not os.path.isfile(f"{folder}{file}"): + print(f"File {file} is not in {folder}") + +def write2v(f, textv, val, dim, i, j): + """Write formatted parameter values to a file.""" + if dim == 0: + f.write(f"{textv.ljust(35)}= {val}\n") + elif dim == 1: + f.write(f"{textv.ljust(35)}= {val[i]}\n") + elif dim == 2: + f.write(f"{textv.ljust(35)}= {val[i][j]}\n") + else: + print("Error: Dim should be 1, 2, or 3") + + +# Parameters that are the same for all the HFI bands (across frequency and horns) should have +# param_name_v=0 to tell the file generator that there is a single value for all bands, if +# there are different values for different frequencies change to param_name_v=1 and if +# it is unique for each horn param_name_v=2 +# This is used for 'dim' (dimension) in write2v + + +# Formatting parameters +data_folder = '/mn/stornext/d23/cmbco/cg/hfi/data/' +eqsig = "&&&" +debug = True # Enable file existence checks + +# Save folder for default files +homedir='/mn/stornext/u3/raelynsu/code/' +param_folder = homedir+"Commander/commander3/parameter_files/defaults/bands/HFI/" + +# Frequency-related parameters +## BAND_NOMINAL_FREQ +nomfreqs = [100, 143, 217, 353, 545, 857] +nomfreqs_v = 1 +##BAND_NSIDE +nsides = [2048, 2048, 4096, 4096, 4096, 4096] +nsides_v = 1 +##BAND_LMAX +lmaxs = [6000, 6000, 10000, 10000, 10000, 10000] +lmaxs_v = 1 + + +# File names for pixel window functions +band_pixel_window = [f"pixel_window_n{n}.fits" for n in nsides] +band_pixel_window_v = 1 + +if debug: + checkFileExists(band_pixel_window,folder=data_folder) + # checkFileExists(band_beam_b_l_file,folder=data_folder) + + +# Data paths for individual horns +common_folder = "/mn/stornext/d23/cmbco/globe/fullres/planck/" +maps_folder, rms_folder, hit_folder = "map/map_", "rms/rms_", "mask/hitmask_" +common_string3 = "_fullres_full_T.fits" + +band_label_v=2 +band_mapfile_v=2 +band_noisefile_v=2 +band_bandpassfile_v=2 +band_maskfile_v=2 + +# Horn configurations +band_arr = [ + ['-1', '-2', '-3', '-4'], # 100 GHz + ['-1', '-2', '-3', '-4', '-5', '-6', '-7'], # 143 GHz + ['-1', '-2', '-3', '-4', '-5', '-6', '-7', '-8'], # 217 GHz + ['-1', '-2', '-3', '-4', '-5', '-6', '-7', '-8'], # 353 GHz + ['-1', '-2', '-4'], # 545 GHz + ['-1', '-2', '-3', '-4'] # 857 GHz +] + + +# Initialize band-specific lists +band_label, band_mapfile, band_noisefile, band_bandpassfile, band_maskfile,band_beam_b_l_file = [], [], [], [], [], [] + +##bandpass name changes for different horns +v1='_SHORN.dat' +v2='.dat' +bp_extra=[[v1,v1,v1,v1], + [v1,v1,v1,v1,v2,v2,v2], + [v2,v2,v2,v2,v1,v1,v1,v1], + [v2,v2,v1,v1,v1,v1,v2,v2], + [v2,v2,v2], + [v2,v2,v2,v2]] + +for i in range(len(nomfreqs)): + b_lab = [str(nomfreqs[i]) + h for h in band_arr[i]] + band_label.append(b_lab) + + common_string2 = f"_npipe_0{nsides[i]}" + map_file = [f"{common_folder}{maps_folder}planck_{b}{common_string2}{common_string3}" for b in b_lab] + rms_file = [f"{common_folder}{rms_folder}planck_{b}{common_string2}{common_string3}" for b in b_lab] + hit_file = [f"{common_folder}{hit_folder}planck_{b}{common_string2}{common_string3}" for b in b_lab] + band_mapfile.append(map_file) + band_noisefile.append(rms_file) + band_maskfile.append(hit_file) + + bpfile = [f"bp_RIMO_v2.0_{b}{bp}" for b, bp in zip(b_lab, bp_extra[i])] + band_bandpassfile.append(bpfile) + + band_beam_b_l= [f"Bl_npipe6v20_{f}x{f}_extended.fits" for f in b_lab] + band_beam_b_l_file.append(band_beam_b_l) + + if debug: + checkFileExists(map_file) + checkFileExists(rms_file) + checkFileExists(hit_file) + checkFileExists(bpfile,folder=data_folder) + checkFileExists(band_beam_b_l_file,folder=data_folder) + + + +band_instrument_label=band_label +band_instrument_label_v=2 +band_beam_b_l_file_v = 2 + +###constant for all HFI currently +band_obs_period='1' +band_obs_period_v=0 +band_polarization='.false.' +band_polarization_v=0 + +band_unit='uK_cmb' +band_unit_v=0 +band_noise_format='rms' +band_noise_format_v=0 +band_reg_noisefile='none' +band_reg_noisefile_v=0 +band_noise_uniformize_fsky='0.01' +band_noise_uniformize_fsky_v=0 +band_maskfile_calib='fullsky' +band_maskfile_calib_v=0 +band_beamtype='b_l' # {b_l, febecop} +band_beamtype_v=0 +band_beam_b_ptsrc_file='none' +band_beam_b_ptsrc_file_v=0 +band_sample_noise_amp='.false.' +band_sample_noise_amp_v=0 + +band_bandpass_type='HFI_cmb' +band_bandpass_type_v=0 +band_bandpass_model='additive_shift' # {powlaw_tilt, additive_shift} +band_bandpass_model_v=0 + +band_samp_bandpass='.false' +band_samp_bandpass_v=0 +band_samp_gain='.false.' +band_samp_gain_v=0 +band_gain_prior_mean='1.' +band_gain_prior_mean_v=0 +band_gain_prior_rms='0.' +band_gain_prior_rms_v=0 +band_gain_calib_comp='all' #all or cmb +band_gain_calib_comp_v=0 +band_gain_lmin='25' +band_gain_lmin_v=0 +band_gain_lmax='100' +band_gain_lmax_v=0 +band_gain_apod_mask='fullsky' +band_gain_apod_mask_v=0 +band_gain_apod_fwhm='120.' +band_gain_apod_fwhm_v=0 +band_default_gain='1.' +band_default_gain_v=0 +band_default_bp_delta='0.' +band_default_bp_delta_v=0 +band_default_noiseamp='1.' +band_default_noiseamp_v=0 +band_component_sensitivity='broadband' +band_component_sensitivity_v=0 +band_tod_type='none' +band_tod_type_v=0 +band_noise_rms_sm1='none' +band_noise_rms_sm1_v=0 +band_noise_rms_sm2='none' +band_noise_rms_sm2_v=0 +band_noise_rms_sm3='none' +band_noise_rms_sm3_v=0 + +# band= +# band_v= +# '' + + +for i in range(len(nomfreqs)): + for j in range(len(band_arr[i])): + f = open(f"{param_folder}HFI_{nomfreqs[i]}{band_arr[i][j]}_HFI.defaults",'w') ##will overwrite exiting files + f.write(f"# {nomfreqs[i]}{band_arr[i][j]} GHz map parameters \n") + write2v(f,'BAND_LABEL'+eqsig,band_label,band_label_v,i,j) + write2v(f,'BAND_INSTRUMENT_LABEL'+eqsig,band_instrument_label,band_instrument_label_v,i,j) + write2v(f,'BAND_OBS_PERIOD'+eqsig,band_obs_period,band_obs_period_v,i,j) + write2v(f,'BAND_POLARIZATION'+eqsig,band_polarization,band_polarization_v,i,j) + write2v(f,'BAND_NSIDE'+eqsig,nsides,nsides_v,i,j) + write2v(f,'BAND_LMAX'+eqsig,lmaxs,lmaxs_v,i,j) + write2v(f,'BAND_UNIT'+eqsig,band_unit,band_unit_v,i,j) + write2v(f,'BAND_NOISE_FORMAT'+eqsig,band_noise_format,band_noise_format_v,i,j) + write2v(f,'BAND_MAPFILE'+eqsig,band_mapfile,band_mapfile_v,i,j) + write2v(f,'BAND_NOISEFILE'+eqsig,band_noisefile,band_noisefile_v,i,j) + write2v(f,'BAND_REG_NOISEFILE'+eqsig,band_reg_noisefile,band_reg_noisefile_v,i,j) + write2v(f,'BAND_NOISE_UNIFORMIZE_FSKY'+eqsig,band_noise_uniformize_fsky,band_noise_uniformize_fsky_v,i,j) + write2v(f,'BAND_MASKFILE'+eqsig,band_maskfile,band_maskfile_v,i,j) + write2v(f,'BAND_MASKFILE_CALIB'+eqsig,band_maskfile_calib,band_maskfile_calib_v,i,j) + write2v(f,'BAND_BEAMTYPE'+eqsig,band_beamtype,band_beamtype_v,i,j) + write2v(f,'BAND_BEAM_B_L_FILE'+eqsig,band_beam_b_l_file,band_beam_b_l_file_v,i,j) + write2v(f,'BAND_BEAM_B_PTSRC_FILE'+eqsig,band_beam_b_ptsrc_file,band_beam_b_ptsrc_file_v,i,j) + write2v(f,'BAND_PIXEL_WINDOW'+eqsig,band_pixel_window,band_pixel_window_v,i,j) + write2v(f,'BAND_SAMP_NOISE_AMP'+eqsig,band_sample_noise_amp,band_sample_noise_amp_v,i,j) + write2v(f,'BAND_BANDPASS_TYPE'+eqsig,band_bandpass_type,band_bandpass_type_v,i,j) + write2v(f,'BAND_BANDPASS_MODEL'+eqsig,band_bandpass_model,band_bandpass_model_v,i,j) + write2v(f,'BAND_NOMINAL_FREQ'+eqsig,nomfreqs,nomfreqs_v,i,j) + write2v(f,'BAND_SAMP_BANDPASS'+eqsig,band_samp_bandpass,band_samp_bandpass_v,i,j) + write2v(f,'BAND_BANDPASSFILE'+eqsig,band_bandpassfile,band_bandpassfile_v,i,j) + write2v(f,'BAND_SAMP_GAIN'+eqsig,band_samp_gain,band_samp_gain_v,i,j) + write2v(f,'BAND_GAIN_PRIOR_MEAN'+eqsig,band_gain_prior_mean,band_gain_prior_mean_v,i,j) + write2v(f,'BAND_GAIN_PRIOR_RMS'+eqsig,band_gain_prior_mean,band_gain_prior_mean_v,i,j) + write2v(f,'BAND_GAIN_CALIB_COMP'+eqsig,band_gain_calib_comp,band_gain_calib_comp_v,i,j) + write2v(f,'BAND_GAIN_LMIN'+eqsig,band_gain_lmin,band_gain_lmin_v,i,j) + write2v(f,'BAND_GAIN_LMAX'+eqsig,band_gain_lmax,band_gain_lmax_v,i,j) + write2v(f,'BAND_GAIN_APOD_MASK'+eqsig,band_gain_apod_mask,band_gain_apod_mask_v,i,j) + write2v(f,'BAND_GAIN_APOD_FWHM'+eqsig,band_gain_apod_fwhm,band_gain_apod_fwhm_v,i,j) + write2v(f,'BAND_DEFAULT_GAIN'+eqsig,band_default_gain,band_default_gain_v,i,j) + write2v(f,'BAND_DEFAULT_BP_DELTA'+eqsig,band_default_bp_delta,band_default_bp_delta_v,i,j) + write2v(f,'BAND_DEFAULT_NOISEAMP'+eqsig,band_default_noiseamp,band_default_noiseamp_v,i,j) + write2v(f,'BAND_COMPONENT_SENSITIVITY'+eqsig,band_component_sensitivity,band_component_sensitivity_v,i,j) + write2v(f,'BAND_TOD_TYPE'+eqsig,band_tod_type,band_tod_type_v,i,j) + write2v(f,'BAND_NOISE_RMS'+eqsig+'_SMOOTH01',band_noise_rms_sm1,band_noise_rms_sm1_v,i,j) + write2v(f,'BAND_NOISE_RMS'+eqsig+'_SMOOTH02',band_noise_rms_sm2,band_noise_rms_sm2_v,i,j) + write2v(f,'BAND_NOISE_RMS'+eqsig+'_SMOOTH03',band_noise_rms_sm3,band_noise_rms_sm3_v,i,j) + f.close() + + \ No newline at end of file diff --git a/commander3/python/commander_tools/tod_tools/commander_instrument.py b/commander3/python/commander_tools/tod_tools/commander_instrument.py index eae57f08f..454a1d608 100644 --- a/commander3/python/commander_tools/tod_tools/commander_instrument.py +++ b/commander3/python/commander_tools/tod_tools/commander_instrument.py @@ -60,6 +60,15 @@ def add_bandpass(self, det, freqs, response): self.add_field(det + '/bandpassx', freqs) self.add_field(det + '/bandpass', response) + + #add bandpass data for detector det + def add_hfi_bandpass(self, det, freqs, response): + if len(freqs) != len(response): + raise ValueError('Bandpass frequency x and f(x) must be the same length, len(freqs): ' + str(len(freqs)) + ' len(f(x)): ' + str(len(response))) + det = self.parse_det(det) + + self.add_field(det + '/bandpassx', freqs * 1e-7 * 299792458.) + self.add_field(det + '/bandpass', response) def add_alms(self, det, almType, lmax, mmax, T, E, B): diff --git a/commander3/python/commander_tools/tod_tools/commander_tod.py b/commander3/python/commander_tools/tod_tools/commander_tod.py index 44a215408..665d8d7eb 100644 --- a/commander3/python/commander_tools/tod_tools/commander_tod.py +++ b/commander3/python/commander_tools/tod_tools/commander_tod.py @@ -20,10 +20,10 @@ #================================================================================ import h5py -#import commander_tools.tod_tools.huffman as huffman -#import commander_tools.tod_tools.rice as rice -import tod_tools.huffman as huffman -import tod_tools.rice as rice +import commander_tools.tod_tools.huffman as huffman +import commander_tools.tod_tools.rice as rice +#import tod_tools.huffman as huffman +#import tod_tools.rice as rice import healpy as hp import numpy as np import multiprocessing as mp @@ -31,12 +31,12 @@ import sys class commander_tod: - - def __init__(self, outPath, name, version=None, dicts=None, overwrite=False): + + def __init__(self, outPath, experiment, version=None, dicts=None, overwrite=False): self.outPath = outPath self.filelists = dicts self.version = version - self.name = name + self.experiment = experiment #TODO: something with the version number self.overwrite = overwrite @@ -51,20 +51,14 @@ def init_file(self, freq, od, mode='r'): self.od = od self.freq = freq - if self.name and self.name.lower() == 'planck': + if self.experiment.lower() == 'lfi': sfreq = str(freq).zfill(3) else: sfreq = str(freq) if not self.od: - if not self.name: - self.outName = os.path.join(self.outPath, sfreq + '.h5') - else: - self.outName = os.path.join(self.outPath, self.name+ '_' + sfreq + '.h5') + self.outName = os.path.join(self.outPath, self.experiment+ '_' + sfreq + '.h5') else: - if not self.name: - self.outName = os.path.join(self.outPath, sfreq + '_' + str(od).zfill(6) + '.h5') - else: - self.outName = os.path.join(self.outPath, self.name+ '_' + sfreq + '_' + str(od).zfill(6) + '.h5') + self.outName = os.path.join(self.outPath, self.experiment+ '_' + sfreq + '_' + str(od).zfill(6) + '.h5') self.exists = False @@ -164,10 +158,25 @@ def add_field(self, fieldName, data, compression=None): dictNum = compArr[1]['dictNum'] if dictNum not in self.huffDict.keys(): self.huffDict[dictNum] = {} + + #check for uint issue before differencing + #np.diff maintains data types so this was a mess for uints + if(np.issubdtype(data.dtype, np.unsignedinteger)): + dtypestr = str(data.dtype) + + dsize = int(dtypestr[4:]) + dsize *= 2 + dtypestr = 'int' + str(dsize) + #print("Converting unsigned Huffman field " + fieldName + " from " + str(data.dtype) + " to " + dtypestr) + data = data.astype(dtypestr) + delta = np.diff(data) delta = np.insert(delta, 0, data[0]) self.huffDict[dictNum][fieldName] = delta - #print("adding " + fieldName + " to dict, contents ", delta[delta != 0], data[data != 0]) + #if('flag' in fieldName): + # for i in range(len(data)): + # print(data[i], delta[i], ",", end='') + #print("adding " + fieldName + " to dict, contents ", delta[delta!=0]) self.add_attribute(fieldName, 'huffmanDictNumber', dictNum) writeField = False diff --git a/commander3/python/commander_tools/tod_tools/hfi.py b/commander3/python/commander_tools/tod_tools/hfi.py index a3699745f..bcd250202 100644 --- a/commander3/python/commander_tools/tod_tools/hfi.py +++ b/commander3/python/commander_tools/tod_tools/hfi.py @@ -26,14 +26,13 @@ import healpy as hp import random import math - class hfi(object): freqs = [100, 143, 217, 353, 545, 857] dets = {100:['1a', '1b', '2a', '2b', '3a', '3b', '4a', '4b'], 143:['1a', '1b', '2a', '2b', '3a', '3b', '4a', '4b', '5', '6', '7'], 217:['1', '2', '3', '4', '5a', '5b', '6a', '6b', '7a', '7b', '8a', '8b'], 353:['1', '2', '3a', '3b', '4a', '4b', '5a', '5b', '6a', '6b', '7', '8'], 545:['1', '2', '4'], 857:['1', '2', '3', '4']} npsi = 4096 ntodsigma = 100 - nsides = {100:1024, 143:1024, 217:1024, 353:1024, 545:2048, 857:2048} + nsides = {100:1024, 143:2048, 217:2048, 353:2048, 545:2048, 857:2048} #compression arrays huffman = ['huffman', {'dictNum':1}] huffTod = ['huffman', {'dictNum':2}] @@ -100,6 +99,56 @@ def get_extra_flags(times, det, flags): outFlags[np.logical_and(times > entry[0],times < entry[1])] = 128 return outFlags + #computes the pre-differencing gains from the insturment calibration params + #at a given time + #heavily based on https://github.com/planck-npipe/toast-npipe/blob/master/toast_planck/preproc_modules/transf1_nodemod.py + + def compute_l1_gain(detector, time, hsk): + if(type(time) == np.int64): + time = np.array([time]) + params = hsk[detector.encode()] # python 3 + + # Fixed IMO params + GC_bc = params[b'GC_bc'] + F1_bc = params[b'F1_bc'] + HFI_REU_ETAL = params[b'HFI_REU_ETAL'] + REU_bc_offset = params[b'REU_bc_offset'] + + gamp = hfi.expand_hsk(hsk, params[b'gamp'], time) + nsamp = hfi.expand_hsk(hsk, params[b'nsamp'], time) + nblanck = hfi.expand_hsk(hsk, params[b'nblanck'], time) + + nsamp[nsamp == 0] = 45 + nsamp[nsamp == 1] = 40 + nsamp[nsamp == 2] = 36 + nsamp[nsamp == 3] = 45 + + #print(GC_bc, F1_bc, HFI_REU_ETAL, REU_bc_offset) + #print(gamp, nsamp, nblanck) + + return F1_bc * GC_bc[gamp] * (nsamp - nblanck).astype(np.float64)/GC_bc[HFI_REU_ETAL], (nsamp - nblanck).astype(np.float64) * REU_bc_offset + + #produces a housekeeping estimate at time(s) t + def expand_hsk(hsk, field, time): + grp, obj = field.split(b'/') + t, x = hsk[grp][obj] + + i0 = len(time) // 2 + + if time[i0] < 1e10: + # from nanoseconds to seconds + tt = t.astype(np.float64) * 1e-9 + elif time[i0] < 1e18: + # from nanoseconds to OBT ticks + tt = t.astype(np.float64) * 1e-9 * 2.**16. + else: + tt = t + + # interpolate + + ind = np.searchsorted(tt, time) + return x[ind - 1] + @staticmethod def instrument_filename(version): return 'HFI_instrument_v' + str(version) + '.h5' @@ -137,5 +186,12 @@ def verify_instrument_file(outDir, version): if version == 1: print("Should check the version here") - if version > 1: + if version == 2: + print("I don't know how this is supposed to be different than 1") + + if version == 3: + if f['545-1/sllmax'] != 0: + print("HFI instrument file doesn't contain sidelobes for 545") + + if version > 3: raise ValueError("Version " + str(version) + " of HFI instrument file has not yet been defined.") diff --git a/commander3/python/commander_tools/tod_tools/lfi.py b/commander3/python/commander_tools/tod_tools/lfi.py index 12e3de783..ac821768a 100644 --- a/commander3/python/commander_tools/tod_tools/lfi.py +++ b/commander3/python/commander_tools/tod_tools/lfi.py @@ -20,8 +20,8 @@ #================================================================================ import h5py -#import commander_tools.tod_tools.commander_instrument as inst -import tod_tools.commander_instrument as inst +import commander_tools.tod_tools.commander_instrument as inst +#import tod_tools.commander_instrument as inst import os import numpy as np import healpy as hp diff --git a/commander3/python/extend_beams.py b/commander3/python/extend_beams.py new file mode 100644 index 000000000..f3d16f281 --- /dev/null +++ b/commander3/python/extend_beams.py @@ -0,0 +1,53 @@ +import healpy as hp +import numpy as np + + + +def extend_beam(bl,fwhm,lmax_bl,lmax_trans,lmax_gauss): + ''' + bl - the original beam function + fwhm - the fwhm of the extended beam Gaussian in arcmin + lmax_bl - the lmax from the original beam + lmax_trans - the lmax of the transition from the original beam to the Gaussian beam + lmax_gauss - the lmax of the extended beam + ''' + #generate the gaussian beam and empty array for the extended beam + gl=hp.gauss_beam(np.deg2rad(fwhm/60),lmax=lmax_gauss) + bl_ext=np.zeros(lmax_gauss+1) + #rescale so that the start of the Gaussian beam is the same value as the end of the original beam + gl=(gl/(gl[lmax_bl]))*bl[lmax_bl] + #set the lowest ell equal to the original beam, and the highest ell to a pure gaussian beam + bl_ext[0:lmax_bl]=bl[0:lmax_bl] + bl_ext[lmax_trans:]=gl[lmax_trans:] + #calculate and apply apodization function between orginal and fully Gaussian beams + ell=np.arange(lmax_bl,lmax_trans) + apod=0.5*(1+np.cos(np.pi*(lmax_trans-ell)/(lmax_trans-lmax_bl))) + bl_ext[lmax_bl:lmax_trans]=gl[lmax_bl:lmax_trans]*apod+bl[lmax_bl:lmax_trans]*(1-apod) + + bl_ext/=bl_ext[0] + return bl_ext + +freq=np.array([100,143,217,353,545,857]) +freq_arr=[[1,2,3,4], + [1,2,3,4,5,6,7], + [1,2,3,4,5,6,7,8], + [1,2,3,4,5,6,7,8], + [1,2,4], + [1,2,3,4]] + +fwhm=np.array([9.659, 7.22, 4.9, 4.916, 4.675, 4.216]) ##from the FWHMGAUS in the HFI_RIMO_R3.00.fits +lmax_trans=np.array([2200,3000,5200,5500,4300,4300]) ##chosen by eye such that the original beam is still smooth +lmax_bl=lmax_trans-100 +lmax_gauss=10000 + +folder='/mn/stornext/u3/raelynsu/d23hfi/data/Bl_npipe6v20_' +#353-7x353-7.fits' + +for i in range(len(freq)): + for j in range(len(freq_arr[i])): + strv=str(freq[i])+'-'+str(freq_arr[i][j]) + bl=hp.read_cl(folder+strv+'x'+strv+'.fits') + bl_ext=extend_beam(bl,fwhm[i],lmax_bl[i],lmax_trans[i],lmax_gauss) + hp.write_cl(folder+strv+'x'+strv+'_extended.fits',bl_ext,overwrite=True) + + diff --git a/commander3/src/Makefile b/commander3/src/Makefile index 7b2c178e6..463181576 100644 --- a/commander3/src/Makefile +++ b/commander3/src/Makefile @@ -28,6 +28,7 @@ F90SOURCES=hashtbl.f90 \ hmc_mod.f90 \ comm_hdf_mod.f90 \ sharp.f90 \ + comm_sparse_mod.f90 \ sort_utils.f90 \ ars_mod.f90 \ math_tools.f90 \ @@ -54,6 +55,7 @@ F90SOURCES=hashtbl.f90 \ comm_bp_utils.f90 \ comm_param_mod.f90 \ comm_comp_mod.f90 \ + comm_dust_extinction_mod.f90 \ comm_diffuse_comp_mod.f90 comm_diffuse_comp_smod.f90 \ comm_comp_interface_mod.f90 \ comm_cmb_comp_mod.f90 \ @@ -92,10 +94,12 @@ F90SOURCES=hashtbl.f90 \ comm_f_int_0d_mod.f90 \ comm_f_int_2d_mod.f90 \ comm_fft_mod.f90 \ + comm_tod_pixhist_mod.f90 \ comm_tod_noise_psd_mod.f90 \ comm_tod_mod.f90 \ comm_tod_mapmaking_mod.f90 \ comm_tod_bandpass_mod.f90 \ + comm_tod_crosstalk_mod.f90 \ comm_tod_gain_mod.f90 comm_tod_gain_smod.f90 \ comm_tod_pointing_mod.f90 \ comm_tod_lfi_mod.f90 comm_tod_lfi_smod.f90 \ @@ -118,9 +122,11 @@ F90SOURCES=hashtbl.f90 \ comm_tod_lb_mod.f90 \ comm_tod_dirbe_mod.f90 \ comm_tod_hfi_mod.f90 \ + comm_tod_hfi_smod.f90 \ comm_camb_mod.f90 \ comm_tod_adc_mod.f90 comm_tod_adc_smod.f90 \ comm_timing_mod.f90 \ + comm_tod_cray_mod.f90 \ commander.f90 #comm_tod_quiet_mod.f90 comm_tod_quiet_smod.f90 @@ -129,6 +135,10 @@ all: commander commander: $(subst .f,.o,$(FSOURCES)) $(subst .f90,.o,$(F90SOURCES)) $(MPF90) -o commander $+ $(LINK) $(MPFCLIBS) +sharp_test: sharp.o sharp_test.o + $(MPF90) -o sharp_test sharp_test.o sharp.o comm_map_mod.o $(LINK) $(MPFCLIBS) + + .PHONY: clean clean: -rm -f *.o commander *.{mod,smod} @@ -145,6 +155,7 @@ clean: $(MPCXX) $(CXXCOMP) -c $< @touch $@ + sort_utils.o : comm_defs.o : comm_system_mod.o : @@ -153,48 +164,101 @@ hashtbl.o : sharp.o : locate_mod.o : math_tools.o : +comm_sparse_mod.o : math_tools.o powell_mod.o : hmc_mod.o : +comm_utils.o : comm_system_mod.o comm_defs.o sort_utils.o spline_1d_mod.o comm_mpi_mod.o spline_1d_mod.o : math_tools.o locate_mod.o ars_mod.o : sort_utils.o -invsamp_mod.o : spline_1d_mod.o -comm_utils.o : comm_system_mod.o comm_defs.o sort_utils.o spline_1d_mod.o comm_mpi_mod.o powell_mod.o hmc_mod.o -spline_2d_mod.o : comm_utils.o -comm_timing_mod.o : comm_utils.o -comm_shared_output_mod.o : comm_utils.o -comm_status_mod.o : comm_timing_mod.o comm_shared_output_mod.o -comm_param_mod.o : comm_status_mod.o -comm_hdf_mod.o : comm_utils.o comm_4d_map_mod.o : hashtbl_4dmap.o comm_hdf_mod.o -comm_cr_utils.o : comm_utils.o +comm_ame_lognormal_mod.o : comm_comp_interface_mod.o +commander.o : comm_nonlin_mod.o comm_mh_specind_mod.o comm_zodi_samp_mod.o +comm_b_bl_mod.o : comm_b_mod.o +comm_beam_mod.o : comm_b_mod.o comm_b_bl_mod.o comm_b_firas_mod.o +comm_b_firas_mod.o : comm_b_mod.o +comm_b_mod.o : comm_map_mod.o +comm_bp_mod.o : comm_param_mod.o comm_bp_utils.o +comm_bp_utils.o : comm_utils.o comm_hdf_mod.o +comm_chisq_mod.o : comm_comp_interface_mod.o +comm_cl_mod.o : comm_map_mod.o comm_bp_utils.o invsamp_mod.o +comm_cmb_comp_mod.o : comm_comp_interface_mod.o +comm_cmb_relquad_comp_mod.o : comm_comp_interface_mod.o +comm_comp_interface_mod.o : comm_diffuse_comp_mod.o comm_ptsrc_comp_mod.o comm_template_comp_mod.o comm_comp_mod.o comm_f_mod.o +comm_comp_mod.o : comm_cr_utils.o comm_cr_precond_mod.o comm_data_mod.o +comm_conviqt_mod.o : comm_map_mod.o comm_shared_arr_mod.o +comm_cr_mod.o : comm_output_mod.o comm_cr_precond_mod.o : comm_utils.o -comm_fft_mod.o : comm_utils.o comm_param_mod.o locate_mod.o +comm_cr_utils.o : comm_utils.o +comm_curvature_comp_mod.o : comm_comp_interface_mod.o +comm_data_mod.o : comm_bp_mod.o comm_noise_mod.o comm_beam_mod.o comm_tod_inst_mod.o +comm_dust_extinction_mod.o : comm_map_mod.o +comm_diffuse_comp_mod.o : comm_comp_mod.o comm_cl_mod.o comm_f_mod.o comm_dust_extinction_mod.o +comm_diffuse_comp_smod.o : comm_diffuse_comp_mod.o +comm_exp_comp_mod.o : comm_comp_interface_mod.o +comm_fft_mod.o : comm_param_mod.o +comm_f_int_0d_mod.o : comm_f_int_mod.o +comm_f_int_1d_mod.o : comm_f_int_mod.o +comm_f_int_2d_mod.o : comm_f_int_mod.o +comm_f_int_mod.o : comm_bp_mod.o comm_comp_mod.o spline_2d_mod.o +comm_f_line_mod.o : comm_f_int_mod.o +comm_f_mod.o : comm_comp_mod.o comm_param_mod.o comm_map_mod.o comm_bp_mod.o comm_f_int_mod.o comm_f_int_0d_mod.o comm_f_int_1d_mod.o comm_f_int_2d_mod.o comm_f_line_mod.o +comm_freefree_comp_mod.o : comm_comp_interface_mod.o +comm_freefreeEM_comp_mod.o : comm_comp_interface_mod.o +comm_gain_mod.o : comm_signal_mod.o comm_hdf_mod.o : comm_utils.o -comm_map_mod.o : sharp.o comm_hdf_mod.o comm_param_mod.o -comm_shared_arr_mod.o : comm_utils.o -comm_conviqt_mod.o : comm_map_mod.o comm_shared_arr_mod.o comm_huffman_mod.o : comm_utils.o -#comm_task_mod.o : comm_utils.o # Not currently used - -comm_bp_utils.o : comm_utils.o comm_hdf_mod.o -comm_bp_mod.o : comm_param_mod.o comm_bp_utils.o - -comm_b_mod.o : comm_map_mod.o -comm_b_bl_mod.o : comm_b_mod.o -comm_b_firas_mod.o : comm_b_mod.o -comm_beam_mod.o : comm_b_mod.o comm_b_bl_mod.o comm_b_firas_mod.o - +comm_line_comp_mod.o : comm_comp_interface_mod.o +comm_map_mod.o : sharp.o comm_hdf_mod.o comm_param_mod.o comm_status_mod.o comm_timing_mod.o +comm_mbb_comp_mod.o : comm_comp_interface_mod.o +comm_mbbtab_comp_mod.o : comm_comp_interface_mod.o +comm_md_comp_mod.o : comm_comp_interface_mod.o +comm_mh_specind_mod.o : comm_signal_mod.o +comm_n_lcut_mod.o : comm_n_mod.o comm_n_mod.o : comm_map_mod.o +comm_noise_mod.o : comm_n_mod.o comm_n_rms_mod.o comm_n_rms_qucov_mod.o comm_n_qucov_mod.o comm_n_lcut_mod.o +comm_nonlin_mod.o : comm_gain_mod.o +comm_nonlin_smod.o : comm_nonlin_mod.o comm_n_qucov_mod.o : comm_n_mod.o -comm_n_lcut_mod.o : comm_n_mod.o comm_n_rms_mod.o : comm_n_mod.o comm_n_rms_qucov_mod.o : comm_n_mod.o -comm_noise_mod.o : comm_n_mod.o comm_n_rms_mod.o comm_n_qucov_mod.o comm_n_lcut_mod.o comm_n_rms_qucov_mod.o - -comm_tod_simulations_mod.o : comm_hdf_mod.o comm_fft_mod.o comm_shared_arr_mod.o -comm_tod_noise_psd_mod.o : comm_utils.o +comm_output_mod.o : comm_chisq_mod.o +comm_pah_comp_mod.o : comm_comp_interface_mod.o +comm_param_mod.o : comm_status_mod.o hashtbl.o +comm_physdust_comp_mod.o : comm_comp_interface_mod.o +comm_powlaw_break_comp_mod.o : comm_comp_interface_mod.o +comm_powlaw_comp_mod.o : comm_comp_interface_mod.o +comm_ptsrc_comp_mod.o : comm_f_mod.o comm_dust_extinction_mod.f90 +comm_shared_arr_mod.o : comm_utils.o +comm_shared_output_mod.o : comm_utils.o +comm_signal_mod.o : comm_chisq_mod.o comm_cr_mod.o comm_cmb_comp_mod.o comm_cmb_relquad_comp_mod.o comm_mbb_comp_mod.o comm_mbbtab_comp_mod.o comm_powlaw_comp_mod.o comm_curvature_comp_mod.o comm_spindust_comp_mod.o comm_spindust2_comp_mod.o comm_md_comp_mod.o comm_line_comp_mod.o comm_freefree_comp_mod.o comm_freefreeEM_comp_mod.o comm_exp_comp_mod.o comm_physdust_comp_mod.o comm_pah_comp_mod.o comm_powlaw_break_comp_mod.o comm_ame_lognormal_mod.o +comm_spindust2_comp_mod.o : comm_comp_interface_mod.o +comm_spindust_comp_mod.o : comm_comp_interface_mod.o +comm_status_mod.o : comm_shared_output_mod.o comm_timing_mod.o +comm_task_mod.o : comm_utils.o +comm_template_comp_mod.o : math_tools.o comm_param_mod.o comm_comp_mod.o comm_f_int_mod.o comm_data_mod.o comm_hdf_mod.o comm_cr_utils.o comm_cr_precond_mod.o locate_mod.o spline_1d_mod.o +comm_timing_mod.o : comm_utils.o +comm_tod_adc_mod.o : math_tools.o spline_1d_mod.o comm_tod_mod.o comm_map_mod.o comm_param_mod.o invsamp_mod.o comm_hdf_mod.o +comm_tod_adc_smod.o : comm_tod_adc_mod.o +comm_tod_bandpass_mod.o : comm_tod_mod.o comm_utils.o comm_status_mod.o +comm_tod_crosstalk_mod.o : comm_tod_mod.o comm_status_mod.o +comm_tod_cray_mod.o : comm_param_mod.o +comm_tod_dirbe_mod.o : comm_tod_driver_mod.o +comm_tod_driver_mod.o : comm_tod_mod.o comm_tod_gain_mod.o comm_tod_noise_mod.o comm_tod_pointing_mod.o comm_tod_bandpass_mod.o comm_tod_orbdipole_mod.o comm_tod_simulations_mod.o comm_tod_mapmaking_mod.o comm_tod_jump_mod.o comm_tod_adc_mod.o comm_zodi_mod.o comm_tod_cray_mod.o comm_shared_arr_mod.o comm_huffman_mod.o comm_4d_map_mod.o +comm_tod_gain_mod.o : comm_tod_noise_mod.o +comm_tod_gain_smod.o : comm_tod_gain_mod.o +comm_tod_hfi_mod.o : comm_tod_driver_mod.o comm_tod_cray_mod.o comm_tod_crosstalk_mod.o +comm_tod_hfi_smod.o : comm_tod_hfi_mod.o +comm_tod_inst_mod.o : comm_tod_mod.o comm_tod_lfi_mod.o comm_tod_wmap_mod.o comm_tod_hfi_mod.o comm_tod_spider_mod.o comm_tod_dirbe_mod.o comm_tod_lb_mod.o comm_tod_jump_mod.o : comm_utils.o +comm_tod_lb_mod.o : comm_tod_mod.o comm_tod_driver_mod.o comm_conviqt_mod.o +comm_tod_lfi_mod.o : comm_conviqt_mod.o comm_tod_driver_mod.o +comm_tod_lfi_smod.o : comm_tod_lfi_mod.o +comm_tod_mapmaking_mod.o : comm_tod_mod.o comm_shared_arr_mod.o comm_map_mod.o +comm_tod_mod.o : comm_bp_mod.o comm_fft_mod.o comm_huffman_mod.o comm_conviqt_mod.o comm_tod_cray_mod.o comm_tod_orbdipole_mod.o comm_tod_noise_psd_mod.o comm_shared_arr_mod.o comm_utils.o +comm_tod_noise_mod.o : comm_tod_mod.o invsamp_mod.o comm_tod_noise_psd_mod.o comm_status_mod.o +comm_tod_noise_psd_mod.o : comm_utils.o comm_tod_orbdipole_mod.o : comm_map_mod.o +comm_tod_pixhist_mod.o : comm_tod_mod.o comm_tod_driver_mod.o comm_tod_mod.o : comm_fft_mod.o comm_huffman_mod.o comm_conviqt_mod.o comm_tod_orbdipole_mod.o comm_tod_noise_psd_mod.o comm_shared_arr_mod.o comm_tod_pointing_mod.o : comm_tod_mod.o comm_tod_noise_mod.o : comm_tod_mod.o invsamp_mod.o @@ -217,11 +281,11 @@ comm_tod_lfi_mod.o : comm_tod_driver_mod.o comm_tod_adc_mod.o comm_tod_spider_mod.o : comm_tod_driver_mod.o comm_tod_spider_smod.o : comm_tod_spider_mod.o comm_tod_wmap_mod.o : comm_tod_driver_mod.o -comm_tod_dirbe_mod.o : comm_tod_driver_mod.o +comm_tod_dirbe_mod.o : comm_tod_driver_mod.o comm_tod_pixhist_mod.o comm_tod_hfi_mod.o : comm_tod_driver_mod.o comm_tod_inst_mod.o : comm_tod_lb_mod.o comm_tod_lfi_mod.o comm_tod_spider_mod.o comm_tod_wmap_mod.o comm_tod_dirbe_mod.o comm_tod_hfi_mod.o #comm_tod_quiet_mod.o -comm_data_mod.o : comm_noise_mod.o comm_bp_mod.o comm_beam_mod.o comm_tod_inst_mod.o +comm_data_mod.o : comm_noise_mod.o comm_bp_mod.o comm_beam_mod.o comm_tod_inst_mod.o comm_dust_extinction_mod.o comm_comp_mod.o : comm_cr_utils.o comm_cr_precond_mod.o comm_data_mod.o spline_2d_mod.o comm_f_int_mod.o : comm_bp_mod.o comm_comp_mod.o @@ -233,7 +297,7 @@ comm_f_mod.o : comm_f_int_mod.o comm_f_int_0d_mod.o comm_f_int_1d comm_cl_mod.o : comm_map_mod.o comm_bp_utils.o comm_diffuse_comp_mod.o : comm_f_mod.o comm_cl_mod.o comm_diffuse_comp_smod.o : comm_diffuse_comp_mod.o -comm_ptsrc_comp_mod.o : comm_f_mod.o +comm_ptsrc_comp_mod.o : comm_f_mod.o comm_sparse_mod.o comm_template_comp_mod.o : comm_f_mod.o comm_comp_interface_mod.o : comm_diffuse_comp_mod.o comm_ptsrc_comp_mod.o comm_template_comp_mod.o @@ -265,18 +329,6 @@ comm_signal_mod.o : comm_chisq_mod.o comm_cr_mod.o comm_ame_lognormal_ comm_mh_specind_mod.o : comm_signal_mod.o comm_gain_mod.o : comm_signal_mod.o comm_nonlin_mod.o : comm_gain_mod.o - comm_nonlin_smod.o : comm_nonlin_mod.o - -commander.o : comm_nonlin_mod.o comm_mh_specind_mod.o comm_zodi_samp_mod.o - - - - - - - - - - - +comm_nonlin_smod.o : comm_nonlin_mod.o +commander.o : comm_nonlin_mod.o comm_mh_specind_mod.o comm_zodi_samp_mod.o comm_sparse_mod.o diff --git a/commander3/src/comm_bp_mod.f90 b/commander3/src/comm_bp_mod.f90 index d214c8bed..c5e13786a 100644 --- a/commander3/src/comm_bp_mod.f90 +++ b/commander3/src/comm_bp_mod.f90 @@ -30,6 +30,7 @@ module comm_bp_mod integer(i4b) :: n, npar real(dp) :: threshold real(dp) :: nu_c, a2t, f2t, a2sz, unit_scale, nu_eff, a2f + real(dp) :: RJ2data real(dp), allocatable, dimension(:) :: nu0, nu, tau0, tau, delta, a2f_arr contains ! Data procedures @@ -180,8 +181,6 @@ function constructor_bp(cpar, id, id_abs, detlabel, subdets) result(c) end do c%tau0 = c%tau0 / ndet else - print *, "got to nonzero threshold, aborting" - stop call read_bandpass_nonzero_threshold(cpar%ds_bpfile(id_abs), dets, ndet, & & c%threshold, & & c%n, c%nu0, c%tau0) @@ -215,6 +214,27 @@ function constructor_bp(cpar, id, id_abs, detlabel, subdets) result(c) ! WARNING! Should be replaced with proper integral. See planck2013 HFI spectral response eq. 2 c%nu_eff = sum(c%tau*c%nu)/sum(c%tau) + + ! Initialize conversion from RJ to data units + select case (trim(cpar%ds_unit(id_abs))) + case ('uK_cmb') + c%RJ2data = c%a2t + case ('mK_cmb') + c%RJ2data = c%a2t * 1d-3 + case ('K_cmb') + c%RJ2data = c%a2t * 1d-6 + case ('MJy/sr') + c%RJ2data = c%a2f + case ('y_SZ') + c%RJ2data = c%a2sz + case ('uK_RJ') + c%RJ2data = 1.d0 + case ('K km/s') + write(*,*) 'Conversion from RJ to Kkm/s not implemented yet' + c%RJ2data = 1.d0 + case default + c%RJ2data = 1.d0 + end select end function constructor_bp diff --git a/commander3/src/comm_chisq_mod.f90 b/commander3/src/comm_chisq_mod.f90 index 7663c0e8d..c2d1eb0aa 100644 --- a/commander3/src/comm_chisq_mod.f90 +++ b/commander3/src/comm_chisq_mod.f90 @@ -24,7 +24,7 @@ module comm_chisq_mod contains - subroutine compute_chisq(comm, chisq_map, chisq_fullsky, mask, maskpath, lowres_eval, band_list, evalpol) + subroutine compute_chisq(comm, chisq_map, chisq_fullsky, mask, maskpath, lowres_eval, band_list, evalpol, ndof) implicit none integer(i4b), intent(in) :: comm logical(lgt), intent(in), optional :: lowres_eval @@ -36,6 +36,7 @@ subroutine compute_chisq(comm, chisq_map, chisq_fullsky, mask, maskpath, lowres_ type(map_ptr), dimension(1:), intent(in), optional :: mask character(len=512), intent(in), optional :: maskpath integer(i4b), dimension(:), intent(in), optional :: band_list + integer(i4b), intent(out), optional :: ndof integer(i4b) :: i, j, k, p, ierr, nmaps, nbands integer(i4b), dimension(:), allocatable :: bandlist @@ -78,6 +79,7 @@ subroutine compute_chisq(comm, chisq_map, chisq_fullsky, mask, maskpath, lowres_ if (present(chisq_fullsky) .or. present(chisq_map)) then if (present(chisq_fullsky)) chisq_fullsky = 0.d0 if (present(chisq_map)) chisq_map%map = 0.d0 + if (present(ndof)) ndof = 0 do p = 1, nbands i = bandlist(p) if (i == 0) cycle @@ -98,6 +100,11 @@ subroutine compute_chisq(comm, chisq_map, chisq_fullsky, mask, maskpath, lowres_ res%map = res%map * mask(i)%p%map else if (present(maskpath)) then mask_tmp => comm_map(data(i)%info, trim(maskpath), udgrade=.true.) + where(mask_tmp%map < 0.5d0) + mask_tmp%map = 0.d0 + elsewhere + mask_tmp%map = 1.d0 + end where res%map = res%map * mask_tmp%map call mask_tmp%dealloc(); deallocate(mask_tmp) end if @@ -138,8 +145,11 @@ subroutine compute_chisq(comm, chisq_map, chisq_fullsky, mask, maskpath, lowres_ if (present(chisq_fullsky)) then if (lowres) then chisq_fullsky = chisq_fullsky + sum(res_lowres%map) + if (present(ndof)) ndof = ndof + count(res_lowres%map /= 0.) else chisq_fullsky = chisq_fullsky + sum(res%map) + if (present(ndof)) ndof = ndof + count(res%map /= 0.) + !write(*,*) trim(data(i)%label), sum(res%map), chisq_fullsky end if end if @@ -153,6 +163,7 @@ subroutine compute_chisq(comm, chisq_map, chisq_fullsky, mask, maskpath, lowres_ if (present(chisq_fullsky)) then call mpi_allreduce(MPI_IN_PLACE, chisq_fullsky, 1, MPI_DOUBLE_PRECISION, MPI_SUM, comm, ierr) + if (present(ndof)) call mpi_allreduce(MPI_IN_PLACE, ndof, 1, MPI_INTEGER, MPI_SUM, comm, ierr) end if end subroutine compute_chisq @@ -448,7 +459,7 @@ subroutine get_sky_signal(band, det, map_out, mono, cmbmap, abscal_comps, gainma character(len=512), intent(in), optional :: abscal_comps class(comm_map), pointer, intent(inout), optional :: gainmap - integer(i4b) :: i, j, k, n + integer(i4b) :: i, j, k, n, nmaps logical(lgt) :: skip, mono_, calmap real(dp) :: rms_EE2_prior class(comm_map), pointer :: map_diff, cmbmap_band, gaindiff @@ -456,12 +467,23 @@ subroutine get_sky_signal(band, det, map_out, mono, cmbmap, abscal_comps, gainma real(dp), allocatable, dimension(:,:) :: map, alm real(dp), dimension(5) :: P_quad character(len=16), dimension(100) :: abscal_labels - + class(comm_mapinfo), pointer :: info_pol => null() + mono_ = .true.; if (present(mono)) mono_=mono ! Allocate map - map_out => comm_map(data(band)%info) - map_diff => comm_map(data(band)%info) + nmaps = data(band)%info%nmaps + if(nmaps > 3) nmaps = 3 + + if(data(band)%distribute_type == 'nplus2') then + info_pol => comm_mapinfo(data(band)%info%comm, data(band)%info%nside, data(band)%info%lmax, nmaps, data(band)%info%pol, & + &distribute_type=data(band)%info%distribute_type) + map_out => comm_map(info_pol) + map_diff => comm_map(info_pol) + else + map_out => comm_map(data(band)%info) + map_diff => comm_map(data(band)%info) + end if if (present(cmbmap)) then cmbmap_band => comm_map(data(band)%info) @@ -504,7 +526,7 @@ subroutine get_sky_signal(band, det, map_out, mono, cmbmap, abscal_comps, gainma else alm = c%getBand(band, alm_out=.true., det=det) end if - map_diff%alm = map_diff%alm + alm + map_diff%alm = map_diff%alm + alm(:,1:nmaps) if (calmap) then do i = 1, n if (trim(c%label) == trim(abscal_labels(i))) then @@ -516,7 +538,7 @@ subroutine get_sky_signal(band, det, map_out, mono, cmbmap, abscal_comps, gainma class is (comm_ptsrc_comp) allocate(map(0:data(band)%info%np-1,data(band)%info%nmaps)) map = c%getBand(band, det=det) - map_out%map = map_out%map + map + map_out%map = map_out%map + map(:, 1:nmaps) if (calmap) then do i = 1, n if (trim(c%label) == trim(abscal_labels(i))) then @@ -528,7 +550,7 @@ subroutine get_sky_signal(band, det, map_out, mono, cmbmap, abscal_comps, gainma class is (comm_template_comp) allocate(map(0:data(band)%info%np-1,data(band)%info%nmaps)) map = c%getBand(band, det=det) - map_out%map = map_out%map + map + map_out%map = map_out%map + map(:, 1:nmaps) if (calmap) then do i = 1, n if (trim(c%label) == trim(abscal_labels(i))) then diff --git a/commander3/src/comm_cl_mod.f90 b/commander3/src/comm_cl_mod.f90 index e7f4d069d..33c435108 100644 --- a/commander3/src/comm_cl_mod.f90 +++ b/commander3/src/comm_cl_mod.f90 @@ -129,6 +129,7 @@ function constructor(cpar, info, id, id_abs) constructor%lmin = cpar%cs_lmin_amp(id_abs) constructor%lmax = cpar%cs_lmax_amp(id_abs) constructor%lmax_prior = cpar%cs_lmax_amp_prior(id_abs) + constructor%l_apod = cpar%cs_l_apod(id_abs) constructor%unit = cpar%cs_unit(id_abs) constructor%nu_ref = cpar%cs_nu_ref(id_abs,:) constructor%nmaps = 1; if (cpar%cs_polarization(id_abs)) constructor%nmaps = 3 diff --git a/commander3/src/comm_cmb_comp_mod.f90 b/commander3/src/comm_cmb_comp_mod.f90 index f22eaa11c..7dc933eab 100644 --- a/commander3/src/comm_cmb_comp_mod.f90 +++ b/commander3/src/comm_cmb_comp_mod.f90 @@ -58,6 +58,8 @@ function constructor_cmb(cpar, id, id_abs) result(c) allocate(c) c%npar = 0 call c%initDiffuse(cpar, id, id_abs) + call c%initLmaxSpecind(cpar, id, id_abs) + ! Precompute mixmat integrator for each band allocate(c%F_int(3,numband,0:c%ndet)) @@ -109,7 +111,7 @@ subroutine updateIntF_cmb(self, band) cycle end if end if - f = comp_a2t(self%nu_ref(k)) / data(i)%bp(j)%p%a2t * data(i)%RJ2data(j) + f = comp_a2t(self%nu_ref(k)) / data(i)%bp(j)%p%a2t * data(i)%bp(j)%p%RJ2data !if (.not. associated(self%F_int(k,i,j)%p)) then self%F_int(k,i,j)%p => comm_F_int_0D(self, data(i)%bp(j)%p, k, f_precomp=f) !else diff --git a/commander3/src/comm_cr_mod.f90 b/commander3/src/comm_cr_mod.f90 index f3de77661..45e0283bd 100644 --- a/commander3/src/comm_cr_mod.f90 +++ b/commander3/src/comm_cr_mod.f90 @@ -35,18 +35,19 @@ module comm_cr_mod contains - subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat) + subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat, verbosity) implicit none type(comm_params), intent(in) :: cpar integer(i4b), intent(in) :: samp_group real(dp), dimension(1:), intent(out) :: x real(dp), dimension(1:), intent(in) :: b integer(i4b), intent(out) :: stat + integer(i4b), intent(in), optional :: verbosity - integer(i4b) :: i, j, k, l, m, n, maxiter, root, ierr + integer(i4b) :: i, j, k, l, m, n, maxiter, root, ierr, verbosity_ integer(i4b), save :: samp_group_prev real(dp) :: eps, tol, delta0, delta_new, delta_old, alpha, beta, t1, t2, t3, t4 - real(dp) :: lim_convergence, val_convergence, chisq, chisq_prev, buff + real(dp) :: lim_convergence, val_convergence, chisq, chisq_prev, buff, dq real(dp), allocatable, dimension(:) :: Ax, r, d, q, temp_vec, s, x_out real(dp), allocatable, dimension(:,:) :: alm, pamp class(comm_comp), pointer :: c => null() @@ -55,6 +56,7 @@ subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat) maxiter = cpar%cg_samp_group_maxiter(samp_group) eps = cpar%cg_tol n = size(x) + verbosity_ = cpar%verbosity; if (present(verbosity)) verbosity_ = verbosity ! Allocate temporary data vectors call update_status(status, "cr1") @@ -67,7 +69,7 @@ subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat) samp_group_prev = samp_group !call update_status(status, "cr3") call wall_time(t2) - if (cpar%myid_chain == root .and. cpar%verbosity > 2) then + if (cpar%myid_chain == root .and. verbosity_ > 2) then write(*,fmt='(a,f8.2)') ' | CG initialize preconditioner, time = ', real(t2-t1,sp) end if @@ -94,7 +96,7 @@ subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat) deallocate(alm) end if class is (comm_ptsrc_comp) - if (c%myid == 0 .and. .not. c%precomputed_amps) then + if (c%myid == 0 .and. allocated(c%src(1)%P_x)) then call cr_extract_comp(c%id, x, pamp) do j = 1, c%nmaps do i = 1, c%nsrc @@ -139,6 +141,15 @@ subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat) !!$ call mpi_finalize(ierr) !!$ stop +!!$ x = 0.d0 +!!$ x(1) = 1.d0 +!!$ r = cr_matmulA(x, samp_group) ! x is zero +!!$ +!!$ write(*,*) 'Ax = ', r +!!$ +!!$ call mpi_finalize(ierr) +!!$ stop + call update_status(status, "cr4") r = b - cr_matmulA(x, samp_group) ! x is zero call update_status(status, "cr5") @@ -194,7 +205,12 @@ subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat) !if (delta_new < eps * delta0 .and. (i >= cpar%cg_miniter .or. delta_new <= 1d-30 * delta0)) exit q = cr_matmulA(d, samp_group) - alpha = delta_new / mpi_dot_product(cpar%comm_chain, d, q) + dq = mpi_dot_product(cpar%comm_chain, d, q) +!!$ if (dq == 0.d0) then +!!$ val_convergence = 0.d0 +!!$ cycle +!!$ end if + alpha = delta_new / dq x = x + alpha * d ! Restart every 50th iteration to suppress numerical errors @@ -203,8 +219,8 @@ subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat) else r = r - alpha*q end if - - call update_status(status, "cg3") + + call update_status(status, "cg3") call wall_time(t3) s = cr_invM(cpar%comm_chain, r, samp_group) call wall_time(t4) @@ -239,7 +255,7 @@ subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat) deallocate(alm) end if class is (comm_ptsrc_comp) - if (c%myid == 0 .and. .not. c%precomputed_amps) then + if (c%myid == 0 .and. allocated(c%src(1)%P_x)) then call cr_extract_comp(c%id, x_out, pamp) do j = 1, c%nmaps do k = 1, c%nsrc @@ -270,7 +286,7 @@ subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat) !if (cpar%myid == root) write(*,*) x(size(x)-1:size(x)) call wall_time(t2) - if (cpar%myid_chain == root .and. cpar%verbosity > 2) then + if (cpar%myid_chain == root .and. verbosity_ > 2) then if (trim(cpar%cg_conv_crit) == 'residual' .or. trim(cpar%cg_conv_crit) == 'fixed_iter') then !!$ write(*,*) ' CG iter. ', i, ' -- res = ', & !!$ & val_convergence, ', tol = ', lim_convergence, & @@ -313,7 +329,7 @@ subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat) deallocate(alm) end if class is (comm_ptsrc_comp) - if (c%myid == 0 .and. .not. c%precomputed_amps) then + if (c%myid == 0 .and. allocated(c%src(1)%P_x)) then call cr_extract_comp(c%id, x, pamp) do j = 1, c%nmaps do k = 1, c%nsrc @@ -340,7 +356,7 @@ subroutine solve_cr_eqn_by_CG(cpar, samp_group, x, b, stat) write(*,*) ' number of iterations = ', maxiter stat = stat + 1 else - if (cpar%myid_chain == root .and. cpar%verbosity > 1) then + if (cpar%myid_chain == root .and. verbosity_ > 1) then write(*,fmt='(a,i5,a,e13.5,a,e13.5,a,f8.2)') ' | Final CG iter ', i, ' -- res = ', & & real(val_convergence,sp), ', tol = ', real(lim_convergence,sp) end if @@ -383,7 +399,7 @@ subroutine cr_compute_chisq(comm, samp_group, x, chisq) deallocate(alm) end if class is (comm_ptsrc_comp) - if (c%myid == 0 .and. .not. c%precomputed_amps) then + if (c%myid == 0 .and. allocated(c%src(1)%P_x)) then call cr_extract_comp(c%id, x_out, pamp) do j = 1, c%nmaps do k = 1, c%nsrc @@ -429,9 +445,9 @@ subroutine cr_amp2x_full(samp_group, x) ind = ind + c%x%info%nalm end do class is (comm_ptsrc_comp) - if (c%myid == 0 .and. .not. c%precomputed_amps) then + if (c%myid == 0) then do i = 1, c%nmaps - if (c%active_samp_group(samp_group)) x(ind:ind+c%nsrc-1) = c%x(:,i) + if (c%active_samp_group(samp_group)) x(ind:ind+c%nsrc-1) = c%x(1:c%nsrc,i) ind = ind + c%nsrc end do end if @@ -466,7 +482,7 @@ subroutine cr_x2amp_full(samp_group, x) class is (comm_ptsrc_comp) do i = 1, c%nmaps if (c%myid == 0) then - if (c%active_samp_group(samp_group)) c%x(:,i) = x(ind:ind+c%nsrc-1) + if (c%active_samp_group(samp_group)) c%x(1:c%nsrc,i) = x(ind:ind+c%nsrc-1) ind = ind + c%nsrc end if end do @@ -608,20 +624,19 @@ subroutine cr_computeRHS(operation, resamp_cmb, only_pol, handle, handle_noise, call Tm%dealloc(); deallocate(Tm) nullify(info) class is (comm_ptsrc_comp) - if(.not. c%precomputed_amps) then - - allocate(Tp(c%nsrc,c%nmaps)) - Tp = c%projectBand(i,map) - if (c%myid == 0) then - do j = 1, c%nmaps - do k = 1, c%nsrc - Tp(k,j) = Tp(k,j) * c%src(k)%P_x(j,2) - end do - end do - call cr_insert_comp(c%id, .true., Tp, rhs) - end if - deallocate(Tp) + allocate(Tp(c%nsrc,c%nmaps)) + Tp = c%projectBand(i,map) + if (c%myid == 0) then + if (allocated(c%src(1)%P_x)) then + do j = 1, c%nmaps + do k = 1, c%nsrc + Tp(k,j) = Tp(k,j) * c%src(k)%P_x(j,2) + end do + end do + end if + call cr_insert_comp(c%id, .true., Tp, rhs) end if + deallocate(Tp) class is (comm_template_comp) allocate(Tp(1,1)) Tp = c%projectBand(i,map) @@ -678,27 +693,25 @@ subroutine cr_computeRHS(operation, resamp_cmb, only_pol, handle, handle_noise, deallocate(eta) end if class is (comm_ptsrc_comp) - if (.not. c%precomputed_amps) then - if (c%myid == 0) then - allocate(eta(1:c%nsrc,c%nmaps)) - eta = 0.d0 - ! Variance term - if (trim(operation) == 'sample') then - do j = 1, c%nmaps - do i = 1, c%nsrc - eta(i,j) = rand_gauss(handle) - end do - end do - end if - ! Mean term - do j = 1, c%nmaps - do i = 1, c%nsrc - eta(i,j) = eta(i,j) + c%src(i)%P_x(j,1)/c%src(i)%P_x(j,2) - end do - end do - call cr_insert_comp(c%id, .true., eta, rhs) - deallocate(eta) - end if + if (c%myid == 0 .and. allocated(c%src(1)%P_x)) then + allocate(eta(1:c%nsrc,c%nmaps)) + eta = 0.d0 + ! Variance term + if (trim(operation) == 'sample') then + do j = 1, c%nmaps + do i = 1, c%nsrc + eta(i,j) = rand_gauss(handle) + end do + end do + end if + ! Mean term + do j = 1, c%nmaps + do i = 1, c%nsrc + eta(i,j) = eta(i,j) + c%src(i)%P_x(j,1)/c%src(i)%P_x(j,2) + end do + end do + call cr_insert_comp(c%id, .true., eta, rhs) + deallocate(eta) end if class is (comm_template_comp) if (c%myid == 0) then @@ -741,6 +754,7 @@ function cr_matmulA(x, samp_group) !call update_status(status, "A1") allocate(y(ncr), sqrtS_x(ncr)) y = 0.d0 + myid = data(1)%map%info%myid ! Multiply with sqrt(S) call wall_time(t1) @@ -749,7 +763,7 @@ function cr_matmulA(x, samp_group) !call update_status(status, "A3") c => compList lmax = -1 -! !write(*,*) 'df2' + ! !write(*,*) 'df2' do while (associated(c)) if (.not. c%active_samp_group(samp_group)) then c => c%nextComp() @@ -768,7 +782,7 @@ function cr_matmulA(x, samp_group) end if lmax = max(max(lmax, c%lmax_amp),2) class is (comm_ptsrc_comp) - if (c%myid == 0 .and. .not. c%precomputed_amps) then + if (c%myid == 0 .and. allocated(c%src(1)%P_x)) then call cr_extract_comp(c%id, sqrtS_x, pamp) do j = 1, c%nmaps do i = 1, c%nsrc @@ -789,6 +803,8 @@ function cr_matmulA(x, samp_group) c => c%nextComp() end do call wall_time(t2) + !if (myid == 0) write(*,fmt='(a,f8.2)') 'sqrtS time = ', real(t2-t1,sp) + !write(*,*) 'df3' ! Add frequency dependent terms @@ -829,13 +845,11 @@ function cr_matmulA(x, samp_group) deallocate(alm, m) !write(*,*) 'df6' class is (comm_ptsrc_comp) - if(.not. c%precomputed_amps) then - call cr_extract_comp(c%id, sqrtS_x, pamp) - allocate(m(0:data(i)%info%np-1,data(i)%info%nmaps)) - m = c%getBand(i, amp_in=pamp) - pmap%map = pmap%map + m - deallocate(pamp, m) - end if + call cr_extract_comp(c%id, sqrtS_x, pamp) + allocate(m(0:data(i)%info%np-1,data(i)%info%nmaps)) + m = c%getBand(i, amp_in=pamp) + pmap%map = pmap%map + m + deallocate(pamp, m) class is (comm_template_comp) call cr_extract_comp(c%id, sqrtS_x, pamp) allocate(m(0:data(i)%info%np-1,data(i)%info%nmaps)) @@ -865,6 +879,7 @@ function cr_matmulA(x, samp_group) !call update_status(status, "A11") !write(*,*) 'c', sum(abs(pmap%map)) call wall_time(t2) + !if (myid == 0) !write(*,fmt='(a,f8.2)') 'getBand time = ', real(t2-t1,sp) !write(*,*) 'df5' ! Multiply with invN @@ -872,7 +887,8 @@ function cr_matmulA(x, samp_group) call data(i)%N%InvN(map, samp_group=samp_group) call wall_time(t2) !call update_status(status, "A12") - + !if (myid == 0) write(*,fmt='(a,f8.2)') 'invN time = ', real(t2-t1,sp) + ! Project summed map into components, ie., row-wise matrix elements call wall_time(t1) c => compList @@ -900,12 +916,10 @@ function cr_matmulA(x, samp_group) call cr_insert_comp(c%id, .true., alm, y) deallocate(alm) class is (comm_ptsrc_comp) - if(.not. c%precomputed_amps) then - allocate(pamp(0:c%nsrc-1,c%nmaps)) - pamp = c%projectBand(i, map) - if (c%myid == 0) call cr_insert_comp(c%id, .true., pamp, y) - deallocate(pamp) - end if + allocate(pamp(0:c%nsrc-1,c%nmaps)) + pamp = c%projectBand(i, map) + if (c%myid == 0) call cr_insert_comp(c%id, .true., pamp, y) + deallocate(pamp) class is (comm_template_comp) allocate(pamp(1,1)) pamp = c%projectBand(i, map) @@ -922,7 +936,7 @@ function cr_matmulA(x, samp_group) end do !call update_status(status, "A16") !write(*,*) 'df6' - + ! Add prior term and multiply with sqrt(S) for relevant components call wall_time(t1) c => compList @@ -949,7 +963,7 @@ function cr_matmulA(x, samp_group) end if !write(*,*) 'df9' class is (comm_ptsrc_comp) - if (c%myid == 0 .and. .not. c%precomputed_amps) then + if (c%myid == 0 .and. allocated(c%src(1)%P_x)) then ! Multiply with sqrt(Cl) call cr_extract_comp(c%id, y, pamp) do j = 1, c%nmaps @@ -1021,9 +1035,9 @@ function cr_invM(comm, x, samp_group) !!$ call mpi_finalize(ierr) !!$ stop - call applyDiffPrecond(cr_invM) - call applyPtsrcPrecond(cr_invM) - call applyTemplatePrecond(cr_invM) + call applyDiffPrecond(cr_invM, samp_group) + call applyPtsrcPrecond(cr_invM, samp_group) + call applyTemplatePrecond(cr_invM, samp_group) if (Q_is_active) cr_invM = cr_invM + Qx diff --git a/commander3/src/comm_cr_precond_mod.f90 b/commander3/src/comm_cr_precond_mod.f90 index a234492ab..00bb40ec9 100644 --- a/commander3/src/comm_cr_precond_mod.f90 +++ b/commander3/src/comm_cr_precond_mod.f90 @@ -20,6 +20,7 @@ !================================================================================ module comm_cr_precond_mod use comm_utils + use comm_sparse_mod implicit none type invM @@ -28,12 +29,18 @@ module comm_cr_precond_mod real(dp), allocatable, dimension(:,:) :: M0, M end type invM + type invM_sparse + integer(i4b) :: n + integer(i4b), allocatable, dimension(:) :: ind, comp2ind + class(sparse_system), pointer :: M + end type invM_sparse + type precond - type(invM), allocatable, dimension(:,:) :: invM_diff ! (0:nalm-1,nmaps) - type(invM), allocatable, dimension(:,:) :: invM_src ! (1,nmaps) - type(invM), allocatable, dimension(:,:) :: invM_temp ! (1,1) + type(invM), allocatable, dimension(:,:) :: invM_diff ! (0:nalm-1,nmaps) + type(invM_sparse), allocatable, dimension(:,:) :: invM_src ! (1,nmaps) + type(invM), allocatable, dimension(:,:) :: invM_temp ! (1,1) end type precond - type(precond) :: P_cr + type(precond), allocatable, dimension(:) :: P_cr ! (n_sampgroup) end module comm_cr_precond_mod diff --git a/commander3/src/comm_data_mod.f90 b/commander3/src/comm_data_mod.f90 index fdf405543..632071c07 100644 --- a/commander3/src/comm_data_mod.f90 +++ b/commander3/src/comm_data_mod.f90 @@ -23,6 +23,7 @@ module comm_data_mod use comm_noise_mod use comm_beam_mod use comm_tod_inst_mod + use comm_dust_extinction_mod implicit none type comm_data_set @@ -38,13 +39,13 @@ module comm_data_mod real(dp) :: gain, gain_tmp, gain_prior(2) real(dp), allocatable, dimension(:) :: gain_sigmas character(len=128) :: gain_comp - character(len=128) :: rescale_comp integer(i4b) :: gain_lmin, gain_lmax integer(i4b) :: ndet character(len=128) :: tod_type integer(i4b) :: tod_freq logical(lgt) :: pol_only, subtract_zodi logical(lgt) :: cr_active + character(len=128) :: distribute_type class(comm_mapinfo), pointer :: info => null() class(comm_mapinfo), pointer :: rmsinfo => null() @@ -56,6 +57,7 @@ module comm_data_mod class(comm_map), pointer :: mask => null() class(comm_map), pointer :: procmask => null() class(comm_map), pointer :: gainmask => null() + class(comm_map), pointer :: A_ext => null() class(comm_tod), pointer :: tod => null() class(comm_N), pointer :: N => null() class(B_ptr), allocatable, dimension(:) :: B @@ -64,7 +66,6 @@ module comm_data_mod type(comm_B_bl_ptr), allocatable, dimension(:) :: B_postproc class(comm_N_ptr), allocatable, dimension(:) :: N_smooth contains - procedure :: RJ2data procedure :: chisq => get_chisq !procedure :: apply_proc_mask end type comm_data_set @@ -84,12 +85,12 @@ subroutine initialize_data_mod(cpar, handle) type(comm_params), intent(in) :: cpar type(planck_rng), intent(inout) :: handle - integer(i4b) :: i, j, k, n, nmaps, numband_tot, ierr + integer(i4b) :: i, j, k, n, nmaps, numband_tot, ierr, ndets character(len=512) :: dir, mapfile class(comm_N), pointer :: tmp => null() class(comm_map), pointer :: smoothed_rms => null() class(comm_mapinfo), pointer :: info_smooth => null(), info_postproc => null() - class(comm_mapinfo), pointer :: smoothed_rms_info => null() + class(comm_mapinfo), pointer :: smoothed_rms_info => null(), info_ext => null() real(dp), allocatable, dimension(:) :: nu real(dp), allocatable, dimension(:,:) :: regnoise, mask_misspix @@ -121,8 +122,10 @@ subroutine initialize_data_mod(cpar, handle) data(n)%tod_type = cpar%ds_tod_type(i) data(n)%subtract_zodi = cpar%ds_tod_subtract_zodi(i) data(n)%noise_format = cpar%ds_noise_format(i) + data(n)%distribute_type = '' allocate(data(n)%gain_stat(cpar%mcmc_num_user_samp_groups)) + data(n)%gain_stat = 0 if (cpar%myid == 0 .and. cpar%verbosity > 0) & @@ -130,15 +133,28 @@ subroutine initialize_data_mod(cpar, handle) call update_status(status, "data_"//trim(data(n)%label)) ! Initialize map structures - nmaps = 1; if (cpar%ds_polarization(i)) nmaps = 3 + nmaps = 1 + if (cpar%ds_polarization(i)) then + nmaps = 3 + end if + if (data(n)%tod_type /= 'none') then + if (cpar%ds_tod_map_type(i) == 'nplus2') then + data(n)%distribute_type = 'nplus2' + ndets = num_tokens(trim(cpar%ds_tod_dets(i)), ",") + nmaps = ndets + 3 + end if + end if + data(n)%info => comm_mapinfo(cpar%comm_chain, cpar%ds_nside(i), cpar%ds_lmax(i), & - & nmaps, cpar%ds_polarization(i)) + & nmaps, cpar%ds_polarization(i), distribute_type=data(n)%distribute_type) call get_mapfile(cpar, i, mapfile) data(n)%map => comm_map(data(n)%info, trim(mapfile), mask_misspix=mask_misspix) if (trim(data(n)%noise_format) == 'rms_qucov' .and. cpar%ds_polarization(i)) then data(n)%rmsinfo => comm_mapinfo(cpar%comm_chain, cpar%ds_nside(i), cpar%ds_lmax(i), & - & nmaps+1, cpar%ds_polarization(i)) - else + & nmaps+1, cpar%ds_polarization(i), distribute_type=data(n)%distribute_type) + end if + + if(.not. associated(data(n)%rmsinfo)) then data(n)%rmsinfo => data(n)%info end if if (cpar%only_pol) data(n)%map%map(:,1) = 0.d0 @@ -187,7 +203,7 @@ subroutine initialize_data_mod(cpar, handle) write(*,*) 'Unrecognized TOD experiment type = ', trim(data(n)%tod_type) stop end if - + if (trim(cpar%ds_tod_type(i)) /= 'none') then data(n)%map0 => comm_map(data(n)%map) !copy the input map that has no added regnoise, for output to HDF data(n)%tod_freq = cpar%ds_tod_freq(i) @@ -281,24 +297,26 @@ subroutine initialize_data_mod(cpar, handle) call update_status(status, "data_N") ! Initialize bandpass structures; 0 is full freq, j is detector - allocate(data(n)%bp(0:data(n)%ndet)) - + allocate(data(n)%bp(0:data(n)%ndet)) do j = 1, data(n)%ndet if (j==1) then - data(n)%bp(j)%p => comm_bp(cpar, n, i, detlabel=trim(data(n)%tod%label(j))) + data(n)%bp(1)%p => comm_bp(cpar, n, i, detlabel=trim(data(n)%tod%label(j))) else ! Check if bandpass already exists in detector list - call read_bandpass(trim(cpar%ds_bpfile(i)), & - & trim(data(n)%tod%label(j)),& - & 0.d0, & + call read_bandpass(trim(adjustl(cpar%ds_bpfile(i))), & + & trim(data(n)%tod%label(j)), & + & data(n)%bp(1)%p%threshold, & & n_dummy, & & nu_dummy, & & tau_dummy) - do k=1, j - if (all(tau_dummy==data(n)%bp(k)%p%tau0)) then + do k=1, j-1 + if(size(tau_dummy)==size(data(n)%bp(k)%p%tau0)) then + if (all(tau_dummy==data(n)%bp(k)%p%tau0)) then data(n)%bp(j)%p => data(n)%bp(k)%p ! If bp exists, point to existing object exit - else if (k==j-1) then + end if + end if + if(k==j-1) then !if we got through the whole loop above data(n)%bp(j)%p => comm_bp(cpar, n, i, detlabel=trim(data(n)%tod%label(j))) end if end do @@ -311,6 +329,25 @@ subroutine initialize_data_mod(cpar, handle) else data(n)%bp(0)%p => comm_bp(cpar, n, i, subdets=cpar%ds_tod_dets(i)) end if + ! Set up bp pointers in the TOD object + if (cpar%enable_TOD_analysis) then + if (data(n)%ndet .ne. 0) then + allocate(data(n)%tod%bp(0:data(n)%ndet)) + do j = 0, data(n)%ndet + data(n)%tod%bp(j)%p => data(n)%bp(j)%p + end do + end if + end if + + ! Initialize dust extinction map + if (active_dust_ext_model(data(n)%bp(0)%p%nu_c)) then + info_smooth => comm_mapinfo(data(n)%info%comm, data(n)%info%nside, & + & -1, 1, .false.) + data(n)%A_ext => comm_map(data(n)%info) + call get_dust_attenuation_map(data(n)%bp(0)%p%nu_c, data(n)%A_ext) + call data(n)%A_ext%writeFITS(trim(cpar%outdir)//'/dust_ext_'//trim(data(n)%label)//'.fits') + end if + ! Initialize smoothed data structures allocate(data(n)%B_smooth(cpar%num_smooth_scales)) allocate(data(n)%B_postproc(cpar%num_smooth_scales)) @@ -389,37 +426,6 @@ function get_chisq(self) end function get_chisq - function RJ2data(self, det) - implicit none - - class(comm_data_set), intent(in) :: self - integer(i4b), intent(in), optional :: det - real(dp) :: RJ2data - - integer(i4b) :: d - - d = 0; if (present(det)) d = det - - select case (trim(self%unit)) - case ('uK_cmb') - RJ2data = self%bp(d)%p%a2t - case ('mK_cmb') - RJ2data = self%bp(d)%p%a2t * 1d-3 - case ('K_cmb') - RJ2data = self%bp(d)%p%a2t * 1d-6 - case ('MJy/sr') - RJ2data = self%bp(d)%p%a2f - case ('y_SZ') - RJ2data = self%bp(d)%p%a2sz - case ('uK_RJ') - RJ2data = 1.d0 - case ('K km/s') - RJ2data = 1.d0 - case default - RJ2data = 1.d0 - end select - - end function RJ2data subroutine dump_unit_conversion(dir) implicit none @@ -673,7 +679,7 @@ subroutine get_mapfile(cpar, band, mapfile) integer(i4b), intent(in) :: band character(len=*), intent(out) :: mapfile - integer(i4b) :: i, n, unit + integer(i4b) :: i, j, n, unit character(len=512) :: filename filename = trim(adjustl(cpar%ds_mapfile(band))) @@ -698,6 +704,7 @@ subroutine initialize_inter_tod_params(cpar) type(comm_params), intent(in) :: cpar integer(i4b) :: i, j + real(sp) :: elon character(len=512) :: model ! Initialize solar centric maps @@ -725,6 +732,61 @@ subroutine initialize_inter_tod_params(cpar) end if end do + ! Initialize Moon centric maps + do i = 1, numband + if (trim(data(i)%tod_type) == 'none') cycle + data(i)%tod%map_moon_allocated = .false. + model = cpar%ds_tod_moon_model(data(i)%tod%band) + if (trim(model) == 'none') cycle + if (model(1:1) == '>') then + do j = 1, numband + if (trim(data(j)%label) == trim(model(2:))) then + data(i)%tod%map_moon => data(j)%tod%map_moon + exit + end if + end do + cycle + else + data(i)%tod%map_moon_allocated = .true. + allocate(data(i)%tod%map_moon(0:data(i)%info%npix-1,1)) + if (trim(cpar%ds_tod_moon_init(data(i)%tod%band)) == 'none') then + data(i)%tod%map_moon = 0.d0 + else + call read_map(cpar%ds_tod_moon_init(data(i)%tod%band), data(i)%tod%map_moon) + end if + end if + end do + + ! Initialize Earth elongation profiles + do i = 1, numband + if (trim(data(i)%tod_type) == 'none') cycle + data(i)%tod%map_earth_allocated = .false. + model = cpar%ds_tod_earth_model(data(i)%tod%band) + if (trim(model) == 'none') cycle + if (model(1:1) == '>') then + do j = 1, numband + if (trim(data(j)%label) == trim(model(2:))) then + data(i)%tod%map_earth => data(j)%tod%map_earth + exit + end if + end do + cycle + else + data(i)%tod%map_earth_allocated = .true. + allocate(data(i)%tod%map_earth(1:NBIN_EARTH_ELON)) + if (trim(cpar%ds_tod_earth_init(data(i)%tod%band)) == 'none') then + data(i)%tod%map_earth = 0.d0 + else + open(58,file=trim(cpar%ds_tod_earth_init(data(i)%tod%band))) + do j = 1, NBIN_EARTH_ELON + read(58,*) elon, data(i)%tod%map_earth(j) + end do + close(58) + end if + end if + end do + + end subroutine initialize_inter_tod_params diff --git a/commander3/src/comm_defs.f90 b/commander3/src/comm_defs.f90 index 755f2a162..f217c16df 100644 --- a/commander3/src/comm_defs.f90 +++ b/commander3/src/comm_defs.f90 @@ -33,12 +33,18 @@ module comm_defs real(dp) :: v_solar(3)= [0.d0, 0.d0, 0.d0] real(dp) :: EXP_OVERFLOW = 700.d0 real(dp) :: SECOND_TO_DAY = 1.1574074074074073e-05 - integer(i4b) :: zodi_nside = 64 + integer(i4b) :: zodi_nside = 512 !************************************************** ! Counters !************************************************** integer(i4b), parameter :: GAIN = 1 integer(i4b), parameter :: NOISEAMP = 2 + + !************************************************** + ! Constants + !************************************************** + + integer(i4b), parameter :: NBIN_EARTH_ELON = 180 end module comm_defs diff --git a/commander3/src/comm_diffuse_comp_mod.f90 b/commander3/src/comm_diffuse_comp_mod.f90 index df114bfdf..74a09ac83 100644 --- a/commander3/src/comm_diffuse_comp_mod.f90 +++ b/commander3/src/comm_diffuse_comp_mod.f90 @@ -36,7 +36,7 @@ module comm_diffuse_comp_mod ! only interfaces in this file, accompanying smod.f character(len=512) :: cltype integer(i4b) :: nside, nx, x0, ndet logical(lgt) :: pol, output_mixmat, output_EB, apply_jeffreys, almsamp_pixreg, priorsamp_local - logical(lgt) :: output_localsamp_maps + logical(lgt) :: output_localsamp_maps, apply_dust_ext integer(i4b) :: lmin_amp, lmax_amp, lmax_ind, lmax_prior, lpiv, l_apod, lmax_pre_lowl integer(i4b) :: lmax_def, nside_def, ndef, nalm_tot, sample_first_niter @@ -97,6 +97,7 @@ module comm_diffuse_comp_mod ! only interfaces in this file, accompanying smod.f class(comm_map), pointer :: defmask => null() class(comm_map), pointer :: priormask => null() class(comm_map), pointer :: x => null() ! Spatial parameters + real(dp) :: x_scale !overall scaling parameter for component class(comm_map), pointer :: x_smooth => null() ! Spatial parameters class(comm_map), pointer :: mu => null() ! Spatial prior mean class(comm_B), pointer :: B_out => null() ! Output beam @@ -112,9 +113,9 @@ module comm_diffuse_comp_mod ! only interfaces in this file, accompanying smod.f logical(lgt), dimension(:,:), allocatable :: F_null ! Don't allocate space for null mixmat's type(F_int_ptr), dimension(:,:,:), allocatable :: F_int ! SED integrator integer(i4b) :: ntab - real(dp), allocatable, dimension(:,:) :: SEDtab - real(dp), allocatable, dimension(:,:) :: SEDtab_buff - real(dp) :: SEDtab_prior ! Single value for MH proposals, per comp + real(dp), allocatable, dimension(:,:) :: SEDtab ! (2+npar_tab, nbin) + real(dp), allocatable, dimension(:,:) :: SEDtab_buff ! + real(dp) :: SEDtab_prior ! (npar_tab), Single value for MH proposals, per comp contains procedure :: initDiffuse procedure :: initPixregSampling @@ -244,24 +245,24 @@ module subroutine initSpecindProp(self,cpar, id, id_abs) end subroutine initSpecindProp - module subroutine initDiffPrecond(comm) + module subroutine initDiffPrecond(comm, samp_group) implicit none - integer(i4b), intent(in) :: comm + integer(i4b), intent(in) :: comm, samp_group end subroutine initDiffPrecond - module subroutine initDiffPrecond_diagonal(comm) + module subroutine initDiffPrecond_diagonal(comm, samp_group) implicit none - integer(i4b), intent(in) :: comm + integer(i4b), intent(in) :: comm, samp_group end subroutine initDiffPrecond_diagonal - module subroutine initDiffPrecond_pseudoinv(comm) + module subroutine initDiffPrecond_pseudoinv(comm, samp_group) implicit none - integer(i4b), intent(in) :: comm + integer(i4b), intent(in) :: comm, samp_group end subroutine initDiffPrecond_pseudoinv @@ -335,25 +336,28 @@ module function projectDiffuseBand(self, band, map, alm_in, det) result(res) end function projectDiffuseBand - module subroutine applyDiffPrecond(x) + module subroutine applyDiffPrecond(x, samp_group) implicit none real(dp), dimension(:), intent(inout) :: x + integer(i4b), intent(in) :: samp_group end subroutine applyDiffPrecond - module subroutine applyDiffPrecond_diagonal(x) + module subroutine applyDiffPrecond_diagonal(x, samp_group) implicit none real(dp), dimension(:), intent(inout) :: x + integer(i4b), intent(in) :: samp_group end subroutine applyDiffPrecond_diagonal - module subroutine applyDiffPrecond_pseudoinv(x) + module subroutine applyDiffPrecond_pseudoinv(x, samp_group) implicit none real(dp), dimension(:), intent(inout) :: x + integer(i4b), intent(in) :: samp_group end subroutine applyDiffPrecond_pseudoinv @@ -433,8 +437,9 @@ end function lnL_diffuse_multi - module subroutine print_precond_mat + module subroutine print_precond_mat(samp_group) implicit none + integer(i4b), intent(in) :: samp_group end subroutine print_precond_mat module subroutine updateDiffuseFInt(self, band) @@ -479,10 +484,11 @@ module subroutine setup_needlets(info, nside_def, defmask, Z, ndef) integer(i4b), intent(out) :: ndef end subroutine setup_needlets - module subroutine applyMonoDipolePrior(self, handle) + module subroutine applyMonoDipolePrior(self, handle, verbosity) implicit none class(comm_diffuse_comp), intent(inout) :: self type(planck_rng), intent(inout) :: handle + integer(i4b), intent(in), optional :: verbosity end subroutine applyMonoDipolePrior module subroutine nullify_monopole_amp(band) diff --git a/commander3/src/comm_diffuse_comp_smod.f90 b/commander3/src/comm_diffuse_comp_smod.f90 index c034349f9..e76ab1f40 100644 --- a/commander3/src/comm_diffuse_comp_smod.f90 +++ b/commander3/src/comm_diffuse_comp_smod.f90 @@ -63,20 +63,15 @@ module subroutine initDiffuse(self, cpar, id, id_abs) call update_status(status, "init_diffuse_start") ! Initialize variables specific to diffuse source type - self%pol = cpar%cs_polarization(id_abs) - self%nside = cpar%cs_nside(id_abs) - self%lmin_amp = cpar%cs_lmin_amp(id_abs) - self%lmax_amp = cpar%cs_lmax_amp(id_abs) - self%lmax_prior = cpar%cs_lmax_amp_prior(id_abs) - self%l_apod = cpar%cs_l_apod(id_abs) - self%nu_min = cpar%cs_nu_min(id_abs) - self%nu_max = cpar%cs_nu_max(id_abs) - - if(self%npar == 0) then - self%lmax_ind = 0 !default - allocate(self%lmax_ind_mix(3,1)) - self%lmax_ind_mix = 0 - end if + self%pol = cpar%cs_polarization(id_abs) + self%nside = cpar%cs_nside(id_abs) + self%lmin_amp = cpar%cs_lmin_amp(id_abs) + self%lmax_amp = cpar%cs_lmax_amp(id_abs) + self%lmax_prior = cpar%cs_lmax_amp_prior(id_abs) + self%l_apod = cpar%cs_l_apod(id_abs) + self%nu_min = cpar%cs_nu_min(id_abs) + self%nu_max = cpar%cs_nu_max(id_abs) + self%apply_dust_ext = cpar%cs_apply_dust_ext(id_abs) self%cltype = cpar%cs_cltype(id_abs) self%cg_scale(1:3) = cpar%cs_cg_scale(1:3,id_abs) @@ -86,6 +81,7 @@ module subroutine initDiffuse(self, cpar, id, id_abs) self%apply_jeffreys = .false. self%sample_first_niter = cpar%cs_local_burn_in self%output_localsamp_maps = cpar%cs_output_localsamp_maps + self%x_scale = 1.d0 only_pol = cpar%only_pol only_I = cpar%only_I @@ -140,6 +136,21 @@ module subroutine initDiffuse(self, cpar, id, id_abs) self%B_out => comm_B_bl(cpar, self%x%info, 0, 0, fwhm=cpar%cs_fwhm(id_abs), nside=self%nside,& & init_realspace=.false.) + ! Deconvolve the existing beam if initialized from an input map + if (trim(cpar%cs_input_amp(id_abs)) /= 'zero' .and. trim(cpar%cs_input_amp(id_abs)) /= 'none') then + do i = 0, self%x%info%nalm-1 + call self%x%info%i2lm(i,l,m) + where (self%B_out%b_l(l,:) > 1d-6) + self%x%alm(i,:) = self%x%alm(i,:) / self%B_out%b_l(l,:) + elsewhere + self%x%alm(i,:) = 0.d0 + end where +!!$ if (l > 500) then +!!$ self%x%alm(i,:) = self%x%alm(i,:) * real(500.d0/l,dp)**20 +!!$ end if + end do + end if + ! Read component mask if (trim(cpar%cs_mask(id_abs)) /= 'fullsky' .and. self%latmask < 0.d0) then self%mask => comm_map(self%x%info, trim(cpar%cs_mask(id_abs)), & @@ -224,15 +235,18 @@ module subroutine initDiffuse(self, cpar, id, id_abs) self%F(i,j)%p => comm_map(info) self%F_null(i,j) = .false. else - do k=1, j - if (all(data(i)%bp(k)%p%tau0==data(i)%bp(j)%p%tau0)) then + do k=1, j-1 + if(size(data(i)%bp(k)%p%tau0) == size(data(i)%bp(j)%p%tau0)) then + if (all(data(i)%bp(k)%p%tau0==data(i)%bp(j)%p%tau0)) then self%F(i,j)%p => self%F(i,k)%p self%F_null(i,j) = .false. exit - else if (k==j-1) then - self%F(i,j)%p => comm_map(info) - self%F_null(i,j) = .false. - end if + end if + end if + if (k==j-1) then !if we got through the whole loop above + self%F(i,j)%p => comm_map(info) + self%F_null(i,j) = .false. + end if end do end if if (data(i)%bp(j)%p%nu_c < self%nu_min .or. data(i)%bp(j)%p%nu_c > self%nu_max) self%F_null(i,j) = .true. @@ -257,7 +271,8 @@ module subroutine initDiffuse(self, cpar, id, id_abs) if (trim(self%mono_prior_type) /= 'none') then self%cg_samp_group_md = cpar%cg_samp_group_md temp_filename = get_token(cpar%cs_mono_prior(id_abs), ":", 2) - if(temp2(1:1) /= '/') then + !!raelyn changed temp2 (never initialized) to temp_filename, needed to add the data directroy to the file names + if(temp_filename(1:1) /= '/') then if(trim(self%mono_prior_type) /= 'bandmono') then temp_filename = trim(cpar%datadir)// '/' // trim(temp_filename) end if @@ -315,7 +330,7 @@ module subroutine initDiffuse(self, cpar, id, id_abs) filename = get_token(temp_filename, ",", 1) info_tempfit => comm_mapinfo(cpar%comm_chain, self%nside, 0, 2, .false.) self%mono_prior_map => comm_map(info_tempfit, trim(filename)) - else + else filename = get_token(temp_filename, ",", 1) self%mono_prior_map => comm_map(self%x%info, trim(filename)) end if @@ -339,7 +354,12 @@ module subroutine initLmaxSpecind(self, cpar, id, id_abs) nmaps = 1 if (cpar%cs_polarization(id_abs)) nmaps=3 - if (self%npar==0) return !do not go further, lmax_ind is set in initDiffuse + if (self%npar==0) then + allocate(self%lmax_ind_mix(3,1)) + self%lmax_ind = 0 + self%lmax_ind_mix = 0 + return !do not go further, lmax_ind is set in initDiffuse + end if allocate(self%lmax_ind_pol(3,self%npar)) ! {integer}: lmax per. polarization (poltype index) per spec. ind. @@ -350,7 +370,7 @@ module subroutine initLmaxSpecind(self, cpar, id, id_abs) do i = 1,self%npar do p = 1, self%poltype(i) l = cpar%cs_lmax_ind_pol(p,i,id_abs) - + !assign lmax per spec ind per polarization (poltype) if (self%poltype(i)==1) then !all polarizations have the same lmax self%lmax_ind_pol(:,i) = l @@ -487,6 +507,7 @@ module subroutine initPixregSampling(self, cpar, id, id_abs) allocate(self%first_ind_sample(3,self%npar)) !used for pixelregion sampling self%first_ind_sample=.true. + call update_status(status, "initPixreg_specind_pixreg_type") self%npixreg = 0 @@ -640,7 +661,7 @@ module subroutine initPixregSampling(self, cpar, id, id_abs) write(*,fmt='(a,a)') 'Component "'//trim(self%label)//'", spec. ind "'& & //trim(self%indlabel(i))//'", all poltypes have pixel region sampling '//& & 'and all regions have been fixed. This only the prior RMS should do. Exiting' - stop + !stop end if end do !npar end if @@ -1044,7 +1065,7 @@ module subroutine initPixregSampling(self, cpar, id, id_abs) ! if (self%myid == 0) write(*,*) 'd1', self%theta(i)%p%map(0,1:self%nmaps) smooth_scale = self%smooth_scale(i) - if (cpar%num_smooth_scales > 0 .and. smooth_scale >= 0) then + if (cpar%num_smooth_scales > 0 .and. smooth_scale > 0) then !ind. map with 1 map (will be smoothed like zero spin map using the existing code) tp => comm_map(info2) @@ -1135,7 +1156,9 @@ module subroutine initPixregSampling(self, cpar, id, id_abs) if (self%lmax_ind_pol(j,i) >= 0) then self%lmax_ind_mix(p_min:p_max,i) = self%lmax_ind_pol(j,i) !in case only_pol and poltype = 2 has lmax > 0 else if (self%pol_pixreg_type(j,i)==1) then !pixel region is defined fullsky - self%lmax_ind_mix(p_min:p_max,i) = 0 + do k = p_min, p_max + self%lmax_ind_mix(k,i) = min(self%lmax_ind_pol(k,i), 0) + end do else self%lmax_ind_mix(p_min:p_max,i) = self%lmax_ind_pol(j,i) end if @@ -1286,24 +1309,27 @@ module subroutine initSpecindProp(self,cpar, id, id_abs) end subroutine initSpecindProp - module subroutine initDiffPrecond(comm) + module subroutine initDiffPrecond(comm, samp_group) implicit none - integer(i4b), intent(in) :: comm + integer(i4b), intent(in) :: comm, samp_group + if (npre == 0) return + select case (trim(precond_type)) case ("diagonal") - call initDiffPrecond_diagonal(comm) + call initDiffPrecond_diagonal(comm, samp_group) case ("pseudoinv") - call initDiffPrecond_pseudoinv(comm) + call initDiffPrecond_pseudoinv(comm, samp_group) case default call report_error("Preconditioner type not supported: "//trim(precond_type)) end select end subroutine initDiffPrecond - module subroutine initDiffPrecond_diagonal(comm) + module subroutine initDiffPrecond_diagonal(comm, samp_group) implicit none integer(i4b), intent(in) :: comm + integer(i4b), intent(in) :: samp_group integer(i4b) :: i, i1, i2, j, k1, k2, q, l, m, n real(dp) :: t1, t2 @@ -1314,7 +1340,7 @@ module subroutine initDiffPrecond_diagonal(comm) call update_status(status, "init_diffpre1") if (npre == 0) return - if (allocated(P_cr%invM_diff)) return + if (allocated(P_cr(samp_group)%invM_diff)) return if (.not. allocated(diffComps)) then ! Set up an array of all the diffuse components @@ -1335,7 +1361,7 @@ module subroutine initDiffPrecond_diagonal(comm) ! Build frequency-dependent part of preconditioner call wall_time(t1) - allocate(P_cr%invM_diff(0:info_pre%nalm-1,info_pre%nmaps)) + allocate(P_cr(samp_group)%invM_diff(0:info_pre%nalm-1,info_pre%nmaps)) !!$OMP PARALLEL PRIVATE(mat, ind, j, i1, l, m, q, i2, k1, p1, k2, n) allocate(mat(npre,npre), ind(npre)) do j = 1, info_pre%nmaps @@ -1344,15 +1370,18 @@ module subroutine initDiffPrecond_diagonal(comm) call info_pre%i2lm(i1, l, m) mat = 0.d0 do q = 1, numband + if (.not. data(q)%cr_active) cycle call data(q)%info%lm2i(l,m,i2) if (i2 == -1) cycle if (j > data(q)%info%nmaps) cycle do k1 = 1, npre p1 => diffComps(k1)%p + if (.not. p1%active_samp_group(samp_group)) cycle if (l > p1%lmax_amp) cycle if (j > p1%nmaps) cycle do k2 = 1, npre p2 => diffComps(k2)%p + if (.not. p2%active_samp_group(samp_group)) cycle if (l > p2%lmax_amp) cycle if (j > p2%nmaps) cycle mat(k1,k2) = mat(k1,k2) + & @@ -1364,20 +1393,20 @@ module subroutine initDiffPrecond_diagonal(comm) end do n = 0 - allocate(P_cr%invM_diff(i1,j)%comp2ind(npre)) - P_cr%invM_diff(i1,j)%comp2ind = -1 + allocate(P_cr(samp_group)%invM_diff(i1,j)%comp2ind(npre)) + P_cr(samp_group)%invM_diff(i1,j)%comp2ind = -1 do k1 = 1, npre if (mat(k1,k1) > 0.d0) then n = n+1 ind(n) = k1 - P_cr%invM_diff(i1,j)%comp2ind(k1) = n + P_cr(samp_group)%invM_diff(i1,j)%comp2ind(k1) = n end if end do - P_cr%invM_diff(i1,j)%n = n - allocate(P_cr%invM_diff(i1,j)%ind(n)) - allocate(P_cr%invM_diff(i1,j)%M0(n,n), P_cr%invM_diff(i1,j)%M(n,n)) - P_cr%invM_diff(i1,j)%ind = ind(1:n) - P_cr%invM_diff(i1,j)%M0 = mat(ind(1:n),ind(1:n)) + P_cr(samp_group)%invM_diff(i1,j)%n = n + allocate(P_cr(samp_group)%invM_diff(i1,j)%ind(n)) + allocate(P_cr(samp_group)%invM_diff(i1,j)%M0(n,n), P_cr(samp_group)%invM_diff(i1,j)%M(n,n)) + P_cr(samp_group)%invM_diff(i1,j)%ind = ind(1:n) + P_cr(samp_group)%invM_diff(i1,j)%M0 = mat(ind(1:n),ind(1:n)) end do !!$OMP END DO end do @@ -1389,9 +1418,9 @@ module subroutine initDiffPrecond_diagonal(comm) end subroutine initDiffPrecond_diagonal - module subroutine initDiffPrecond_pseudoinv(comm) + module subroutine initDiffPrecond_pseudoinv(comm, samp_group) implicit none - integer(i4b), intent(in) :: comm + integer(i4b), intent(in) :: comm, samp_group integer(i4b) :: i, i1, i2, j, k1, k2, q, l, m, n real(dp) :: t1, t2 @@ -1401,7 +1430,7 @@ module subroutine initDiffPrecond_pseudoinv(comm) real(dp), allocatable, dimension(:,:) :: mat if (npre == 0) return - if (allocated(P_cr%invM_diff)) return + if (allocated(P_cr(samp_group)%invM_diff)) return if (.not. allocated(diffComps)) then ! Set up an array of all the diffuse components @@ -1421,10 +1450,10 @@ module subroutine initDiffPrecond_pseudoinv(comm) ! Allocate space for pseudo-inverse of U call wall_time(t1) - allocate(P_cr%invM_diff(0:lmax_pre,info_pre%nmaps)) + allocate(P_cr(samp_group)%invM_diff(0:lmax_pre,info_pre%nmaps)) do j = 1, info_pre%nmaps do l = 0, lmax_pre - allocate(P_cr%invM_diff(l,j)%M(npre,numband+npre)) + allocate(P_cr(samp_group)%invM_diff(l,j)%M(npre,numband+npre)) end do end do @@ -1436,6 +1465,8 @@ module subroutine updateDiffPrecond(samp_group, force_update) integer(i4b), intent(in) :: samp_group logical(lgt), intent(in) :: force_update + if (npre == 0) return + select case (trim(precond_type)) case ("diagonal") call updateDiffPrecond_diagonal(samp_group, force_update) @@ -1467,7 +1498,7 @@ module subroutine updateDiffPrecond_diagonal(samp_group, force_update) !self%invM = self%invM0 do j = 1, info_pre%nmaps do i = 0, info_pre%nalm-1 - if (P_cr%invM_diff(i,j)%n > 0) P_cr%invM_diff(i,j)%M = P_cr%invM_diff(i,j)%M0 + if (P_cr(samp_group)%invM_diff(i,j)%n > 0) P_cr(samp_group)%invM_diff(i,j)%M = P_cr(samp_group)%invM_diff(i,j)%M0 end do end do @@ -1483,11 +1514,11 @@ module subroutine updateDiffPrecond_diagonal(samp_group, force_update) if (.not. diffComps(k2)%p%active_samp_group(samp_group)) cycle do j = 1, info_pre%nmaps do i = 0, info_pre%nalm-1 - if (P_cr%invM_diff(i,j)%n == 0) cycle - p = P_cr%invM_diff(i,j)%comp2ind(k1) - q = P_cr%invM_diff(i,j)%comp2ind(k2) + if (P_cr(samp_group)%invM_diff(i,j)%n == 0) cycle + p = P_cr(samp_group)%invM_diff(i,j)%comp2ind(k1) + q = P_cr(samp_group)%invM_diff(i,j)%comp2ind(k2) if (p /= -1 .and. q /= -1) then - alm(i,j) = P_cr%invM_diff(i,j)%M(q,p) + alm(i,j) = P_cr(samp_group)%invM_diff(i,j)%M(q,p) else alm(i,j) = 0.d0 end if @@ -1500,10 +1531,10 @@ module subroutine updateDiffPrecond_diagonal(samp_group, force_update) !stop do j = 1, info_pre%nmaps do i = 0, info_pre%nalm-1 - if (P_cr%invM_diff(i,j)%n == 0) cycle - p = P_cr%invM_diff(i,j)%comp2ind(k1) - q = P_cr%invM_diff(i,j)%comp2ind(k2) - if (p /= -1 .and. q /= -1) P_cr%invM_diff(i,j)%M(q,p) = alm(i,j) + if (P_cr(samp_group)%invM_diff(i,j)%n == 0) cycle + p = P_cr(samp_group)%invM_diff(i,j)%comp2ind(k1) + q = P_cr(samp_group)%invM_diff(i,j)%comp2ind(k2) + if (p /= -1 .and. q /= -1) P_cr(samp_group)%invM_diff(i,j)%M(q,p) = alm(i,j) end do end do end do @@ -1523,11 +1554,11 @@ module subroutine updateDiffPrecond_diagonal(samp_group, force_update) if (.not. diffComps(k2)%p%active_samp_group(samp_group)) cycle do j = 1, info_pre%nmaps do i = 0, info_pre%nalm-1 - if (P_cr%invM_diff(i,j)%n == 0) cycle - p = P_cr%invM_diff(i,j)%comp2ind(k1) - q = P_cr%invM_diff(i,j)%comp2ind(k2) + if (P_cr(samp_group)%invM_diff(i,j)%n == 0) cycle + p = P_cr(samp_group)%invM_diff(i,j)%comp2ind(k1) + q = P_cr(samp_group)%invM_diff(i,j)%comp2ind(k2) if (p /= -1 .and. q /= -1) then - alm(i,j) = P_cr%invM_diff(i,j)%M(p,q) + alm(i,j) = P_cr(samp_group)%invM_diff(i,j)%M(p,q) else alm(i,j) = 0.d0 end if @@ -1538,10 +1569,10 @@ module subroutine updateDiffPrecond_diagonal(samp_group, force_update) ! if (info_pre%myid == 0) write(*,*) 'd', k1, k2, alm(4,1) do j = 1, info_pre%nmaps do i = 0, info_pre%nalm-1 - if (P_cr%invM_diff(i,j)%n == 0) cycle - p = P_cr%invM_diff(i,j)%comp2ind(k1) - q = P_cr%invM_diff(i,j)%comp2ind(k2) - if (p /= -1 .and. q /= -1) P_cr%invM_diff(i,j)%M(p,q) = alm(i,j) + if (P_cr(samp_group)%invM_diff(i,j)%n == 0) cycle + p = P_cr(samp_group)%invM_diff(i,j)%comp2ind(k1) + q = P_cr(samp_group)%invM_diff(i,j)%comp2ind(k2) + if (p /= -1 .and. q /= -1) P_cr(samp_group)%invM_diff(i,j)%M(p,q) = alm(i,j) end do end do end do @@ -1555,8 +1586,8 @@ module subroutine updateDiffPrecond_diagonal(samp_group, force_update) ! Nullify temperature block if only polarization if (only_pol) then do i = 0, info_pre%nalm-1 - if (P_cr%invM_diff(i,1)%n == 0) cycle - P_cr%invM_diff(i,1)%M = 0.d0 + if (P_cr(samp_group)%invM_diff(i,1)%n == 0) cycle + P_cr(samp_group)%invM_diff(i,1)%M = 0.d0 end do end if @@ -1574,9 +1605,9 @@ module subroutine updateDiffPrecond_diagonal(samp_group, force_update) !end if if (l <= diffComps(k1)%p%lmax_amp) then do j = 1, info_pre%nmaps - if (P_cr%invM_diff(i,j)%n == 0) cycle - p = P_cr%invM_diff(i,j)%comp2ind(k1) - if (p > 0) P_cr%invM_diff(i,j)%M(p,p) = P_cr%invM_diff(i,j)%M(p,p) + 1.d0 + if (P_cr(samp_group)%invM_diff(i,j)%n == 0) cycle + p = P_cr(samp_group)%invM_diff(i,j)%comp2ind(k1) + if (p > 0) P_cr(samp_group)%invM_diff(i,j)%M(p,p) = P_cr(samp_group)%invM_diff(i,j)%M(p,p) + 1.d0 end do end if end do @@ -1588,13 +1619,13 @@ module subroutine updateDiffPrecond_diagonal(samp_group, force_update) ! Nullify elements that are not involved in current sample group do j = 1, info_pre%nmaps do i = 0, info_pre%nalm-1 - if (P_cr%invM_diff(i,j)%n == 0) cycle + if (P_cr(samp_group)%invM_diff(i,j)%n == 0) cycle do k1 = 1, npre if (diffComps(k1)%p%active_samp_group(samp_group)) cycle - p = P_cr%invM_diff(i,j)%comp2ind(k1) + p = P_cr(samp_group)%invM_diff(i,j)%comp2ind(k1) if (p == -1) cycle - P_cr%invM_diff(i,j)%M(p,:) = 0.d0 - P_cr%invM_diff(i,j)%M(:,p) = 0.d0 + P_cr(samp_group)%invM_diff(i,j)%M(p,:) = 0.d0 + P_cr(samp_group)%invM_diff(i,j)%M(:,p) = 0.d0 end do end do end do @@ -1608,10 +1639,10 @@ module subroutine updateDiffPrecond_diagonal(samp_group, force_update) do j = 1, nmaps_pre do i = 0, info_pre%nalm-1 call info_pre%i2lm(i, l, m) - n = P_cr%invM_diff(i,j)%n + n = P_cr(samp_group)%invM_diff(i,j)%n if (n > 0) then allocate(W(n), ind(n)) - call get_eigenvalues(P_cr%invM_diff(i,j)%M, W) + call get_eigenvalues(P_cr(samp_group)%invM_diff(i,j)%M, W) W_ref = minval(abs(W)) cond(l) = max(cond(l), maxval(abs(W/W_ref))) W_min(l) = min(W_min(l), minval(W)) @@ -1643,8 +1674,8 @@ module subroutine updateDiffPrecond_diagonal(samp_group, force_update) call wall_time(t1) do j = 1, nmaps_pre do i = 0, info_pre%nalm-1 - if (P_cr%invM_diff(i,j)%n > 0) then - if (any(P_cr%invM_diff(i,j)%M /= 0.d0)) call invert_matrix_with_mask(P_cr%invM_diff(i,j)%M) + if (P_cr(samp_group)%invM_diff(i,j)%n > 0) then + if (any(P_cr(samp_group)%invM_diff(i,j)%M /= 0.d0)) call invert_matrix_with_mask(P_cr(samp_group)%invM_diff(i,j)%M) end if end do end do @@ -1712,8 +1743,8 @@ module subroutine updateDiffPrecond_pseudoinv(samp_group, force_update) end do ! Store pseudo-inverse of U - call compute_pseudo_inverse(mat, P_cr%invM_diff(l,j)%M) - !P_cr%invM_diff(l,j)%M = transpose(mat) + call compute_pseudo_inverse(mat, P_cr(samp_group)%invM_diff(l,j)%M) + !P_cr(samp_group)%invM_diff(l,j)%M = transpose(mat) end do end do deallocate(mat) @@ -1753,7 +1784,7 @@ module subroutine updateDiffuseMixmat(self, theta, beta, band, df, par) integer(i4b), intent(in), optional :: par ! Parameter ID for derivative integer(i4b) :: i, j, k, l, n, p, p_min, p_max, nmaps, ierr - real(dp) :: lat, lon, t1, t2 + real(dp) :: lat, lon, t1, t2, A_ext logical(lgt) :: precomp, mixmatnull, bad ! NEW character(len=2) :: ctext real(dp), allocatable, dimension(:,:,:) :: theta_p @@ -1781,7 +1812,7 @@ module subroutine updateDiffuseMixmat(self, theta, beta, band, df, par) if (present(band)) then if (i /= band) cycle end if - + ! Compute spectral parameters at the correct resolution for this channel if (self%npar > 0) then nmaps = min(data(i)%info%nmaps, self%theta(1)%p%info%nmaps) @@ -1791,8 +1822,8 @@ module subroutine updateDiffuseMixmat(self, theta, beta, band, df, par) do j = 1,self%npar info => comm_mapinfo(data(i)%info%comm, data(i)%info%nside, & & self%theta(j)%p%info%lmax, nmaps, data(i)%info%pol) - td => comm_map(info) - + td => comm_map(info) !empty array, commander type map + ! if self%theta(j)%p%info%lmax=0 constant on the sky ! if any polarization is alm sampled. Only use alms to set polarizations with alm sampling if (any(self%lmax_ind_pol(1:self%poltype(j),j) >= 0)) then t => comm_map(info) @@ -1881,7 +1912,6 @@ module subroutine updateDiffuseMixmat(self, theta, beta, band, df, par) !if (info%myid == 0) write(*,*) 'udgrade = ', t2-t1 end if theta_p(:,:,j) = td%map - !if (info%myid == 0) write(*,*) 'q1, j=',j, minval(theta_p(:,:,j)), maxval(theta_p(:,:,j)) call td%dealloc(); deallocate(td) end do end if @@ -1894,7 +1924,6 @@ module subroutine updateDiffuseMixmat(self, theta, beta, band, df, par) cycle end if - ! Loop over all pixels, computing mixing matrix for each !allocate(theta_p(self%npar,self%nmaps)) call wall_time(t1) @@ -1908,14 +1937,21 @@ module subroutine updateDiffuseMixmat(self, theta, beta, band, df, par) end if end if -! if (all(self%lmax_ind_mix(1:min(self%nmaps,data(i)%info%nmaps)) == 0)) then !if (self%lmax_ind == 0) then -! cycle -! end if + ! Initialize dust extinction + if (self%apply_dust_ext .and. associated(data(i)%A_ext)) then + A_ext = data(i)%A_ext%map(j,1) + else + A_ext = 1.d0 + end if + + +! if (all(self%lmax_ind_mix(1:min(self%nmaps,da + !if (all(self%lmax_ind_mix(1:min(self%nmaps,data(i)%info%nmaps)) == 0)) then !if (s ! NEW ! Check band sensitivity before mixing matrix update ! Possible labels are "broadband", "cmb", "synch", "dust", "co10", "co21", "co32", "ff", "ame" if (data(i)%comp_sens == "broadband") then - ! If broadband, calculate mixing matrix + ! If broadband, calculate mixing matrix mixmatnull = .false. else ! If component sensitivity, only calculate mixmat on that component. @@ -1936,13 +1972,14 @@ module subroutine updateDiffuseMixmat(self, theta, beta, band, df, par) write(*,*) i, l, j, real(theta_p(j,1,:),sp) stop !debug, replace by proper stop and error message end if - self%F(i,l)%p%map(j,1) = self%F_int(1,i,l)%p%eval(theta_p(j,1,:)) * data(i)%gain * self%cg_scale(1) + self%F(i,l)%p%map(j,1) = self%F_int(1,i,l)%p%eval(theta_p(j,1,:)) * data(i)%gain * self%cg_scale(1) * A_ext + !write(*,*) i, j, theta_p(j,1,:), self%F_int(1,i,l)%p%eval(theta_p(j,1,:)), self%F(i,l)%p%map(j,1) end if else if (mixmatnull) then self%F(i,l)%p%map(j,1) = 0.0 else - self%F(i,l)%p%map(j,1) = self%F_int(1,i,l)%p%eval([0.d0]) * data(i)%gain * self%cg_scale(1) + self%F(i,l)%p%map(j,1) = self%F_int(1,i,l)%p%eval([0.d0]) * data(i)%gain * self%cg_scale(1) * A_ext end if end if end if @@ -1959,9 +1996,9 @@ module subroutine updateDiffuseMixmat(self, theta, beta, band, df, par) write(*,*) i, l, j, real(theta_p(j,1,:),sp) end if if (self%npar > 0) then - self%F(i,l)%p%map(j,2) = self%F_int(2,i,l)%p%eval(theta_p(j,2,:)) * data(i)%gain * self%cg_scale(2) + self%F(i,l)%p%map(j,2) = self%F_int(2,i,l)%p%eval(theta_p(j,2,:)) * data(i)%gain * self%cg_scale(2) * A_ext else - self%F(i,l)%p%map(j,2) = self%F_int(2,i,l)%p%eval([0.d0]) * data(i)%gain * self%cg_scale(2) + self%F(i,l)%p%map(j,2) = self%F_int(2,i,l)%p%eval([0.d0]) * data(i)%gain * self%cg_scale(2) * A_ext end if end if @@ -1975,9 +2012,9 @@ module subroutine updateDiffuseMixmat(self, theta, beta, band, df, par) write(*,*) i, l, j, real(theta_p(j,1,:),sp) end if if (self%npar > 0) then - self%F(i,l)%p%map(j,3) = self%F_int(3,i,l)%p%eval(theta_p(j,3,:)) * data(i)%gain * self%cg_scale(3) + self%F(i,l)%p%map(j,3) = self%F_int(3,i,l)%p%eval(theta_p(j,3,:)) * data(i)%gain * self%cg_scale(3) * A_ext else - self%F(i,l)%p%map(j,3) = self%F_int(3,i,l)%p%eval([0.d0]) * data(i)%gain * self%cg_scale(3) + self%F(i,l)%p%map(j,3) = self%F_int(3,i,l)%p%eval([0.d0]) * data(i)%gain * self%cg_scale(3) * A_ext end if end if end if @@ -1987,7 +2024,7 @@ module subroutine updateDiffuseMixmat(self, theta, beta, band, df, par) if (self%npar > 0) then do k = 1, nmaps if (k <= self%poltype(par)) then - df(i)%p%map(j,k) = self%F_int(k,i,l)%p%eval_deriv(theta_p(j,k,:),par) * data(i)%gain * self%cg_scale(k) + df(i)%p%map(j,k) = self%F_int(k,i,l)%p%eval_deriv(theta_p(j,k,:),par) * data(i)%gain * self%cg_scale(k) * A_ext end if end do else @@ -1996,8 +2033,6 @@ module subroutine updateDiffuseMixmat(self, theta, beta, band, df, par) end if end do - - call wall_time(t2) !if (self%x%info%myid == 0) write(*,*) 'eval = ', t2-t1 ! Compute mixing matrix average; for preconditioning only @@ -2069,7 +2104,7 @@ module function evalDiffuseBand(self, band, amp_in, pix, alm_out, det) result(re if (apply_mixmat) then ! Scale to correct frequency through multiplication with mixing matrix - if (all(self%lmax_ind_mix(1:nmaps,:) == 0) .and. self%latmask < 0.d0) then + if (all(self%lmax_ind_mix(1:nmaps,:) == 0) .and. self%latmask < 0.d0 .and. .not. (self%apply_dust_ext .and. associated(data(band)%A_ext))) then do i = 1, m%info%nmaps m%alm(:,i) = m%alm(:,i) * self%F_mean(band,d,i) end do @@ -2141,7 +2176,7 @@ module function projectDiffuseBand(self, band, map, alm_in, det) result(res) end if call data(band)%B(d)%p%conv(trans=.true., map=m) - if (all(self%lmax_ind_mix(1:nmaps,:) == 0) .and. self%latmask < 0.d0) then + if (all(self%lmax_ind_mix(1:nmaps,:) == 0) .and. self%latmask < 0.d0 .and. .not. (self%apply_dust_ext .and. associated(data(band)%A_ext))) then do i = 1, nmaps m%alm(:,i) = m%alm(:,i) * self%F_mean(band,d,i) end do @@ -2161,15 +2196,18 @@ module function projectDiffuseBand(self, band, map, alm_in, det) result(res) end function projectDiffuseBand - module subroutine applyDiffPrecond(x) + module subroutine applyDiffPrecond(x, samp_group) implicit none real(dp), dimension(:), intent(inout) :: x + integer(i4b), intent(in) :: samp_group + if (npre == 0) return + select case (trim(precond_type)) case ("diagonal") - call applyDiffPrecond_diagonal(x) + call applyDiffPrecond_diagonal(x, samp_group) case ("pseudoinv") - call applyDiffPrecond_pseudoinv(x) + call applyDiffPrecond_pseudoinv(x, samp_group) case default call report_error("Preconditioner type not supported: "//trim(precond_type)) end select @@ -2177,9 +2215,10 @@ module subroutine applyDiffPrecond(x) end subroutine applyDiffPrecond - module subroutine applyDiffPrecond_diagonal(x) + module subroutine applyDiffPrecond_diagonal(x, samp_group) implicit none real(dp), dimension(:), intent(inout) :: x + integer(i4b), intent(in) :: samp_group integer(i4b) :: i, j, k, l, m, nmaps real(dp), allocatable, dimension(:,:) :: alm @@ -2204,9 +2243,9 @@ module subroutine applyDiffPrecond_diagonal(x) ! Multiply with preconditioner do j = 1, nmaps_pre do i = 0, info_pre%nalm-1 - if (P_cr%invM_diff(i,j)%n == 0) cycle - y(P_cr%invM_diff(i,j)%ind,i,j) = & - & matmul(P_cr%invM_diff(i,j)%M, y(P_cr%invM_diff(i,j)%ind,i,j)) + if (P_cr(samp_group)%invM_diff(i,j)%n == 0) cycle + y(P_cr(samp_group)%invM_diff(i,j)%ind,i,j) = & + & matmul(P_cr(samp_group)%invM_diff(i,j)%M, y(P_cr(samp_group)%invM_diff(i,j)%ind,i,j)) end do end do @@ -2229,9 +2268,10 @@ module subroutine applyDiffPrecond_diagonal(x) end subroutine applyDiffPrecond_diagonal - module subroutine applyDiffPrecond_pseudoinv(x) + module subroutine applyDiffPrecond_pseudoinv(x, samp_group) implicit none real(dp), dimension(:), intent(inout) :: x + integer(i4b), intent(in) :: samp_group integer(i4b) :: i, ii, j, k, l, m, p, q, qq, nmaps, npre_int real(dp) :: t1, t2 @@ -2279,7 +2319,7 @@ module subroutine applyDiffPrecond_pseudoinv(x) do q = 1, npre_int qq = ind_pre(q) do p = 1, nmaps - invN_x%alm(i,p) = invN_x%alm(i,p) + P_cr%invM_diff(l,p)%M(qq,k) * y(q,j,p) + invN_x%alm(i,p) = invN_x%alm(i,p) + P_cr(samp_group)%invM_diff(l,p)%M(qq,k) * y(q,j,p) end do end do end do @@ -2308,7 +2348,7 @@ module subroutine applyDiffPrecond_pseudoinv(x) do q = 1, npre_int qq = ind_pre(q) do p = 1, nmaps - z(q,j,p) = z(q,j,p) + P_cr%invM_diff(l,p)%M(qq,k) * invN_x%alm(i,p) + z(q,j,p) = z(q,j,p) + P_cr(samp_group)%invM_diff(l,p)%M(qq,k) * invN_x%alm(i,p) end do end do end do @@ -2334,13 +2374,13 @@ module subroutine applyDiffPrecond_pseudoinv(x) w2 = 0.d0 do j = 1, npre_int do k = 1, npre_int - w2(j) = w2(j) + P_cr%invM_diff(l,p)%M(ind_pre(k),numband+ind_pre(j))*w(k) + w2(j) = w2(j) + P_cr(samp_group)%invM_diff(l,p)%M(ind_pre(k),numband+ind_pre(j))*w(k) end do end do w = 0.d0 do j = 1, npre_int do k = 1, npre_int - w(j) = w(j) + P_cr%invM_diff(l,p)%M(ind_pre(j),numband+ind_pre(k))*w2(k) + w(j) = w(j) + P_cr(samp_group)%invM_diff(l,p)%M(ind_pre(j),numband+ind_pre(k))*w2(k) end do end do z(:,i,p) = z(:,i,p) + w @@ -2507,6 +2547,10 @@ module subroutine dumpDiffuseToFITS(self, iter, chainfile, output_hdf, postfix, !write(*,*) 'path2', trim(path)//'/amp_' call map%writeFITS(trim(dir)//'/'//trim(filename), & & hdffile=chainfile, hdfpath=trim(path)//'/amp_', output_hdf_map=.false.) + !if we have set the overall scale parameter + if (self%x_scale /= 1.d0 .and. self%myid == 0) then + call write_hdf(chainfile, trim(path)//'/x_scale', self%x_scale) + end if else call map%writeFITS(trim(dir)//'/'//trim(filename)) end if @@ -2603,62 +2647,64 @@ module subroutine dumpDiffuseToFITS(self, iter, chainfile, output_hdf, postfix, end if !write proposal length and number of proposals maps if local sampling was used - if (self%output_localsamp_maps .and. any(self%lmax_ind_pol(:min(self%nmaps,self%poltype(i)),i) < 0 .and. & - & self%pol_pixreg_type(:min(self%nmaps,self%poltype(i)),i) > 0)) then - filename = trim(self%label) // '_' // trim(self%indlabel(i)) // & - & '_proplen_' // trim(postfix) // '.fits' - call self%pol_proplen(i)%p%writeFITS(trim(dir)//'/'//trim(filename)) - - filename = trim(self%label) // '_' // trim(self%indlabel(i)) // & - & '_nprop_' // trim(postfix) // '.fits' - call self%pol_nprop(i)%p%writeFITS(trim(dir)//'/'//trim(filename)) - - end if + if (self%output_localsamp_maps) then + if (any(self%lmax_ind_pol(:min(self%nmaps,self%poltype(i)),i) < 0 .and. & + & self%pol_pixreg_type(:min(self%nmaps,self%poltype(i)),i) > 0)) then + filename = trim(self%label) // '_' // trim(self%indlabel(i)) // & + & '_proplen_' // trim(postfix) // '.fits' + call self%pol_proplen(i)%p%writeFITS(trim(dir)//'/'//trim(filename)) + + filename = trim(self%label) // '_' // trim(self%indlabel(i)) // & + & '_nprop_' // trim(postfix) // '.fits' + call self%pol_nprop(i)%p%writeFITS(trim(dir)//'/'//trim(filename)) + end if - !if pixelregions, create map without smoothed thetas (for input in new runs) - if (self%output_localsamp_maps .and. any(self%pol_pixreg_type(1:min(self%nmaps,self%poltype(i)),i) > 0)) then - - info => comm_mapinfo(self%theta(i)%p%info%comm, self%theta(i)%p%info%nside, & - & self%theta(i)%p%info%lmax, self%theta(i)%p%info%nmaps, self%theta(i)%p%info%pol) - tp => comm_map(info) - tp%map = self%theta(i)%p%map - do p = 1,self%poltype(i) - if (self%pol_pixreg_type(p,i) /=3) cycle - if (self%poltype(i) == 1) then - p_min=1 - p_max=info%nmaps - if (only_pol) p_min = 2 - else if (self%poltype(i)==2) then - if (p == 1) then - p_min = 1 - p_max = 1 + if (any(self%pol_pixreg_type(1:min(self%nmaps,self%poltype(i)),i) > 0)) then + + info => comm_mapinfo(self%theta(i)%p%info%comm, self%theta(i)%p%info%nside, & + & self%theta(i)%p%info%lmax, self%theta(i)%p%info%nmaps, self%theta(i)%p%info%pol) + tp => comm_map(info) + tp%map = self%theta(i)%p%map + do p = 1,self%poltype(i) + if (self%pol_pixreg_type(p,i) /=3) cycle + if (self%poltype(i) == 1) then + p_min=1 + p_max=info%nmaps + if (only_pol) p_min = 2 + else if (self%poltype(i)==2) then + if (p == 1) then + p_min = 1 + p_max = 1 + else + p_min = 2 + p_max = info%nmaps + end if + else if (self%poltype(i)==3) then + p_min = p + p_max = p else - p_min = 2 - p_max = info%nmaps + write(*,*) ' Unknown poltype in component ',self%label,', parameter ',self%indlabel(i) + stop end if - else if (self%poltype(i)==3) then - p_min = p - p_max = p - else - write(*,*) ' Unknown poltype in component ',self%label,', parameter ',self%indlabel(i) - stop - end if - - do j = 0,info%np-1 - tp%map(j,p_min:p_max) = self%theta_pixreg(self%ind_pixreg_arr(j,p,i),p,i) + + do j = 0,info%np-1 + tp%map(j,p_min:p_max) = self%theta_pixreg(self%ind_pixreg_arr(j,p,i),p,i) + end do end do - end do - filename = trim(self%label) // '_' // trim(self%indlabel(i)) // & - & '_noSmooth_' // trim(postfix) // '.fits' - call tp%writeFITS(trim(dir)//'/'//trim(filename)) - call tp%dealloc(); deallocate(tp) + filename = trim(self%label) // '_' // trim(self%indlabel(i)) // & + & '_noSmooth_' // trim(postfix) // '.fits' + call tp%writeFITS(trim(dir)//'/'//trim(filename)) + call tp%dealloc(); deallocate(tp) + end if end if !output theta, proposal length and number of proposals per pixel region to HDF if (output_hdf) then npol=min(self%nmaps,self%poltype(i))!only concerned about the maps/poltypes in use - if (any(self%pol_pixreg_type(:npol,i) > 0)) then + if (.not. allocated(self%pol_pixreg_type)) then + continue + else if (any(self%pol_pixreg_type(:npol,i) > 0)) then npr=0 do j = 1,npol if (self%npixreg(j,i)>npr) npr = self%npixreg(j,i) @@ -2686,6 +2732,8 @@ module subroutine dumpDiffuseToFITS(self, iter, chainfile, output_hdf, postfix, deallocate(dp_pixreg,int_pixreg) end if + else + continue end if end if @@ -2758,6 +2806,10 @@ module subroutine initDiffuseHDF(self, cpar, hdffile, hdfpath) if (l < self%lmin_amp) self%x%alm(i,:) = 0.d0 end do + if (trim(self%type) == 'MBBtab') then + call read_hdf(hdffile, trim(adjustl(path))//'/SED', self%SEDtab) + end if + do i = 1, self%npar call self%theta(i)%p%readHDF(hdffile, trim(path)//'/'//trim(adjustl(self%indlabel(i)))//& & '_map', .true.) @@ -2802,14 +2854,7 @@ module subroutine initDiffuseHDF(self, cpar, hdffile, hdfpath) end do call tp%dealloc(); deallocate(tp) end if - end if !lmax_ind > 0 - !if (trim(self%label) == 'dust' .and. i == 1) self%theta(i)%p%map(:,1) = 1.65d0 - !if (trim(self%label) == 'dust' .and. i == 2) self%theta(i)%p%map(:,1) = 18.d0 - !if (trim(self%label) == 'dust' .and. i > 1) self%theta(i)%p%map(:,1) = 1.6d0 - !if (trim(self%label) == 'dust' .and. i == 1) self%theta(i)%p%alm(:,:) = 1.65d0 * sqrt(4*pi) - !if (trim(self%label) == 'dust' .and. i == 2) self%theta(i)%p%alm(:,:) = 18 * sqrt(4*pi) - !if (trim(self%label) == 'synch' .and. i > 1) self%theta(i)%p%alm(:,:) = -3.11d0 * sqrt(4*pi) - !if (trim(self%label) == 'ame' .and. i == 1) self%theta(i)%p%alm(:,1) = self%theta(i)%p%alm(:,1) + 0.5d0*sqrt(4*pi) + end if !Need to initialize pixelregions and local sampler from chain as well (where relevant) npol=min(self%nmaps,self%poltype(i))!only concerned about the maps/poltypes in use @@ -2845,7 +2890,6 @@ module subroutine initDiffuseHDF(self, cpar, hdffile, hdfpath) end do !i = 1,npar end if - !if (trim(self%label) == 'dust') write(*,*) 'range beta = ', minval(self%theta(1)%p%map), maxval(self%theta(1)%p%map) call self%updateMixmat end subroutine initDiffuseHDF @@ -2889,8 +2933,9 @@ module subroutine sampleDiffuseSpecInd(self, cpar, handle, id, iter) end subroutine sampleDiffuseSpecInd - module subroutine print_precond_mat + module subroutine print_precond_mat(samp_group) implicit none + integer(i4b), intent(in) :: samp_group integer(i4b) :: l, m, i, j, p real(dp), allocatable, dimension(:) :: W @@ -2905,18 +2950,18 @@ module subroutine print_precond_mat call info_pre%lm2i(l, 0, i) write(*,*) write(*,*) l - do j = 1, size(P_cr%invM_diff(i,p)%M(j,:),1) - write(*,*) real(P_cr%invM_diff(i,p)%M(j,:),sp) + do j = 1, size(P_cr(samp_group)%invM_diff(i,p)%M(j,:),1) + write(*,*) real(P_cr(samp_group)%invM_diff(i,p)%M(j,:),sp) end do - allocate(W(P_cr%invM_diff(i,p)%n)) - call get_eigenvalues(P_cr%invM_diff(i,p)%M, W) + allocate(W(P_cr(samp_group)%invM_diff(i,p)%n)) + call get_eigenvalues(P_cr(samp_group)%invM_diff(i,p)%M, W) write(58,*) l, real(W,sp) deallocate(W) end do else allocate(mat(npre,npre)) do l = 0, info_pre%lmax - mat = matmul(P_cr%invM_diff(l,p)%M, transpose(P_cr%invM_diff(l,p)%M)) + mat = matmul(P_cr(samp_group)%invM_diff(l,p)%M, transpose(P_cr(samp_group)%invM_diff(l,p)%M)) write(*,*) write(*,*) l do j = 1, npre @@ -2939,17 +2984,27 @@ module subroutine updateDiffuseFInt(self, band) class(comm_diffuse_comp), intent(inout) :: self integer(i4b), intent(in), optional :: band - integer(i4b) :: i, j, k + integer(i4b) :: i, j, k, nmaps + + ! only do the computation for the I,Q,U maps, not for the individual det maps + ! that info is instead stored in the j index in this structure if (present(band)) then - do i = 1, data(band)%info%nmaps + ! only do the computation for the I,Q,U maps, not for the individual det maps + ! that info is instead stored in the j index in this structure + nmaps = data(band)%info%nmaps + if (nmaps > 3) nmaps = 3 + + do i = 1, nmaps do j = 0, data(band)%ndet call self%F_int(i,band,j)%p%update(pol=i) end do end do else do k = 1, numband - do i = 1, data(k)%info%nmaps + nmaps = data(k)%info%nmaps + if (nmaps > 3) nmaps = 3 + do i = 1, nmaps do j = 0, data(k)%ndet call self%F_int(i,k,j)%p%update(pol=i) end do @@ -3463,12 +3518,13 @@ module subroutine setup_needlets(info, nside_def, defmask, Z, ndef) end subroutine setup_needlets - module subroutine applyMonoDipolePrior(self, handle) + module subroutine applyMonoDipolePrior(self, handle, verbosity) implicit none class(comm_diffuse_comp), intent(inout) :: self type(planck_rng), intent(inout) :: handle + integer(i4b), intent(in), optional :: verbosity - integer(i4b) :: i, j, k, l, m, ierr, pix + integer(i4b) :: i, j, k, l, m, ierr, pix, verbosity_ real(dp) :: mu(0:3), a, b, Amat(0:3,0:3), bmat(0:3), v(0:3), corr_res(3) class(comm_map), pointer :: map, lr_map class(comm_mapinfo), pointer :: info => null() @@ -3481,6 +3537,8 @@ module subroutine applyMonoDipolePrior(self, handle) return end if + verbosity_ = 10; if (present(verbosity)) verbosity_ = verbosity + ! Compute monopole offset given the specified prior mu = 0.d0 @@ -3506,7 +3564,7 @@ module subroutine applyMonoDipolePrior(self, handle) ! Subtract mean in real space self%x%map(:,1) = self%x%map(:,1) - mu(0) - if (self%x%info%myid == 0) then + if (self%x%info%myid == 0 .and. verbosity_ > 0) then write(*,fmt='(a)') ' | Monopole prior correction for component: '//trim(self%label) write(*,fmt='(a,f11.3)') ' | Monopole: ',mu(0)*self%cg_scale(1) write(*,fmt='(a)') ' | ' @@ -3536,7 +3594,7 @@ module subroutine applyMonoDipolePrior(self, handle) if (trim(self%mono_prior_type) == 'monopole-dipole') then ! Subtract mean in real space self%x%map(:,1) = self%x%map(:,1) - mu(0) - if (self%x%info%myid == 0) then + if (self%x%info%myid == 0 .and. verbosity_ > 0) then write(*,fmt='(a)') ' | Monopole prior correction (with dipole estimate) for component: '//trim(self%label) write(*,fmt='(a,f10.3,a,3f10.3,a)') ' | Monopole (dipole):', & & mu(0)*self%cg_scale(1),' ( ',mu(1:3)*self%cg_scale(1), ' )' @@ -3551,7 +3609,7 @@ module subroutine applyMonoDipolePrior(self, handle) call pix2vec_ring(self%x%info%nside, self%x%info%pix(i+1), v(1:3)) self%x%map(i,1) = self%x%map(i,1) - sum(v*mu) end do - if (self%x%info%myid == 0) then + if (self%x%info%myid == 0 .and. verbosity_ > 0) then write(*,fmt='(a)') ' Monopole+dipole prior correction for component: '//trim(self%label) write(*,fmt='(a)') ' Monopole Dipole_x Dipole_y Dipole_z' write(*,fmt='(a,4f11.3)') ' ',mu*self%cg_scale(1) @@ -3671,7 +3729,7 @@ module subroutine applyMonoDipolePrior(self, handle) ! Subtract mean in real space self%x%map(:,1) = self%x%map(:,1) - mu(0) - if (self%x%info%myid == 0) then + if (self%x%info%myid == 0 .and. verbosity_ > 0) then write(*,fmt='(a)') ' | Cross-correlation prior correction for component: '//trim(self%label) write(*,fmt='(a,i2)') ' | Number of linear fits (thresholds): ',& & self%mono_prior_Nthresh @@ -3754,7 +3812,7 @@ module subroutine applyMonoDipolePrior(self, handle) ! Subtract mean in real space self%x%map(:,1) = self%x%map(:,1) - mu(0) - if (self%x%info%myid == 0) then + if (self%x%info%myid == 0 .and. verbosity_ > 0) then write(*,fmt='(a)') ' Lowest value prior correction for component: '//trim(self%label) write(*,fmt='(a,f14.3,f14.3)') ' Prior value (mu,RMS) ', & & self%mono_prior_gaussian_mean*self%cg_scale(1), & @@ -3864,7 +3922,7 @@ module subroutine applyMonoDipolePrior(self, handle) ! Subtract mean in real space self%x%map(:,1) = self%x%map(:,1) - mu(0) - if (self%x%info%myid == 0) then + if (self%x%info%myid == 0 .and. verbosity_ > 0) then write(*,fmt='(a)') ' | Band monopole prior correction for -- comp: '//trim(self%label)//' -- prior band: '//trim(self%mono_prior_band) write(*,fmt='(a,f14.3,f14.3)') ' | Band monopole prior (mu,RMS) ', prior_vals(1),prior_vals(2) write(*,fmt='(a,f14.3)') ' | New band monopole ',b*mono_mix/sqrt(4.d0*pi) diff --git a/commander3/src/comm_dust_extinction_mod.f90 b/commander3/src/comm_dust_extinction_mod.f90 new file mode 100644 index 000000000..f65bb79a3 --- /dev/null +++ b/commander3/src/comm_dust_extinction_mod.f90 @@ -0,0 +1,329 @@ +!================================================================================ +! +! Copyright (C) 2020 Institute of Theoretical Astrophysics, University of Oslo. +! +! This file is part of Commander3 +! +! Commander3 is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! Commander3 is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with Commander3. If not, see . +! +!================================================================================ +module comm_dust_extinction_mod + use comm_utils + use comm_map_mod + implicit none + + private + public initialize_dust_extinction_mod, get_dust_attenuation_map, get_dust_attenuation_pos, active_dust_ext_model + + integer(i4b), parameter :: NPAR_EXT = 47 + + integer(i4b), parameter :: UV_C1_A = 1 + integer(i4b), parameter :: UV_C1_B = 2 + integer(i4b), parameter :: UV_C2_A = 3 + integer(i4b), parameter :: UV_C2_B = 4 + integer(i4b), parameter :: UV_C3_A = 5 + integer(i4b), parameter :: UV_C3_B = 6 + integer(i4b), parameter :: UV_C4_A = 7 + integer(i4b), parameter :: UV_C4_B = 8 + integer(i4b), parameter :: UV_X0 = 9 + integer(i4b), parameter :: UV_GAMMA = 10 + + integer(i4b), parameter :: OPT_E0_A = 11 + integer(i4b), parameter :: OPT_E0_B = 12 + integer(i4b), parameter :: OPT_E1_A = 13 + integer(i4b), parameter :: OPT_E1_B = 14 + integer(i4b), parameter :: OPT_E2_A = 15 + integer(i4b), parameter :: OPT_E2_B = 16 + integer(i4b), parameter :: OPT_E3_A = 17 + integer(i4b), parameter :: OPT_E3_B = 18 + integer(i4b), parameter :: OPT_E4_A = 19 + integer(i4b), parameter :: OPT_E4_B = 20 + integer(i4b), parameter :: OPT_F1_A = 21 + integer(i4b), parameter :: OPT_F1_B = 22 + integer(i4b), parameter :: OPT_F2_A = 23 + integer(i4b), parameter :: OPT_F2_B = 24 + integer(i4b), parameter :: OPT_F3_A = 25 + integer(i4b), parameter :: OPT_F3_B = 26 + integer(i4b), parameter :: OPT_X1 = 27 + integer(i4b), parameter :: OPT_X2 = 28 + integer(i4b), parameter :: OPT_X3 = 29 + integer(i4b), parameter :: OPT_GAMMA1 = 30 + integer(i4b), parameter :: OPT_GAMMA2 = 31 + integer(i4b), parameter :: OPT_GAMMA3 = 32 + + integer(i4b), parameter :: IR_G1_A = 33 + integer(i4b), parameter :: IR_G1_B = 34 + integer(i4b), parameter :: IR_ALPHA1_A = 35 + integer(i4b), parameter :: IR_ALPHA1_B = 36 + integer(i4b), parameter :: IR_ALPHA2 = 37 + integer(i4b), parameter :: IR_LAMBDAB = 38 + integer(i4b), parameter :: IR_DELTA = 39 + integer(i4b), parameter :: IR_S1 = 40 + integer(i4b), parameter :: IR_LAMBDAO1 = 41 + integer(i4b), parameter :: IR_GAMMAO1 = 42 + integer(i4b), parameter :: IR_A1 = 43 + integer(i4b), parameter :: IR_S2 = 44 + integer(i4b), parameter :: IR_LAMBDAO2 = 45 + integer(i4b), parameter :: IR_GAMMAO2 = 46 + integer(i4b), parameter :: IR_A2 = 47 + + type comm_dustext_model + integer(i4b) :: nside = 512 + real(dp), dimension(NPAR_EXT) :: p + real(sp), allocatable, dimension(:,:) :: EBV + end type comm_dustext_model + + real(dp) :: nu_V, nu_B, R + type(comm_dustext_model) :: ext_model + +contains + + subroutine initialize_dust_extinction_mod(cpar) + implicit none + type(comm_params), intent(in) :: cpar + + real(dp) :: aB, bB, aV, bV + + if (trim(cpar%EBVmap) == 'none') return + + ! Initialize sky model + allocate(ext_model%EBV(0:12*ext_model%nside**2-1,1)) + call read_map(trim(cpar%EBVmap), ext_model%EBV) + !info => comm_mapinfo(cpar%comm_chain, nside, lmax, 1, .false.) + !EBV_map => comm_map(info, trim(cpar%EBVmap)) + + ! Initialize parametric model + ext_model%p(UV_C1_A) = 0.81297d0 + ext_model%p(UV_C1_B) = -2.97868d0 + ext_model%p(UV_C2_A) = 0.2775d0 + ext_model%p(UV_C2_B) = 1.89808d0 + ext_model%p(UV_C3_A) = 1.06295d0 + ext_model%p(UV_C3_B) = 3.10334d0 + ext_model%p(UV_C4_A) = 0.11303d0 + ext_model%p(UV_C4_B) = 0.65484d0 + ext_model%p(UV_X0) = 4.60d0 + ext_model%p(UV_GAMMA) = 0.99d0 + + ext_model%p(OPT_E0_A) = -0.35848d0 + ext_model%p(OPT_E0_B) = 0.12354d0 + ext_model%p(OPT_E1_A) = 0.7122d0 + ext_model%p(OPT_E1_B) = -2.68335d0 + ext_model%p(OPT_E2_A) = 0.08746d0 + ext_model%p(OPT_E2_B) = 2.01901d0 + ext_model%p(OPT_E3_A) = -0.05403d0 + ext_model%p(OPT_E3_B) = -0.39299d0 + ext_model%p(OPT_E4_A) = 0.00674d0 + ext_model%p(OPT_E4_B) = 0.03355d0 + ext_model%p(OPT_F1_A) = 0.03893d0 + ext_model%p(OPT_F1_B) = 0.18453d0 + ext_model%p(OPT_F2_A) = 0.02965d0 + ext_model%p(OPT_F2_B) = 0.19728d0 + ext_model%p(OPT_F3_A) = 0.01747d0 + ext_model%p(OPT_F3_B) = 0.1713d0 + ext_model%p(OPT_X1) = 2.288d0 + ext_model%p(OPT_X2) = 2.054d0 + ext_model%p(OPT_X3) = 1.587d0 + ext_model%p(OPT_GAMMA1) = 0.243d0 + ext_model%p(OPT_GAMMA2) = 0.179d0 + ext_model%p(OPT_GAMMA3) = 0.243d0 + + ! Typo in paper -- extra minus in exponent in alpha1? + ext_model%p(IR_G1_A) = 0.38526d0 + ext_model%p(IR_G1_B) = -1.01251d0 + ext_model%p(IR_ALPHA1_A) = 1.68467d0 + ext_model%p(IR_ALPHA1_B) = 1.06099d0 ! Sign change + ext_model%p(IR_ALPHA2) = 0.78791d0 + ext_model%p(IR_LAMBDAB) = 4.30578d0 + ext_model%p(IR_DELTA) = 4.78338d0 + ext_model%p(IR_S1) = 0.06652d0 + ext_model%p(IR_LAMBDAO1) = 9.8434d0 + ext_model%p(IR_GAMMAO1) = 2.21205d0 + ext_model%p(IR_A1) = -0.24703d0 + ext_model%p(IR_S2) = 0.0267d0 + ext_model%p(IR_LAMBDAO2) = 19.258294d0 + ext_model%p(IR_GAMMAO2) = 17.0d0 + ext_model%p(IR_A2) = -0.27d0 + + nu_V = c/551d-9 + nu_B = c/445d-9 + call compute_dust_ext_linfit(nu_V, aV, bV) + call compute_dust_ext_linfit(nu_B, aB, bB) + !R = (1.d0-(bB-bV))/((aB-aV)-(bB-bV)/3.1d0) + R = 3.1d0 !(1.d0-bB)/(aB-bB/3.1d0) + !R = 6.0d0 !(1.d0-bB)/(aB-bB/3.1d0) +!!$ write(*,*) 'a, b, V = ', aV, bV +!!$ write(*,*) 'a, b, B = ', aB, bB +!!$ write(*,*) 'R = ', R + + end subroutine initialize_dust_extinction_mod + + subroutine get_dust_attenuation_map(nu, A_ext) + implicit none + real(dp), intent(in) :: nu + class(comm_map), intent(inout) :: A_ext + + integer(i4b) :: i + real(dp) :: f, a, b + real(sp), allocatable, dimension(:) :: EBV + + ! Get A_V = R*E(B-V) at correct resolution + if (A_ext%info%nside /= ext_model%nside) then + allocate(EBV(0:A_ext%info%npix-1)) + call udgrade_ring(ext_model%EBV(:,1), ext_model%nside, EBV, A_ext%info%nside) + A_ext%map(:,1) = R*EBV(A_ext%info%pix) + else + A_ext%map(:,1) = R*ext_model%EBV(A_ext%info%pix,1) + end if + + ! Convert to attenuation + call compute_dust_ext_linfit(nu, a, b) + f = a + b * (1d0/R - 1d0/3.1d0) + A_ext%map = exp(-A_ext%map*f/2.5d0) + +!!$ call A_ext%writeFITS('A.fits') +!!$ call mpi_finalize(i) +!!$ stop + end subroutine get_dust_attenuation_map + + subroutine get_dust_attenuation_pos(vec, nu, A_ext) + implicit none + real(dp), intent(in) :: vec(3) + real(dp), intent(in) :: nu + real(dp), intent(out) :: A_ext + + integer(i4b) :: i, pix + real(dp) :: A_V, a, b + + if (.not. allocated(ext_model%EBV)) then + A_ext = 1.d0 + return + end if + + call vec2pix_ring(ext_model%nside, vec, pix) + A_V = R * ext_model%EBV(pix,1) + call compute_dust_ext_linfit(nu, a, b) + A_ext = exp(-0.4d0 * A_V * (a + b * (1d0/R - 1d0/3.1d0))) + end subroutine get_dust_attenuation_pos + + + subroutine compute_dust_ext_linfit(nu, a, b) + implicit none + real(dp), intent(in) :: nu + real(dp), intent(out) :: a, b + + real(dp) :: lambda, lam0, lamb, a_uv, b_uv, a_opt, b_opt, a_ir, b_ir, x, D, W, Dm1, Dm2, z, g1, F, delta, gamma + + lambda = c/nu * 1d6 ! wavelength in micron + x = 1d0/lambda + D = x*x / ((x-ext_model%p(UV_X0))**2 + (x*ext_model%p(UV_GAMMA))**2) + + ! Compute basic linear coefficients for each range + if (lambda >= 0.091d0 .and. lambda < 0.33d0) then + ! Ultra-violet + F = 0.5392d0*(x-5.9d0)**2 + 0.05644d0*(x-5.9d0)**3 + a_uv = ext_model%p(UV_C1_A) + ext_model%p(UV_C2_A)*x + & + & ext_model%p(UV_C3_A)*D + ext_model%p(UV_C4_A)*F + b_uv = ext_model%p(UV_C1_B) + ext_model%p(UV_C2_B)*x + & + & ext_model%p(UV_C3_B)*D + ext_model%p(UV_C4_B)*F + end if + if (lambda >= 0.3d0 .and. lambda < 1.1d0) then + ! Optical + a_opt = ext_model%p(OPT_E0_A) + ext_model%p(OPT_E1_A)*x + & + & ext_model%p(OPT_E2_A)*x**2 + ext_model%p(OPT_E3_A)*x**3 + & + & ext_model%p(OPT_E4_A)*x**4 + & + & ext_model%p(OPT_F1_A)*D*ext_model%p(OPT_GAMMA1) + & + & ext_model%p(OPT_F2_A)*D*ext_model%p(OPT_GAMMA2) + & + & ext_model%p(OPT_F3_A)*D*ext_model%p(OPT_GAMMA3) + b_opt = ext_model%p(OPT_E0_B) + ext_model%p(OPT_E1_B)*x + & + & ext_model%p(OPT_E2_B)*x**2 + ext_model%p(OPT_E3_B)*x**3 + & + & ext_model%p(OPT_E4_B)*x**4 + & + & ext_model%p(OPT_F1_B)*D*ext_model%p(OPT_GAMMA1)**2 + & + & ext_model%p(OPT_F2_B)*D*ext_model%p(OPT_GAMMA2)**2 + & + & ext_model%p(OPT_F3_B)*D*ext_model%p(OPT_GAMMA3)**2 + end if + if (lambda >= 0.9d0 .and. lambda < 32d0) then + ! Infrared + lamb = ext_model%p(IR_LAMBDAB) + lam0 = ext_model%p(IR_LAMBDAO1) + delta = ext_model%p(IR_DELTA) + gamma = 2.d0*ext_model%p(IR_GAMMAO1)/(1.d0+exp(ext_model%p(IR_A1)*(lambda-lam0))) + Dm1 = (gamma/lam0)**2 / ((lambda/lam0-lam0/lambda)**2 + (gamma/lam0)**2) + lam0 = ext_model%p(IR_LAMBDAO2) + gamma = 2.d0*ext_model%p(IR_GAMMAO2)/(1.d0+exp(ext_model%p(IR_A2)*(lambda-lam0))) + Dm2 = (gamma/lam0)**2 / ((lambda/lam0-lam0/lambda)**2 + (gamma/lam0)**2) + W = get_W_smooth_step(lambda, lamb, delta) + g1 = ext_model%p(IR_G1_A) + a_ir = g1*lambda**(-ext_model%p(IR_ALPHA1_A))*(1.d0-W) + & + & g1*lamb**(ext_model%p(IR_ALPHA2)-ext_model%p(IR_ALPHA1_A)) * & + & lambda**(-ext_model%p(IR_ALPHA2)) * W + & + & ext_model%p(IR_S1)*Dm1 + ext_model%p(IR_S2)*Dm2 + b_ir = ext_model%p(IR_G1_B)*lambda**(-ext_model%p(IR_ALPHA1_B)) + end if + + ! Generate smooth function + if (lambda >= 0.091d0 .and. lambda < 0.30d0) then + a = a_uv + b = b_uv + else if (lambda >= 0.30d0 .and. lambda < 0.33d0) then + W = get_W_smooth_step(lambda, 0.315d0, 0.03d0) + a = (1.d0-W)*a_uv + W*a_opt + b = (1.d0-W)*b_uv + W*b_opt + else if (lambda >= 0.33d0 .and. lambda < 0.90d0) then + a = a_opt + b = b_opt + else if (lambda >= 0.90d0 .and. lambda < 1.1d0) then + W = get_W_smooth_step(lambda, 1.d0, 0.2d0) + a = (1.d0-W)*a_opt + W*a_ir + b = (1.d0-W)*b_opt + W*b_ir + else if (lambda >= 1.10d0 .and. lambda < 32d0) then + a = a_ir + b = b_ir + else + a = 0.d0 + b = 0.d0 + end if + end subroutine compute_dust_ext_linfit + + function get_W_smooth_step(lambda, lambda_b, delta) + implicit none + real(dp), intent(in) :: lambda, lambda_b, delta + real(dp) :: get_W_smooth_step + + real(dp) :: z + + z = (lambda - lambda_b + 0.5d0*delta)/delta + if (z >= 0.d0 .and. z <= 1.d0) then + get_W_smooth_step = 3.d0*z**2 -2.d0*z**3 + else + get_W_smooth_step = 0.d0 + end if + end function get_W_smooth_step + + function active_dust_ext_model(nu) + implicit none + real(dp), intent(in) :: nu + logical(lgt) :: active_dust_ext_model + + real(dp) :: lambda + + lambda = c/nu * 1d6 ! wavelength in microns + if (allocated(ext_model%EBV) .and. lambda >= 0.091d0 .and. lambda < 32.d0) then + active_dust_ext_model = .true. + else + active_dust_ext_model = .false. + end if + + end function active_dust_ext_model + +end module comm_dust_extinction_mod diff --git a/commander3/src/comm_freefreeEM_comp_mod.f90 b/commander3/src/comm_freefreeEM_comp_mod.f90 index 3bbfeca1f..0027b6780 100644 --- a/commander3/src/comm_freefreeEM_comp_mod.f90 +++ b/commander3/src/comm_freefreeEM_comp_mod.f90 @@ -67,8 +67,11 @@ function constructor_ffEM(cpar, id, id_abs) result(c) do i = 1, c%npar c%poltype(i) = cpar%cs_poltype(i,id_abs) end do - call c%initLmaxSpecind(cpar, id, id_abs) - + !call c%initLmaxSpecind(cpar, id, id_abs) + allocate(c%lmax_ind_pol(3,c%npar), c%lmax_ind_mix(3,c%npar)) + c%lmax_ind_pol = -1 + c%lmax_ind_mix = -1 + call c%initDiffuse(cpar, id, id_abs) ! Component specific parameters @@ -126,9 +129,9 @@ function constructor_ffEM(cpar, id, id_abs) result(c) end if end do - call c%initPixregSampling(cpar, id, id_abs) + !call c%initPixregSampling(cpar, id, id_abs) ! Init alm - if (c%lmax_ind >= 0) call c%initSpecindProp(cpar, id, id_abs) + !if (c%lmax_ind >= 0) call c%initSpecindProp(cpar, id, id_abs) ! Initialize mixing matrix call c%updateMixmat @@ -154,7 +157,7 @@ function evalSED_ffEM(self, nu, band, pol, theta) tau = 5.468d-2 * Te**(-1.5d0) * (nu/1.d9)**(-2) * EM * g evalSED_ffEM = 1.d6 * Te * (1.d0 - exp(-tau)) - + end function evalSED_ffEM diff --git a/commander3/src/comm_hdf_mod.f90 b/commander3/src/comm_hdf_mod.f90 index 949a68dcf..786cf42ee 100644 --- a/commander3/src/comm_hdf_mod.f90 +++ b/commander3/src/comm_hdf_mod.f90 @@ -304,7 +304,7 @@ subroutine close_hdf_set(file) type(hdf_file) :: file if (file%sethandle == -1) return call h5dclose_f(file%sethandle, file%status) - call assert(file%status>=0, 'comm_hdf_mod: Could not close set') + call assert(file%status>=0, 'comm_hdf_mod: Could not close set' // file%setname // ' in ' // file%filename) file%sethandle = -1 file%setname = '' end subroutine close_hdf_set @@ -2579,6 +2579,7 @@ subroutine read_hdf_opaque(file, setname, val) call open_hdf_set(file, setname) call h5dget_type_f(file%sethandle, dtype, file%status) call h5tget_size_f(dtype, len, file%status) + call assert(file%status>=0, "comm_hdf_mod: Cannot read data from hdf set " // setname // ' from file ' // trim(file%filename)) numint = len allocate(val(numint)) f_ptr = c_loc(val) @@ -5311,7 +5312,9 @@ subroutine create_hdf_group(file, group) character(len=*) :: group integer(hid_t) :: gid call h5gcreate_f(file%filehandle, group, gid, file%status) + call assert(file%status>=0, "comm_hdf_mod: Cannot create group "//trim(file%filename)//', '//trim(group)) call h5gclose_f(gid, file%status) + call assert(file%status>=0, "comm_hdf_mod: Cannot close group "//trim(file%filename)//', '//trim(group)) end subroutine ! ********************** diff --git a/commander3/src/comm_hdf_mod.f90.in b/commander3/src/comm_hdf_mod.f90.in deleted file mode 100644 index 02a7aba72..000000000 --- a/commander3/src/comm_hdf_mod.f90.in +++ /dev/null @@ -1,787 +0,0 @@ -!================================================================================ -! -! Copyright (C) 2020 Institute of Theoretical Astrophysics, University of Oslo. -! -! This file is part of Commander3. -! -! Commander3 is free software: you can redistribute it and/or modify -! it under the terms of the GNU General Public License as published by -! the Free Software Foundation, either version 3 of the License, or -! (at your option) any later version. -! -! Commander3 is distributed in the hope that it will be useful, -! but WITHOUT ANY WARRANTY; without even the implied warranty of -! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -! GNU General Public License for more details. -! -! You should have received a copy of the GNU General Public License -! along with Commander3. If not, see . -! -!================================================================================ -! Due to the extreme amount of redundancy in hdf_mod, it is now generated -! by using the handy tempita template language. All the machinery for -! doing this is included in the repository, so this should just work. -{{py: -ndim = 8 -types = [ - [ "dp", "real", "dp", "H5T_IEEE_F64LE", "H5T_NATIVE_DOUBLE" ], - [ "sp", "real", "sp", "H5T_IEEE_F32LE", "H5T_NATIVE_REAL" ], - [ "int", "integer", "i4b", "H5T_STD_I32LE", "H5T_NATIVE_INTEGER" ], - [ "char", "character", "len=*", "H5T_FORTRAN_S1", "H5T_NATIVE_CHARACTER" ], -] -def desc(i): - return "%dd" % i -def dims(i): - if i == 0: return "" - else: return ",dimension("+",".join([":" for i in range(i)])+")" -def args(id,i): - return ",".join(["%s%d" % (id,i) for i in range(i)]) -}} -module comm_hdf_mod - use healpix_types - use comm_utils - use hdf5 - implicit none - - type hdf_file - character(len=512) :: filename, setname - integer(hid_t) :: filehandle, sethandle - integer :: status - end type hdf_file - - type :: byte_pointer - byte, allocatable, dimension(:) :: p - ! contains - ! final :: dealloc_byte_pointer - end type byte_pointer - - interface read_hdf - {{for s in ["", "slice_"]}} - {{for d in range(ndim)}} - {{for t in types}} - module procedure read_hdf_{{s}}{{desc(d)}}_{{t[0]}} - {{endfor}} - {{endfor}} - {{endfor}} - end interface - - interface read_alloc_hdf - {{for d in range(1,ndim)}} - {{for t in types}} - module procedure read_alloc_hdf_{{desc(d)}}_{{t[0]}} - {{endfor}} - {{endfor}} - end interface - - interface write_hdf - {{for s in ["", "slice_"]}} - {{for d in range(ndim)}} - {{for t in types}} - module procedure write_hdf_{{s}}{{desc(d)}}_{{t[0]}} - {{endfor}} - {{endfor}} - {{endfor}} - end interface - - interface slice - {{for d in range(ndim)}} - module procedure slice_{{desc(d)}} - {{endfor}} - end interface - -contains - - ! ***************************************************** - ! Initialization and cleanup routines - ! ***************************************************** - subroutine initialize_comm_hdf_mod - implicit none - logical(lgt), save :: initialized = .false. - integer(i4b) :: status - if(initialized) return - call h5open_f(status) - call assert(status==0, 'comm_hdf_mod: Could not initialize hdf module') - initialized = .true. - end subroutine initialize_comm_hdf_mod - - subroutine cleanup_comm_hdf_mod - implicit none - integer(i4b) :: status - call h5close_f(status) - call assert(status==0, 'comm_hdf_mod: Could not close hdf module') - end subroutine cleanup_comm_hdf_mod - - subroutine copy_hdf_struct(file_in, file_out) - implicit none - type(hdf_file), intent(in) :: file_in - type(hdf_file), intent(out) :: file_out - - file_out%filename = file_in%filename - file_out%setname = file_in%setname - file_out%filehandle = file_in%filehandle - file_out%sethandle = file_in%sethandle - file_out%status = file_in%status - - end subroutine copy_hdf_struct - - - ! ***************************************************** - ! Basic file open and close routines - ! ***************************************************** - subroutine open_hdf_file(filename, file, mode) - implicit none - character(len=*), intent(in) :: filename - character(len=1), intent(in) :: mode - type(hdf_file) :: file - - ! Initialize - call initialize_comm_hdf_mod - - ! Open file in either read or write mode - file%filename = filename - file%status = 0 - if (mode == 'r') then - call h5fopen_f(file%filename, H5F_ACC_RDONLY_F, file%filehandle, file%status) - else if (mode == 'w') then - call h5fcreate_f(file%filename, H5F_ACC_TRUNC_F, file%filehandle, file%status) - else if (mode == 'b') then - call h5fopen_f(file%filename, H5F_ACC_RDWR_F, file%filehandle, file%status) - else - write(*,*) 'comm_hdf_mod: Unknown hdf file mode =', mode - stop - end if - - ! Initalize sethandle to empty value - file%setname = '' - file%sethandle = -1 - end subroutine open_hdf_file - - subroutine close_hdf_file(file) - implicit none - type(hdf_file) :: file - call close_hdf_set(file) - call h5fclose_f(file%filehandle, file%status) - call assert(file%status>=0, 'comm_hdf_mod: Could not close file') - end subroutine close_hdf_file - - subroutine open_hdf_set(file, setname) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - if (trim(file%setname) == trim(setname)) return - call close_hdf_set(file) - file%setname = setname - call h5dopen_f(file%filehandle, file%setname, file%sethandle, file%status) - end subroutine open_hdf_set - - subroutine close_hdf_set(file) - implicit none - type(hdf_file) :: file - if (file%sethandle == -1) return - call h5dclose_f(file%sethandle, file%status) - call assert(file%status>=0, 'comm_hdf_mod: Could not close set') - file%sethandle = -1 - file%setname = '' - end subroutine close_hdf_set - - ! ***************************************************** - ! Query operations - ! ***************************************************** - function get_rank_hdf(file, setname) result(rank) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - integer(i4b) :: rank - integer(hid_t) :: space - call open_hdf_set(file, setname) - call h5dget_space_f(file%sethandle, space, file%status) - call h5sget_simple_extent_ndims_f(space, rank, file%status) - call h5sclose_f(space, file%status) - end function - - subroutine get_size_hdf(file, setname, ext) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - integer(i4b), intent(out) :: ext(:) - integer(i4b) :: rank - integer(hid_t) :: space, n - integer(hsize_t), allocatable, dimension(:) :: ext_hdf, mext_hdf - call open_hdf_set(file, setname) - call h5dget_space_f(file%sethandle, space, file%status) - call h5sget_simple_extent_ndims_f(space, rank, file%status) - allocate(ext_hdf(rank), mext_hdf(rank)) - call h5sget_simple_extent_dims_f(space, ext_hdf, mext_hdf, file%status) - call h5sclose_f(space, file%status) - if (file%status == -1) then - write(*,*) 'Error reading file ', trim(file%filename), trim(setname) - stop - end if - n = min(size(ext),rank) - ext(:n) = int(ext_hdf(:n),i4b) - deallocate(ext_hdf, mext_hdf) - end subroutine get_size_hdf - -!!$ function hdf_group_exist(file, group) -!!$ implicit none -!!$ type(hdf_file) :: file -!!$ character(len=*), intent(in) :: group -!!$ type(hf -!!$ -!!$ -!!$ -!!$ end function hdf_group_exist - - ! ***************************************************** - ! Set read operations - ! ***************************************************** - - subroutine read_hdf_dp_2d_buffer(file, setname, val) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - TYPE(h5o_info_t) :: object_info - integer(i4b) :: hdferr, v(100) - integer(hsize_t) :: s(2), ext2(2) - integer(i4b) :: ext(2) - real(dp), dimension(:,:), intent(out) :: val - real(dp), dimension(:,:), allocatable :: buffer - call h5eset_auto_f(0, hdferr) - call h5oget_info_by_name_f(file%filehandle, setname, object_info, hdferr) - if (hdferr /= 0) then - write(*,*) 'Warning: HDF field does not exist in '//trim(file%filename)//' = ', trim(setname) - return - end if - call open_hdf_set(file, setname) - s = int(shape(val)) - call get_size_hdf(file, setname, ext) - allocate(buffer(ext(1),ext(2))) - ext2 = ext - ! Validate that sizes are consistent - !call get_size_hdf(file, setname, ext) - if (any(ext /= s)) then - write(*,*) 'HDF error -- inconsistent array sizes' - write(*,*) ' Filename = ', trim(file%filename) - write(*,*) ' Setname = ', trim(setname) - write(*,*) ' HDF size = ', ext - write(*,*) ' Requested size = ', int(s,i4b) - !write(*,*) opt_, 'Optional parameter' - end if - call h5dread_f(file%sethandle, H5T_NATIVE_DOUBLE, buffer, ext2, file%status) - val = buffer(1:s(1),1:s(2)) - deallocate(buffer) - call assert(file%status>=0, "comm_hdf_mod: Cannot read data from hdf set " // setname) - end subroutine - - subroutine read_hdf_int_2d_buffer(file, setname, val) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - TYPE(h5o_info_t) :: object_info - integer(i4b) :: hdferr, v(100) - integer(hsize_t) :: s(2), ext2(2) - integer(i4b) :: ext(2) - integer(i4b), dimension(:,:), intent(out) :: val - integer(i4b), dimension(:,:), allocatable :: buffer - call h5eset_auto_f(0, hdferr) - call h5oget_info_by_name_f(file%filehandle, setname, object_info, hdferr) - if (hdferr /= 0) then - write(*,*) 'Warning: HDF field does not exist in '//trim(file%filename)//' = ', trim(setname) - return - end if - call open_hdf_set(file, setname) - s = int(shape(val)) - call get_size_hdf(file, setname, ext) - allocate(buffer(ext(1),ext(2))) - ext2 = ext - ! Validate that sizes are consistent - !call get_size_hdf(file, setname, ext) - if (any(ext /= s)) then - write(*,*) 'HDF error -- inconsistent array sizes' - write(*,*) ' Filename = ', trim(file%filename) - write(*,*) ' Setname = ', trim(setname) - write(*,*) ' HDF size = ', ext - write(*,*) ' Requested size = ', int(s,i4b) - !write(*,*) opt_, 'Optional parameter' - end if - call h5dread_f(file%sethandle, H5T_NATIVE_INTEGER, buffer, ext2, file%status) - val = buffer(1:s(1),1:s(2)) - deallocate(buffer) - call assert(file%status>=0, "comm_hdf_mod: Cannot read data from hdf set " // setname) - end subroutine - - {{for d in range(ndim)}} - {{for t in types}} - subroutine read_hdf_{{desc(d)}}_{{t[0]}}(file, setname, val, opt) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - logical(lgt), intent(in), optional :: opt - TYPE(h5o_info_t) :: object_info - integer(i4b) :: hdferr, v(100) - integer(hsize_t) :: s({{d}}), ext2({{d}}) - integer(i4b) :: ext({{d}}) - {{t[1]}}({{t[2]}}) {{dims(d)}}, intent(out) :: val - logical(lgt) :: opt_ - - if(.not. present(opt)) then - opt_ = .false. - else - opt_ = opt - end if - call h5eset_auto_f(0, hdferr) - call h5oget_info_by_name_f(file%filehandle, setname, object_info, hdferr) - if (hdferr /= 0) then - if(.not. opt_) then - write(*,*) 'Warning: HDF field does not exist in '//trim(file%filename)//' = ', trim(setname) - else - return - end if - end if - call open_hdf_set(file, setname) - s = int(shape(val)) - ! Validate that sizes are consistent - call get_size_hdf(file, setname, ext) - if (any(ext /= s)) then - write(*,*) 'HDF error -- inconsistent array sizes' - write(*,*) ' Filename = ', trim(file%filename) - write(*,*) ' Setname = ', trim(setname) - write(*,*) ' HDF size = ', ext - write(*,*) ' Requested size = ', int(s,i4b) - write(*,*) opt_, 'Optional parameter' - end if - call h5dread_f(file%sethandle, {{t[4]}}, val, s, file%status) - call assert(file%status>=0, "comm_hdf_mod: Cannot read data from hdf set " // setname) - end subroutine - - {{endfor}} - {{endfor}} - - {{for d in range(1,ndim)}} - {{for t in types}} - subroutine read_alloc_hdf_{{desc(d)}}_{{t[0]}}(file, setname, val) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - {{t[1]}}({{t[2]}}) {{dims(d)}}, allocatable, intent(out) :: val - integer(i4b) :: n({{d}}) - integer(hsize_t) :: s({{d}}) - integer(i4b) :: ext({{d}}) - if(allocated(val)) deallocate(val) - call get_size_hdf(file, setname, n) - allocate(val({{",".join(["n(%d)" % (i+1) for i in range(d)])}})) - call open_hdf_set(file, setname) - s = int(shape(val)) - ! Validate that sizes are consistent - call get_size_hdf(file, setname, ext) - if (any(ext /= s)) then - write(*,*) 'HDF error -- inconsistent array sizes' - write(*,*) ' Filename = ', trim(file%filename) - write(*,*) ' Setname = ', trim(setname) - write(*,*) ' HDF size = ', ext - write(*,*) ' Requested size = ', int(s,i4b) - !write(*,*) opt_, 'Optional parameter' - end if - call h5dread_f(file%sethandle, {{t[4]}}, val, s, file%status) - call assert(file%status>=0, "comm_hdf_mod: Cannot read data from hdf set " // setname) - end subroutine - - {{endfor}} - {{endfor}} - - subroutine read_hdf_opaque(file, setname, val) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - byte, allocatable, dimension(:), target, intent(out) :: val - - integer(hid_t) :: dtype - integer(size_t) :: len, numint - type(c_ptr) :: f_ptr - call open_hdf_set(file, setname) - call h5dget_type_f(file%sethandle, dtype, file%status) - call h5tget_size_f(dtype, len, file%status) - numint = len - allocate(val(numint)) - f_ptr = c_loc(val) - call h5dread_f(file%sethandle, dtype, f_ptr, file%status) - call h5tclose_f(dtype, file%status) - end subroutine read_hdf_opaque - - - subroutine write_hdf_opaque(file, setname, val) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - byte, dimension(:), target, intent(in) :: val - - integer(hid_t) :: dtype - integer(size_t) :: len, numint - type(c_ptr) :: f_ptr - !call open_hdf_set(file, setname) - !call h5dget_type_f(file%sethandle, dtype, file%status) - !call h5tget_size_f(dtype, len, file%status) - !numint = len - !allocate(val(numint)) - !f_ptr = c_loc(val) - !call h5dread_f(file%sethandle, dtype, f_ptr, file%status) - !call h5tclose_f(dtype, file%status) - end subroutine write_hdf_opaque - - subroutine read_hdf_vlen(file, setname, val) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - type(byte_pointer), dimension(:), intent(inout) :: val - - INTEGER(HID_T) :: filetype, memtype, space, dset ! Handles - INTEGER :: hdferr - INTEGER(HSIZE_T), DIMENSION(1:1) :: maxdims, dims - INTEGER :: i, j - integer, dimension(:), pointer :: ptr_r - - ! vl data - TYPE(hvl_t), dimension(:), allocatable, target :: rdata ! Pointer to vlen structures - TYPE(C_PTR) :: f_ptr - !type(byte_pointer), allocatable, dimension(:) :: r_ptr - byte, pointer, dimension(:) :: r_ptr - - call open_hdf_set(file, setname) - call h5dget_type_f(file%sethandle, filetype, hdferr) - CALL h5dget_space_f(file%sethandle, space, hdferr) - - CALL h5sget_simple_extent_dims_f(space, dims, maxdims, hdferr) - - allocate(rdata(dims(1))) - - CALL h5tvlen_create_f(H5T_STD_U8LE, memtype, hdferr) - ! Get address of the C pointer corresponding - ! to the first element of our data - f_ptr = C_LOC(rdata(1)) - CALL h5dread_f(file%sethandle, memtype, f_ptr, hdferr) - ! - ! Write the variable-length data to the fortran array - ! - allocate(r_ptr(dims(1))) - DO i = 1, dims(1) - !WRITE(*,'(A,"(",I0,"):",/,"{")', ADVANCE="no") setname,i - !CALL c_f_pointer(rdata(i)%p, r_ptr(i)%p, [rdata(i)%len] ) - CALL c_f_pointer(rdata(i)%p, r_ptr, [rdata(i)%len] ) - !allocate(val(i)%p(size(r_ptr(i)%p))) - allocate(val(i)%p(size(r_ptr))) - !val(i)%p(:) = r_ptr(i)%p(:) - val(i)%p(:) = r_ptr - - !DO j = 1, rdata(i)%len - ! WRITE(*,'(1X,I0)', ADVANCE='no') val(i)%p(j) - ! IF ( j .LT. rdata(i)%len) WRITE(*,'(",")', ADVANCE='no') - !ENDDO - !WRITE(*,'( " }")') - - ENDDO - ! - ! Close and release resources. Note the use of H5Dvlen_reclaim - ! removes the need to manually deallocate the previously allocated - ! data. - ! - ! Not clear if this line is good or not. It could be de-allocating the read - ! memory that we are now pointing to, but I am not sure - CALL h5dvlen_reclaim_f(memtype, space, H5P_DEFAULT_F, f_ptr, hdferr) - CALL h5dclose_f(dset , hdferr) - CALL h5sclose_f(space, hdferr) - CALL h5tclose_f(filetype, hdferr) - call close_hdf_set(file) - CALL h5tclose_f(memtype, hdferr) - !deallocate(r_ptr, rdata) - deallocate(rdata) - ! deallocate(rdata) - - end subroutine read_hdf_vlen - - subroutine get_hdf_vlen_ext(file, setname, ext) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - integer(i4b), dimension(:), intent(out) :: ext - - INTEGER(HID_T) :: filetype, memtype, space, dset ! Handles - INTEGER :: hdferr - INTEGER(HSIZE_T), DIMENSION(1:1) :: maxdims, dims - INTEGER :: i, j - integer, dimension(:), pointer :: ptr_r - - ! vl data - TYPE(hvl_t), dimension(:), allocatable, target :: rdata ! Pointer to vlen structures - TYPE(C_PTR) :: f_ptr - - call open_hdf_set(file, setname) - call h5dget_type_f(file%sethandle, filetype, hdferr) - CALL h5dget_space_f(file%sethandle, space, hdferr) - CALL h5sget_simple_extent_dims_f(space, dims, maxdims, hdferr) - - allocate(rdata(dims(1))) - CALL h5tvlen_create_f(H5T_STD_U8LE, memtype, hdferr) - f_ptr = C_LOC(rdata(1)) - CALL h5dread_f(file%sethandle, memtype, f_ptr, hdferr) - ext(:) = rdata(:)%len - - CALL h5dvlen_reclaim_f(memtype, space, H5P_DEFAULT_F, f_ptr, hdferr) - CALL h5dclose_f(dset , hdferr) - CALL h5sclose_f(space, hdferr) - CALL h5tclose_f(filetype, hdferr) - call close_hdf_set(file) - CALL h5tclose_f(memtype, hdferr) - deallocate(rdata) - - end subroutine get_hdf_vlen_ext - - subroutine read_hdf_string(file, setname, val) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - character(len=*), intent(out) :: val - - integer(i4b), parameter :: mlen=10000 - integer(hid_t) :: filetype, space - integer(size_t), dimension(1) :: len - integer(hsize_t), dimension(1:2) :: data_dims - integer :: hdferr - character(mlen), allocatable, dimension(:) :: rdata - - call open_hdf_set(file, setname) - CALL H5Dget_type_f(file%sethandle, filetype, hdferr) - CALL H5Dget_space_f(file%sethandle, space, hdferr) - ALLOCATE(rdata(1)) - len=mlen - data_dims = [mlen,1] - CALL h5dread_vl_f(file%sethandle, filetype, rdata, data_dims, len, hdferr, space) - val = rdata(1) - DEALLOCATE(rdata) - call close_hdf_set(file) - CALL h5sclose_f(space, hdferr) - CALL H5Tclose_f(filetype, hdferr) - - end subroutine read_hdf_string - - - subroutine read_hdf_string2(file, setname, val, n) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - character(len=*), intent(out) :: val - integer(i4b), intent(out) :: n - - integer(i4b), parameter :: mlen=100000 - integer(hid_t) :: filetype, space - INTEGER(SIZE_T) :: size - !integer(size_t), dimension(1) :: len - !integer(hsize_t), dimension(1:2) :: data_dims - INTEGER(HSIZE_T), DIMENSION(1:1) :: dims = (/mlen/) - INTEGER(HSIZE_T), DIMENSION(1:1) :: maxdims - integer :: hdferr - !character(len=mlen), dimension(1) :: rdata - character(len=mlen) :: rdata - - call open_hdf_set(file, setname) - CALL H5Dget_type_f(file%sethandle, filetype, hdferr) - CALL H5Tget_size_f(filetype, size, hdferr) - CALL H5Dget_space_f(file%sethandle, space, hdferr) - CALL H5Sget_simple_extent_dims_f(space, dims, maxdims, hdferr) - - call h5dread_f(file%sethandle, filetype, rdata, dims, hdferr, H5S_ALL_F, H5S_ALL_F, H5P_DEFAULT_F) - val = rdata(1:size) - n = int(size,i4b) - - call close_hdf_set(file) - CALL h5sclose_f(space, hdferr) - CALL H5Tclose_f(filetype, hdferr) - - end subroutine read_hdf_string2 - - ! ***************************************************** - ! Set write operations - ! ***************************************************** - - {{for d in range(ndim)}} - {{for t in types}} - subroutine write_hdf_{{desc(d)}}_{{t[0]}}(file, setname, val) - {{if t[0] == "char"}} - - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - integer(hsize_t), allocatable, dimension(:) :: ext_hdf - {{t[1]}}({{t[2]}}) {{dims(d)}}, intent(in) :: val - integer(hid_t) :: str_dtype - integer :: hdferr - - allocate(ext_hdf(size(shape(val)))) - ext_hdf = int(shape(val), hsize_t) - - call H5Tcopy_f({{t[3]}}, str_dtype, hdferr) - call H5Tset_size_f(str_dtype, int(len(val), size_t), hdferr) - - call create_hdf_set(file, setname, shape(val), str_dtype) - call h5dwrite_f(file%sethandle, str_dtype, val, ext_hdf, file%status) - call assert(file%status>=0, "comm_hdf_mod: Cannot write data set") - deallocate(ext_hdf) - - {{else}} - - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - integer(hsize_t), allocatable, dimension(:) :: i - integer(hsize_t), allocatable, dimension(:) :: ext_hdf - {{t[1]}}({{t[2]}}) {{dims(d)}}, intent(in) :: val - {{t[1]}}({{t[2]}}), allocatable {{dims(d)}} :: v - - allocate(ext_hdf(size(shape(val)))) - allocate(v, source=val) - ext_hdf = int(shape(val), hsize_t) - - call create_hdf_set(file, setname, shape(val), {{t[3]}}) - call h5dwrite_f(file%sethandle, {{t[4]}}, v, ext_hdf, file%status) - call assert(file%status>=0, "comm_hdf_mod: Cannot write data set") - deallocate(ext_hdf, v) - - {{endif}} - end subroutine - - {{endfor}} - {{endfor}} - - ! ***************************************************** - ! Sliced set operations. - ! These are like read/write, but the dataset is - ! indexed with a slice. Note that the dataset must - ! exist beforehand. Use create_hdf_set for this. - ! ***************************************************** - - {{for op in [["read","out"],["write","in"]]}} - {{for d in range(ndim)}} - {{for t in types}} - subroutine {{op[0]}}_hdf_slice_{{desc(d)}}_{{t[0]}}(file, setname, slice, arr) - implicit none - type(hdf_file) :: file - character(len=*), intent(in) :: setname - integer(i4b), intent(in) :: slice(:,:) - {{t[1]}}({{t[2]}}) {{dims(d)}}, intent({{op[1]}}) :: arr - integer(hid_t) :: dspace, mspace - integer(i4b), allocatable :: ext(:) - integer(hsize_t) :: hslice(3,size(slice,2)) - integer(hsize_t) :: s({{d}}) - ! Set up data spaces for memory and disk - s = int(shape(arr)) - call h5screate_simple_f(size(shape(arr)), s, mspace, file%status) - call open_hdf_set(file, setname) - allocate(ext(get_rank_hdf(file, setname))) - call get_size_hdf(file, setname, ext) - call h5screate_simple_f(size(ext), int(ext,hsize_t), dspace, file%status) - ! Specify the slice - hslice = int(parse_hdf_slice(slice, ext),hsize_t) - call h5sselect_hyperslab_f(dspace, H5S_SELECT_SET_F, hslice(1,:), hslice(2,:), & - & file%status, stride=hslice(3,:)) - call h5d{{op[0]}}_f(file%sethandle, {{t[4]}}, arr, s, & - & file%status, file_space_id=dspace, mem_space_id=mspace) - call h5sclose_f(dspace, file%status) - call h5sclose_f(mspace, file%status) - deallocate(ext) - end subroutine - - {{endfor}} - {{endfor}} - {{endfor}} - - ! ***************************************************** - ! Optional Reads - ! ***************************************************** - - - ! ***************************************************** - ! Dataset creation operation - ! ***************************************************** - subroutine create_hdf_set(file, setname, ext, type_id) - implicit none - - type(hdf_file) :: file - character(len=*), intent(in) :: setname - integer(i4b), dimension(:), intent(in) :: ext - integer(hid_t) :: type_id - integer(hid_t) :: space - integer(hsize_t), allocatable, dimension(:) :: ext_hdf - if (trim(file%setname) /= trim(setname)) call close_hdf_set(file) - !write(*,*) trim(file%setname), trim(setname) - file%setname = setname - allocate(ext_hdf(size(shape(ext)))) - ext_hdf = int(ext, hsize_t) - call h5screate_simple_f(size(ext), ext_hdf, space, file%status) - call assert(file%status>=0, "comm_hdf_mod: Cannot create data space, "//trim(file%filename)//', '//trim(setname)) - !write(*,*) trim(file%setname), type_id, space, file%sethandle, file%status, ext - call h5dcreate_f(file%filehandle, file%setname, type_id, space, file%sethandle, file%status) - !write(*,*) ' HDF status = ', file%status - !call h5eprint_f(file%status) - call assert(file%status>=0, "comm_hdf_mod: Cannot create data set "//trim(file%filename)//', '//trim(setname)) - call h5sclose_f(space, file%status) - call assert(file%status>=0, "comm_hdf_mod: Cannot close data space") - deallocate(ext_hdf) - end subroutine create_hdf_set - - ! Group creation. Once created, they can be used by specifying "group/dset" instead - ! of just "dset". - subroutine create_hdf_group(file, group) - implicit none - type(hdf_file) :: file - character(len=*) :: group - integer(hid_t) :: gid - call h5gcreate_f(file%filehandle, group, gid, file%status) - call h5gclose_f(gid, file%status) - end subroutine - - ! ********************** - ! Helper functions - ! ********************** - - function slice_0d() result(res) - implicit none - integer(i4b) :: res(3,0) - res = 0 - end function - - function slice_1d(s0) result(res) - implicit none - integer(i4b), dimension(:) :: s0(:) - integer(i4b) :: res(3,1) - select case(size(s0)) - case(0); res(:,1) = [1,-1,1] - case(1); res(:,1) = [s0(1),s0(1),1] - case(2); res(:,1) = [s0(1),s0(2),1] - case(3:); res(:,1) = s0 - end select - end function - - {{for d in range(2,ndim)}} - function slice_{{desc(d)}}({{args("s",d)}}) result(res) - implicit none - integer(i4b), dimension(:) :: {{args("s",d)}} - integer(i4b) :: res(3,{{d}}) - {{for i in range(d)}} - res(:,{{i+1}}:{{i+1}}) = slice_1d({{"s%d"%i}}) - {{endfor}} - end function - - {{endfor}} - function parse_hdf_slice(slice, ext) result(hslice) - implicit none - integer(i4b), intent(in) :: slice(:,:), ext(:) - integer(i4b) :: hslice(3,size(slice,2)) - hslice = slice - ! Negative indices count from the end, with -1 being the last valid index - where(hslice([1,2],:) < 0) hslice([1,2],:) = hslice([1,2],:) + spread(ext,1,2) + 1 - ! We need to translate "to" into "count" - hslice(2,:) = (hslice(2,:)-hslice(1,:)+hslice(3,:))/hslice(3,:) - ! 0 based - hslice(1,:) = hslice(1,:) - 1 - end function - -end module comm_hdf_mod diff --git a/commander3/src/comm_huffman_mod.f90 b/commander3/src/comm_huffman_mod.f90 index e837b183a..1fd7ce436 100644 --- a/commander3/src/comm_huffman_mod.f90 +++ b/commander3/src/comm_huffman_mod.f90 @@ -80,6 +80,8 @@ subroutine huffman_decode2_int(hcode, x_in, x_out, imod) j = 7 end if end do + !call hcode%get_symbol(node, buf) + !x_out(k) = buf x_out(k) = hcode%int_symbs(node) if (k > 1) x_out(k) = x_out(k-1) + x_out(k) if (present(imod)) x_out(k) = iand(x_out(k),imod) diff --git a/commander3/src/comm_line_comp_mod.f90 b/commander3/src/comm_line_comp_mod.f90 index a617d17e3..231b6386e 100644 --- a/commander3/src/comm_line_comp_mod.f90 +++ b/commander3/src/comm_line_comp_mod.f90 @@ -36,6 +36,7 @@ module comm_line_comp_mod contains procedure :: S => evalSED_line procedure :: sampleSpecInd => sampleLineRatios + procedure :: updateMixmat => updateMixmatLineRatios end type comm_line_comp interface comm_line_comp @@ -151,7 +152,7 @@ function constructor_line(cpar, id, id_abs) result(c) do k = 0, data(i)%ndet ! write(*,*) 'line disabled' c%F_int(l,i,k)%p => comm_F_line(c, data(i)%bp(k)%p, .true., & - & c%line2RJ(j) / c%line2RJ_ref * data(i)%RJ2data(k), j) + & c%line2RJ(j) / c%line2RJ_ref * data(i)%bp(k)%p%RJ2data, j) end do j = j+1 else @@ -305,7 +306,7 @@ subroutine sampleLineRatios(self, cpar, handle, id, iter) end if ! Draw sample - par = -1.d30 + par = -1.d300 if (trim(self%operation) == 'optimize') then if (mu < self%p_uni(1,id)) then par = self%p_uni(1,id) @@ -326,7 +327,11 @@ subroutine sampleLineRatios(self, cpar, handle, id, iter) end do end if - write(*,*) ' Line ratio i = ', id, ' = ', par + if (band == self%ref_band) then + write(*,*) ' Line ratio i = ', id, ' = ', par, ' (at refband)' + else + write(*,*) ' Line ratio i = ', id, ' = ', par + end if end if ! Distribute new relative line ratio, and update @@ -352,4 +357,123 @@ subroutine sampleLineRatios(self, cpar, handle, id, iter) end subroutine sampleLineRatios -end module comm_line_comp_mod + ! update the mixing matrix, assumes only temperature and constant across the whole map + subroutine updateMixmatLineRatios(self, theta, beta, band, df, par) + implicit none + class(comm_line_comp), intent(inout) :: self + class(comm_map), dimension(:), intent(in), optional :: theta + real(dp), dimension(:,:,:), intent(in), optional :: beta ! Not used here + integer(i4b), intent(in), optional :: band + class(map_ptr), dimension(:), intent(inout), optional :: df ! Derivative of mixmat with respect to parameter par; for Jeffreys prior + integer(i4b), intent(in), optional :: par ! Parameter ID for derivative + + + integer(i4b) :: i, j, l, p, nmaps, ierr !,checkv, p_min, p_max, n, k, + real(dp) :: t1, t2 !lat, lon, + logical(lgt) :: mixmatnull ! NEW ,only_pol, , bad, precomp, + ! character(len=2) :: ctext + real(dp), allocatable, dimension(:) :: buffer, buff2, theta_p_v ! s, nu, + class(comm_mapinfo), pointer :: info => null() !, info_tp => null() + ! class(map_ptr), allocatable, dimension(:) :: theta_prev + + ! call wall_time(t1) + if (trim(self%type) == 'md') return + + call update_status(status, "mixupdate1 " // trim(self%label)) + + ! Copy over alms from input structure, and compute pixel-space parameter maps + if (present(theta)) then + do i = 1, self%npar + ! write(*,*) 'Check 1' + self%theta(i)%p%alm = theta(i)%alm + end do + end if + + + ! Compute mixing matrix + do i = 1, numband + + ! Only update requested band if present + if (present(band)) then + if (i /= band) cycle + end if + + ! Compute spectral parameters at the correct resolution for this channel + ! only temperature can have a monopole, doesn't make sense for polarization - check with HKE and others about + ! procedure going forwards + if (self%npar > 0) then + nmaps = min(data(i)%info%nmaps, self%theta(1)%p%info%nmaps) + allocate(theta_p_v(self%npar)) + do j = 1,self%npar + ! if self%theta(j)%p%info%lmax=0 constant on the sky + theta_p_v(j) = self%theta(j)%p%alm(0,1)/sqrt(4.0d0*pi) + end do + end if + ! write(*,*) 'id', self%x%info%myid + + call mpi_bcast(theta_p_v,size(theta_p_v),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ierr) + + do l = 0, data(i)%ndet + if (self%F_null(i,l)) then + if (present(df)) df(i)%p%map = 0.d0 + cycle + end if + + if (data(i)%comp_sens == "broadband") then + ! If broadband, calculate mixing matrix + mixmatnull = .false. + else + ! If component sensitivity, only calculate mixmat on that component. + mixmatnull = .true. + If (data(i)%comp_sens == self%label) then + mixmatnull = .false. + end if + end if + + ! Temperature + if (self%npar > 0) then + if (mixmatnull) then + self%F(i,l)%p%map(:,1) = 0.0 + else + self%F(i,l)%p%map(:,1) = self%F_int(1,i,l)%p%eval(theta_p_v(:)) * data(i)%gain * self%cg_scale(1) + ! if (self%x%info%myid==0 .or. self%x%info%myid==1) then + ! write(*,*) 'Check inside core', self%x%info%myid + ! end if + end if + else + if (mixmatnull) then + self%F(i,l)%p%map(:,1) = 0.0 + else + self%F(i,l)%p%map(:,1) = self%F_int(1,i,l)%p%eval([0.d0]) * data(i)%gain * self%cg_scale(1) + end if + end if + + + + allocate(buffer(self%nmaps), buff2(self%nmaps)) + do j = 1, min(self%nmaps, data(i)%info%nmaps) + self%F_mean(i,l,j) = sum(self%F(i,l)%p%map(:,j)) + end do + buff2 = self%F_mean(i,l,:) + !call mpi_barrier(mpi_comm_world, ierr) + call mpi_allreduce(buff2, buffer, self%nmaps, & + & MPI_DOUBLE_PRECISION, MPI_SUM, self%x%info%comm, ierr) + self%F_mean(i,l,:) = buffer / self%F(i,l)%p%info%npix + deallocate(buffer,buff2) + + end do + if (allocated(theta_p_v)) deallocate(theta_p_v) + end do + + call update_status(status, "mixupdate2 " // trim(self%label)) + + ! Request preconditioner update + recompute_diffuse_precond = .true. + + ! call wall_time(t2) + ! if (self%x%info%myid == 0) write(*,*) ' Update line ratio mixing matrix time = ', t2-t1 + + end subroutine updateMixmatLineRatios + + +end module comm_line_comp_mod diff --git a/commander3/src/comm_map_mod.f90 b/commander3/src/comm_map_mod.f90 index 3a574bd2e..50567ae9d 100644 --- a/commander3/src/comm_map_mod.f90 +++ b/commander3/src/comm_map_mod.f90 @@ -47,7 +47,7 @@ module comm_map_mod ! Data variables type(sharp_alm_info) :: alm_info type(sharp_geom_info) :: geom_info_T, geom_info_P - logical(lgt) :: pol, dist + logical(lgt) :: pol, dist, rms integer(i4b) :: comm, myid, nprocs integer(i4b) :: nside, npix, nmaps, nspec, nring, np, lmax, nm, nalm, mmax integer(c_int), allocatable, dimension(:) :: rings @@ -57,6 +57,7 @@ module comm_map_mod integer(c_int), allocatable, dimension(:) :: pix real(c_double), allocatable, dimension(:,:) :: W integer(i4b), allocatable, dimension(:) :: nalms + character(len=128) :: distribute_type contains procedure :: lm2i procedure :: i2lm @@ -155,11 +156,13 @@ end subroutine tod2file_dp3 !************************************************** ! Constructors !************************************************** - function constructor_mapinfo(comm, nside, lmax, nmaps, pol, dist) + function constructor_mapinfo(comm, nside, lmax, nmaps, pol, dist, distribute_type, rms) implicit none integer(i4b), intent(in) :: comm, nside, lmax, nmaps logical(lgt), intent(in) :: pol logical(lgt), optional, intent(in) :: dist + character(len=128), optional, intent(in) :: distribute_type + logical(lgt), optional, intent(in) :: rms class(comm_mapinfo), pointer :: constructor_mapinfo integer(i4b) :: myid, nprocs, ierr @@ -212,6 +215,10 @@ function constructor_mapinfo(comm, nside, lmax, nmaps, pol, dist) p_new%pol = pol p_new%npix = 12*nside**2 p_new%dist = distval + p_new%distribute_type = '' + if(present(distribute_type)) p_new%distribute_type = distribute_type + p_new%rms = .false. + if(present(rms)) p_new%rms = rms ! Select rings and pixels @@ -347,9 +354,9 @@ function constructor_map(info, filename, mask_misspix, udgrade) if (present(filename)) then if (present(mask_misspix)) then allocate(mask_misspix(0:info%np-1,info%nmaps)) - call constructor_map%readFITS(filename, mask=mask_misspix, udgrade=udgrade) + call constructor_map%readFITS(filename, mask=mask_misspix, udgrade=udgrade, dist_type=info%distribute_type) else - call constructor_map%readFITS(filename, udgrade=udgrade) + call constructor_map%readFITS(filename, udgrade=udgrade, dist_type=info%distribute_type) end if else if (info%np > 0) constructor_map%map = 0.d0 @@ -428,6 +435,7 @@ subroutine deallocate_comm_map(self) if (allocated(self%map)) deallocate(self%map) if (allocated(self%alm)) deallocate(self%alm) + if (allocated(self%alm_buff)) deallocate(self%alm_buff) nullify(self%info) if (associated(self%nextLink)) then @@ -472,10 +480,14 @@ subroutine exec_sharp_Y(self) if (self%info%pol) then call sharp_execute(SHARP_Y, 0, 1, self%alm(:,1:1), self%info%alm_info, & & self%map(:,1:1), self%info%geom_info_T, comm=self%info%comm) - if (self%info%nmaps == 3) then + if (self%info%nmaps >= 3) then call sharp_execute(SHARP_Y, 2, 2, self%alm(:,2:3), self%info%alm_info, & & self%map(:,2:3), self%info%geom_info_P, comm=self%info%comm) end if + if (self%info%nmaps > 3) then + call sharp_execute(SHARP_Y, 0, self%info%nmaps-3, self%alm(:,4:self%info%nmaps), self%info%alm_info, & + & self%map(:,4:self%info%nmaps), self%info%geom_info_T, comm=self%info%comm) + end if else call sharp_execute(SHARP_Y, 0, self%info%nmaps, self%alm, self%info%alm_info, & & self%map, self%info%geom_info_T, comm=self%info%comm) @@ -494,10 +506,15 @@ subroutine exec_sharp_WY(self) if (self%info%pol) then call sharp_execute(SHARP_WY, 0, 1, self%alm(:,1:1), self%info%alm_info, & & self%map(:,1:1), self%info%geom_info_T, comm=self%info%comm) - if (self%info%nmaps == 3) then + if (self%info%nmaps >= 3) then call sharp_execute(SHARP_WY, 2, 2, self%alm(:,2:3), self%info%alm_info, & & self%map(:,2:3), self%info%geom_info_P, comm=self%info%comm) end if + if (self%info%nmaps > 3) then + call sharp_execute(SHARP_WY, 0, self%info%nmaps-3, self%alm(:,4:self%info%nmaps), self%info%alm_info, & + & self%map(:,4:self%info%nmaps), self%info%geom_info_T, comm=self%info%comm) + end if + else call sharp_execute(SHARP_WY, 0, self%info%nmaps, self%alm, self%info%alm_info, & & self%map, self%info%geom_info_T, comm=self%info%comm) @@ -553,11 +570,15 @@ subroutine exec_sharp_Yt(self) if (self%info%pol) then call sharp_execute(SHARP_Yt, 0, 1, self%alm(:,1:1), self%info%alm_info, & & self%map(:,1:1), self%info%geom_info_T, comm=self%info%comm) - if (self%info%nmaps == 3) then + if (self%info%nmaps >= 3) then call sharp_execute(SHARP_Yt, 2, 2, self%alm(:,2:3), self%info%alm_info, & & self%map(:,2:3), self%info%geom_info_P, comm=self%info%comm) end if - + if (self%info%nmaps > 3) then + call sharp_execute(SHARP_Yt, 0, self%info%nmaps-3, self%alm(:,4:self%info%nmaps), self%info%alm_info, & + & self%map(:,4:self%info%nmaps), self%info%geom_info_T, comm=self%info%comm) + end if + else call sharp_execute(SHARP_Yt, 0, self%info%nmaps, self%alm, self%info%alm_info, & & self%map, self%info%geom_info_T, comm=self%info%comm) @@ -596,6 +617,11 @@ subroutine exec_sharp_YtW(self) call sharp_execute(SHARP_YtW, 2, 2, self%alm(:,2:3), self%info%alm_info, & & self%map(:,2:3), self%info%geom_info_P, comm=self%info%comm) end if + if (self%info%nmaps > 3) then + call sharp_execute(SHARP_YtW, 0, self%info%nmaps-3, self%alm(:,4:self%info%nmaps), self%info%alm_info, & + & self%map(:,4:self%info%nmaps), self%info%geom_info_T, comm=self%info%comm) + end if + else call sharp_execute(SHARP_YtW, 0, self%info%nmaps, self%alm, self%info%alm_info, & & self%map, self%info%geom_info_T, comm=self%info%comm) @@ -829,25 +855,46 @@ subroutine writeFITS(self, filename, comptype, nu_ref, unit, ttype, spectrumfile end subroutine writeFITS - subroutine readFITS(self, filename, mask, udgrade) + subroutine readFITS(self, filename, mask, udgrade, dist_type) implicit none class(comm_map), intent(inout) :: self real(dp), dimension(0:,1:), intent(out), optional :: mask logical(lgt), intent(in), optional :: udgrade character(len=*), intent(in) :: filename + character(len=128), intent(in), optional :: dist_type - integer(i4b) :: i, j, np, npix, ordering, nside, nmaps, ierr, badpix + integer(i4b) :: i, j, np, npix, ordering, nside, nmaps, ierr, badpix, nmaps_in real(dp), allocatable, dimension(:,:) :: map, buffer, map_in integer(i4b), allocatable, dimension(:) :: p integer(i4b), dimension(MPI_STATUS_SIZE) :: mpistat ! Check file consistency npix = int(getsize_fits(trim(filename), ordering=ordering, nside=nside, nmaps=nmaps),i4b) + if (nmaps < self%info%nmaps) then - if (self%info%myid == 0) write(*,*) 'Incorrect nmaps in ' // trim(filename), nmaps, self%info%nmaps - call mpi_finalize(ierr) - stop + if(present(dist_type)) then + if (trim(dist_type) == 'nplus2') then + !distribute the nmaps=3 maps to I,Q,U,I_1,I_2,I_3... + if(nmaps > 3) then + if (self%info%myid == 0) write(*,*) 'Unbroadcastable nmaps in ' // trim(filename), nmaps, self%info%nmaps + call mpi_finalize(ierr) + stop + end if + nmaps_in = nmaps + else + if (self%info%myid == 0) write(*,*) 'dist_type not supported for ' // trim(filename), nmaps, self%info%nmaps, dist_type + call mpi_finalize(ierr) + write(*,*)1.0/0.d0 + stop + end if + else !crash because we don't know what to do + if (self%info%myid == 0) write(*,*) 'Incorrect nmaps in ' // trim(filename), nmaps, self%info%nmaps, present(dist_type), dist_type + call mpi_finalize(ierr) + stop + end if + else + nmaps_in = self%info%nmaps end if if (nside /= self%info%nside .and. .not. (present(udgrade))) then if (self%info%myid == 0) write(*,*) 'Incorrect nside in ' // trim(filename), 'Expected ', self%info%nside @@ -861,16 +908,16 @@ subroutine readFITS(self, filename, mask, udgrade) ! Read map and convert to RING format if necessary allocate(map(0:self%info%npix-1,self%info%nmaps)) if (present(udgrade)) then - allocate(map_in(0:npix-1,self%info%nmaps)) - call input_map(filename, map_in, npix, self%info%nmaps, ignore_polcconv=.true.) + allocate(map_in(0:npix-1, nmaps_in)) + call input_map(filename, map_in, npix, nmaps_in, ignore_polcconv=.true.) if (ordering == 1) then - call udgrade_ring(map_in, nside, map, nside_out=self%info%nside) + call udgrade_ring(map_in, nside, map(:,1:nmaps_in), nside_out=self%info%nside) else - call udgrade_nest(map_in, nside, map, nside_out=self%info%nside) + call udgrade_nest(map_in, nside, map(:,1:nmaps_in), nside_out=self%info%nside) end if deallocate(map_in) else - call input_map(filename, map, self%info%npix, self%info%nmaps, ignore_polcconv=.true.) + call input_map(filename, map, self%info%npix, nmaps_in, ignore_polcconv=.true.) end if if (present(mask)) then @@ -886,6 +933,15 @@ subroutine readFITS(self, filename, mask, udgrade) end do end if + if(dist_type == 'nplus2') then !Use I map for I_1,I_2... + if(self%info%myid == 0) write(*,'(a,i1,a,a)') "Broadcasting n+2 maps from nmaps= ", nmaps, " for ", trim(filename) + do i = 4, self%info%nmaps + map(:,i) = map(:,1) + ! scale rms maps by sqrt(n) + if(self%info%rms) map(:,i) = map(:,i) *sqrt(float(self%info%nmaps - 3)) + end do + end if + ! Distribute to other nodes allocate(p(self%info%npix)) self%map = map(self%info%pix,:) @@ -1028,6 +1084,7 @@ subroutine write_map(filename, map, comptype, nu_ref, unit, ttype, spectrumfile, character(len=80), dimension(1:120) :: header character(len=16) :: unit_, ttype_ + character(len=8) :: headernum npix = size(map(:,1)) nside = nint(sqrt(real(npix,sp)/12.)) @@ -1094,7 +1151,7 @@ subroutine write_map(filename, map, comptype, nu_ref, unit, ttype, spectrumfile, call add_card(header,"TUNIT4", unit_//'^2',"Map unit") call add_card(header) - else + else if(nmaps <= 3) then call add_card(header) ! blank line call add_card(header,"TTYPE1", "I_"//ttype_,"Stokes I") call add_card(header,"TUNIT1", unit_,"Map unit") @@ -1109,6 +1166,13 @@ subroutine write_map(filename, map, comptype, nu_ref, unit, ttype, spectrumfile, call add_card(header,"TUNIT3", unit_,"Map unit") call add_card(header) endif + else !Something weird with a nonstandard number of maps, add dummy header + call add_card(header) + do i = 1, nmaps + write(headernum, *) i + call add_card(header, "TTYPE"//trim(headernum), "unknown"//trim(headernum), "Unknown datatype") + call add_card(header, "TUNIT"//trim(headernum), unit_, "Map Unit") + end do end if call add_card(header,"COMMENT","-----------------------------------------------") call add_card(header,"COMMENT"," Commander Keywords ") @@ -1476,28 +1540,32 @@ subroutine bcast_fullsky_map(self, map) class(comm_map), intent(in) :: self real(dp), dimension(0:,1:), intent(out) :: map - integer(i4b) :: i, nmaps, npix, np, ierr - real(dp), allocatable, dimension(:,:) :: buffer + integer(i4b) :: i, npix, np, ierr, nmaps_loc + real(dp), allocatable, dimension(:,:) :: buffer_loc integer(i4b), allocatable, dimension(:) :: p npix = self%info%npix - nmaps = self%info%nmaps + nmaps_loc = size(map, 2) + + ! If we are just broadcasting I or just IQU for an n+2 map + !if(size(map, 2) < nmaps) nmaps = size(map, 2) allocate(p(npix)) do i = 0, self%info%nprocs-1 if (self%info%myid == i) then np = self%info%np p(1:np) = self%info%pix(1:np) - allocate(buffer(np,nmaps)) - buffer = self%map + allocate(buffer_loc(np,nmaps_loc)) + buffer_loc = self%map(:, 1:nmaps_loc) end if - + + call mpi_bcast(np, 1, MPI_INTEGER, i, self%info%comm, ierr) call mpi_bcast(p(1:np), np, MPI_INTEGER, i, self%info%comm, ierr) - if (.not. allocated(buffer)) allocate(buffer(np,nmaps)) - call mpi_bcast(buffer, np*nmaps, MPI_DOUBLE_PRECISION, i, self%info%comm, ierr) - map(p(1:np),:) = buffer(1:np,:) - deallocate(buffer) + if (.not. allocated(buffer_loc)) allocate(buffer_loc(np,nmaps_loc)) + call mpi_bcast(buffer_loc, np*nmaps_loc, MPI_DOUBLE_PRECISION, i, self%info%comm, ierr) + map(p(1:np),:) = buffer_loc(1:np,:) + deallocate(buffer_loc) end do deallocate(p) diff --git a/commander3/src/comm_mbbtab_comp_mod.f90 b/commander3/src/comm_mbbtab_comp_mod.f90 index adbd048de..b7e62e264 100644 --- a/commander3/src/comm_mbbtab_comp_mod.f90 +++ b/commander3/src/comm_mbbtab_comp_mod.f90 @@ -29,7 +29,8 @@ module comm_MBBtab_comp_mod ! Modified Black Body (MBBtab) component !************************************************** type, extends (comm_diffuse_comp) :: comm_MBBtab_comp - !integer(i4b) :: ntab + character(len=128) :: mbbtab_type + integer(i4b) :: npar_tab !real(dp), allocatable, dimension(:,:) :: SEDtab !real(dp), allocatable, dimension(:,:) :: SEDtab_buff contains @@ -74,7 +75,18 @@ function constructor_mbbtab(cpar, id, id_abs) result(c) call c%initLmaxSpecind(cpar, id, id_abs) call c%initDiffuse(cpar, id, id_abs) - + + ! Set up MBBtab type + c%mbbtab_type = cpar%cs_mbbtab_type(id_abs) + if (trim(c%mbbtab_type) == 'binned') then + c%npar_tab = 1 + else if (trim(c%mbbtab_type) == 'linear') then + c%npar_tab = 2 + else + write(*,*) 'Error: Unknown MBBtab type =', trim(c%mbbtab_type) + stop + end if + ! Component specific parameters allocate(c%theta_def(2), c%p_gauss(2,2), c%p_uni(2,2)) allocate(c%indlabel(2)) @@ -128,16 +140,16 @@ function constructor_mbbtab(cpar, id, id_abs) result(c) call c%initPixregSampling(cpar, id, id_abs) ! Init alm if (c%lmax_ind >= 0) call c%initSpecindProp(cpar, id, id_abs) - + ! Read SED table call c%read_SED_table(cpar%cs_SED_template(1,id_abs)) - + allocate(c%theta_steplen(2+c%ntab, cpar%mcmc_num_samp_groups)) c%theta_steplen = 0d0 ! Initialize SED priors c%SEDtab_prior = cpar%cs_SED_prior(id_abs) - + ! Initialize mixing matrix call c%updateMixmat @@ -165,7 +177,12 @@ function evalSED_mbbtab(self, nu, band, pol, theta) do i = 1, self%ntab if (nu > self%SEDtab(1,i) .and. nu <= self%SEDtab(2,i)) then ! Table defined in flux density - evalSED_mbbtab = self%SEDtab(3,i) * (self%nu_ref(pol)/nu)**2 + if (trim(self%mbbtab_type) == 'binned') then + evalSED_mbbtab = self%SEDtab(3,i) + else if (trim(self%mbbtab_type) == 'linear') then + evalSED_mbbtab = self%SEDtab(3,i) + self%SEDtab(4,i) * (nu-self%SEDtab(1,i))/(self%SEDtab(2,i)-self%SEDtab(1,i)) + end if + evalSED_mbbtab = evalSED_mbbtab * (self%nu_ref(pol)/nu)**2 return end if end do @@ -205,8 +222,8 @@ subroutine read_SED_table(self, filename) end do 1 close(unit) - allocate(self%SEDtab(3,self%ntab)) - allocate(self%SEDtab_buff(3,self%ntab)) + allocate(self%SEDtab(2+self%npar_tab,self%ntab)) + allocate(self%SEDtab_buff(2+self%npar_tab,self%ntab)) open(unit, file=trim(filename)) i = 0 do while (.true.) diff --git a/commander3/src/comm_md_comp_mod.f90 b/commander3/src/comm_md_comp_mod.f90 index 8cfe079a9..85ca40d24 100644 --- a/commander3/src/comm_md_comp_mod.f90 +++ b/commander3/src/comm_md_comp_mod.f90 @@ -80,6 +80,7 @@ function constructor_md(cpar, id, id_abs, band, label, mu, rms, def) result(c) c%nside_def = 0 c%fwhm_def = 0.d0 c%mono_prior_type = 'none' + c%latmask = -1.d0 precond_type = cpar%cg_precond call get_tokens(cpar%output_comps, ",", comp_label, n) diff --git a/commander3/src/comm_mh_specind_mod.f90 b/commander3/src/comm_mh_specind_mod.f90 index 1793aef0f..b015564cd 100644 --- a/commander3/src/comm_mh_specind_mod.f90 +++ b/commander3/src/comm_mh_specind_mod.f90 @@ -22,6 +22,8 @@ module comm_mh_specind_mod use comm_signal_mod implicit none + integer(i4b), dimension(100,2) :: mh_accept_stat = 0 ! (nsamp, naccept) + real(dp), dimension(100) :: mh_scale = 1. ! Step length modifier contains @@ -212,7 +214,6 @@ subroutine sample_template_mh(outdir, cpar, handle, handle_noise, l) allocate(scales(n_scales)) - ! Calculate initial chisq chisq_old = 0d0 call compute_chisq(data(1)%info%comm, chisq_fullsky=chisq_old, & @@ -243,9 +244,11 @@ subroutine sample_template_mh(outdir, cpar, handle, handle_noise, l) select type(c) class is (comm_diffuse_comp) c%x%alm = c%x%alm*scales(i) + c%x_scale = c%x_scale * scales(i) !call c%x%Y class is (comm_template_comp) c%T%map = c%T%map*scales(i) + c%T_scale = c%T_scale * scales(i) class default write(*,*) "You have not set behavior for class ", trim(c%class) stop @@ -266,6 +269,8 @@ subroutine sample_template_mh(outdir, cpar, handle, handle_noise, l) call compute_chisq(data(1)%info%comm, chisq_fullsky=chisq_prop, & & maskpath=cpar%mcmc_samp_group_mask(l), band_list=cpar%mcmc_group_bands_indices(l,:)) + !call output_FITS_sample(cpar, 2000+l, .true.) + if (cpar%myid_chain .eq. 0) then write(*,*) "| Proposal chisq is ", chisq_prop write(*,*) "| Delta chi^2 is ", chisq_prop - chisq_old @@ -283,6 +288,26 @@ subroutine sample_template_mh(outdir, cpar, handle, handle_noise, l) write(*,*) '| ' end if + i = 0 + c => compList + do while (associated(c)) + if (c%scale_sigma(l) > 0d0) then + i = i + 1 + select type(c) + class is (comm_diffuse_comp) + c%x%alm = c%x%alm/scales(i) + !call c%x%Y + class is (comm_template_comp) + c%T%map = c%T%map/scales(i) + class default + write(*,*) "You have not set behavior for class ", trim(c%class) + stop + end select + end if + c => c%nextComp() + end do + + ! Instead of doing compsep, revert the amplitudes here if (trim(cpar%mcmc_update_cg_groups(l)) .ne. 'none') call revert_CG_amps(cpar) @@ -325,23 +350,30 @@ subroutine sample_mbbtab_mh(outdir, cpar, handle, handle_noise, l) type(comm_params) :: cpar real(dp) :: chisq, my_chisq, chisq_old, chisq_new, chisq_prop, mval, mval_0 - integer(i4b) :: band, ierr, i, j, k, m, pol, pix - logical(lgt) :: include_comp, reject, todo + integer(i4b) :: band, ierr, i, j, k, m, pol, pix, ndof + logical(lgt) :: include_comp, reject, todo, negative character(len=512) :: tokens(10), str_buff, operation class(comm_comp), pointer :: c => null() class(comm_map), pointer :: invN_res => null(), map => null(), sig => null(), res => null() - - + if (cpar%myid == 0) then + write(*,fmt='(a,i3,a,a)') ' | MH MBBtab sampling group ', l, ', active CG sampling groups = ', trim(cpar%mcmc_update_cg_groups(l)) + if (.false. .and. mh_accept_stat(l,1) > 30 .and. real(mh_accept_stat(l,2),sp)/mh_accept_stat(l,1) < 0.1d0) then + write(*,*) 'MH MBBtab ADJUSTING STEP LENGTH for group', l + mh_scale(l) = mh_scale(l) / 2. + mh_accept_stat(l,:) = 0 + end if + write(*,fmt='(a,f10.5)') ' | Step length modifier = ', mh_scale(l) + if (mh_accept_stat(l,1) > 0) then + write(*,fmt='(a,i8,a,f8.4)') ' | nsamp_tot = ', mh_accept_stat(l,1), ', accept rate = ', real(mh_accept_stat(l,2),sp)/mh_accept_stat(l,1) + end if + end if + ! Loop over sampling groups - - !do l = 1, cpar%mcmc_num_user_samp_groups do m = 1, cpar%mcmc_samp_group_numstep(l) - if (cpar%myid == 0) write(*,*) '| Running MH sample ', m, ' out of ', cpar%mcmc_samp_group_numstep(l) mval_0 = -1d0 - k = 0 - + k = 0 c => compList do while (associated(c)) k = k + 1 @@ -358,52 +390,49 @@ subroutine sample_mbbtab_mh(outdir, cpar, handle, handle_noise, l) call mpi_bcast(mval_0, 1, MPI_DOUBLE_PRECISION, & & 0, data(1)%info%comm, ierr) - if (mval_0 <= 0d0) then - return + if (mval_0 <= 0d0) return + + if (cpar%myid == 0) write(*,fmt='(a,i3,a,i3)') ' | Sample ', m, ' out of ', cpar%mcmc_samp_group_numstep(l) + mh_accept_stat(l,1) = mh_accept_stat(l,1) + 1 + + ! Perform one CG sample for init chisq; this should in principle not + ! be necessary, but is useful for cases where the Gibbs chain hasn't burned in yet. + ! Otherwise, one gets a burn-in penalty during the CG step from the large number of + ! free parameters involved there, compared to the few global parameters sampled here. + call store_buffer() ! Avoid burn-in penalty + if (trim(cpar%mcmc_update_cg_groups(l)) /= 'none') then + call sample_all_amps_by_CG(cpar, handle, handle_noise, cg_groups=cpar%mcmc_update_cg_groups(l), verbosity=0) end if - if (cpar%myid == 0) then - write(*,*) '| MH sampling group ', l - end if - + ! Calculate initial chisq - chisq_old = 0d0 - call compute_chisq(data(1)%info%comm, chisq_fullsky=chisq_old, & - & maskpath=cpar%mcmc_samp_group_mask(l), band_list=cpar%mcmc_group_bands_indices(l,:)) - - if (cpar%myid_chain .eq. 0) then - write(*,*) '| Old chisq is ', chisq_old + if (trim(cpar%mcmc_update_cg_groups(l)) /= 'none' .or. m == 1) then + call compute_chisq(data(1)%info%comm, chisq_fullsky=chisq_old, & + & maskpath=cpar%mcmc_samp_group_mask(l), band_list=cpar%mcmc_group_bands_indices(l,:), ndof=ndof) + if (trim(cpar%mcmc_update_cg_groups(l)) .ne. 'none') call revert_CG_amps(cpar) ! Reset to previous values end if - call store_buffer() - + negative = .false. c => compList do while (associated(c)) select type (c) type is (comm_MBBtab_comp) - !if (c%id == k) then if (maxval(c%theta_steplen(c%npar+1:,l)) > 0) then - if (cpar%myid_chain .eq. 0) then - write(*,*) '| ', trim(c%label) c%SEDtab_buff = c%SEDtab - write(*,*) '| MBBtab original' + write(*,fmt='(a,a12)',advance='no') ' | ', trim(c%label) do i = 1, c%ntab - if (c%theta_steplen(c%npar+i,l) > 0) then - write(*,*) '| ', c%SEDtab(3,i) - end if - end do - write(*,*) '| MBBtab proposal' - do i = 1, c%ntab - if (c%theta_steplen(c%npar+i,l) > 0) then - c%SEDtab(3,i) = c%SEDtab(3,i) + rand_gauss(handle) * c%theta_steplen(c%npar+i,l) - write(*,*) '| ', c%SEDtab(3,i) - end if + if (c%theta_steplen(c%npar+i,l) > 0) then + write(*,fmt='(a,i4,a,f16.8)',advance='no') ', bin = ', i, ', old = ', c%SEDtab(3,i) + do j = 3, size(c%SEDtab(:,i)) + c%SEDtab(j,i) = c%SEDtab(j,i) + rand_gauss(handle) * c%theta_steplen(c%npar+i,l) * mh_scale(l) + end do + write(*,fmt='(a,f16.8)') ', prop = ', c%SEDtab(3,i) + end if end do end if - - + negative = negative .or. any(c%SEDtab(3:,:) < 0.d0) end if call mpi_bcast(c%SEDtab, size(c%SEDtab), MPI_DOUBLE_PRECISION, & & 0, data(1)%info%comm, ierr) @@ -412,7 +441,7 @@ subroutine sample_mbbtab_mh(outdir, cpar, handle, handle_noise, l) end select - !go to next compedt + !go to next component c => c%nextComp() end do @@ -420,91 +449,65 @@ subroutine sample_mbbtab_mh(outdir, cpar, handle, handle_noise, l) call update_mixing_matrices(update_F_int=.true.) ! Perform component separation - if (trim(cpar%mcmc_update_cg_groups(l)) == 'none') then - if (cpar%myid == 0) write(*,*) '| No groups to sample' - else - if (cpar%myid == 0) write(*,*) '| Sampling CG groups ',trim(cpar%mcmc_update_cg_groups(l)) - call sample_all_amps_by_CG(cpar, handle, handle_noise, cg_groups=cpar%mcmc_update_cg_groups(l)) + if (trim(cpar%mcmc_update_cg_groups(l)) /= 'none') then + call sample_all_amps_by_CG(cpar, handle, handle_noise, cg_groups=cpar%mcmc_update_cg_groups(l), verbosity=0) end if chisq_prop = 0d0 call compute_chisq(data(1)%info%comm, chisq_fullsky=chisq_prop, & & maskpath=cpar%mcmc_samp_group_mask(l), band_list=cpar%mcmc_group_bands_indices(l,:)) - if (cpar%myid_chain .eq. 0) then - write(*,*) "| Proposal chisq is ", chisq_prop - write(*,*) "| Delta chi^2 is ", chisq_prop - chisq_old - end if - ! Check MH statistic + !reject = log(rand_uni(handle)) > (chisq_old - chisq_prop)/2 .or. negative reject = log(rand_uni(handle)) > (chisq_old - chisq_prop)/2 call mpi_bcast(reject, 1, MPI_LOGICAL, 0, data(1)%info%comm, ierr) - if (reject) then - if (cpar%myid_chain == 0) then - write(*,*) '| ' - write(*,*) '| MH step rejected, returning to original tabulated values.' - write(*,*) '| ' - end if - - - c => compList - do while (associated(c)) - - select type (c) - type is (comm_MBBtab_comp) - - !if (c%id == k) then - if (maxval(c%theta_steplen(c%npar+1:,l)) > 0) then - if (cpar%myid_chain .eq. 0) then - do i = 1, c%ntab - c%SEDtab(3,i) = c%SEDtab_buff(3,i) - end do - end if - - call mpi_bcast(c%SEDtab, size(c%SEDtab), MPI_DOUBLE_PRECISION, & - & 0, data(1)%info%comm, ierr) - end if - - end select - - !go to next component - c => c%nextComp() - end do - - ! Update mixing matrices - call update_mixing_matrices(update_F_int=.true.) - - ! Instead of doing compsep, revert the amplitudes here - if (trim(cpar%mcmc_update_cg_groups(l)) .ne. 'none') call revert_CG_amps(cpar) - - chisq_prop = 0d0 - call compute_chisq(data(1)%info%comm, chisq_fullsky=chisq_prop, & - & maskpath=cpar%mcmc_samp_group_mask(l), band_list=cpar%mcmc_group_bands_indices(l,:)) + if (cpar%myid_chain == 0) then + write(*,fmt='(a,f12.2,a,f12.2,a,f7.3)') " | REJECT -- X^2 = ", chisq_prop, ', dX^2 = ', (chisq_prop - chisq_old), ', X^2/dof = ', chisq_prop/ndof + end if - if (cpar%myid_chain == 0) then - write(*,*) '| ' - write(*,*) '| Chisq reverted back to ', chisq_prop, ' should be ', chisq_old - write(*,*) '| ' - end if + ! Reset parameters to old values + c => compList + do while (associated(c)) + select type (c) + type is (comm_MBBtab_comp) + if (maxval(c%theta_steplen(c%npar+1:,l)) > 0) then + if (cpar%myid_chain .eq. 0) then + do i = 1, c%ntab + c%SEDtab(3:,i) = c%SEDtab_buff(3:,i) + end do + end if + call mpi_bcast(c%SEDtab, size(c%SEDtab), MPI_DOUBLE_PRECISION, & + & 0, data(1)%info%comm, ierr) + end if + end select + c => c%nextComp() + end do - else - if (cpar%myid_chain == 0) then - write(*,*) '| ' - write(*,*) '| MH step accepted' - write(*,*) '| ' - end if + ! Update mixing matrices + call update_mixing_matrices(update_F_int=.true.) + + ! Instead of doing compsep, revert the amplitudes here + if (trim(cpar%mcmc_update_cg_groups(l)) .ne. 'none') call revert_CG_amps(cpar) + + ! Test for proper reset +!!$ chisq_prop = 0d0 +!!$ call compute_chisq(data(1)%info%comm, chisq_fullsky=chisq_prop, & +!!$ & maskpath=cpar%mcmc_samp_group_mask(l), band_list=cpar%mcmc_group_bands_indices(l,:)) +!!$ if (cpar%myid_chain == 0) then +!!$ write(*,*) '| ' +!!$ write(*,*) '| Chisq reverted back to ', chisq_prop, ' should be ', chisq_old +!!$ write(*,*) '| ' +!!$ end if + + else if (cpar%myid_chain == 0) then + write(*,fmt='(a,f12.2,a,f12.2,a,f7.3)') " | ACCEPT -- X^2 = ", chisq_prop, ', dX^2 = ', (chisq_prop - chisq_old), ', X^2/dof = ', chisq_prop/ndof + chisq_old = chisq_prop + mh_accept_stat(l,2) = mh_accept_stat(l,2) + 1 end if - - end do - - if (cpar%myid == 0) then - write(*,*) '| Finished sampling mbbtab' - end if - end subroutine sample_mbbtab_mh subroutine sample_specind_mh(outdir, cpar, handle, handle_noise, l) @@ -683,6 +686,7 @@ subroutine sample_specind_mh(outdir, cpar, handle, handle_noise, l) c%theta(j)%p%map(pix,pol) = c%theta_pixreg_buff(c%ind_pixreg_arr(pix,pol,j),pol,j) end do end do + c%theta_pixreg(:,:,j) = c%theta_pixreg_buff(:,:,j) if (any(c%lmax_ind_pol(:,j) >= 0)) call c%theta(j)%p%YtW_scalar() end select end do @@ -742,7 +746,7 @@ subroutine initialize_mh_mod(cpar) class(comm_map), pointer :: indmask, mask_ud - integer(i4b) :: i, j, k, nside, lmax, nmaps, n, m, n_tokens, n_in_group, ierr, num_gains + integer(i4b) :: i, j, k, nside, lmax, nmaps, n, m, npar, n_tokens, n_in_group, ierr, num_gains integer(i4b) :: wire_to_ind, wire_from_ind integer(i4b), allocatable, dimension(:,:) :: bands_to_sample real(dp) :: sigma @@ -808,9 +812,7 @@ subroutine initialize_mh_mod(cpar) ! Initializing, allocating all gain proposal lengths do i = 1, numband allocate(data(i)%gain_sigmas(cpar%mcmc_num_user_samp_groups)) - !allocate(data(i)%rescale_comp(cpar%mcmc_num_user_samp_groups)) data(i)%gain_sigmas = 0d0 - !data(i)%rescale_comp = '' end do do i = 1, cpar%mcmc_num_user_samp_groups @@ -843,16 +845,13 @@ subroutine initialize_mh_mod(cpar) else if (n == 1) then + call get_tokens(tokens(j), '%', comp_tokens) + read(comp_tokens(2), *) sigma call get_tokens(comp_tokens(1), ':', comp_names) - - if (comp_names(1)(1:7) == 'rescale') then - write(*,*) comp_tokens(1) - stop - else if (trim(comp_names(1)) == 'gain') then - call get_tokens(tokens(j), '%', comp_tokens) - read(comp_tokens(2), *) sigma + + if (trim(comp_names(1)) == 'gain') then do k = 1, numband if (trim(comp_names(2)) .eq. trim(data(k)%label)) then data(k)%gain_sigmas(i) = sigma @@ -860,8 +859,6 @@ subroutine initialize_mh_mod(cpar) end do else if (trim(comp_names(2)) == 'scale') then - call get_tokens(tokens(j), '%', comp_tokens) - read(comp_tokens(2), *) sigma c => compList do while (associated(c)) @@ -964,10 +961,10 @@ subroutine revert_CG_amps(cpar) integer(i4b) :: i, ind class(comm_comp), pointer :: c => null() - if (cpar%myid == 0) then - write(*,*) '| Reverting to buffer values. Did you run sample_maps_with_CG with ' - write(*,*) '| store_buff = .true.?' - end if + !if (cpar%myid == 0) then + ! write(*,*) '| Reverting to buffer values. Did you run sample_maps_with_CG with ' + ! write(*,*) '| store_buff = .true.?' + !end if c => compList do while (associated(c)) diff --git a/commander3/src/comm_n_lcut_mod.f90 b/commander3/src/comm_n_lcut_mod.f90 index 1407e3e70..0b75632a9 100644 --- a/commander3/src/comm_n_lcut_mod.f90 +++ b/commander3/src/comm_n_lcut_mod.f90 @@ -64,7 +64,7 @@ function constructor(cpar, info, id, id_abs, id_smooth, mask, handle, regnoise, implicit none class(comm_N_lcut), pointer :: constructor type(comm_params), intent(in) :: cpar - type(comm_mapinfo), target, intent(in) :: info + type(comm_mapinfo), target, intent(inout) :: info integer(i4b), intent(in) :: id, id_abs, id_smooth class(comm_map), intent(in) :: mask type(planck_rng), intent(inout) :: handle @@ -151,8 +151,8 @@ end function constructor subroutine update_N_lcut(self, info, handle, mask, regnoise, procmask, noisefile, map) implicit none - class(comm_N_lcut), intent(inout) :: self - class(comm_mapinfo), intent(in) :: info + class(comm_N_lcut), intent(inout) :: self + class(comm_mapinfo), intent(inout) :: info type(planck_rng), intent(inout) :: handle class(comm_map), intent(in), optional :: mask real(dp), dimension(0:,1:), intent(out), optional :: regnoise diff --git a/commander3/src/comm_n_mod.f90 b/commander3/src/comm_n_mod.f90 index 7186928d2..4dfa60eaa 100644 --- a/commander3/src/comm_n_mod.f90 +++ b/commander3/src/comm_n_mod.f90 @@ -110,7 +110,7 @@ subroutine update_N(self, info, handle, mask, regnoise, procmask, noisefile, map implicit none class(comm_N), intent(inout) :: self type(planck_rng), intent(inout) :: handle - class(comm_mapinfo), intent(in) :: info + class(comm_mapinfo), intent(inout) :: info class(comm_map), intent(in), optional :: mask real(dp), dimension(0:,1:), intent(out), optional :: regnoise class(comm_map), intent(in), optional :: procmask diff --git a/commander3/src/comm_n_qucov_mod.f90 b/commander3/src/comm_n_qucov_mod.f90 index c016bd361..62d70646b 100644 --- a/commander3/src/comm_n_qucov_mod.f90 +++ b/commander3/src/comm_n_qucov_mod.f90 @@ -59,7 +59,7 @@ function constructor(cpar, info, id, id_abs, id_smooth, mask, handle, regnoise, implicit none class(comm_N_QUcov), pointer :: constructor type(comm_params), intent(in) :: cpar - type(comm_mapinfo), target, intent(in) :: info + type(comm_mapinfo), target, intent(inout) :: info integer(i4b), intent(in) :: id, id_abs, id_smooth class(comm_map), intent(in) :: mask type(planck_rng), intent(inout) :: handle @@ -93,7 +93,7 @@ end function constructor subroutine update_N_QUcov(self, info, handle, mask, regnoise, procmask, noisefile, map) implicit none class(comm_N_QUcov), intent(inout) :: self - class(comm_mapinfo), intent(in) :: info + class(comm_mapinfo), intent(inout) :: info type(planck_rng), intent(inout) :: handle class(comm_map), intent(in), optional :: mask real(dp), dimension(0:,1:), intent(out), optional :: regnoise diff --git a/commander3/src/comm_n_rms_mod.f90 b/commander3/src/comm_n_rms_mod.f90 index 05fe03451..8adf1fbb2 100644 --- a/commander3/src/comm_n_rms_mod.f90 +++ b/commander3/src/comm_n_rms_mod.f90 @@ -59,7 +59,7 @@ function constructor(cpar, info, id, id_abs, id_smooth, mask, handle, regnoise, implicit none class(comm_N_rms), pointer :: constructor type(comm_params), intent(in) :: cpar - type(comm_mapinfo), target, intent(in) :: info + type(comm_mapinfo), target, intent(inout) :: info integer(i4b), intent(in) :: id, id_abs, id_smooth class(comm_map), intent(in) :: mask type(planck_rng), intent(inout) :: handle @@ -108,7 +108,7 @@ function constructor(cpar, info, id, id_abs, id_smooth, mask, handle, regnoise, else tmp = int(getsize_fits(trim(cpar%ds_noise_rms_smooth(id_abs,id_smooth)), nside=nside_smooth), i4b) info_smooth => comm_mapinfo(info%comm, nside_smooth, cpar%lmax_smooth(id_smooth), & - & constructor%nmaps, constructor%pol) + & constructor%nmaps, constructor%pol, distribute_type=info%distribute_type, rms=.true.) constructor%nside = info_smooth%nside constructor%np = info_smooth%np constructor%siN => comm_map(info_smooth, trim(cpar%ds_noise_rms_smooth(id_abs,id_smooth))) @@ -143,7 +143,7 @@ end function constructor subroutine update_N_rms(self, info, handle, mask, regnoise, procmask, noisefile, map) implicit none class(comm_N_rms), intent(inout) :: self - class(comm_mapinfo), intent(in) :: info + class(comm_mapinfo), intent(inout) :: info type(planck_rng), intent(inout) :: handle class(comm_map), intent(in), optional :: mask real(dp), dimension(0:,1:), intent(out), optional :: regnoise @@ -157,11 +157,12 @@ subroutine update_N_rms(self, info, handle, mask, regnoise, procmask, noisefile, class(comm_mapinfo), pointer :: info_lowres => null() call update_status(status, "update_N_rms") + info%rms = .true. if (present(noisefile)) then self%rms0 => comm_map(info, noisefile) else if (present(map)) then - self%rms0 => comm_map(info) + if (.not. associated(self%rms0)) self%rms0 => comm_map(info) self%rms0%map = map%map else call report_error('Error in update_N_rms - no noisefile or map declared') @@ -174,6 +175,9 @@ subroutine update_N_rms(self, info, handle, mask, regnoise, procmask, noisefile, if (associated(self%rms_reg)) then self%siN%map = sqrt(self%siN%map**2 + self%rms_reg%map**2) end if + if(.not. present(mask)) then + write(*,*) "Mask not provided in update_N_rms" + end if call uniformize_rms(handle, self%siN, self%uni_fsky, mask, regnoise) self%siN%map = self%siN%map * mask%map ! Apply mask if (present(procmask)) then @@ -251,7 +255,7 @@ subroutine update_N_rms(self, info, handle, mask, regnoise, procmask, noisefile, ! Set up lowres map if (.not.associated(self%siN_lowres)) then - info_lowres => comm_mapinfo(self%info%comm, self%nside_chisq_lowres, 0, self%nmaps, self%pol) + info_lowres => comm_mapinfo(self%info%comm, self%nside_chisq_lowres, 0, self%nmaps, self%pol, rms=.true.) self%siN_lowres => comm_map(info_lowres) end if iN => comm_map(self%siN) diff --git a/commander3/src/comm_n_rms_qucov_mod.f90 b/commander3/src/comm_n_rms_qucov_mod.f90 index ac265515a..7a882a6d4 100644 --- a/commander3/src/comm_n_rms_qucov_mod.f90 +++ b/commander3/src/comm_n_rms_qucov_mod.f90 @@ -67,9 +67,9 @@ module comm_N_rms_QUcov_mod !************************************************** function constructor(cpar, info, id, id_abs, id_smooth, mask, handle, regnoise, procmask, map) implicit none - class(comm_N_rms_QUcov), pointer :: constructor + class(comm_N_rms_QUcov), pointer :: constructor type(comm_params), intent(in) :: cpar - type(comm_mapinfo), target, intent(in) :: info + type(comm_mapinfo), target, intent(inout) :: info integer(i4b), intent(in) :: id, id_abs, id_smooth class(comm_map), intent(in) :: mask type(planck_rng), intent(inout) :: handle @@ -156,8 +156,8 @@ end function constructor subroutine update_N_rms_QUcov(self, info, handle, mask, regnoise, procmask, noisefile, map) implicit none - class(comm_N_rms_QUcov), intent(inout) :: self - class(comm_mapinfo), intent(in) :: info + class(comm_N_rms_QUcov), intent(inout) :: self + class(comm_mapinfo), intent(inout) :: info type(planck_rng), intent(inout) :: handle class(comm_map), intent(in), optional :: mask real(dp), dimension(0:,1:), intent(out), optional :: regnoise @@ -181,7 +181,7 @@ subroutine update_N_rms_QUcov(self, info, handle, mask, regnoise, procmask, nois if (present(noisefile)) then self%N_map => comm_map(info, noisefile) else if (present(map)) then - self%N_map => comm_map(info) + if (.not. associated(self%N_map)) self%N_map => comm_map(info) if (map%info%nmaps == 3) then self%N_map%map(:,1:3) = map%map self%N_map%map(:,4) = 0 diff --git a/commander3/src/comm_output_mod.f90 b/commander3/src/comm_output_mod.f90 index e8d3f6159..0992ef081 100644 --- a/commander3/src/comm_output_mod.f90 +++ b/commander3/src/comm_output_mod.f90 @@ -89,7 +89,7 @@ subroutine output_FITS_sample(cpar, iter, output_hdf) integer(i4b), intent(in) :: iter logical(lgt), intent(in) :: output_hdf - integer(i4b) :: i, j, p, hdferr, ierr, unit, p_min, p_max + integer(i4b) :: i, j, p, hdferr, ierr, unit, p_min, p_max, nmaps real(dp) :: chisq, chisq_eff, t1, t2, t3, t4, theta_sum, uscale logical(lgt) :: exist, init, new_header character(len=4) :: ctext @@ -104,6 +104,7 @@ subroutine output_FITS_sample(cpar, iter, output_hdf) class(comm_N), pointer :: N => null() type(hdf_file) :: file TYPE(h5o_info_t) :: object_info + real(dp), allocatable, dimension(:,:) :: map_out call update_status(status, "output_start") @@ -145,7 +146,7 @@ subroutine output_FITS_sample(cpar, iter, output_hdf) call create_hdf_group(file, trim(adjustl(itext))//'/md') end if call update_status(status, "output_chain") - + !Prepare mean foregrounds values print to file if (cpar%myid_chain == 0) then fg_file=trim(cpar%outdir)//'/fg_ind_mean_c' // trim(adjustl(ctext))//'.dat' @@ -343,7 +344,7 @@ subroutine output_FITS_sample(cpar, iter, output_hdf) if (cpar%output_chisq) then call data(i)%N%sqrtInvN(map) map%map = map%map**2 - info => comm_mapinfo(data(i)%info%comm, chisq_map%info%nside, 0, data(i)%info%nmaps, data(i)%info%nmaps==3) + info => comm_mapinfo(data(i)%info%comm, chisq_map%info%nside, 0, data(i)%info%nmaps, data(i)%info%pol) chisq_sub => comm_map(info) call map%udgrade(chisq_sub) @@ -351,18 +352,23 @@ subroutine output_FITS_sample(cpar, iter, output_hdf) ! of bands with different units comparable uscale = data(i)%bp(0)%p%unit_scale do j = 1, data(i)%info%nmaps - chisq_map%map(:,j) = chisq_map%map(:,j) + chisq_sub%map(:,j) * (map%info%npix/chisq_sub%info%npix) - chisq_map_eff%map(:,j) = chisq_map_eff%map(:,j) + chisq_sub%map(:,j) * (map%info%npix/chisq_sub%info%npix) - !N => data(i)%N - ! select type (N) - ! Defining chisq_eff = -2*log(L) such that - ! -2*log(L) = chi^2 + log(det(2*pi*Sigma)) - ! log(det(Sigma)) -> 2*log(2*pi*sigma) - ! class is (comm_N_rms) - ! chisq_map_eff%map(:,j) = chisq_map_eff%map(:,j) + log(2*pi) + 2*log(N%rms0%map(:,j)/uscale) - ! class is (comm_N_lcut) - ! chisq_map_eff%map(:,j) = chisq_map_eff%map(:,j) + log(2*pi) + 2*log(N%rms0%map(:,j)/uscale) - ! end select + if(data(i)%info%nmaps > 3) then + chisq_map%map(:,1) = chisq_map%map(:,1) + chisq_sub%map(:,j) * (map%info%npix/chisq_sub%info%npix) + chisq_map_eff%map(:,1) = chisq_map_eff%map(:,1) + chisq_sub%map(:,j) * (map%info%npix/chisq_sub%info%npix) + else + chisq_map%map(:,j) = chisq_map%map(:,j) + chisq_sub%map(:,j) * (map%info%npix/chisq_sub%info%npix) + chisq_map_eff%map(:,j) = chisq_map_eff%map(:,j) + chisq_sub%map(:,j) * (map%info%npix/chisq_sub%info%npix) + !N => data(i)%N + ! select type (N) + ! Defining chisq_eff = -2*log(L) such that + ! -2*log(L) = chi^2 + log(det(2*pi*Sigma)) + ! log(det(Sigma)) -> 2*log(2*pi*sigma) + ! class is (comm_N_rms) + ! chisq_map_eff%map(:,j) = chisq_map_eff%map(:,j) + log(2*pi) + 2*log(N%rms0%map(:,j)/uscale) + ! class is (comm_N_lcut) + ! chisq_map_eff%map(:,j) = chisq_map_eff%map(:,j) + log(2*pi) + 2*log(N%rms0%map(:,j)/uscale) + ! end select + end if end do call chisq_sub%dealloc(); deallocate(chisq_sub) end if @@ -453,6 +459,30 @@ subroutine output_FITS_sample(cpar, iter, output_hdf) do i = 1, numband if (trim(data(i)%tod_type) == 'none') cycle if (data(i)%tod%map_solar_allocated) call write_map2(trim(cpar%outdir) // '/tod_'//trim(data(i)%label)//'_solar_c'//ctext//'_k' // itext // '.fits', data(i)%tod%map_solar) + if (data(i)%tod%map_moon_allocated) call write_map2(trim(cpar%outdir) // '/tod_'//trim(data(i)%label)//'_moon_c'//ctext//'_k' // itext // '.fits', data(i)%tod%map_moon) + if (data(i)%tod%map_earth_allocated) then + open(58,file=trim(cpar%outdir) // '/tod_'//trim(data(i)%label)//'_earth_c'//ctext//'_k' // itext // '.dat') + do j = 1, NBIN_EARTH_ELON + write(58,*) real(j+0.5,sp)*pi/NBIN_EARTH_ELON, data(i)%tod%map_earth(j) + end do + close(58) + end if + end do + end if + + ! Output pixel histogram summary + if (cpar%myid_chain == 0 .and. iter == 1) then + do i = 1, numband + if (trim(data(i)%tod_type) == 'none') cycle + if (allocated(data(i)%tod%pixhist)) then + allocate(map_out(0:size(data(i)%tod%pixhist,2)-1,5)) + map_out = transpose(data(i)%tod%pixhist) + do j = 1, size(map_out,2) + call convert_nest2ring(data(i)%tod%nside_pixhist, map_out(:,j)) + end do + call write_map2(trim(cpar%outdir) // '/tod_'//trim(data(i)%label)//'_pixhist.fits', map_out) + deallocate(map_out) + end if end do end if end if @@ -510,8 +540,8 @@ subroutine write_params_to_hdf(cpar, chainfile) call create_hdf_group(chainfile, 'parameters') n = size(cpar%cs_label) - do i = 1, n + !write(*,*) i, trim(adjustl(cpar%cs_label(i))) hdf_path = 'parameters/'//trim(adjustl(cpar%cs_label(i))) call create_hdf_group(chainfile, trim(hdf_path)) diff --git a/commander3/src/comm_param_mod.f90 b/commander3/src/comm_param_mod.f90 index f72e41e10..3fe11a3b6 100644 --- a/commander3/src/comm_param_mod.f90 +++ b/commander3/src/comm_param_mod.f90 @@ -41,16 +41,18 @@ module comm_param_mod type(status_file) :: status type InterplanetaryDustParamLabels - character(len=128), dimension(2) :: general = [character(len=128) :: "T_0", "T_DELTA"] - character(len=128), dimension(6) :: common = [character(len=128) :: 'N_0', 'I', 'OMEGA', 'X_0', 'Y_0', 'Z_0'] - character(len=128), dimension(4) :: cloud = [character(len=128) :: 'ALPHA', 'BETA', 'GAMMA', 'MU'] - character(len=128), dimension(4) :: band = [character(len=128) :: 'DELTA_ZETA', 'DELTA_R', 'V', 'P'] - character(len=128), dimension(5) :: ring = [character(len=128) :: 'R', 'SIGMA_R', 'SIGMA_Z', 'THETA', 'SIGMA_THETA'] - character(len=128), dimension(5) :: feature = [character(len=128) :: 'R', 'SIGMA_R', 'SIGMA_Z', 'THETA', 'SIGMA_THETA'] - character(len=128), dimension(2) :: interstellar = [character(len=128) :: 'R', 'ALPHA'] - character(len=128), dimension(5) :: fan = [character(len=128) :: 'Q', 'P', 'gamma', 'Z_midplane_0', 'R_outer'] - character(len=128), dimension(4) :: comet = [character(len=128) :: 'P', 'Z_midplane_0', 'R_inner', 'R_outer'] - character(len=128), dimension(4) :: comp_types = [character(len=128) :: 'CLOUD', 'BAND', 'RING', 'FEATURE'] + character(len=2048), dimension(7) :: general = [character(len=2048) :: "T_0", "T_DELTA", "G1", "G2", "G3", "W2", "W3"] + character(len=2048), dimension(6) :: common = [character(len=2048) :: 'N_0', 'I', 'OMEGA', 'X_0', 'Y_0', 'Z_0'] + character(len=2048), dimension(4) :: cloud = [character(len=2048) :: 'ALPHA', 'BETA', 'GAMMA', 'MU'] + character(len=2048), dimension(4) :: band = [character(len=2048) :: 'DELTA_ZETA', 'DELTA_R', 'V', 'P'] + character(len=2048), dimension(5) :: ring = [character(len=2048) :: 'R', 'SIGMA_R', 'SIGMA_Z', 'THETA', 'SIGMA_THETA'] + character(len=2048), dimension(5) :: feature = [character(len=2048) :: 'R', 'SIGMA_R', 'SIGMA_Z', 'THETA', 'SIGMA_THETA'] + character(len=2048), dimension(2) :: interstellar = [character(len=2048) :: 'R', 'ALPHA'] + character(len=2048), dimension(5) :: fan = [character(len=2048) :: 'Q', 'P', 'gamma', 'Z_midplane_0', 'R_outer'] + character(len=2048), dimension(4) :: comet = [character(len=2048) :: 'P', 'Z_midplane_0', 'R_inner', 'R_outer'] + character(len=2048), dimension(16) :: WrightCloudRing = [character(len=2048) :: 'p1', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9', 'p10', 'p13', 'p14', 'p15', 'p16', 'p17', 'p18', 'p19'] + character(len=2048), dimension(6) :: WrightBand = [character(len=2048) :: 'q1', 'q5', 'q6', 'q7', 'q8', 'R_1'] + character(len=2048), dimension(6) :: comp_types = [character(len=2048) :: 'CLOUD', 'BAND', 'RING', 'FEATURE', 'WRIGHTCLOUDRING', 'WRIGHTBAND'] contains procedure :: get_labels @@ -70,11 +72,11 @@ module comm_param_mod integer(i4b) :: first_samp_resamp, last_samp_resamp, numsamp_per_resamp integer(i4b) :: verbosity, base_seed, base_seed_noise, numchain, num_smooth_scales integer(i4b) :: num_gibbs_iter, thinning, num_init_chains - character(len=512) :: chain_status, init_chain_prefix + character(len=2048) :: chain_status, init_chain_prefix real(dp) :: T_CMB - character(len=512) :: MJysr_convention - character(len=512) :: fft_magic_number_file - character(len=512) :: output_comps + character(len=2048) :: MJysr_convention + character(len=2048) :: fft_magic_number_file + character(len=2048) :: output_comps logical(lgt) :: only_pol, only_I logical(lgt) :: enable_TOD_analysis logical(lgt) :: enable_TOD_simulations !< start commander in simulation regime @@ -83,21 +85,22 @@ module comm_param_mod integer(i4b) :: output_4D_map_nth_iter, output_aux_maps logical(lgt) :: include_tod_zodi, sample_zodi, incl_zodi_solar_comp integer(i4b) :: zodi_solar_nside - character(len=512) :: zodi_solar_initmap, zodi_static_bands + logical(lgt) :: sample_solar_maps, sample_moon_maps, sample_earth_maps + character(len=2048) :: zodi_solar_initmap, zodi_moon_initmap, zodi_earth_initmap, zodi_static_bands real(dp), allocatable, dimension(:) :: fwhm_smooth real(dp), allocatable, dimension(:) :: fwhm_postproc_smooth integer(i4b), allocatable, dimension(:) :: lmax_smooth integer(i4b), allocatable, dimension(:) :: nside_smooth - character(len=512), allocatable, dimension(:) :: pixwin_smooth - character(len=512), allocatable, dimension(:) :: init_chain_prefixes - character(len=512) :: sims_output_dir !< simulations directory + character(len=2048), allocatable, dimension(:) :: pixwin_smooth + character(len=2048), allocatable, dimension(:) :: init_chain_prefixes + character(len=2048) :: sims_output_dir !< simulations directory ! alm-sampler integer(i4b) :: almsamp_nsamp, almsamp_nside_chisq_lowres, almsamp_prior_fwhm, almsamp_burnin logical(lgt) :: almsamp_optimize, almsamp_apply_prior, almsamp_pixreg, almsamp_priorsamp_frozen ! Output parameters - character(len=512) :: outdir + character(len=2048) :: outdir integer(i4b) :: nside_chisq, nmaps_chisq logical(lgt) :: pol_chisq, output_mixmat, output_residuals, output_chisq, output_cg_eigenvals integer(i4b) :: output_cg_freq @@ -105,70 +108,71 @@ module comm_param_mod logical(lgt) :: sample_signal_amplitudes, sample_specind, sample_powspec ! Numerical parameters - character(len=512) :: cg_conv_crit, cg_precond + character(len=2048) :: cg_conv_crit, cg_precond integer(i4b) :: cg_lmax_precond, cg_maxiter, cg_num_samp_groups, cg_num_user_samp_groups, cg_miniter, cg_check_conv_freq, cg_samp_group_md logical(lgt) :: cg_init_zero, set_noise_to_mean real(dp) :: cg_tol integer(i4b) :: num_bp_prop - character(len=512), dimension(MAXSAMPGROUP) :: cg_samp_group - character(len=512), dimension(MAXSAMPGROUP) :: cg_samp_group_mask + character(len=2048), dimension(MAXSAMPGROUP) :: cg_samp_group + character(len=2048), dimension(MAXSAMPGROUP) :: cg_samp_group_mask integer(i4b), dimension(MAXSAMPGROUP) :: cg_samp_group_maxiter - character(len=512), dimension(MAXSAMPGROUP) :: cg_samp_group_bands + character(len=2048), dimension(MAXSAMPGROUP) :: cg_samp_group_bands ! Data parameters integer(i4b) :: numband - character(len=512) :: datadir, ds_sourcemask, ds_procmask + character(len=2048) :: datadir, ds_sourcemask, ds_procmask logical(lgt), allocatable, dimension(:) :: ds_active integer(i4b), allocatable, dimension(:) :: ds_period logical(lgt), allocatable, dimension(:) :: ds_polarization integer(i4b), allocatable, dimension(:) :: ds_nside integer(i4b), allocatable, dimension(:) :: ds_lmax - character(len=512), allocatable, dimension(:) :: ds_label - character(len=512), allocatable, dimension(:) :: ds_instlabel - character(len=512), allocatable, dimension(:) :: ds_unit - character(len=512), allocatable, dimension(:) :: ds_noise_format + character(len=2048), allocatable, dimension(:) :: ds_label + character(len=2048), allocatable, dimension(:) :: ds_instlabel + character(len=2048), allocatable, dimension(:) :: ds_unit + character(len=2048), allocatable, dimension(:) :: ds_noise_format integer(i4b), allocatable, dimension(:) :: ds_noise_lcut - character(len=512), allocatable, dimension(:) :: ds_mapfile - character(len=512), allocatable, dimension(:) :: ds_noisefile - character(len=512), allocatable, dimension(:) :: ds_regnoise - character(len=512), allocatable, dimension(:,:) :: ds_noise_rms_smooth + character(len=2048), allocatable, dimension(:) :: ds_mapfile + character(len=2048), allocatable, dimension(:) :: ds_noisefile + character(len=2048), allocatable, dimension(:) :: ds_regnoise + character(len=2048), allocatable, dimension(:,:) :: ds_noise_rms_smooth real(dp), allocatable, dimension(:) :: ds_noise_uni_fsky - character(len=512), allocatable, dimension(:) :: ds_maskfile - character(len=512), allocatable, dimension(:) :: ds_maskfile_calib - character(len=512), allocatable, dimension(:) :: ds_beamtype - character(len=512), allocatable, dimension(:) :: ds_blfile - character(len=512), allocatable, dimension(:) :: ds_btheta_file - character(len=512), allocatable, dimension(:) :: ds_pixwin + character(len=2048), allocatable, dimension(:) :: ds_maskfile + character(len=2048), allocatable, dimension(:) :: ds_maskfile_calib + character(len=2048), allocatable, dimension(:) :: ds_beamtype + character(len=2048), allocatable, dimension(:) :: ds_blfile + character(len=2048), allocatable, dimension(:) :: ds_btheta_file + character(len=2048), allocatable, dimension(:) :: ds_pixwin logical(lgt), allocatable, dimension(:) :: ds_samp_noiseamp - character(len=512), allocatable, dimension(:) :: ds_bptype - character(len=512), allocatable, dimension(:) :: ds_bpfile - character(len=512), allocatable, dimension(:) :: ds_bpmodel + character(len=2048), allocatable, dimension(:) :: ds_bptype + character(len=2048), allocatable, dimension(:) :: ds_bpfile + character(len=2048), allocatable, dimension(:) :: ds_bpmodel real(dp), allocatable, dimension(:) :: ds_nu_c logical(lgt), allocatable, dimension(:) :: ds_sample_gain real(dp), allocatable, dimension(:,:) :: ds_gain_prior - character(len=512), allocatable, dimension(:) :: ds_gain_calib_comp + character(len=2048), allocatable, dimension(:) :: ds_gain_calib_comp integer(i4b), allocatable, dimension(:) :: ds_gain_lmin integer(i4b), allocatable, dimension(:) :: ds_gain_lmax - character(len=512), allocatable, dimension(:) :: ds_gain_apodmask - character(len=512), allocatable, dimension(:) :: ds_gain_fwhm + character(len=2048), allocatable, dimension(:) :: ds_gain_apodmask + character(len=2048), allocatable, dimension(:) :: ds_gain_fwhm real(dp), allocatable, dimension(:,:) :: ds_defaults - character(len=512), allocatable, dimension(:) :: ds_component_sensitivity + character(len=2048), allocatable, dimension(:) :: ds_component_sensitivity real(dp), allocatable, dimension(:, :):: ds_zodi_emissivity, ds_zodi_albedo logical(lgt), allocatable, dimension(:) :: ds_zodi_reference_band !TOD data parameters - character(len=512), allocatable, dimension(:) :: ds_tod_type - character(len=512), allocatable, dimension(:) :: ds_tod_procmask1 - character(len=512), allocatable, dimension(:) :: ds_tod_procmask2 - character(len=512), allocatable, dimension(:) :: ds_tod_procmask_zodi - character(len=512), allocatable, dimension(:) :: ds_tod_filelist - character(len=512), allocatable, dimension(:) :: ds_tod_jumplist - character(len=512), allocatable, dimension(:) :: ds_tod_instfile - character(len=512), allocatable, dimension(:) :: ds_tod_dets - character(len=512), allocatable, dimension(:) :: ds_tod_bp_init - character(len=512), allocatable, dimension(:) :: ds_tod_initHDF - character(len=512), allocatable, dimension(:) :: ds_tod_level - character(len=512), allocatable, dimension(:) :: ds_tod_abscal + character(len=2048), allocatable, dimension(:) :: ds_tod_type + character(len=2048), allocatable, dimension(:) :: ds_tod_procmask1 + character(len=2048), allocatable, dimension(:) :: ds_tod_procmask2 + character(len=2048), allocatable, dimension(:) :: ds_tod_procmask_zodi + character(len=2048), allocatable, dimension(:) :: ds_tod_filelist + character(len=2048), allocatable, dimension(:) :: ds_tod_jumplist + character(len=2048), allocatable, dimension(:) :: ds_tod_map_type + character(len=2048), allocatable, dimension(:) :: ds_tod_instfile + character(len=2048), allocatable, dimension(:) :: ds_tod_dets + character(len=2048), allocatable, dimension(:) :: ds_tod_bp_init + character(len=2048), allocatable, dimension(:) :: ds_tod_initHDF + character(len=2048), allocatable, dimension(:) :: ds_tod_level + character(len=2048), allocatable, dimension(:) :: ds_tod_abscal integer(i4b), allocatable, dimension(:,:) :: ds_tod_scanrange integer(i4b), allocatable, dimension(:) :: ds_tod_tot_numscan integer(i4b), allocatable, dimension(:) :: ds_tod_flag @@ -176,40 +180,46 @@ module comm_param_mod logical(lgt), allocatable, dimension(:) :: ds_tod_orb_abscal logical(lgt), allocatable, dimension(:) :: ds_tod_subtract_zodi integer(i4b), allocatable, dimension(:) :: ds_tod_freq - character(len=512), allocatable, dimension(:) :: ds_tod_solar_mask - character(len=512), allocatable, dimension(:) :: ds_tod_solar_model - character(len=512), allocatable, dimension(:) :: ds_tod_solar_init + character(len=2048), allocatable, dimension(:) :: ds_tod_solar_mask + character(len=2048), allocatable, dimension(:) :: ds_tod_solar_model + character(len=2048), allocatable, dimension(:) :: ds_tod_solar_init + character(len=2048), allocatable, dimension(:) :: ds_tod_moon_model + character(len=2048), allocatable, dimension(:) :: ds_tod_moon_mask + character(len=2048), allocatable, dimension(:) :: ds_tod_moon_init + character(len=2048), allocatable, dimension(:) :: ds_tod_earth_model + character(len=2048), allocatable, dimension(:) :: ds_tod_earth_mask + character(len=2048), allocatable, dimension(:) :: ds_tod_earth_init ! Component parameters - character(len=512) :: cs_inst_parfile - character(len=512) :: cs_init_inst_hdf + character(len=2048) :: cs_inst_parfile + character(len=2048) :: cs_init_inst_hdf integer(i4b) :: cs_ncomp, cs_ncomp_tot, cs_local_burn_in logical(lgt) :: cs_output_localsamp_maps real(dp) :: cmb_dipole_prior(3) - character(len=512) :: cmb_dipole_prior_mask + character(len=2048) :: cmb_dipole_prior_mask logical(lgt), allocatable, dimension(:) :: cs_include - character(len=512), allocatable, dimension(:) :: cs_initHDF - character(len=512), allocatable, dimension(:) :: cs_label - character(len=512), allocatable, dimension(:) :: cs_type - character(len=512), allocatable, dimension(:) :: cs_class + character(len=2048), allocatable, dimension(:) :: cs_initHDF + character(len=2048), allocatable, dimension(:) :: cs_label + character(len=2048), allocatable, dimension(:) :: cs_type + character(len=2048), allocatable, dimension(:) :: cs_class logical(lgt), allocatable, dimension(:) :: cs_polarization real(dp), allocatable, dimension(:,:) :: cs_cg_scale integer(i4b), allocatable, dimension(:) :: cs_nside integer(i4b), allocatable, dimension(:,:) :: cs_poltype integer(i4b), allocatable, dimension(:) :: cs_cg_samp_group_maxiter - character(len=512), allocatable, dimension(:,:,:) :: cs_spec_lnLtype - character(len=512), allocatable, dimension(:,:,:) :: cs_spec_pixreg - character(len=512), allocatable, dimension(:,:) :: cs_spec_pixreg_map - character(len=512), allocatable, dimension(:,:,:) :: cs_spec_fix_pixreg - character(len=512), allocatable, dimension(:,:,:) :: cs_spec_pixreg_priors - character(len=512), allocatable, dimension(:,:) :: cs_spec_mask - character(len=512), allocatable, dimension(:,:) :: cs_spec_nprop - character(len=512), allocatable, dimension(:,:) :: cs_spec_proplen - character(len=512), allocatable, dimension(:,:) :: cs_spec_mono_mask - character(len=512), allocatable, dimension(:,:) :: cs_spec_mono_freeze - character(len=512), allocatable, dimension(:,:) :: cs_spec_mono_type - character(len=512), allocatable, dimension(:,:) :: cs_almsamp_init - character(len=512), allocatable, dimension(:,:) :: cs_pixreg_init_theta + character(len=2048), allocatable, dimension(:,:,:) :: cs_spec_lnLtype + character(len=2048), allocatable, dimension(:,:,:) :: cs_spec_pixreg + character(len=2048), allocatable, dimension(:,:) :: cs_spec_pixreg_map + character(len=2048), allocatable, dimension(:,:,:) :: cs_spec_fix_pixreg + character(len=2048), allocatable, dimension(:,:,:) :: cs_spec_pixreg_priors + character(len=2048), allocatable, dimension(:,:) :: cs_spec_mask + character(len=2048), allocatable, dimension(:,:) :: cs_spec_nprop + character(len=2048), allocatable, dimension(:,:) :: cs_spec_proplen + character(len=2048), allocatable, dimension(:,:) :: cs_spec_mono_mask + character(len=2048), allocatable, dimension(:,:) :: cs_spec_mono_freeze + character(len=2048), allocatable, dimension(:,:) :: cs_spec_mono_type + character(len=2048), allocatable, dimension(:,:) :: cs_almsamp_init + character(len=2048), allocatable, dimension(:,:) :: cs_pixreg_init_theta integer(i4b), allocatable, dimension(:,:,:) :: cs_spec_nprop_init real(dp), allocatable, dimension(:,:,:) :: cs_spec_proplen_init real(dp), allocatable, dimension(:,:) :: cs_spec_corr_limit @@ -227,39 +237,41 @@ module comm_param_mod integer(i4b), allocatable, dimension(:) :: cs_lmax_amp_prior integer(i4b), allocatable, dimension(:) :: cs_l_apod integer(i4b), allocatable, dimension(:) :: cs_lmax_ind - character(len=512), allocatable, dimension(:) :: cs_unit + character(len=2048), allocatable, dimension(:) :: cs_unit real(dp), allocatable, dimension(:,:) :: cs_nu_ref real(dp), allocatable, dimension(:) :: cs_nu_min, cs_nu_max - character(len=512), allocatable, dimension(:) :: cs_band_ref + character(len=2048), allocatable, dimension(:) :: cs_band_ref real(dp), allocatable, dimension(:) :: cs_fwhm - character(len=512), allocatable, dimension(:) :: cs_cltype - character(len=512), allocatable, dimension(:) :: cs_clfile - character(len=512), allocatable, dimension(:) :: cs_binfile + character(len=2048), allocatable, dimension(:) :: cs_cltype + character(len=2048), allocatable, dimension(:) :: cs_clfile + character(len=2048), allocatable, dimension(:) :: cs_binfile integer(i4b), allocatable, dimension(:) :: cs_lpivot - character(len=512), allocatable, dimension(:) :: cs_mask - character(len=512), allocatable, dimension(:) :: cs_mono_prior + character(len=2048), allocatable, dimension(:) :: cs_mask + character(len=2048), allocatable, dimension(:) :: cs_mono_prior real(dp), allocatable, dimension(:) :: cs_latmask - character(len=512), allocatable, dimension(:) :: cs_indmask - character(len=512), allocatable, dimension(:) :: cs_defmask + logical(lgt), allocatable, dimension(:) :: cs_apply_dust_ext + character(len=2048), allocatable, dimension(:) :: cs_indmask + character(len=2048), allocatable, dimension(:) :: cs_defmask real(dp), allocatable, dimension(:,:) :: cs_cl_prior real(dp), allocatable, dimension(:,:) :: cs_cl_amp_def real(dp), allocatable, dimension(:,:) :: cs_cl_beta_def real(dp), allocatable, dimension(:,:) :: cs_cl_theta_def integer(i4b), allocatable, dimension(:) :: cs_cl_poltype logical(lgt), allocatable, dimension(:) :: cs_output_EB - character(len=512), allocatable, dimension(:) :: cs_input_amp - character(len=512), allocatable, dimension(:) :: cs_prior_amp - character(len=512), allocatable, dimension(:,:) :: cs_input_ind - character(len=512), allocatable, dimension(:,:) :: cs_SED_template + character(len=2048), allocatable, dimension(:) :: cs_input_amp + character(len=2048), allocatable, dimension(:) :: cs_prior_amp + character(len=2048), allocatable, dimension(:,:) :: cs_input_ind + character(len=2048), allocatable, dimension(:,:) :: cs_SED_template + character(len=2048), allocatable, dimension(:) :: cs_MBBtab_type real(dp), allocatable, dimension(:) :: cs_SED_prior real(dp), allocatable, dimension(:,:) :: cs_theta_def real(dp), allocatable, dimension(:,:) :: cs_nu_break integer(i4b), allocatable, dimension(:,:) :: cs_smooth_scale real(dp), allocatable, dimension(:,:,:) :: cs_p_gauss real(dp), allocatable, dimension(:,:,:) :: cs_p_uni - character(len=512), allocatable, dimension(:) :: cs_catalog - character(len=512), allocatable, dimension(:) :: cs_init_catalog - character(len=512), allocatable, dimension(:) :: cs_ptsrc_template + character(len=2048), allocatable, dimension(:) :: cs_catalog + character(len=2048), allocatable, dimension(:) :: cs_init_catalog + character(len=2048), allocatable, dimension(:) :: cs_ptsrc_template real(dp), allocatable, dimension(:,:) :: cs_nu_min_beta real(dp), allocatable, dimension(:,:) :: cs_nu_max_beta logical(lgt), allocatable, dimension(:) :: cs_burn_in @@ -270,16 +282,22 @@ module comm_param_mod real(dp), allocatable, dimension(:,:) :: cs_auxpar logical(lgt), allocatable, dimension(:) :: cs_apply_jeffreys + ! Exctinction parameters + character(len=2048) :: EBVmap + ! Zodi parameters integer(i4b) :: zs_ncomps, zs_num_samp_groups, zs_covar_first, zs_covar_last + character(len=24) :: zs_phasefunc, zs_bandpass + real(dp) :: zs_nu_min_scatter, zs_nu_max_thermal integer(i4b), dimension(:) :: zs_los_steps(MAXZODICOMPS) real(dp), allocatable, dimension(:, :) :: zs_phase_coeff ! (n_band, 3) real(dp), allocatable, dimension(:) :: zs_nu_ref, zs_solar_irradiance ! (n_band) real(dp) :: zs_comp_params(MAXZODICOMPS, MAXZODIPARAMS, 4), zs_delta_t_reset, zs_general_params(MAXZODIPARAMS, 4), zs_r_min(MAXZODICOMPS), zs_r_max(MAXZODICOMPS), zs_randomize_rms real(dp) :: zs_tod_thin_factor, zs_tod_thin_threshold, zs_sol_elong(2) - character(len=128) :: zs_comp_labels(MAXZODICOMPS), zs_comp_types(MAXZODICOMPS), zs_init_hdf(MAXZODICOMPS), zs_sample_method, zs_init_ascii, zs_refband, zs_em_global, zs_al_global + character(len=2048) :: zs_comp_labels(MAXZODICOMPS), zs_comp_types(MAXZODICOMPS), zs_init_hdf(MAXZODICOMPS), zs_sample_method, zs_init_ascii, zs_refband, zs_em_global, zs_al_global character(len=2048) :: zs_wiring character(len=2048), allocatable :: zs_samp_groups(:), zs_samp_group_bands(:) + real(dp), allocatable :: zs_samp_group_max_b_ecl(:) logical(lgt) :: zs_output_comps, zs_output_ascii, zs_joint_mono, zs_output_tod_res type(InterplanetaryDustParamLabels) :: zodi_param_labels @@ -288,9 +306,9 @@ module comm_param_mod integer(i4b) :: mcmc_num_user_samp_groups ! NUM_MCMC_SAMPLING_GROUPS integer(i4b) :: mcmc_num_samp_groups ! NUM_MCMC_SAMPLING_GROUPS character(len=2048), allocatable :: mcmc_samp_groups(:) ! MCMC_SAMPLING_GROUP_PARAMS, MCMC_SAMPLING_GROUP_CHISQ_BANDS - character(len=512), dimension(MAXSAMPGROUP) :: mcmc_samp_group_mask - character(len=512), dimension(MAXSAMPGROUP) :: mcmc_samp_group_bands - character(len=512), dimension(MAXSAMPGROUP) :: mcmc_update_cg_groups ! MCMC_SAMPLING_GROUP_UPDATE_CG_GROUPS&& + character(len=2048), dimension(MAXSAMPGROUP) :: mcmc_samp_group_mask + character(len=2048), dimension(MAXSAMPGROUP) :: mcmc_samp_group_bands + character(len=2048), dimension(MAXSAMPGROUP) :: mcmc_update_cg_groups ! MCMC_SAMPLING_GROUP_UPDATE_CG_GROUPS&& ! Sample using specificed cg ! groups. If none, skip amplitude ! sampling @@ -310,8 +328,8 @@ subroutine read_comm_params(cpar) type(comm_params), intent(inout) :: cpar integer(i4b) :: paramfile_len, ierr, i, idx - character(len=512) :: paramfile, paramfile_name - character(len=512), allocatable, dimension(:) :: paramfile_cache + character(len=2048) :: paramfile, paramfile_name + character(len=2048), allocatable, dimension(:) :: paramfile_cache call getarg(1, paramfile) ! read parameter file once, save to ascii array @@ -322,7 +340,7 @@ subroutine read_comm_params(cpar) ! Read parameters into cache if (cpar%myid == cpar%root) then - paramfile_len = 512 + paramfile_len = 2048 allocate(paramfile_cache(paramfile_len)) call read_paramfile_to_ascii(paramfile,paramfile_cache,paramfile_len) end if @@ -331,7 +349,7 @@ subroutine read_comm_params(cpar) allocate(paramfile_cache(paramfile_len)) end if do i=1,paramfile_len - call mpi_bcast(paramfile_cache(i), 512, MPI_CHAR, cpar%root, MPI_COMM_WORLD, ierr) + call mpi_bcast(paramfile_cache(i), 2048, MPI_CHAR, cpar%root, MPI_COMM_WORLD, ierr) end do !Initialize a hash table call init_hash_tbl_sll(htable,tbl_len=10*paramfile_len) @@ -347,6 +365,11 @@ subroutine read_comm_params(cpar) call read_global_params_hash(htable,cpar) call read_data_params_hash(htable,cpar) call read_component_params_hash(htable,cpar) + + ! Read extinction parameters + call get_parameter_hashtable(htable, 'EXTINCTION_E(B-V)_MAP', par_string=cpar%EBVmap, path=.true.) + + ! Read zodi parameters if (cpar%include_tod_zodi) call read_zodi_params_hash(htable, cpar) !output parameter file to output directory @@ -519,11 +542,15 @@ subroutine read_global_params_hash(htbl, cpar) call get_parameter_hashtable(htbl, 'FFTW3_MAGIC_NUMBERS', par_string=cpar%fft_magic_number_file, path=.true.) call get_parameter_hashtable(htbl, 'TOD_NUM_BP_PROPOSALS_PER_ITER', par_int=cpar%num_bp_prop) call get_parameter_hashtable(htbl, 'NUM_GIBBS_STEPS_PER_TOD_SAMPLE', par_int=cpar%tod_freq) + if (cpar%tod_freq .eq. 0) cpar%tod_freq = cpar%num_gibbs_iter + 1 call get_parameter_hashtable(htbl, 'TOD_OUTPUT_4D_MAP_EVERY_NTH_ITER', par_int=cpar%output_4D_map_nth_iter) call get_parameter_hashtable(htbl, 'TOD_OUTPUT_AUXILIARY_MAPS_EVERY_NTH_ITER', par_int=cpar%output_aux_maps) call get_parameter_hashtable(htbl, 'TOD_INCLUDE_ZODI', par_lgt=cpar%include_TOD_zodi) if (cpar%include_TOD_zodi) then - call get_parameter_hashtable(htbl, 'SAMPLE_ZODI', par_lgt=cpar%sample_zodi) + call get_parameter_hashtable(htbl, 'SAMPLE_ZODI', par_lgt=cpar%sample_zodi) + call get_parameter_hashtable(htbl, 'SAMPLE_SOLAR_MAPS', par_lgt=cpar%sample_solar_maps) + call get_parameter_hashtable(htbl, 'SAMPLE_MOON_MAPS', par_lgt=cpar%sample_moon_maps) + call get_parameter_hashtable(htbl, 'SAMPLE_EARTH_MAPS', par_lgt=cpar%sample_earth_maps) call get_parameter_hashtable(htbl, 'ZODI_USE_SOLAR_CENTRIC_COMP', par_lgt=cpar%incl_zodi_solar_comp) if (cpar%incl_zodi_solar_comp) then call get_parameter_hashtable(htbl, 'ZODI_STATIC_COMP_NSIDE', par_int=cpar%zodi_solar_nside) @@ -531,6 +558,8 @@ subroutine read_global_params_hash(htbl, cpar) call get_parameter_hashtable(htbl, 'ZODI_STATIC_MAP_BANDS', par_string=cpar%zodi_static_bands) end if end if + else + cpar%tod_freq = cpar%num_gibbs_iter + 1 end if if (cpar%resamp_CMB) then @@ -578,7 +607,8 @@ subroutine read_data_params_hash(htbl, cpar) character(len=3) :: itext character(len=2) :: jtext - len_itext=len(trim(itext)) !! FIXME + call int2string(1, itext) + len_itext=len(trim(itext)) call get_parameter_hashtable(htbl, 'NUMBAND', par_int=cpar%numband) !call get_parameter_hashtable(htbl, 'DATA_DIRECTORY', par_string=cpar%datadir) call get_parameter_hashtable(htbl, 'SOURCE_MASKFILE', par_string=cpar%ds_sourcemask, path=.true.) @@ -599,11 +629,13 @@ subroutine read_data_params_hash(htbl, cpar) allocate(cpar%ds_gain_lmin(n), cpar%ds_gain_apodmask(n), cpar%ds_gain_fwhm(n)) allocate(cpar%ds_defaults(n,2)) allocate(cpar%ds_component_sensitivity(n)) - allocate(cpar%ds_tod_type(n), cpar%ds_tod_filelist(n), cpar%ds_tod_jumplist(n), cpar%ds_tod_initHDF(n), cpar%ds_tod_level(n)) + allocate(cpar%ds_tod_type(n), cpar%ds_tod_filelist(n), cpar%ds_tod_jumplist(n), cpar%ds_tod_initHDF(n), cpar%ds_tod_level(n), cpar%ds_tod_map_type(n)) allocate(cpar%ds_tod_procmask1(n), cpar%ds_tod_procmask2(n), cpar%ds_tod_bp_init(n)) allocate(cpar%ds_tod_instfile(n), cpar%ds_tod_dets(n), cpar%ds_tod_scanrange(n,2)) allocate(cpar%ds_tod_tot_numscan(n), cpar%ds_tod_flag(n), cpar%ds_tod_abscal(n), cpar%ds_tod_halfring(n), cpar%ds_tod_subtract_zodi(n), cpar%ds_tod_freq(n)) allocate(cpar%ds_tod_solar_model(n), cpar%ds_tod_solar_mask(n), cpar%ds_tod_solar_init(n)) + allocate(cpar%ds_tod_moon_model(n), cpar%ds_tod_moon_mask(n), cpar%ds_tod_moon_init(n)) + allocate(cpar%ds_tod_earth_model(n), cpar%ds_tod_earth_mask(n), cpar%ds_tod_earth_init(n)) cpar%ds_nside = 0 ! Zodi mod currently uses cpar nsides to cache some stuff. Setting to 0 to filter unique nsides do i = 1, n @@ -681,6 +713,18 @@ subroutine read_data_params_hash(htbl, cpar) & par_string=cpar%ds_tod_solar_mask(i), path=.true.) call get_parameter_hashtable(htbl, 'BAND_TOD_SOLAR_CENTRIC_INITMAP'//itext, len_itext=len_itext, & & par_string=cpar%ds_tod_solar_init(i), path=.true.) + call get_parameter_hashtable(htbl, 'BAND_TOD_MOON_CENTRIC_MODEL'//itext, len_itext=len_itext, & + & par_string=cpar%ds_tod_moon_model(i)) + call get_parameter_hashtable(htbl, 'BAND_TOD_MOON_CENTRIC_MASK'//itext, len_itext=len_itext, & + & par_string=cpar%ds_tod_moon_mask(i), path=.true.) + call get_parameter_hashtable(htbl, 'BAND_TOD_MOON_CENTRIC_INITMAP'//itext, len_itext=len_itext, & + & par_string=cpar%ds_tod_moon_init(i), path=.true.) + call get_parameter_hashtable(htbl, 'BAND_TOD_EARTH_CENTRIC_MODEL'//itext, len_itext=len_itext, & + & par_string=cpar%ds_tod_earth_model(i)) + call get_parameter_hashtable(htbl, 'BAND_TOD_EARTH_CENTRIC_MASK'//itext, len_itext=len_itext, & + & par_string=cpar%ds_tod_earth_mask(i), path=.true.) + call get_parameter_hashtable(htbl, 'BAND_TOD_EARTH_CENTRIC_INITMAP'//itext, len_itext=len_itext, & + & par_string=cpar%ds_tod_earth_init(i), path=.true.) call get_parameter_hashtable(htbl, 'BAND_TOD_FILELIST'//itext, len_itext=len_itext, & & par_string=cpar%ds_tod_filelist(i), path=.true.) call get_parameter_hashtable(htbl, 'BAND_TOD_JUMPLIST'//itext, len_itext=len_itext, & @@ -691,8 +735,11 @@ subroutine read_data_params_hash(htbl, cpar) & par_int=cpar%ds_tod_scanrange(i,2)) call get_parameter_hashtable(htbl, 'BAND_TOD_TOT_NUMSCAN'//itext, len_itext=len_itext, & & par_int=cpar%ds_tod_tot_numscan(i)) + call get_parameter_hashtable(htbl, 'BAND_TOD_MAPMAKE_TYPE'//itext, len_itext=len_itext, & + & par_string=cpar%ds_tod_map_type(i)) call get_parameter_hashtable(htbl, 'BAND_TOD_FLAG'//itext, len_itext=len_itext, & & par_int=cpar%ds_tod_flag(i)) + cpar%ds_tod_flag(i) = cpar%ds_tod_flag(i) + 2**30 ! Always Enable dynamic flagging in Commander !call get_parameter_hashtable(htbl, 'BAND_TOD_ORBITAL_ONLY_ABSCAL'//itext, len_itext=len_itext, & ! & par_lgt=cpar%ds_tod_orb_abscal(i)) if (cpar%include_TOD_zodi) then @@ -752,15 +799,16 @@ subroutine read_component_params_hash(htbl, cpar) integer(i4b) :: i, j, k, n, len_itext, idx real(dp) :: amp, lat, lon character(len=2) :: itext - character(len=512) :: maskfile, tokens(4) - character(len=512) :: pol_labels(3) + character(len=2048) :: maskfile, tokens(4) + character(len=2048) :: pol_labels(3) logical(lgt) :: bool_flag pol_labels(1)='INT' pol_labels(2)='POL' pol_labels(3)='POL3' - len_itext=len(trim(itext)) !FIXME!! + call int2string(1, itext) + len_itext=len(trim(itext)) call get_parameter_hashtable(htbl, 'INSTRUMENT_PARAM_FILE', par_string=cpar%cs_inst_parfile, path=.true.) call get_parameter_hashtable(htbl, 'INIT_INSTRUMENT_FROM_HDF', par_string=cpar%cs_init_inst_hdf) call get_parameter_hashtable(htbl, 'NUM_SIGNAL_COMPONENTS', par_int=cpar%cs_ncomp_tot) @@ -793,6 +841,7 @@ subroutine read_component_params_hash(htbl, cpar) n = cpar%cs_ncomp_tot allocate(cpar%cs_include(n), cpar%cs_label(n), cpar%cs_type(n), cpar%cs_class(n)) allocate(cpar%cs_spec_lnLtype(3,MAXPAR,n)) + allocate(cpar%cs_apply_dust_ext(n)) allocate(cpar%cs_pixreg_init_theta(MAXPAR,n)) allocate(cpar%cs_almsamp_init(MAXPAR,n),cpar%cs_theta_prior(2,3,MAXPAR,n)) allocate(cpar%cs_spec_pixreg(3,MAXPAR,n),cpar%cs_spec_mask(MAXPAR,n)) @@ -815,7 +864,7 @@ subroutine read_component_params_hash(htbl, cpar) allocate(cpar%cs_input_amp(n), cpar%cs_prior_amp(n), cpar%cs_input_ind(MAXPAR,n)) allocate(cpar%cs_theta_def(MAXPAR,n), cpar%cs_p_uni(n,2,MAXPAR), cpar%cs_p_gauss(n,2,MAXPAR)) allocate(cpar%cs_catalog(n), cpar%cs_init_catalog(n), cpar%cs_SED_template(4,n), cpar%cs_cg_scale(3,n)) - allocate(cpar%cs_SED_prior(n)) + allocate(cpar%cs_SED_prior(n), cpar%cs_MBBtab_type(n)) allocate(cpar%cs_ptsrc_template(n), cpar%cs_output_ptsrc_beam(n), cpar%cs_min_src_dist(n)) allocate(cpar%cs_auxpar(MAXAUXPAR,n), cpar%cs_apply_pos_prior(n)) allocate(cpar%cs_nu_min_beta(n,MAXPAR), cpar%cs_nu_max_beta(n,MAXPAR), cpar%cs_burn_in(n)) @@ -829,6 +878,7 @@ subroutine read_component_params_hash(htbl, cpar) cpar%cs_spec_mono_combined=.false. !by default cpar%cs_spec_corr_convergence=.false. !by default + cpar%cs_apply_dust_ext=.false. do i = 1, n call int2string(i, itext) @@ -856,6 +906,7 @@ subroutine read_component_params_hash(htbl, cpar) ! Break up the diffuse parameter reading into something a bit more legible else if (trim(cpar%cs_class(i)) == 'diffuse') then call read_diffuse_gen_params_hash(htbl, cpar, itext, i, len_itext, bool_flag, pol_labels) + call get_parameter_hashtable(htbl, 'COMP_APPLY_DUST_EXTINCTION'//itext, len_itext=len_itext, par_lgt=cpar%cs_apply_dust_ext(i)) select case (trim(cpar%cs_type(i))) case ('cmb') call read_cmb_params_hash(htbl,cpar) @@ -979,6 +1030,18 @@ subroutine read_component_params_hash(htbl, cpar) end if end do + + if (cpar%myid == 0) then + do i = 1, n + do j = i+1, n + if (trim(cpar%cs_label(i)) == (cpar%cs_label(j))) then + write(*,*) 'COMP_LABEL ', i, ' and ', j, ' are both ', trim(cpar%cs_label(i)) + write(*,*) 'Only unique components labels allowed' + stop + end if + end do + end do + end if cpar%cs_ncomp = count(cpar%cs_include) !cpar%cg_num_samp_groups = maxval(cpar%cs_cg_samp_group) @@ -1002,11 +1065,11 @@ subroutine read_diffuse_gen_params_hash(htbl, cpar, itext, i, len_itext, bool_fl type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k, idx - character(len=512) :: maskfile + character(len=2048) :: maskfile call get_parameter_hashtable(htbl, 'COMP_POLARIZATION'//itext, len_itext=len_itext, par_lgt=cpar%cs_polarization(i)) @@ -1075,6 +1138,7 @@ subroutine read_diffuse_gen_params_hash(htbl, cpar, itext, i, len_itext, bool_fl end if cpar%cs_cl_amp_def(i,:) = cpar%cs_cl_amp_def(i,:) / cpar%cs_cg_scale(:,i)**2 end if + ! Note to future Mathew: don't try to add path=true, it's not always a path call get_parameter_hashtable(htbl, 'COMP_MONOPOLE_PRIOR'//itext, len_itext=len_itext, par_string=cpar%cs_mono_prior(i)) call get_parameter_hashtable(htbl, 'COMP_MASK'//itext, len_itext=len_itext, par_string=cpar%cs_mask(i), path=.true.) if(cpar%cs_mask(i) /= 'fullsky') then @@ -1110,7 +1174,7 @@ subroutine read_cmb_params_hash(htbl, cpar) type(comm_params), intent(inout) :: cpar real(dp) :: amp, lat, lon - character(len=512) :: tokens(4) + character(len=2048) :: tokens(4) call get_parameter_hashtable(htbl, 'CMB_DIPOLE_PRIOR', par_string=cpar%cmb_dipole_prior_mask, path=.true.) if (trim(cpar%cmb_dipole_prior_mask) /= 'none') then @@ -1135,7 +1199,7 @@ subroutine read_power_law_params_hash(htbl, cpar, itext, i, len_itext, bool_flag type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k @@ -1262,7 +1326,7 @@ subroutine read_power_law_break_params_hash(htbl, cpar, itext, i, len_itext, boo type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k @@ -1493,7 +1557,7 @@ subroutine read_curvature_params_hash(htbl, cpar, itext, i, len_itext, bool_flag type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k @@ -1713,7 +1777,7 @@ subroutine read_physdust_params_hash(htbl, cpar, itext, i, len_itext, bool_flag, type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k @@ -1842,7 +1906,7 @@ subroutine read_spindust_params_hash(htbl, cpar, itext, i, len_itext, bool_flag, type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k @@ -1966,7 +2030,7 @@ subroutine read_spindust2_params_hash(htbl, cpar, itext, i, len_itext, bool_flag type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k @@ -2185,7 +2249,7 @@ subroutine read_pah_params_hash(htbl, cpar, itext, i, len_itext, bool_flag, pol_ type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k @@ -2202,7 +2266,7 @@ subroutine read_lognormal_params_hash(htbl, cpar, itext, i, len_itext, bool_flag type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k @@ -2423,7 +2487,7 @@ subroutine read_mbb_params_hash(htbl, cpar, itext, i, len_itext, bool_flag, pol_ type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k @@ -2637,6 +2701,8 @@ subroutine read_mbb_params_hash(htbl, cpar, itext, i, len_itext, bool_flag, pol_ if (trim(cpar%cs_type(i)) == 'MBBtab') then call get_parameter_hashtable(htbl, 'COMP_SED_TEMPLATE'//itext, len_itext=len_itext, & & par_string=cpar%cs_SED_template(1,i), path=.true.) + call get_parameter_hashtable(htbl, 'COMP_MBBTAB_TYPE'//itext, len_itext=len_itext, & + & par_string=cpar%cs_MBBtab_type(i)) call get_parameter_hashtable(htbl, 'COMP_SED_PRIOR'//itext, len_itext=len_itext, & & par_dp=cpar%cs_SED_prior(i)) end if @@ -2650,7 +2716,7 @@ subroutine read_freefree_params_hash(htbl, cpar, itext, i, len_itext, bool_flag, type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k @@ -2790,7 +2856,7 @@ subroutine read_freefreeEM_params_hash(htbl, cpar, itext, i, len_itext, bool_fla type(comm_params), intent(inout) :: cpar logical(lgt), intent(inout) :: bool_flag - character(len=512), intent(in) :: pol_labels(3) + character(len=2048), intent(in) :: pol_labels(3) character(len=2), intent(in) :: itext integer(i4b), intent(in) :: len_itext, i integer(i4b) :: j, k @@ -2815,6 +2881,8 @@ subroutine read_freefreeEM_params_hash(htbl, cpar, itext, i, len_itext, bool_fla call get_parameter_hashtable(htbl, 'COMP_EM_SMOOTHING_SCALE'//itext, len_itext=len_itext, & & par_int=cpar%cs_smooth_scale(i,1)) cpar%cs_almsamp_init(1,i) = 'none' + cpar%cs_spec_pixreg(:,1,i) = 'fullsky' + cpar%cs_spec_pixreg_map(:,i) = 'fullsky' call get_parameter_hashtable(htbl, 'COMP_T_E_POLTYPE'//itext, len_itext=len_itext, par_int=cpar%cs_poltype(2,i)) k = cpar%cs_poltype(2,i) @@ -2932,21 +3000,25 @@ subroutine read_zodi_params_hash(htbl, cpar) type(hash_tbl_sll), intent(in) :: htbl type(comm_params), intent(inout) :: cpar - integer(i4b) :: i, j, k, comp_idx, len_itext, n_params, n_tokens, N_COMMON_PARAMETERS, N_CLOUD_PARAMETERS, N_BAND_PARAMETERS, N_RING_PARAMETERS, N_FEATURE_PARAMETERS, N_DIRBE_BANDS, num_e, num_a + integer(i4b) :: i, j, k, comp_idx, len_itext, n_params, n_tokens, N_COMMON_PARAMETERS, N_CLOUD_PARAMETERS, N_BAND_PARAMETERS, N_RING_PARAMETERS, N_WRIGHTCLOUDRING_PARAMETERS, N_WRIGHTBAND_PARAMETERS, N_FEATURE_PARAMETERS, N_DIRBE_BANDS, num_e, num_a character(len=2) :: itext2 character(len=3) :: itext character(len=64), allocatable :: parameter_labels(:) - character(len=512), dimension(4) :: value_and_priors_str - character(len=512), dimension(20) :: zs_comp_lens_str + character(len=2048), dimension(4) :: value_and_priors_str + character(len=2048), dimension(20) :: zs_comp_lens_str real(dp), dimension(4) :: value_and_priors character(len=64) :: value_string logical(lgt) :: use_comp - character(len=512) :: temp_emissivity, temp_albedo - character(len=512), allocatable, dimension(:) :: samp_group_strings, emissivity_string, albedo_string + character(len=2048) :: temp_emissivity, temp_albedo + character(len=2048), allocatable, dimension(:) :: samp_group_strings, emissivity_string, albedo_string real(dp), parameter :: DEFAULT_PRIOR_LOWER_LIMIT = -1d300, DEFAULT_PRIOR_UPPER_LIMIT = 1d300 call get_parameter_hashtable(htbl, 'NUM_ZODI_COMPS', par_int=cpar%zs_ncomps) call get_parameter_from_hash(htbl, 'ZODI_DELTA_T_RESET', par_dp=cpar%zs_delta_t_reset) + call get_parameter_from_hash(htbl, 'ZODI_PHASE_FUNCTION_TYPE', par_string=cpar%zs_phasefunc) + call get_parameter_from_hash(htbl, 'ZODI_BANDPASS_TYPE', par_string=cpar%zs_bandpass) + call get_parameter_from_hash(htbl, 'ZODI_NU_MIN_SCATTERING', par_dp=cpar%zs_nu_min_scatter) + call get_parameter_from_hash(htbl, 'ZODI_NU_MAX_THERMAL', par_dp=cpar%zs_nu_max_thermal) call get_parameter_from_hash(htbl, 'ZODI_OUTPUT_COMP_MAPS', par_lgt=cpar%zs_output_comps) call get_parameter_from_hash(htbl, 'ZODI_JOINT_MONOPOLE_SAMPLING', par_lgt=cpar%zs_joint_mono) call get_parameter_from_hash(htbl, 'ZODI_OUTPUT_TOD_RESIDUALS', par_lgt=cpar%zs_output_tod_res) @@ -2968,6 +3040,7 @@ subroutine read_zodi_params_hash(htbl, cpar) cpar%zs_general_params(:, 3) = DEFAULT_PRIOR_UPPER_LIMIT do i = 1, size(cpar%zodi_param_labels%general) + if (trim(cpar%zs_phasefunc) /= 'Hong' .and. i > 2) cycle call get_parameter_from_hash(htbl, 'ZODI_'//trim(adjustl(cpar%zodi_param_labels%general(i))), par_string=value_string)! par_dp=cpar%zs_general_params(i)) call get_tokens(value_string, ',', value_and_priors_str, num=n_tokens) if (.not. (n_tokens == 4 .or. n_tokens == 1)) stop "zodi parameter must have 1, or 4 tokens (value,) or (value,prior_lower_limit,prior_upper_limit,prior_type) [no spaces]" @@ -3053,15 +3126,17 @@ subroutine read_zodi_params_hash(htbl, cpar) call get_parameter_hashtable(htbl, 'ZODI_RMS_RANDOMIZE_BETWEEN_STEPS', par_dp=cpar%zs_randomize_rms) allocate(cpar%zs_samp_groups(cpar%zs_num_samp_groups)) allocate(cpar%zs_samp_group_bands(cpar%zs_num_samp_groups)) + allocate(cpar%zs_samp_group_max_b_ecl(cpar%zs_num_samp_groups)) do i = 1, cpar%zs_num_samp_groups call int2string(i, itext2) call get_parameter_hashtable(htbl, 'ZODI_SAMPLING_GROUP'//itext2, par_string=cpar%zs_samp_groups(i)) call get_parameter_hashtable(htbl, 'ZODI_SAMPLING_GROUP_BANDS'//itext2, par_string=cpar%zs_samp_group_bands(i)) + call get_parameter_hashtable(htbl, 'ZODI_SAMPLING_GROUP_MAX_ECL_LAT'//itext2, par_dp=cpar%zs_samp_group_max_b_ecl(i)) end do end if -end subroutine +end subroutine read_zodi_params_hash ! ******************************************************** ! Utility routines @@ -3071,7 +3146,7 @@ subroutine read_zodi_params_hash(htbl, cpar) subroutine parse_parameter(line, parname, found, par_int, par_char, par_string, par_sp, par_dp, par_lgt) implicit none character(len=*) :: line, parname - character(len=256) :: toks(2), key, value, par + character(len=2048) :: toks(2), key, value, par logical(lgt) :: found integer(i4b), optional :: par_int character(len=*), optional :: par_char @@ -3128,7 +3203,7 @@ subroutine get_parameter_arg(parname, par_int, par_char, & logical(lgt), optional :: par_present character(len=*), optional :: desc - character(len=512) :: line + character(len=2048) :: line integer(i4b) :: i logical(lgt) :: found do i = 1, command_argument_count() !iargc() @@ -3154,7 +3229,7 @@ end subroutine get_parameter_arg subroutine dump_expanded_paramfile(parfile, outfile) implicit none character(len=*) :: parfile, outfile - integer(i4b), parameter :: maxdepth = 256 + integer(i4b), parameter :: maxdepth = 2048 integer(i4b) :: depth, units(maxdepth), i, num, ounit, stat character(len=1024) :: key, value, arg, default_path @@ -3390,8 +3465,8 @@ subroutine tokenize(string, sep, ext, group, allow_empty) implicit none character(len=*) :: string, sep character(len=*), optional :: group - character(len=256) :: op, cl - integer(i4b), save :: level(256), nl + character(len=2048) :: op, cl + integer(i4b), save :: level(2048), nl integer(i4b), intent(inout) :: ext(2) logical(lgt), optional :: allow_empty @@ -3468,7 +3543,7 @@ subroutine validate_params(cpar) type(comm_params), intent(inout) :: cpar integer(i4b) :: i, j - character(len=512) :: chaindir + character(len=2048) :: datadir, chaindir, filename, filename1 character(len=2) :: itext, jtext logical(lgt) :: exist @@ -3524,6 +3599,10 @@ subroutine validate_params(cpar) call validate_file(trim(cpar%ds_tod_procmask2(i)), 'BAND_TOD_SMALL_PROCMASK'//itext) ! Procmask2 call validate_file(trim(cpar%ds_tod_solar_mask(i)), 'BAND_TOD_SOLAR_CENTRIC_MASK'//itext) ! Solar centric/sidelobe mask call validate_file(trim(cpar%ds_tod_solar_init(i)), 'BAND_TOD_SOLAR_CENTRIC_INITMAP'//itext) ! Initial solar centric map + call validate_file(trim(cpar%ds_tod_moon_init(i)), 'BAND_TOD_MOON_CENTRIC_INITMAP'//itext) ! Initial moon centric map + call validate_file(trim(cpar%ds_tod_moon_mask(i)), 'BAND_TOD_SOLAR_CENTRIC_MASK'//itext) ! Solar centric/sidelobe mask + call validate_file(trim(cpar%ds_tod_earth_init(i)), 'BAND_TOD_EARTH_CENTRIC_INITMAP'//itext) ! Initial Earth centric map + call validate_file(trim(cpar%ds_tod_earth_mask(i)), 'BAND_TOD_SOLAR_CENTRIC_MASK'//itext) ! Solar centric/sidelobe mask call validate_file(trim(cpar%ds_tod_filelist(i)), 'BAND_TOD_FILELIST'//itext) ! Filelist if (trim(cpar%ds_tod_jumplist(i)) /= 'none') then call validate_file(trim(cpar%ds_tod_jumplist(i)), 'BAND_TOD_JUMPLIST'//itext) ! Jumplist @@ -3560,6 +3639,13 @@ subroutine validate_params(cpar) if (trim(cpar%cs_input_amp(i)) /= 'none') then call validate_file(trim(cpar%cs_input_amp(i)), 'COMP_AMP_INPUT_MAP'//itext) end if + + if (trim(cpar%cs_mono_prior(i)) /= 'none' .and. cpar%cs_mono_prior(i)(1:8) .ne. 'bandmono') then + filename = get_token(cpar%cs_mono_prior(i), ":", 2) + filename1 = get_token(filename, ",", 1) + call validate_file(trim(cpar%datadir) //"/"// trim(filename1),"COMP_MONOPOLE_PRIOR"//itext) + end if + if (trim(cpar%cs_prior_amp(i)) /= 'none') then call validate_file(trim(cpar%cs_prior_amp(i)), 'COMP_AMP_PRIOR_MAP'//itext) end if @@ -3675,17 +3761,17 @@ end subroutine validate_file subroutine read_paramfile_to_ascii(paramfile,paramfile_cache, paramfile_len) implicit none - character(len=512), intent(in) :: paramfile - character(len=512), allocatable, dimension(:), intent(inout) :: paramfile_cache + character(len=2048), intent(in) :: paramfile + character(len=2048), allocatable, dimension(:), intent(inout) :: paramfile_cache integer(i4b),intent(inout) :: paramfile_len - integer(i4b), parameter :: maxdepth = 256 + integer(i4b), parameter :: maxdepth = 2048 integer(i4b) :: depth, units(maxdepth), line_nr,i, stat, pos - character(len=512) :: key, value, filenames(maxdepth), line + character(len=2048) :: key, value, filenames(maxdepth), line character(len=1024) :: default_path character(len=3) :: band_num - character(len=512), allocatable, dimension(:) :: new_cache + character(len=2048), allocatable, dimension(:) :: new_cache ! read file to ascii array @@ -3863,10 +3949,10 @@ subroutine get_parameter_from_hash(htbl, parname, len_itext, par_int, par_char, logical(lgt), optional :: par_present character(len=*), optional :: desc logical(lgt), optional :: path - character(len=256) :: key + character(len=2048) :: key character(len=:), ALLOCATABLE :: itext,jtext CHARACTER(len=:), ALLOCATABLE :: val,val2,val3 - character(len=512) :: val4 + character(len=2048) :: val4 integer(i4b) :: i,j logical(lgt) :: loc_path @@ -3962,8 +4048,8 @@ end subroutine get_parameter_from_hash ! outputs the parameter file to the path provided subroutine save_ascii_parameter_file(outfile, ascii_table) implicit none - character(len=512), intent(in) :: outfile - character(len=512), dimension(:), intent(in) :: ascii_table + character(len=2048), intent(in) :: outfile + character(len=2048), dimension(:), intent(in) :: ascii_table integer(i4b) :: unit, i @@ -3985,10 +4071,10 @@ end subroutine save_ascii_parameter_file ! filling the hash table with elements from the parameter file (ascii array) subroutine put_ascii_into_hashtable(asciitbl,htbl) implicit none - character(len=512), allocatable, dimension(:), intent(in) :: asciitbl + character(len=2048), allocatable, dimension(:), intent(in) :: asciitbl type(hash_tbl_sll), intent(inout) :: htbl - character(len=512) :: key, val - character(len=256) :: toks(2) + character(len=2048) :: key, val + character(len=2048) :: toks(2) integer :: i, n do i = 1,size(asciitbl) call get_tokens(trim(asciitbl(i)), "=", group="''" // '""', maxnum=2, toks=toks, num=n) @@ -4011,11 +4097,11 @@ end subroutine put_ascii_into_hashtable subroutine get_chainfile_and_samp(string, chainfile, initsamp) implicit none character(len=*), intent(in) :: string - character(len=512), intent(out) :: chainfile + character(len=2048), intent(out) :: chainfile integer(i4b), intent(out) :: initsamp integer(i4b) :: i, num, e - character(len=512), dimension(2) :: toks + character(len=2048), dimension(2) :: toks call get_tokens(string, ":", toks, num) @@ -4096,8 +4182,8 @@ function get_labels(self, comp_type, add_common) result(labels) class(InterplanetaryDustParamLabels), intent(in) :: self character(len=*), intent(in) :: comp_type logical(lgt), intent(in), optional :: add_common - character(len=128), allocatable :: labels(:) - character(len=128) :: comp_type_upper + character(len=2048), allocatable :: labels(:) + character(len=2048) :: comp_type_upper comp_type_upper = comp_type call toupper(comp_type_upper) @@ -4115,7 +4201,11 @@ function get_labels(self, comp_type, add_common) result(labels) case ('FAN') labels = self%fan case ('COMET') - labels = self%comet + labels = self%comet + case ('WRIGHTCLOUDRING') + labels = self%wrightcloudring + case ('WRIGHTBAND') + labels = self%wrightband case default print *, 'Unknown component type: ', comp_type stop diff --git a/commander3/src/comm_ptsrc_comp_mod.f90 b/commander3/src/comm_ptsrc_comp_mod.f90 index 2caf35775..b0b3a6a44 100644 --- a/commander3/src/comm_ptsrc_comp_mod.f90 +++ b/commander3/src/comm_ptsrc_comp_mod.f90 @@ -20,6 +20,7 @@ !================================================================================ module comm_ptsrc_comp_mod use comm_F_mod + use comm_dust_extinction_mod implicit none private @@ -30,6 +31,7 @@ module comm_ptsrc_comp_mod !************************************************** type Tnu integer(i4b) :: nside, nside_febecop, np, nmaps + real(dp) :: A_ext ! Dust extinction, absolute attenuation integer(i4b), allocatable, dimension(:,:) :: pix ! Pixel list, both absolute and relative real(dp), allocatable, dimension(:,:) :: map ! (0:np-1,nmaps) real(dp), allocatable, dimension(:,:) :: F ! Mixing matrix (nmaps,ndet) @@ -51,8 +53,8 @@ module comm_ptsrc_comp_mod type, extends (comm_comp) :: comm_ptsrc_comp character(len=512) :: outprefix real(dp) :: cg_scale, amp_rms_scale - integer(i4b) :: nside, nside_febecop, nsrc, ncr_tot, ndet, nactive - logical(lgt) :: apply_pos_prior, burn_in, precomputed_amps + integer(i4b) :: nside, nside_febecop, nsrc, ndet, nactive + logical(lgt) :: apply_pos_prior, burn_in, precomputed_amps, recompute_ptsrc_precond real(dp), allocatable, dimension(:,:) :: x ! Amplitudes (nsrc,nmaps) real(dp), allocatable, dimension(:,:) :: x_buff ! Amplitudes (nsrc,nmaps) type(F_int_ptr), allocatable, dimension(:,:,:) :: F_int ! SED integrator (numband) @@ -82,13 +84,10 @@ module comm_ptsrc_comp_mod class(comm_ptsrc_comp), pointer :: p => null() end type ptsrc_ptr - integer(i4b) :: ncomp_pre = 0 - integer(i4b) :: npre = 0 - integer(i4b) :: nmaps_pre = -1 + integer(i4b), allocatable, dimension(:) :: npre, nmaps_pre integer(i4b) :: comm_pre = -1 integer(i4b) :: myid_pre = -1 integer(i4b) :: numprocs_pre = -1 - logical(lgt) :: recompute_ptsrc_precond = .false. logical(lgt) :: apply_ptsrc_precond = .false. character(len=24), private :: operation @@ -113,6 +112,7 @@ function constructor_ptsrc(cpar, id, id_abs) result(c) call update_status(status, "init_ptsrc1") ! General parameters + apply_ptsrc_precond = .true. allocate(c) ! Initialize general parameters @@ -137,14 +137,12 @@ function constructor_ptsrc(cpar, id, id_abs) result(c) c%comm = cpar%comm_chain c%numprocs = cpar%numprocs_chain c%init_from_HDF = cpar%cs_initHDF(id_abs) - ncomp_pre = ncomp_pre + 1 operation = cpar%operation c%apply_pos_prior = cpar%cs_apply_pos_prior(id_abs) c%burn_in = cpar%cs_burn_in(id_abs) c%amp_rms_scale = cpar%cs_amp_rms_scale(id_abs) c%precomputed_amps= .false. - - if (.not. c%apply_pos_prior) recompute_ptsrc_precond = .true. + c%recompute_ptsrc_precond = .not. c%apply_pos_prior call get_tokens(cpar%output_comps, ",", comp_label, n) c%output = .false. @@ -254,19 +252,6 @@ function constructor_ptsrc(cpar, id, id_abs) result(c) call report_error("Unknown point source model: " // trim(c%type)) end select - ! Read and allocate source structures - call update_status(status, "init_ptsrc2") - if( trim(c%type) == 'stars') then - ! stars uses an hdf catalogue instead of a txt file - call read_star_catalogue(c, cpar, id, id_abs) - else - call read_sources(c, cpar, id, id_abs) - end if - - ! Update mixing matrix - call update_status(status, "init_ptsrc3") - call c%updateMixmat - ! Set up CG sampling groups allocate(c%active_samp_group(cpar%cg_num_samp_groups)) c%active_samp_group = .false. @@ -282,7 +267,29 @@ function constructor_ptsrc(cpar, id, id_abs) result(c) end do ! Disable CG search when asking for positivity prior - if (c%apply_pos_prior) c%active_samp_group = .false. + !if (c%apply_pos_prior) c%active_samp_group = .false. + + ! Read and allocate source structures + call update_status(status, "init_ptsrc2") + if( trim(c%type) == 'stars') then + ! stars uses an hdf catalogue instead of a txt file + call read_star_catalogue(c, cpar, id, id_abs) + else + call read_sources(c, cpar, id, id_abs) + end if + + ! Initialize dust extinction correction + do j = 1, c%nsrc + do i = 1, numband + if (c%F_null(i)) cycle + ia = c%b2a(i) + call get_dust_attenuation_pos(c%src(j)%vec, data(i)%bp(0)%p%nu_c, c%src(j)%T(ia)%A_ext) + end do + end do + + ! Update mixing matrix + call update_status(status, "init_ptsrc3") + call c%updateMixmat call update_status(status, "init_ptsrc4") @@ -302,7 +309,7 @@ subroutine updateF(self, theta, beta, band, df, par) integer(i4b) :: i, ia, j, k ! if we have fixed precomputed amps, we don't change mixing matrix - if(self%precomputed_amps) return + !if(self%precomputed_amps) return do j = 1, self%nsrc @@ -323,25 +330,29 @@ subroutine updateF(self, theta, beta, band, df, par) do k = 0, data(i)%ndet ! Temperature - self%src(j)%T(ia)%F(1,k) = & - & self%F_int(1,ia,k)%p%eval(self%src(j)%theta(:,1)) * data(i)%gain * self%cg_scale + if(self%precomputed_amps) then + self%src(j)%T(ia)%F(1,k) = self%src(j)%amp_precomp(ia) * data(i)%gain * self%cg_scale * self%src(j)%T(ia)%A_ext + else + self%src(j)%T(ia)%F(1,k) = & + & self%F_int(1,ia,k)%p%eval(self%src(j)%theta(:,1)) * data(i)%gain * self%cg_scale * self%src(j)%T(ia)%A_ext + end if ! Polarization if (self%nmaps == 3) then ! Stokes Q - if (self%poltype(1) < 2) then + if (self%poltype(1) < 2 .or. self%precomputed_amps) then self%src(j)%T(ia)%F(2,k) = self%src(j)%T(ia)%F(1,k) else self%src(j)%T(ia)%F(2,k) = & - & self%F_int(2,ia,k)%p%eval(self%src(j)%theta(:,2)) * data(i)%gain * self%cg_scale + & self%F_int(2,ia,k)%p%eval(self%src(j)%theta(:,2)) * data(i)%gain * self%cg_scale * self%src(j)%T(ia)%A_ext end if ! Stokes U - if (self%poltype(1) < 3) then + if (self%poltype(1) < 3 .or. self%precomputed_amps) then self%src(j)%T(ia)%F(3,k) = self%src(j)%T(ia)%F(2,k) else self%src(j)%T(ia)%F(3,k) = & - & self%F_int(3,ia,k)%p%eval(self%src(j)%theta(:,3)) * data(i)%gain * self%cg_scale + & self%F_int(3,ia,k)%p%eval(self%src(j)%theta(:,3)) * data(i)%gain * self%cg_scale * self%src(j)%T(ia)%A_ext end if end if end do @@ -455,12 +466,12 @@ function evalPtsrcBand(self, band, amp_in, pix, alm_out, det) evalPtsrcBand = 0.d0 do i = 1, self%nsrc do j = 1, self%src(i)%T(band_active)%nmaps - if(self%precomputed_amps) then - ! so far just used for stars - m = self%src(i)%amp_precomp(band_active) * amp(i,j) - else +! if(self%precomputed_amps) then +! ! so far just used for stars +! m = self%src(i)%amp_precomp(band_active) * amp(i,j) * data(band)%gain +! else m = self%src(i)%T(band_active)%F(j,d) * amp(i,j) - end if +! end if ! Scale to correct frequency through multiplication with mixing matrix a = self%getScale(band,i,j) * m @@ -512,12 +523,12 @@ function projectPtsrcBand(self, band, map, alm_in, det) val = val + self%src(i)%T(band_active)%map(q,j) * map%map(p,j) end do - if(self%precomputed_amps) then - ! so far just used for stars - m = self%src(i)%amp_precomp(band_active) *self%x(i,j) - else +! if(self%precomputed_amps) then +! ! so far just used for stars +! m = self%src(i)%amp_precomp(band_active) * data(band)%gain +! else m = self%src(i)%T(band_active)%F(j,d) - end if +! end if ! Scale to correct frequency through multiplication with mixing matrix val = self%getScale(band,i,j) * m * val @@ -667,7 +678,7 @@ subroutine initPtsrcHDF(self, cpar, hdffile, hdfpath) path = trim(adjustl(hdfpath))//trim(adjustl(self%label)) // '/' if (self%myid == 0) then - call read_hdf(hdffile, trim(adjustl(path))//'amp', self%x) + call read_hdf(hdffile, trim(adjustl(path))//'amp', self%x(1:self%nsrc,:)) self%x = self%x/self%cg_scale end if @@ -729,7 +740,12 @@ subroutine read_sources(self, cpar, id, id_abs) open(unit,file=trim(cpar%cs_catalog(id_abs)),recl=1024) self%nsrc = 0 self%ncr = 0 - self%ncr_tot = 0 + if (.not. allocated(npre)) then + allocate(npre(cpar%cg_num_samp_groups)) + allocate(nmaps_pre(cpar%cg_num_samp_groups)) + npre = 0 + nmaps_pre = 1 + end if do while (.true.) read(unit,'(a)',end=1) line line = trim(adjustl(line)) @@ -737,10 +753,13 @@ subroutine read_sources(self, cpar, id, id_abs) cycle else self%nsrc = self%nsrc + 1 - npre = npre + 1 - nmaps_pre = max(nmaps_pre, nmaps) - self%ncr_tot = self%ncr_tot + nmaps if (cpar%myid_chain == 0) self%ncr = self%ncr + nmaps + do i = 1, cpar%cg_num_samp_groups + if (self%active_samp_group(i)) then + npre(i) = npre(i) + 1 + nmaps_pre(i) = max(nmaps_pre(i), nmaps) + end if + end do end if end do 1 close(unit) @@ -777,14 +796,20 @@ subroutine read_sources(self, cpar, id, id_abs) end do end if if (skip_src) then - self%nsrc = self%nsrc-1 + self%nsrc = self%nsrc-1 + if (cpar%myid_chain == 0) self%ncr = self%ncr - nmaps + do j = 1, cpar%cg_num_samp_groups + if (self%active_samp_group(j)) then + npre(j) = npre(j) - 1 + end if + end do else i = i+1 allocate(self%src(i)%theta(self%npar,self%nmaps), self%src(i)%T(nactive)) allocate(self%src(i)%theta_rms(self%npar,self%nmaps)) allocate(self%src(i)%amp_rms(self%nmaps)) allocate(self%src(i)%P_theta(self%npar,self%nmaps,2)) - allocate(self%src(i)%P_x(self%nmaps,2)) +! allocate(self%src(i)%P_x(self%nmaps,2)) self%src(i)%id = id_ptsrc self%src(i)%glon = glon * DEG2RAD self%src(i)%glat = glat * DEG2RAD @@ -792,8 +817,8 @@ subroutine read_sources(self, cpar, id, id_abs) self%x(i,:) = amp / self%cg_scale !if (self%myid == 0) write(*,*) 'amp', self%x(i,:) self%src(i)%vec = vec - self%src(i)%P_x(:,1) = amp / self%cg_scale - self%src(i)%P_x(:,2) = amp_rms / self%cg_scale +! self%src(i)%P_x(:,1) = amp / self%cg_scale + ! self%src(i)%P_x(:,2) = amp_rms / self%cg_scale self%src(i)%P_theta(:,:,1) = beta self%src(i)%P_theta(:,:,2) = beta_rms self%src(i)%theta_rms = 0.d0 @@ -871,7 +896,6 @@ subroutine read_sources(self, cpar, id, id_abs) call init_beam_templates(self, cpar, id, id_abs) - end subroutine read_sources @@ -906,7 +930,7 @@ subroutine init_beam_templates(self, cpar, id, id_abs) !if (self%myid == 0) write(*,*) 'a3' ! Construct beam on-the-fly do j = 1, self%nsrc - if (mod(j,1000) == 0 .and. self%myid == 0) & + if (mod(j,10000) == 0 .and. self%myid == 0) & & write(*,fmt='(a,i8,a,i8)') ' | Initializing src no. ', j, ' of ', self%nsrc self%src(j)%T(ia)%nside = data(i)%info%nside self%src(j)%T(ia)%nmaps = min(data(i)%info%nmaps, self%nmaps) @@ -954,9 +978,10 @@ subroutine read_star_catalogue(self, cpar, id, id_abs) type(hdf_file) :: stars_file - integer(i4b) :: i, j, ja + integer(i4b) :: i, j, k, ja, ii, ierr + real(dp) :: vec(3), dist character(len=512), dimension(:), allocatable :: band_list - logical(lgt) :: found + logical(lgt) :: found, skip_src real(dp), dimension(:,:), allocatable :: catalog, star_catalog, coords call open_hdf_file(trim(adjustl(cpar%cs_catalog(id_abs))), stars_file, 'r') @@ -964,7 +989,15 @@ subroutine read_star_catalogue(self, cpar, id, id_abs) call read_alloc_hdf(stars_file, '/reported_values', catalog) !nstars, nbands call read_alloc_hdf(stars_file, '/band_column_mapping', band_list) - ! trim unused bands from star catalog + + if (.not. allocated(npre)) then + allocate(npre(cpar%cg_num_samp_groups)) + allocate(nmaps_pre(cpar%cg_num_samp_groups)) + npre = 0 + nmaps_pre = 1 + end if + + ! trim unused bands from star catalog allocate(star_catalog(self%nactive, size(catalog(1,:)))) do i=1, numband @@ -972,7 +1005,7 @@ subroutine read_star_catalogue(self, cpar, id, id_abs) found = .false. do j=1, size(band_list) if(trim(data(i)%instlabel) == trim(band_list(j))) then ! band is in catalog - star_catalog(self%b2a(i),:) = catalog(j,:) + star_catalog(self%b2a(i),:) = catalog(j,:)/ catalog(1,:) found = .true. !write(*,*) "Found band ", trim(data(i)%label), " at position ", j exit @@ -989,53 +1022,69 @@ subroutine read_star_catalogue(self, cpar, id, id_abs) self%nsrc = size(star_catalog(1, :)) call read_alloc_hdf(stars_file, 'coordinates', coords) + !coords = coords * DEG2RAD ! Convention now in degrees allocate(self%x(self%nsrc,self%nmaps), self%x_buff(self%nsrc,self%nmaps), self%src(self%nsrc)) - self%x = 0.d0 - self%x(1,1) = 1.d0 + self%x = 1.d0 +! self%x(1,1) = 1.d0 !store each pointsource in a source object + self%ncr = 0 + ii = 0 do i=1, self%nsrc - allocate(self%src(i)%amp_precomp(self%nactive)) - allocate(self%src(i)%T(self%nactive)) - !self%src(i)%glon = coords(1,i) * DEG2RAD - !self%src(i)%glat = coords(2,i) * DEG2RAD - self%src(i)%glon = coords(1,i) - self%src(i)%glat = coords(2,i) -!!$ write(*,*) i, coords(:,i) -!!$ write(*,*) i, self%src(i)%glon, self%src(i)%glat -!!$ write(*,*) - - ! Normalize to first frequency - self%src(i)%amp_precomp = star_catalog(:,i)/star_catalog(1,i) - - do j=1, numband !self%nactive - ja = self%b2a(j) - if (ja == -1) cycle - self%src(i)%T(ja)%nside = data(j)%info%nside - self%src(i)%T(ja)%nside_febecop = self%nside_febecop - !self%src(i)%T(j)%np = - self%src(i)%T(ja)%nmaps = self%nmaps - end do + if (myid_pre == 0) then + if (mod(ii,100000) == 0) then + write(*,fmt='(a,i6,a,i6,a,a)') ' | Reading src ', ii, ' of ', self%nsrc + end if + end if - ! Check for processing mask; disable source if within mask -! call ang2pix_ring(data(1)%info%nside, 0.5d0*pi-glat*DEG2RAD, glon*DEG2RAD, pix) -! p = locate(data(1)%info%pix, pix) -! if (associated(data(1)%procmask)) then -! if (p > 0) then -! if (data(1)%info%pix(p) == pix) then -! do j = 1, self%nmaps -! if (data(1)%procmask%map(p,j) < 0.5d0) then -! mask(i,j) = 0 -! end if -! end do -! end if -! end if -! end if + ii = ii+1 + self%src(ii)%glon = coords(1,i) + self%src(ii)%glat = coords(2,i) + call ang2vec(0.5d0*pi-coords(2,i), coords(1,i), self%src(ii)%vec) + ! Check for too close neighbours + skip_src = .false. + if (cpar%cs_min_src_dist(id_abs) > 0.d0) then + do j = 1+self%myid, ii-1, self%numprocs + call angdist(self%src(ii)%vec, self%src(j)%vec, dist) + if (dist*RAD2DEG*60.d0 < cpar%cs_min_src_dist(id_abs)) then + skip_src = .true. + exit + end if + end do + end if + call mpi_allreduce(MPI_IN_PLACE, skip_src, 1, MPI_LOGICAL, & + & MPI_LOR, self%comm, ierr) + if (skip_src) then + ii = ii-1 + cycle + end if - end do + allocate(self%src(ii)%amp_precomp(self%nactive)) + allocate(self%src(ii)%T(self%nactive)) + do j = 1, cpar%cg_num_samp_groups + if (self%active_samp_group(j)) then + npre(j) = npre(j) + 1 + nmaps_pre(j) = max(nmaps_pre(j), self%nmaps) + end if + end do + if (cpar%myid_chain == 0) self%ncr = self%ncr + self%nmaps + + ! Normalize to first frequency + self%src(ii)%amp_precomp = star_catalog(:,i)!/star_catalog(1,i) + do j=1, numband !self%nactive + ja = self%b2a(j) + if (ja == -1) cycle + self%src(ii)%T(ja)%nside = data(j)%info%nside + self%src(ii)%T(ja)%nside_febecop = self%nside_febecop + self%src(ii)%T(ja)%nmaps = self%nmaps + end do + + end do + self%nsrc = ii + self%cg_scale=1 deallocate(star_catalog, coords) @@ -1045,6 +1094,18 @@ subroutine read_star_catalogue(self, cpar, id, id_abs) !load in the beam information call init_beam_templates(self, cpar, id, id_abs) + ! Update mixing matrix -- HKE: GAIN IS MISSING +!!$ do i=1, self%nsrc +!!$ do j=1, numband !self%nactive +!!$ ja = self%b2a(j) +!!$ if (ja == -1) cycle +!!$ do k = 0, data(j)%ndet ! Only T for now +!!$ self%src(i)%T(ja)%F(1,k) = self%src(i)%amp_precomp(self%b2a(j)) +!!$ end do +!!$ end do +!!$ end do + + end subroutine read_star_catalogue @@ -1497,182 +1558,286 @@ subroutine compute_symmetric_beam(band, glon, glat, T, bl, beamfile) end subroutine compute_symmetric_beam - subroutine initPtsrcPrecond(comm) + subroutine initPtsrcPrecond(comm, samp_group, verbosity) implicit none - integer(i4b), intent(in) :: comm + integer(i4b), intent(in) :: comm, samp_group + integer(i4b), intent(in), optional :: verbosity - integer(i4b) :: i, i1, i2, j, j1, j2, k1, k2, q, l, la, m, n, p, p1, p2, n1, n2, myid, ierr, cnt - real(dp) :: t1, t2, t3, t4 + integer(i4b) :: i, i1, i2, j, j1, j2, k1, k2, q, l, la, m, n, p, p1, p2, n1, n2, myid, ierr, cnt, nactive, c1, c2, verbosity_ + real(dp) :: t1, t2, t3, t4, dist, tot, tot2 logical(lgt) :: skip - class(comm_comp), pointer :: c => null(), c1 => null(), c2 => null() + real(dp), allocatable, dimension(:) :: buff + class(comm_comp), pointer :: c => null() class(comm_ptsrc_comp), pointer :: pt1 => null(), pt2 => null() real(dp), allocatable, dimension(:,:) :: mat, mat2 - - if (ncomp_pre == 0) return - if (.not. recompute_ptsrc_precond) return + type(ptsrc_ptr), dimension(5) :: pc + if (.not. apply_ptsrc_precond) return - if (allocated(P_cr%invM_src)) deallocate(P_cr%invM_src) + if (npre(samp_group) == 0) return + verbosity_ = 10; if (present(verbosity)) verbosity_ = verbosity + + ! Make a list of active components, and check that at least one wants update + nactive = 0 + skip = .true. + c => compList + do while (associated(c)) + select type (c) + class is (comm_ptsrc_comp) + if (c%active_samp_group(samp_group)) then + nactive = nactive+1 + pc(nactive)%p => c + if (c%recompute_ptsrc_precond) skip = .false. + end if + end select + c => c%nextComp() + end do + if (nactive == 0 .or. skip) return call mpi_comm_rank(comm, myid, ierr) - + ! Build frequency-dependent part of preconditioner call wall_time(t1) - allocate(P_cr%invM_src(1,nmaps_pre)) - allocate(mat(npre,npre), mat2(npre,npre)) - do j = 1, nmaps_pre - - mat = 0.d0 - i1 = 0 - c1 => compList - do while (associated(c1)) - skip = .true. - select type (c1) - class is (comm_ptsrc_comp) - pt1 => c1 - skip = .false. - end select - if (skip .or. j > pt1%nmaps) then - c1 => c1%nextComp() - cycle - end if - do k1 = 1, pt1%nsrc - !write(*,*) k1, pt1%nsrc - i1 = i1+1 - - i2 = 0 - c2 => compList - do while (associated(c2)) - !do j2 = 1, ncomp_pre - skip = .true. - select type (c2) - class is (comm_ptsrc_comp) - pt2 => c2 - skip = .false. - end select - if (skip .or. j > pt2%nmaps) then - c2 => c2%nextComp() - cycle - end if - do k2 = 1, pt2%nsrc - !write(*,*) k2, pt2%nsrc - i2 = i2+1 - if (i2 < i1) cycle - - do l = 1, numband - if (pt1%F_null(l)) cycle - la = pt1%b2a(l) - n1 = pt1%src(k1)%T(la)%np - n2 = pt2%src(k2)%T(la)%np - - ! Search for common pixels; skip if no pixel overlap - if (n1 == 0 .or. n2 == 0) cycle - if (pt1%src(k1)%T(la)%pix(1,1) > pt2%src(k2)%T(la)%pix(n2,1)) cycle - if (pt1%src(k1)%T(la)%pix(n1,1) < pt2%src(k2)%T(la)%pix(1,1)) cycle - if (j == 1 .and. data(l)%pol_only) cycle - !if (data(l)%bp(0)%p%nu_c < self%nu_min_ind(1) .or. data(l)%bp(0)%p%nu_c > self%nu_max_ind(1)) cycle - - - p1 = 1 - p2 = 1 - do while (.true.) - if (pt1%src(k1)%T(la)%pix(p1,1) == pt2%src(k2)%T(la)%pix(p2,1)) then - p = pt1%src(k1)%T(la)%pix(p1,1) -!!$ write(*,*) 'a', data(l)%N%invN_diag%map(p,j) -!!$ write(*,*) 'b', pt1%src(k1)%T(l)%map(p1,j), pt2%src(k2)%T(l)%map(p2,j) -!!$ write(*,*) 'c', pt1%src(k1)%T(l)%F(j,0), pt2%src(k2)%T(l)%F(j,0) -!!$ write(*,*) 'd', pt1%getScale(l,k1,j), pt2%getScale(l,k2,j) - mat(i1,i2) = mat(i1,i2) + & - & 1.d0/data(l)%N%rms_pix(p,j)**2 * & ! invN_{p,p} - & pt1%src(k1)%T(la)%map(p1,j) * & ! B_1 - & pt2%src(k2)%T(la)%map(p2,j) * & ! B_2 - & pt1%src(k1)%T(la)%F(j,0) * & ! F_1 - & pt2%src(k2)%T(la)%F(j,0) * & ! F_2 - & pt1%getScale(l,k1,j) * & ! Unit 1 - & pt2%getScale(l,k2,j) ! Unit 2 - p1 = p1+1 - p2 = p2+1 - else if (pt1%src(k1)%T(la)%pix(p1,1) < pt2%src(k2)%T(la)%pix(p2,1)) then - p1 = p1+1 - else - p2 = p2+1 - end if - if (p1 > n1 .or. p2 > n2) exit - if (pt1%src(k1)%T(la)%pix(p1,1) > pt2%src(k2)%T(la)%pix(n2,1)) exit - if (pt1%src(k1)%T(la)%pix(n1,1) < pt2%src(k2)%T(la)%pix(p2,1)) exit + if (.not. allocated(P_cr(samp_group)%invM_src)) then + allocate(P_cr(samp_group)%invM_src(1,nmaps_pre(samp_group))) + end if + !allocate(mat(npre,npre), mat2(npre,npre)) + do j = 1, nmaps_pre(samp_group) + + ! Find number of matrix elements + if (.not. associated(P_cr(samp_group)%invM_src(1,j)%M)) then + n = 0 + i1 = 0 + do c1 = 1, nactive + pt1 => pc(c1)%p + if (j > pt1%nmaps) cycle + do k1 = 1, pt1%nsrc + if (myid_pre == 0 .and. mod(k1,10000) == 0 .and. verbosity_ > 0) write(*,*) 'Precomp sparsity =', k1, pt1%nsrc, n + i1 = i1+1 + i2 = pt1%myid + do c2 = 1, nactive + pt2 => pc(c2)%p + if (j > pt2%nmaps) cycle + do k2 = 1+pt1%myid, pt2%nsrc, pt1%numprocs + i2 = i2+pt1%numprocs + if (i2 < i1) cycle + dist = acos(min(max(sum(pt1%src(k1)%vec*pt2%src(k2)%vec),-1.d0),1.d0)) + if (dist <= 3.d0*pi/180.d0) n = n+1 + end do + end do + end do + end do + call mpi_allreduce(MPI_IN_PLACE, n, 1, MPI_INTEGER, MPI_SUM, comm, ierr) + if (myid_pre == 0 .and. verbosity_ > 0) write(*,*) 'Number of matrix elements = ', n + ! Allocate sparse matrix + P_cr(samp_group)%invM_src(1,j)%M => sparse_system(npre(samp_group), n) + end if + + if (P_cr(samp_group)%invM_src(1,j)%M%ni == 0) then + ! Construct matrix with sparsity pattern + i1 = 0 + do c1 = 1, nactive + pt1 => pc(c1)%p + if (j > pt1%nmaps) cycle + do k1 = 1, pt1%nsrc + if (myid_pre == 0 .and. mod(k1,10000) == 0 .and. verbosity_ > 0) write(*,*) 'Computing A =', k1, pt1%nsrc + i1 = i1+1 + + i2 = 0 + do c2 = 1, nactive + pt2 => pc(c2)%p + if (j > pt2%nmaps) cycle + do k2 = 1, pt2%nsrc + i2 = i2+1 + if (i2 < i1) cycle + dist = acos(min(max(sum(pt1%src(k1)%vec*pt2%src(k2)%vec),-1.d0),1.d0)) + if (dist > 3.d0*pi/180.d0) cycle ! Cutoff should be user defined + + tot = 0.d0 + do l = 1, numband + if (pt1%F_null(l)) cycle + if (.not. data(l)%cr_active) cycle + if (j == 1 .and. data(l)%pol_only) cycle + la = pt1%b2a(l) + n1 = pt1%src(k1)%T(la)%np + n2 = pt2%src(k2)%T(la)%np + + ! Search for common pixels; skip if no pixel overlap + if (n1 == 0 .or. n2 == 0) cycle + if (pt1%src(k1)%T(la)%pix(1,1) > pt2%src(k2)%T(la)%pix(n2,1)) cycle + if (pt1%src(k1)%T(la)%pix(n1,1) < pt2%src(k2)%T(la)%pix(1,1)) cycle + + p1 = 1 + p2 = 1 + do while (.true.) + if (pt1%src(k1)%T(la)%pix(p1,1) == pt2%src(k2)%T(la)%pix(p2,1)) then + p = pt1%src(k1)%T(la)%pix(p1,1) + tot = tot + & + & 1.d0/data(l)%N%rms_pix(p,j)**2 * & ! invN_{p,p} + & pt1%src(k1)%T(la)%map(p1,j) * & ! B_1 + & pt2%src(k2)%T(la)%map(p2,j) * & ! B_2 + & pt1%src(k1)%T(la)%F(j,0) * & ! F_1 + & pt2%src(k2)%T(la)%F(j,0) * & ! F_2 + & pt1%getScale(l,k1,j) * & ! Unit 1 + & pt2%getScale(l,k2,j) ! Unit 2 + p1 = p1+1 + p2 = p2+1 + else if (pt1%src(k1)%T(la)%pix(p1,1) < pt2%src(k2)%T(la)%pix(p2,1)) then + p1 = p1+1 + else + p2 = p2+1 + end if + if (p1 > n1 .or. p2 > n2) exit + if (pt1%src(k1)%T(la)%pix(p1,1) > pt2%src(k2)%T(la)%pix(n2,1)) exit + if (pt1%src(k1)%T(la)%pix(n1,1) < pt2%src(k2)%T(la)%pix(p2,1)) exit + end do end do + ! Update sparse matrix + call P_cr(samp_group)%invM_src(1,j)%M%set_A(i1,i2, tot) end do - mat(i2,i1) = mat(i1,i2) end do - c2 => c2%nextComp() end do end do - c1 => c1%nextComp() - end do - ! Collect contributions from all cores - call mpi_reduce(mat, mat2, size(mat2), MPI_DOUBLE_PRECISION, MPI_SUM, 0, comm, ierr) + ! Collect contributions from all cores + allocate(buff(size(P_cr(samp_group)%invM_src(1,j)%M%a))) + call mpi_reduce(P_cr(samp_group)%invM_src(1,j)%M%a, buff, size(P_cr(samp_group)%invM_src(1,j)%M%a), MPI_DOUBLE_PRECISION, MPI_SUM, 0, comm, ierr) + P_cr(samp_group)%invM_src(1,j)%M%a = buff + deallocate(buff) + + else + + ! Construct matrix with sparsity pattern + do i1 = 1, P_cr(samp_group)%invM_src(1,j)%M%ni + if (myid_pre == 0 .and. mod(i1,10000) == 0 .and. verbosity_ > 0) write(*,*) 'Updating A =', i1, P_cr(samp_group)%invM_src(1,j)%M%ni + c1 = 1 + k1 = i1 + do while (k1 > pc(c1)%p%nsrc) + k1 = k1 - pc(c1)%p%nsrc + c1 = c1 + 1 + end do + pt1 => pc(c1)%p + if (j > pt1%nmaps) cycle + do j2 = P_cr(samp_group)%invM_src(1,j)%M%ia(i1), & + & P_cr(samp_group)%invM_src(1,j)%M%ia(i1+1)-1 + i2 = P_cr(samp_group)%invM_src(1,j)%M%ja(j2) + if (i2 < i1) cycle + c2 = 1 + k2 = i2 + do while (k2 > pc(c2)%p%nsrc) + k2 = k2 - pc(c2)%p%nsrc + c2 = c2 + 1 + end do + pt2 => pc(c2)%p + if (j > pt2%nmaps) cycle + + if (.not. pt1%recompute_ptsrc_precond .and. & + & .not. pt2%recompute_ptsrc_precond) cycle + + dist = acos(min(max(sum(pt1%src(k1)%vec*pt2%src(k2)%vec),-1.d0),1.d0)) + if (dist > 3.d0*pi/180.d0) cycle ! Cutoff should be user defined - if (myid == 0) then + tot = 0.d0 + do l = 1, numband + if (pt1%F_null(l)) cycle + if (.not. data(l)%cr_active) cycle + if (j == 1 .and. data(l)%pol_only) cycle + la = pt1%b2a(l) + n1 = pt1%src(k1)%T(la)%np + n2 = pt2%src(k2)%T(la)%np + + ! Search for common pixels; skip if no pixel overlap + if (n1 == 0 .or. n2 == 0) cycle + if (pt1%src(k1)%T(la)%pix(1,1) > pt2%src(k2)%T(la)%pix(n2,1)) cycle + if (pt1%src(k1)%T(la)%pix(n1,1) < pt2%src(k2)%T(la)%pix(1,1)) cycle + + p1 = 1 + p2 = 1 + do while (.true.) + if (pt1%src(k1)%T(la)%pix(p1,1) == pt2%src(k2)%T(la)%pix(p2,1)) then + p = pt1%src(k1)%T(la)%pix(p1,1) + tot = tot + & + & 1.d0/data(l)%N%rms_pix(p,j)**2 * & ! invN_{p,p} + & pt1%src(k1)%T(la)%map(p1,j) * & ! B_1 + & pt2%src(k2)%T(la)%map(p2,j) * & ! B_2 + & pt1%src(k1)%T(la)%F(j,0) * & ! F_1 + & pt2%src(k2)%T(la)%F(j,0) * & ! F_2 + & pt1%getScale(l,k1,j) * & ! Unit 1 + & pt2%getScale(l,k2,j) ! Unit 2 + p1 = p1+1 + p2 = p2+1 + else if (pt1%src(k1)%T(la)%pix(p1,1) < pt2%src(k2)%T(la)%pix(p2,1)) then + p1 = p1+1 + else + p2 = p2+1 + end if + if (p1 > n1 .or. p2 > n2) exit + if (pt1%src(k1)%T(la)%pix(p1,1) > pt2%src(k2)%T(la)%pix(n2,1)) exit + if (pt1%src(k1)%T(la)%pix(n1,1) < pt2%src(k2)%T(la)%pix(p2,1)) exit + end do + end do + ! Update sparse matrix + call mpi_reduce(tot, tot2, 1, MPI_DOUBLE_PRECISION, MPI_SUM, 0, comm, ierr) + if (myid_pre == 0) P_cr(samp_group)%invM_src(1,j)%M%a(j2) = tot2 + end do + end do + end if + + if (myid == 0) then ! Multiply with sqrtS from left side - i1 = 0 - c1 => compList - do while (associated(c1)) - skip = .true. - select type (c1) - class is (comm_ptsrc_comp) - pt1 => c1 - skip = .false. - end select - if (skip .or. j > pt1%nmaps) then - c1 => c1%nextComp() + i1 = 0 + do c1 = 1, nactive + pt1 => pc(c1)%p + if (.not. pt1%recompute_ptsrc_precond) then + i1 = i1 + pt1%nsrc cycle end if + if (j > pt1%nmaps) cycle do k1 = 1, pt1%nsrc i1 = i1+1 - mat2(i1,:) = mat2(i1,:) * pt1%src(k1)%P_x(j,2) + if (allocated(pt1%src(k1)%P_x)) call P_cr(samp_group)%invM_src(1,j)%M%scale_row(i1, pt1%src(k1)%P_x(j,2)) end do - c1 => c1%nextComp() end do ! Multiply with sqrtS from right side i1 = 0 - c1 => compList - do while (associated(c1)) - skip = .true. - select type (c1) - class is (comm_ptsrc_comp) - pt1 => c1 - skip = .false. - end select - if (skip .or. j > pt1%nmaps) then - c1 => c1%nextComp() + do c1 = 1, nactive + pt1 => pc(c1)%p + if (.not. pt1%recompute_ptsrc_precond) then + i1 = i1 + pt1%nsrc cycle end if + if (j > pt1%nmaps) cycle do k1 = 1, pt1%nsrc i1 = i1+1 - mat2(:,i1) = mat2(:,i1) * pt1%src(k1)%P_x(j,2) + if (allocated(pt1%src(k1)%P_x)) call P_cr(samp_group)%invM_src(1,j)%M%scale_col(i1, pt1%src(k1)%P_x(j,2)) end do - c1 => c1%nextComp() end do ! Add unity - do i1 = 1, npre - mat2(i1,i1) = mat2(i1,i1) + 1.d0 + i1 = 0 + do c1 = 1, nactive + pt1 => pc(c1)%p + if (.not. pt1%recompute_ptsrc_precond) then + i1 = i1 + pt1%nsrc + cycle + end if + if (j > pt1%nmaps) cycle + do k1 = 1, pt1%nsrc + i1 = i1+1 + call P_cr(samp_group)%invM_src(1,j)%M%add_diag(0.0d0, i1) + end do end do ! Invert matrix to finalize preconditioner call wall_time(t3) - call invert_matrix_with_mask(mat2) + call P_cr(samp_group)%invM_src(1,j)%M%decomp(verbosity) call wall_time(t4) - if (myid_pre == 0) write(*,*) 'ptsrc precond inv = ', real(t4-t3,sp) - allocate(P_cr%invM_src(1,j)%M(npre,npre)) - P_cr%invM_src(1,j)%M = mat2 + if (myid_pre == 0 .and. verbosity_ > 0) write(*,*) 'ptsrc precond inv = ', real(t4-t3,sp) end if end do call wall_time(t2) - if (myid_pre == 0) write(*,*) 'ptsrc precond init = ', real(t2-t1,sp) - - deallocate(mat,mat2) - - recompute_ptsrc_precond = .false. - apply_ptsrc_precond = .false. + if (myid_pre == 0 .and. verbosity_ > 0) write(*,*) 'ptsrc precond init = ', real(t2-t1,sp) + + do i = 1, nactive + pc(i)%p%recompute_ptsrc_precond = .false. + end do end subroutine initPtsrcPrecond @@ -1680,15 +1845,16 @@ subroutine updatePtsrcPrecond(samp_group) implicit none integer(i4b), intent(in) :: samp_group - call initPtsrcPrecond(comm_pre) + call initPtsrcPrecond(comm_pre, samp_group) end subroutine updatePtsrcPrecond - subroutine applyPtsrcPrecond(x) + subroutine applyPtsrcPrecond(x, samp_group) implicit none real(dp), dimension(:), intent(inout) :: x - + integer(i4b), intent(in) :: samp_group + integer(i4b) :: i, j, k, l, m, nmaps logical(lgt) :: skip real(dp), allocatable, dimension(:,:) :: amp @@ -1696,10 +1862,11 @@ subroutine applyPtsrcPrecond(x) class(comm_comp), pointer :: c => null() class(comm_ptsrc_comp), pointer :: pt => null() - if (npre == 0 .or. myid_pre /= 0 .or. .not. apply_ptsrc_precond) return + if (.not. apply_ptsrc_precond) return + if (npre(samp_group) == 0 .or. myid_pre /= 0) return ! Reformat linear array into y(npre,nalm,nmaps) structure - allocate(y(npre,nmaps_pre)) + allocate(y(npre(samp_group),nmaps_pre(samp_group))) y = 0.d0 l = 1 c => compList @@ -1707,8 +1874,10 @@ subroutine applyPtsrcPrecond(x) skip = .true. select type (c) class is (comm_ptsrc_comp) - pt => c - skip = .false. + if (c%active_samp_group(samp_group)) then + pt => c + skip = .false. + end if end select if (skip) then c => c%nextComp() @@ -1724,8 +1893,10 @@ subroutine applyPtsrcPrecond(x) end do ! Multiply with preconditioner - do j = 1, nmaps_pre - y(:,j) = matmul(P_cr%invM_src(1,j)%M, y(:,j)) + do j = 1, nmaps_pre(samp_group) + !y(:,j) = matmul(P_cr(samp_group)%invM_src(1,j)%M, y(:,j)) + call P_cr(samp_group)%invM_src(1,j)%M%set_rhs(y(:,j)) + call P_cr(samp_group)%invM_src(1,j)%M%solve(y(:,j)) end do ! Reformat y(npre,nmaps) structure back into linear array @@ -1735,8 +1906,10 @@ subroutine applyPtsrcPrecond(x) skip = .true. select type (c) class is (comm_ptsrc_comp) - pt => c - skip = .false. + if (c%active_samp_group(samp_group)) then + pt => c + skip = .false. + end if end select if (skip) then c => c%nextComp() @@ -1751,7 +1924,7 @@ subroutine applyPtsrcPrecond(x) c => c%nextComp() deallocate(amp) end do - + deallocate(y) end subroutine applyPtsrcPrecond @@ -1892,7 +2065,7 @@ subroutine samplePtsrcAmp(self, cpar, handle, samp_group) if (p == 1 .and. data(l)%pol_only) cycle la = self%b2a(l) do q = 1, self%src(i)%T(la)%np - src_amp = self%src(i)%amp_precomp(la) + src_amp = self%src(i)%amp_precomp(la) * data(l)%gain beam = self%src(i)%T(la)%map(q,p) pix = self%src(i)%T(la)%pix(q,1) noise = data(l)%N%rms_pix(pix, p) @@ -1933,8 +2106,9 @@ subroutine samplePtsrcAmp(self, cpar, handle, samp_group) else x_tot = 0.d0 end if + if (self%apply_pos_prior) x_tot = max(x_tot, 0.d0) if (mod(i,10000) == 0) then - write(*,fmt='(a,i8,a,f8.3,a,f8.3)') "Star ", i, " a_old = ", self%x(i,P), " a_new = ", x_tot + write(*,fmt='(a,i8,a,f8.3,a,f8.3,a,f16.8)') "Star ", i, " a_old = ", self%x(i,P), " a_new = ", x_tot, ', sigma = ', 1.d0/sqrt(A_tot) end if self%x(i,p) = x_tot end if @@ -1998,7 +2172,7 @@ subroutine samplePtsrcSpecInd(self, cpar, handle, id, iter) ! return end if - if (trim(operation) == 'optimize') then + if (.true. .or. trim(operation) == 'optimize') then !if (self%myid == 0) write(*,*) 'opimize ptsrc spectral parameters' allocate(theta(self%npar)) do iter2 = 1, n_gibbs @@ -2031,7 +2205,7 @@ subroutine samplePtsrcSpecInd(self, cpar, handle, id, iter) if (p == 1 .and. data(l)%pol_only) cycle if (data(l)%bp(0)%p%nu_c < self%nu_min_ind(1) .or. data(l)%bp(0)%p%nu_c > self%nu_max_ind(1)) cycle ! Compute mixing matrix - s = self%getScale(l,k,p) * self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale + s = self%getScale(l,k,p) * self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale * self%src(k)%T(la)%A_ext do q = 1, self%src(k)%T(la)%np pix = self%src(k)%T(la)%pix(q,1) data(l)%res%map(pix,p) = data(l)%res%map(pix,p) + s*self%src(k)%T(la)%map(q,p) * a @@ -2044,7 +2218,7 @@ subroutine samplePtsrcSpecInd(self, cpar, handle, id, iter) x(1) = self%x(k,p) if (self%apply_pos_prior .and. p == 1 .and. x(1) < 0.d0) x(1) = 0.d0 x(2:1+self%npar) = self%src(k)%theta(:,p) - call powell(x, lnL_ptsrc_multi, ierr) !!!!! + call powell(x, lnL_ptsrc_multi, ierr, tolerance=1d-5) !!!!! a = x(1) theta = x(2:1+self%npar) do l = 1, c_lnL%npar @@ -2091,7 +2265,7 @@ subroutine samplePtsrcSpecInd(self, cpar, handle, id, iter) la = self%b2a(l) if (p == 1 .and. data(l)%pol_only) cycle if (data(l)%bp(0)%p%nu_c < self%nu_min_ind(1) .or. data(l)%bp(0)%p%nu_c > self%nu_max_ind(1)) cycle - s = self%getScale(l,k,p) * self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale + s = self%getScale(l,k,p) * self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale * self%src(k)%T(la)%A_ext do q = 1, self%src(k)%T(la)%np pix = self%src(k)%T(la)%pix(q,1) data(l)%res%map(pix,p) = data(l)%res%map(pix,p) - a*s*self%src(k)%T(la)%map(q,p) @@ -2118,7 +2292,7 @@ subroutine samplePtsrcSpecInd(self, cpar, handle, id, iter) call self%updateMixmat ! Ask for CG preconditioner update - if (any(self%active_samp_group)) recompute_ptsrc_precond = .true. + if (any(self%active_samp_group)) self%recompute_ptsrc_precond = .true. return end if @@ -2216,7 +2390,7 @@ subroutine samplePtsrcSpecInd(self, cpar, handle, id, iter) la = self%b2a(l) if (p == 1 .and. data(l)%pol_only) cycle if (data(l)%bp(0)%p%nu_c < self%nu_min_ind(1) .or. data(l)%bp(0)%p%nu_c > self%nu_max_ind(1)) cycle - s = self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale + s = self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale * self%src(k)%T(la)%A_ext a_curr(l) = self%getScale(l,k,p) * s * amp(k,p) !if (self%myid == 0) write(*,*) 'l numband', l, numband end do @@ -2245,7 +2419,7 @@ subroutine samplePtsrcSpecInd(self, cpar, handle, id, iter) ! Compute mixing matrix theta(j) = x(i) - s = self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale + s = self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale * self%src(k)%T(la)%A_ext ! Compute predicted source amplitude for current band a = self%getScale(l,k,p) * s * amp(k,p) @@ -2334,7 +2508,7 @@ subroutine samplePtsrcSpecInd(self, cpar, handle, id, iter) if (self%F_null(l)) cycle la = self%b2a(l) ! Compute mixing matrix - s = self%getScale(l,k,p) * self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale + s = self%getScale(l,k,p) * self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale * self%src(k)%T(la)%A_ext ! Compute likelihood by summing over pixels do q = 1, self%src(k)%T(la)%np @@ -2370,7 +2544,7 @@ subroutine samplePtsrcSpecInd(self, cpar, handle, id, iter) if (data(l)%bp(0)%p%nu_c < self%nu_min_ind(1) .or. data(l)%bp(0)%p%nu_c > self%nu_max_ind(1)) cycle ! Compute mixing matrix - s = self%getScale(l,k,p) * self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale + s = self%getScale(l,k,p) * self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale * self%src(k)%T(la)%A_ext ! Compute likelihood by summing over pixels do q = 1, self%src(k)%T(la)%np @@ -2432,7 +2606,7 @@ subroutine samplePtsrcSpecInd(self, cpar, handle, id, iter) if (p == 1 .and. data(l)%pol_only) cycle ! Compute mixing matrix - s = self%getScale(l,k,p) * self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale + s = self%getScale(l,k,p) * self%F_int(p,la,0)%p%eval(theta) * data(l)%gain * self%cg_scale * self%src(k)%T(la)%A_ext ! Compute likelihood by summing over pixels do q = 1, self%src(k)%T(la)%np @@ -2475,7 +2649,7 @@ subroutine samplePtsrcSpecInd(self, cpar, handle, id, iter) call self%updateMixmat ! Ask for CG preconditioner update - if (any(self%active_samp_group)) recompute_ptsrc_precond = .true. + if (any(self%active_samp_group)) self%recompute_ptsrc_precond = .true. deallocate(x, P_tot, F, lnL, amp, theta, a_curr) @@ -2509,7 +2683,7 @@ function lnL_ptsrc_total(p) if (data(l)%bp(0)%p%nu_c < c_lnL%nu_min_ind(1) .or. data(l)%bp(0)%p%nu_c > c_lnL%nu_max_ind(1)) cycle ! Compute mixing matrix - s = c_lnL%F_int(1,la,0)%p%eval(theta) * data(l)%gain * c_lnL%cg_scale + s = c_lnL%F_int(1,la,0)%p%eval(theta) * data(l)%gain * c_lnL%cg_scale * c_lnL%src(k_lnL)%T(la)%A_ext ! Compute predicted source amplitude for current band a = c_lnL%getScale(l,k_lnL,p_lnL) * s * amp @@ -2549,7 +2723,7 @@ function grad_lnL_ptsrc_total(p) if (data(l)%bp(0)%p%nu_c < c_lnL%nu_min_ind(1) .or. data(l)%bp(0)%p%nu_c > c_lnL%nu_max_ind(1)) cycle ! Compute mixing matrix - s = c_lnL%F_int(1,la,0)%p%eval(theta) * data(l)%gain * c_lnL%cg_scale + s = c_lnL%F_int(1,la,0)%p%eval(theta) * data(l)%gain * c_lnL%cg_scale * c_lnL%src(k_lnL)%T(la)%A_ext ! Compute predicted source amplitude for current band a = c_lnL%getScale(l,k_lnL,p_lnL) * s * amp @@ -2618,7 +2792,7 @@ function lnL_ptsrc_multi(p) if (data(l)%bp(0)%p%nu_c < c_lnL%nu_min_ind(1) .or. data(l)%bp(0)%p%nu_c > c_lnL%nu_max_ind(1)) cycle ! Compute mixing matrix - s = c_lnL%F_int(1,la,0)%p%eval(theta) * data(l)%gain * c_lnL%cg_scale + s = c_lnL%F_int(1,la,0)%p%eval(theta) * data(l)%gain * c_lnL%cg_scale * c_lnL%src(k_lnL)%T(la)%A_ext ! Compute predicted source amplitude for current band a = c_lnL%getScale(l,k_lnL,p_lnL) * s * amp @@ -2640,9 +2814,11 @@ function lnL_ptsrc_multi(p) if (c_lnL%myid == 0) then ! Apply amplitude prior - if (c_lnL%src(k_lnL)%P_x(p_lnL,2) > 0.d0) then -! lnL_ptsrc_multi = lnL_ptsrc_multi - 0.5d0 * (amp-c_lnL%src(k_lnL)%P_x(p_lnL,1))**2 / & -! & c_lnL%src(k_lnL)%P_x(p_lnL,2)**2 + if (allocated(c_lnL%src(k_lnL)%P_x)) then + if (c_lnL%src(k_lnL)%P_x(p_lnL,2) > 0.d0) then + ! lnL_ptsrc_multi = lnL_ptsrc_multi - 0.5d0 * (amp-c_lnL%src(k_lnL)%P_x(p_lnL,1))**2 / & + ! & c_lnL%src(k_lnL)%P_x(p_lnL,2)**2 + end if end if ! Apply index priors @@ -2714,9 +2890,10 @@ function lnL_ptsrc_multi_grad(p) if (data(l)%bp(0)%p%nu_c < c_lnL%nu_min_ind(1) .or. data(l)%bp(0)%p%nu_c > c_lnL%nu_max_ind(1)) cycle ! Compute mixing matrix - s = c_lnL%F_int(1,la,0)%p%eval(theta) * data(l)%gain * c_lnL%cg_scale + s = c_lnL%F_int(1,la,0)%p%eval(theta) * data(l)%gain * c_lnL%cg_scale * c_lnL%src(k_lnL)%T(la)%A_ext ! Compute predicted source amplitude for current band + ! HKE: Fix extinction correction below? a = c_lnL%getScale(l,k_lnL,p_lnL) * s * amp if (j .eq. 1) then a_grad = c_lnL%getScale(l,k_lnL,p_lnL) * s @@ -2753,13 +2930,16 @@ subroutine updatePtsrcFInt(self, band) class(comm_ptsrc_comp), intent(inout) :: self integer(i4b), intent(in), optional :: band - integer(i4b) :: i, j, k, ka + integer(i4b) :: i, j, k, ka, nmaps if(self%precomputed_amps) return if (present(band)) then + nmaps = data(band)%info%nmaps + if(nmaps > 3) nmaps = 3 + if (self%F_null(band)) return - do i = 1, data(band)%info%nmaps + do i = 1, nmaps do j = 0, data(band)%tod%ndet call self%F_int(i,band,j)%p%update(pol=i) end do @@ -2768,7 +2948,9 @@ subroutine updatePtsrcFInt(self, band) do k = 1, numband if (self%F_null(k)) cycle ka = self%b2a(k) - do i = 1, data(k)%info%nmaps + nmaps = data(k)%info%nmaps + if(nmaps > 3) nmaps = 3 + do i = 1, nmaps do j = 0, data(k)%ndet call self%F_int(i,ka,j)%p%update(pol=i) end do diff --git a/commander3/src/comm_signal_mod.f90 b/commander3/src/comm_signal_mod.f90 index b9f16b7b7..d5857f86f 100644 --- a/commander3/src/comm_signal_mod.f90 +++ b/commander3/src/comm_signal_mod.f90 @@ -105,7 +105,11 @@ subroutine initialize_signal_mod(cpar) case default call report_error("Unknown component type: "//trim(cpar%cs_type(i))) end select - call add_to_complist(c) + if(associated(c)) then + call add_to_complist(c) + else + if(cpar%myid == 0) write(*,*) "Component failed to initialize: "//trim(cpar%cs_type(i)) + end if case ("ptsrc") c => comm_ptsrc_comp(cpar, ncomp, i) call add_to_complist(c) @@ -206,21 +210,23 @@ subroutine dump_components(filename) end subroutine dump_components - subroutine sample_amps_by_CG(cpar, samp_group, handle, handle_noise) + subroutine sample_amps_by_CG(cpar, samp_group, handle, handle_noise, verbosity) implicit none type(comm_params), intent(in) :: cpar integer(i4b), intent(in) :: samp_group type(planck_rng), intent(inout) :: handle, handle_noise - - integer(i4b) :: stat, i, j, l, m, nactive + integer(i4b), intent(in), optional :: verbosity + + integer(i4b) :: stat, i, j, l, m, nactive, verbosity_ real(dp) :: Nscale = 1.d-4 class(comm_comp), pointer :: c => null() character(len=32) :: cr_active_bands(100) real(dp), allocatable, dimension(:) :: rhs, x, mask class(comm_map), pointer :: res => null() - - + + verbosity_ = cpar%verbosity; if (present(verbosity)) verbosity_ = verbosity + allocate(x(ncr), mask(ncr)) ! Set up component mask for current sample group @@ -246,7 +252,7 @@ subroutine sample_amps_by_CG(cpar, samp_group, handle, handle_noise) end do end if - ! Sample point source amplitudes + ! Sample point source amplitudes with precomputed amplitudes c => compList do while (associated(c)) select type (c) @@ -291,9 +297,10 @@ subroutine sample_amps_by_CG(cpar, samp_group, handle, handle_noise) call cr_computeRHS(cpar%operation, cpar%resamp_CMB, cpar%only_pol,& & handle, handle_noise, mask, samp_group, rhs) call update_status(status, "init_precond1") - call initPrecond(cpar%comm_chain) + if (.not. allocated(P_cr)) allocate(P_cr(cpar%cg_num_user_samp_groups)) + call initPrecond(cpar%comm_chain, samp_group, verbosity) call update_status(status, "init_precond2") - call solve_cr_eqn_by_CG(cpar, samp_group, x, rhs, stat) + call solve_cr_eqn_by_CG(cpar, samp_group, x, rhs, stat, verbosity) call cr_x2amp(samp_group, x) call update_status(status, "cr_end") deallocate(rhs,x) @@ -303,7 +310,7 @@ subroutine sample_amps_by_CG(cpar, samp_group, handle, handle_noise) do while (associated(c)) select type (c) class is (comm_diffuse_comp) - if (c%active_samp_group(samp_group)) call c%applyMonoDipolePrior(handle) + if (c%active_samp_group(samp_group)) call c%applyMonoDipolePrior(handle, verbosity) end select c => c%nextComp() end do @@ -319,12 +326,14 @@ subroutine sample_amps_by_CG(cpar, samp_group, handle, handle_noise) call c%x%info%i2lm(i,l,m) if (l == 0) then ! monopole - write(*,fmt='(a)') " | Band monopole of '"//& - & trim(c%label)//"' used as zero-level prior" - write(*,fmt='(a,f14.3)') " | Revert back to pre-CG value: ",& - & c%mono_alm/sqrt(4.d0*pi) - write(*,fmt='(a,f14.3,a)') " | (Sampled value in CG: ",& - & c%x%alm(i,1)/sqrt(4.d0*pi)," )" + if (verbosity_ > 0) then + write(*,fmt='(a)') " | Band monopole of '"//& + & trim(c%label)//"' used as zero-level prior" + write(*,fmt='(a,f14.3)') " | Revert back to pre-CG value: ",& + & c%mono_alm/sqrt(4.d0*pi) + write(*,fmt='(a,f14.3,a)') " | (Sampled value in CG: ",& + & c%x%alm(i,1)/sqrt(4.d0*pi)," )" + end if c%x%alm(i,1) = c%mono_alm ! revert to pre-CG search value !monopole in alm_uKRJ = mu_in_alm_uK_RJ + rms_in_alm_uKRJ * rand_gauss @@ -341,7 +350,7 @@ subroutine sample_amps_by_CG(cpar, samp_group, handle, handle_noise) end subroutine sample_amps_by_CG - subroutine sample_all_amps_by_CG(cpar, handle, handle_noise, cg_groups) + subroutine sample_all_amps_by_CG(cpar, handle, handle_noise, cg_groups, verbosity) ! ! ! Convenience function for performing amplitude sampling over @@ -353,12 +362,14 @@ subroutine sample_all_amps_by_CG(cpar, handle, handle_noise, cg_groups) type(comm_params), intent(in) :: cpar type(planck_rng), intent(inout) :: handle, handle_noise character(len=512), intent(in), optional :: cg_groups + integer(i4b), intent(in), optional :: verbosity - integer(i4b) :: samp_group, i, n + integer(i4b) :: samp_group, i, n, verbosity_ integer(i4b), dimension(MAXSAMPGROUP) :: group_inds character(len=3) :: toks(MAXSAMPGROUP) + verbosity_ = cpar%verbosity; if (present(verbosity)) verbosity_ = verbosity if (present(cg_groups)) then group_inds = 0 @@ -374,12 +385,12 @@ subroutine sample_all_amps_by_CG(cpar, handle, handle_noise, cg_groups) call timer%start(TOT_AMPSAMP) do samp_group = 1, cpar%cg_num_user_samp_groups if (findloc(group_inds, samp_group, dim=1) == 0) cycle - if (cpar%myid_chain == 0) then + if (cpar%myid_chain == 0 .and. verbosity_ > 0) then write(*,fmt='(a,i4,a,i4,a,i4,a,a)') ' | Chain = ', cpar%mychain, & & ' -- CG sample group = ', samp_group, ' of ', cpar%cg_num_user_samp_groups, ': ', & & trim(cpar%cg_samp_group(samp_group)) end if - call sample_amps_by_CG(cpar, samp_group, handle, handle_noise) + call sample_amps_by_CG(cpar, samp_group, handle, handle_noise, verbosity) if (trim(cpar%cmb_dipole_prior_mask) /= 'none') call apply_cmb_dipole_prior(cpar, handle) @@ -388,12 +399,13 @@ subroutine sample_all_amps_by_CG(cpar, handle, handle_noise, cg_groups) end subroutine sample_all_amps_by_CG - subroutine initPrecond(comm) + subroutine initPrecond(comm, samp_group, verbosity) implicit none - integer(i4b), intent(in) :: comm - call initDiffPrecond(comm) - call initPtsrcPrecond(comm) - call initTemplatePrecond(comm) + integer(i4b), intent(in) :: comm, samp_group + integer(i4b), intent(in), optional :: verbosity + call initDiffPrecond(comm, samp_group) + call initPtsrcPrecond(comm, samp_group, verbosity) + call initTemplatePrecond(comm, samp_group) end subroutine initPrecond subroutine add_to_complist(c) @@ -417,7 +429,7 @@ subroutine initialize_from_chain(cpar, handle, init_samp, init_from_output, firs integer(i4b) :: i, j, ext(2), initsamp, initsamp2 character(len=4) :: ctext character(len=6) :: itext, itext2 - character(len=512) :: chainfile, hdfpath + character(len=2048) :: chainfile, hdfpath class(comm_comp), pointer :: c => null() type(hdf_file) :: file, file2 class(comm_N), pointer :: N => null() diff --git a/commander3/src/comm_sparse_mod.f90 b/commander3/src/comm_sparse_mod.f90 new file mode 100644 index 000000000..3aca67c33 --- /dev/null +++ b/commander3/src/comm_sparse_mod.f90 @@ -0,0 +1,334 @@ +!================================================================================ +! +! Copyright (C) 2020 Institute of Theoretical Astrophysics, University of Oslo. +! +! This file is part of Commander3. +! +! Commander3 is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! Commander3 is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with Commander3. If not, see . +! +!================================================================================ +module comm_sparse_mod + use healpix_types + use math_tools + implicit none + + private + public sparse_system, sparse_ptr, sparse_system_tester + + type sparse_system + integer(i8b) :: pt(64) + integer(i4b) :: n, ni, nj, n_a_max, icurr, iparm(64) + integer(i4b) :: maxfct, mnum, mtype, nrhs, msglvl, idum + real(dp) :: ddum + integer(i4b), allocatable, dimension(:) :: ia, ja + real(dp), allocatable, dimension(:) :: a, b, x, y + contains + procedure :: decomp => sparse_system_decomp + procedure :: solve => sparse_system_solve + procedure :: dealloc => sparse_system_dealloc + procedure :: set_A => sparse_system_add_matrix_element + procedure :: set_rhs => sparse_system_set_rhs + procedure :: add_diag => sparse_system_add_diag + procedure :: scale_row => sparse_system_scale_row + procedure :: scale_col => sparse_system_scale_col + procedure :: print => sparse_system_print + end type sparse_system + + interface sparse_system + procedure constructor_sparse_system + end interface sparse_system + + type sparse_ptr + class(sparse_system), pointer :: p => null() + end type sparse_ptr + +contains + + function constructor_sparse_system(n, n_A_max) result(c) + implicit none + integer(i4b), intent(in) :: n, n_A_max + class(sparse_system), pointer :: c + + ! Assign memory + allocate(c) + + ! General parameters + c%n = n + c%n_a_max = n_a_max + c%nrhs = 1 + c%mtype = 2 ! symmetric matrix, positive definite + c%msglvl = 1 ! output statistical information + c%maxfct = 1 + c%mnum = 1 + + ! Initialize arrays + c%ni = 0 + c%nj = 0 + c%icurr = 0 + allocate(c%ia(c%n_a_max), c%ja(c%n_a_max), c%a(c%n_a_max), c%b(n), c%x(n), c%y(n)) + c%ia = 0 + c%ja = 0 + c%a = 0.d0 + c%b = 0.d0 + + end function constructor_sparse_system + + subroutine sparse_system_add_matrix_element(self, i, j, A_ij) + implicit none + class(sparse_system), intent(inout) :: self + integer(i4b), intent(in) :: i, j + real(dp), intent(in) :: A_ij + + integer(i4b), allocatable, dimension(:) :: ibuff + real(dp), allocatable, dimension(:) :: fbuff + + ! Check if array is already full; if so, double its size + if (self%nj == self%n_a_max) then + self%n_a_max = 2*self%n_a_max + allocate(ibuff(self%nj), fbuff(self%nj)) + ! Extend row array + ibuff(1:self%ni) = self%ia(1:self%ni) + deallocate(self%ia); allocate(self%ia(self%n_a_max)) + self%ia(1:self%ni) = ibuff(1:self%ni) + ! Extend column array + ibuff(1:self%nj) = self%ja(1:self%nj) + deallocate(self%ja); allocate(self%ja(self%n_a_max)) + self%ja(1:self%nj) = ibuff(1:self%nj) + ! Extend coefficient array + fbuff(1:self%nj) = self%a(1:self%nj) + deallocate(self%a); allocate(self%a(self%n_a_max)) + self%a(1:self%nj) = fbuff(1:self%nj) + self%a(self%nj+1:) = 0.d0 + deallocate(ibuff, fbuff) + end if + + ! Insert new element + self%nj = self%nj+1 + self%ja(self%nj) = j + self%a(self%nj) = A_ij + if (i /= self%icurr) then + self%icurr = i + self%ni = self%ni+1 + self%ia(self%ni) = self%nj + self%ia(self%ni+1) = self%nj+1 ! Sentinel value indicating end of array + end if + + end subroutine sparse_system_add_matrix_element + + subroutine sparse_system_set_rhs(self, b) + implicit none + class(sparse_system), intent(inout) :: self + real(dp), dimension(:), intent(in) :: b + if (size(b) /= self%n) then + write(*,*) 'sparse_matrix_set_rhs: Incorrect size of input array = ', size(b), self%n + stop + else + self%b = b + end if + end subroutine sparse_system_set_rhs + + subroutine sparse_system_decomp(self, verbosity) + implicit none + class(sparse_system), intent(inout) :: self + integer(i4b), intent(in), optional :: verbosity + + integer(i4b) :: solver, error, phase, msglvl + + ! Initialize PARDISO solver + solver = 10 ! use sparse direct method + call pardisoinit(self%pt, self%mtype, self%iparm) + self%iparm(3) = 1 ! OMP_NUM_THREADS + + ! Symbolic factorization + phase = 11 ! only reordering and symbolic factorization + self%iparm(33) = 1 ! compute determinant + msglvl = self%msglvl; if (present(verbosity)) msglvl = verbosity + call pardiso(self%pt, self%maxfct, self%mnum, self%mtype, phase, self%n, & + & self%a(1:self%nj), self%ia(1:self%ni+1), self%ja(1:self%nj), & + & self%idum, self%nrhs, self%iparm, msglvl, self%ddum, self%ddum, error) + if (error /= 0) THEN + write(*,*) 'pardiso symbolic factorization error: ', error + stop + else + !write(*,*) 'pardiso -- number of nonzeros = ', self%iparm(18) + !write(*,*) 'pardiso -- MFLOPS = ', self%iparm(19) + end if + + ! Perform factorization + phase = 22 + call pardiso(self%pt, self%maxfct, self%mnum, self%mtype, phase, self%n, & + & self%a(1:self%nj), self%ia(1:self%ni+1), self%ja(1:self%nj), & + & self%idum, self%nrhs, self%iparm, msglvl, self%ddum, self%ddum, error) + if (error /= 0) THEN + write(*,*) 'pardiso factorization error: ', error + stop + end if + + end subroutine sparse_system_decomp + + subroutine sparse_system_solve(self, x) + implicit none + class(sparse_system), intent(inout) :: self + real(dp), dimension(:), intent(out) :: x + + integer(i4b) :: phase, error + real(dp) :: normb, normr + + ! Solve system + self%iparm(8) = 1 ! direct solution + phase = 33 ! only solve + CALL pardiso (self%pt, self%maxfct, self%mnum, self%mtype, phase, self%n, self%a(1:self%nj), self%ia(1:self%ni+1), self%ja(1:self%nj), & + & self%idum, self%nrhs, self%iparm, 0, self%b, self%x, error) + if (error /= 0) THEN + write(*,*) 'pardiso solver error: ', error + stop + else + x = self%x + end if + + end subroutine sparse_system_solve + + subroutine sparse_system_dealloc(self) + implicit none + class(sparse_system), intent(inout) :: self + + integer(i4b) :: phase, error + + ! Clean up pardiso + phase = -1 ! deallocate pardiso memory + call pardiso(self%pt, self%maxfct, self%mnum, self%mtype, phase, self%n, self%ddum, self%idum, self%idum, & + & self%idum, self%nrhs, self%iparm, self%msglvl, self%ddum, self%ddum, error) + + ! Deallocate object arrays + deallocate(self%ia, self%ja, self%a, self%b, self%x, self%y) + + ! Nullify array sizes + self%n = 0 + self%ni = 0 + self%nj = 0 + + end subroutine sparse_system_dealloc + + subroutine sparse_system_add_diag(self, val, row) + implicit none + class(sparse_system), intent(inout) :: self + real(dp), intent(in) :: val + integer(i4b), intent(in), optional :: row + integer(i4b) :: i + if (present(row)) then + self%a(self%ia(row)) = self%a(self%ia(row)) + val + else + do i = 1, self%n + self%a(self%ia(i)) = self%a(self%ia(i)) + val + end do + end if + end subroutine sparse_system_add_diag + + subroutine sparse_system_scale_row(self, row, val) + implicit none + class(sparse_system), intent(inout) :: self + integer(i4b), intent(in) :: row + real(dp), intent(in) :: val + integer(i4b) :: c1, c2 + c1 = self%ia(row) + c2 = self%ia(row+1)-1 + self%a(c1:c2) = self%a(c1:c2) * val + end subroutine sparse_system_scale_row + + subroutine sparse_system_scale_col(self, col, val) + implicit none + class(sparse_system), intent(inout) :: self + integer(i4b), intent(in) :: col + real(dp), intent(in) :: val + where (self%ja == col) + self%a = self%a * val + end where + end subroutine sparse_system_scale_col + + subroutine sparse_system_print(self) + implicit none + class(sparse_system), intent(in) :: self + + write(*,*) 'n = ', self%n, ', ni = ', self%ni, ', nj = ', self%nj + write(*,*) 'ia = ', self%ia(1:self%ni+1) + write(*,*) 'ja = ', self%ja(1:self%nj) + write(*,*) 'A = ', self%a(1:self%nj) + write(*,*) 'b = ', self%b(1:self%n) + + end subroutine sparse_system_print + + subroutine sparse_system_tester + implicit none + + integer(i4b) :: i, j, n + real(dp), allocatable, dimension(:) :: b, x + real(dp), allocatable, dimension(:,:) :: A + class(sparse_system), pointer :: ss + + ! Allocate system + n = 8 + ss => sparse_system(n, 4) + + ! Set up coefficient matrix + allocate(A(n,n)); A = 0.d0 + call ss%set_A(1,1, 7.d0); A(1,1) = 7.d0 + call ss%set_A(1,3, 1.d0); A(1,3) = 1.d0; A(3,1) = 1.d0 + call ss%set_A(1,6, 2.d0); A(1,6) = 2.d0; A(6,1) = 2.d0 + call ss%set_A(1,7, 7.d0); A(1,7) = 7.d0; A(7,1) = 7.d0 + call ss%set_A(2,2, -4.d0); A(2,2) = -4.d0 + call ss%set_A(2,3, 8.d0); A(2,3) = 8.d0; A(3,2) = 8.d0 + call ss%set_A(2,5, 2.d0); A(2,5) = 2.d0; A(5,2) = 2.d0 + call ss%set_A(3,3, 1.d0); A(3,3) = 1.d0 + call ss%set_A(3,8, 5.d0); A(3,8) = 5.d0; A(8,3) = 5.d0 + call ss%set_A(4,4, 7.d0); A(4,4) = 7.d0 + call ss%set_A(4,7, 9.d0); A(4,7) = 9.d0; A(7,4) = 9.d0 + call ss%set_A(5,5, 5.d0); A(5,5) = 5.d0 + call ss%set_A(5,6, 1.d0); A(5,6) = 1.d0; A(6,5) = 1.d0 + call ss%set_A(5,7, 5.d0); A(5,7) = 5.d0; A(7,5) = 5.d0 + call ss%set_A(6,6, 0.d0); A(6,6) = 0.d0 + call ss%set_A(6,8, 5.d0); A(6,8) = 5.d0; A(8,6) = 5.d0 + call ss%set_A(7,7, 11.d0); A(7,7) = 11.d0 + call ss%set_A(8,8, 5.d0); A(8,8) = 5.d0 + +!!$ write(*,*) 'n = ', n, ', ni = ', ss%ni, ', nj = ', ss%nj +!!$ write(*,*) 'ia = ', ss%ia(1:ss%ni+1) +!!$ write(*,*) 'ja = ', ss%ja(1:ss%nj) +!!$ write(*,*) 'A = ', ss%a(1:ss%nj) +!!$ write(*,*) 'b = ', ss%b(1:ss%n) +!!$ stop + + ! Decompose matrix + call ss%decomp() + + ! Set up RHS + allocate(b(n), x(n)) + b = 1.d0 + call ss%set_rhs(b) + + ! Solve system + call ss%solve(x) + + ! Output solution + write(*,*) 'x(sparse) = ', x + + ! Solve brute-force + call solve_system_real(A, x, b) + write(*,*) 'x(dense) = ', x + + ! Clean up + call ss%dealloc() + + end subroutine sparse_system_tester + +end module comm_sparse_mod diff --git a/commander3/src/comm_system_backend.cpp b/commander3/src/comm_system_backend.cpp index e448f2aee..8c3fb31ad 100644 --- a/commander3/src/comm_system_backend.cpp +++ b/commander3/src/comm_system_backend.cpp @@ -41,6 +41,7 @@ #include #include #include +#include using namespace std; typedef int (*forthandler)(int*); @@ -68,7 +69,7 @@ extern "C" stringstream path; path << "/proc/" << getpid() << "/statm"; FILE * f = fopen(path.str().c_str(),"r"); int64_t npage; - fscanf(f, "%lld", &npage); + fscanf(f, "%" SCNd64, &npage); fclose(f); return npage*getpagesize(); } diff --git a/commander3/src/comm_template_comp_mod.f90 b/commander3/src/comm_template_comp_mod.f90 index 078449ba1..79b5f4213 100644 --- a/commander3/src/comm_template_comp_mod.f90 +++ b/commander3/src/comm_template_comp_mod.f90 @@ -52,6 +52,7 @@ module comm_template_comp_mod real(dp), dimension(2) :: P ! Gaussian prior on amplitude (mean,sigma) real(dp), dimension(2) :: P_cg ! Gaussian prior on amplitude for CG (mean,sigma) class(comm_map), pointer :: T => null() ! Template + real(dp) :: T_scale ! overall scaling amplitude for the template class(comm_map), pointer :: mask => null() ! Template mask contains procedure :: dumpFITS => dumpTemplateToFITS @@ -112,6 +113,7 @@ function constructor_template(cpar, id, id_abs, mu, rms, def, band, label, mapfi c%comm = cpar%comm_chain c%numprocs = cpar%numprocs_chain c%P = [mu,rms] + c%T_scale = 1.d0 npre = npre + 1 comm_pre = cpar%comm_chain myid_pre = cpar%myid_chain @@ -296,6 +298,9 @@ subroutine dumpTemplateToFITS(self, iter, chainfile, output_hdf, postfix, dir) call create_hdf_group(chainfile, trim(adjustl(path))) path = trim(adjustl(path))//'/'//trim(adjustl(data(self%band)%label)) call write_hdf(chainfile, trim(adjustl(path)), self%x) + if(self%T_scale /= 1.d0 .and. self%myid == 0) then + call write_hdf(chainfile, trim(adjustl(path)) // 'T_scale', self%T_scale) + end if end if end subroutine dumpTemplateToFITS @@ -330,9 +335,9 @@ subroutine initTemplateHDF(self, cpar, hdffile, hdfpath) end subroutine initTemplateHDF - subroutine initTemplatePrecond(comm) + subroutine initTemplatePrecond(comm, samp_group) implicit none - integer(i4b), intent(in) :: comm + integer(i4b), intent(in) :: comm, samp_group integer(i4b) :: i, i1, i2, j, j1, j2, k1, k2, q, l, m, n, p, p1, p2, n1, n2, myid, ierr, cnt real(dp) :: t1, t2 @@ -343,7 +348,7 @@ subroutine initTemplatePrecond(comm) real(dp), allocatable, dimension(:,:) :: mat, mat2 if (npre == 0) return - if (allocated(P_cr%invM_temp)) return + if (allocated(P_cr(samp_group)%invM_temp)) return call mpi_comm_rank(comm, myid, ierr) @@ -396,7 +401,7 @@ subroutine initTemplatePrecond(comm) call mpi_reduce(mat, mat2, size(mat2), MPI_DOUBLE_PRECISION, MPI_SUM, 0, comm, ierr) ! Invert matrix to finalize preconditioner - allocate(P_cr%invM_temp(1,1)) + allocate(P_cr(samp_group)%invM_temp(1,1)) if (myid == 0) then ! Multiply with sqrtS from left side i1 = 0 @@ -440,8 +445,8 @@ subroutine initTemplatePrecond(comm) end do ! Invert matrix to finalize preconditioner call invert_matrix_with_mask(mat2) - allocate(P_cr%invM_temp(1,1)%M(npre,npre)) - P_cr%invM_temp(1,1)%M = mat2 + allocate(P_cr(samp_group)%invM_temp(1,1)%M(npre,npre)) + P_cr(samp_group)%invM_temp(1,1)%M = mat2 end if deallocate(mat,mat2) @@ -458,10 +463,11 @@ subroutine updateTemplatePrecond(samp_group) end subroutine updateTemplatePrecond - subroutine applyTemplatePrecond(x) + subroutine applyTemplatePrecond(x, samp_group) implicit none real(dp), dimension(:), intent(inout) :: x - + integer(i4b), intent(in) :: samp_group + integer(i4b) :: i, j, k, l, m, nmaps logical(lgt) :: skip real(dp), allocatable, dimension(:,:) :: amp @@ -496,7 +502,7 @@ subroutine applyTemplatePrecond(x) end do ! Multiply with preconditioner - y = matmul(P_cr%invM_temp(1,1)%M, y) + y = matmul(P_cr(samp_group)%invM_temp(1,1)%M, y) ! Reformat y(npre) structure back into linear array l = 1 diff --git a/commander3/src/comm_timing_mod.f90 b/commander3/src/comm_timing_mod.f90 index bae904339..b47cfa776 100644 --- a/commander3/src/comm_timing_mod.f90 +++ b/commander3/src/comm_timing_mod.f90 @@ -230,6 +230,13 @@ subroutine comm_timer_dumpASCII(self, labels, filename) write(unit,*) write(unit,*) ' Channel = ', trim(labels(band)) write(unit,fmt='(a,f12.3,"h")') ' TOD initialization = ', t(b+TOD_INIT) + !write(*,*) t(b+TOD_SL_PRE), self%numsamp, T(b+TOD_TOT) + + if(T(b+TOD_TOT) == 0.d0) then !if we never used timing mod + close(unit) + return + end if + write(unit,fmt='(a,f12.3,"h",f10.2,"%")') ' TOD sidelobe precomputation = ', t(b+TOD_SL_PRE) / self%numsamp(band), 100*t(b+TOD_SL_PRE)/T(b+TOD_TOT) write(unit,fmt='(a,f12.3,"h",f10.2,"%")') ' TOD sidelobe interpolation = ', t(b+TOD_SL_INT) / self%numsamp(band), 100*t(b+TOD_SL_INT)/T(b+TOD_TOT) write(unit,fmt='(a,f12.3,"h",f10.2,"%")') ' TOD sky-to-tod projection = ', t(b+TOD_PROJECT) / self%numsamp(band), 100*t(b+TOD_PROJECT)/T(b+TOD_TOT) diff --git a/commander3/src/comm_tod_bandpass_mod.f90 b/commander3/src/comm_tod_bandpass_mod.f90 index 42a1f7c43..2f9694140 100644 --- a/commander3/src/comm_tod_bandpass_mod.f90 +++ b/commander3/src/comm_tod_bandpass_mod.f90 @@ -20,6 +20,8 @@ !================================================================================ module comm_tod_bandpass_mod use comm_tod_mod + use comm_utils + use comm_status_mod implicit none contains diff --git a/commander3/src/comm_tod_cray_mod.f90 b/commander3/src/comm_tod_cray_mod.f90 new file mode 100644 index 000000000..e05db2331 --- /dev/null +++ b/commander3/src/comm_tod_cray_mod.f90 @@ -0,0 +1,79 @@ +!================================================================================ +! +! Copyright (C) 2020 Institute of Theoretical Astrophysics, University +! of Oslo. +! +! This file is part of Commander3. +! +! Commander3 is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! Commander3 is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with Commander3. If not, see . +! +!================================================================================ +module comm_tod_cray_mod + use comm_param_mod + implicit none + + private + public comm_cray, cray_ptr + + type :: comm_cray + real(dp), allocatable, dimension(:,:) :: templates + integer(i4b) :: ntemps + contains + procedure :: build_cray_templates + procedure :: fit_cray_amplitudes + end type comm_cray + + interface comm_cray + procedure constructor + end interface comm_cray + + type cray_ptr + class(comm_cray), pointer :: p => null() + end type cray_ptr + +contains + + ! Constructor + + function constructor(ntemps) + implicit none + integer(i4b), intent(in) :: ntemps + + + class(comm_cray), pointer :: constructor + + allocate(constructor) + + constructor%ntemps = ntemps + + end function constructor + + ! builds a set of templates for cosmic ray response from the TOD + subroutine build_cray_templates(self) + implicit none + class(comm_cray), intent(inout) :: self + + + end subroutine build_cray_templates + + ! fits the constructed templates to the cosmic rays in the timestreams + subroutine fit_cray_amplitudes(self, tod, cr) + implicit none + class(comm_cray), intent(inout) :: self + real(sp), dimension(:), intent(in) :: tod + real(sp), dimension(:), intent(inout) :: cr + + end subroutine fit_cray_amplitudes + +end module comm_tod_cray_mod diff --git a/commander3/src/comm_tod_crosstalk_mod.f90 b/commander3/src/comm_tod_crosstalk_mod.f90 new file mode 100644 index 000000000..73cd9ac77 --- /dev/null +++ b/commander3/src/comm_tod_crosstalk_mod.f90 @@ -0,0 +1,75 @@ +!================================================================================ +! +! Copyright (C) 2020 Institute of Theoretical Astrophysics, University of Oslo. +! +! This file is part of Commander3. +! +! Commander3 is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! Commander3 is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with Commander3. If not, see . +! +!================================================================================ + +module comm_tod_crosstalk_mod + use comm_tod_mod + use comm_status_mod + use comm_tod_driver_mod + implicit none + private + + public comm_crosstalk + + type :: comm_crosstalk + real(dp), dimension (:,:), allocatable :: crosstalk_matrix + contains + procedure :: estimate_crosstalk_matrix + procedure :: remove_crosstalk_signal + end type comm_crosstalk + + interface comm_crosstalk + procedure xtalk_constructor + end interface comm_crosstalk + + type crosstalk_pointer + class(comm_crosstalk), pointer :: p => null() + end type crosstalk_pointer + +contains + + !initializes a comm_crosstalk class + function xtalk_constructor(correlations) result(c) + implicit none + logical(lgt), dimension(:,:), intent(in) :: correlations + class(comm_crosstalk), pointer :: c + + allocate(c) + allocate(c%crosstalk_matrix(size(correlations(1,:)), size(correlations(:,1)))) + + end function xtalk_constructor + + ! estimates the crosstalk coeficients between each detector + subroutine estimate_crosstalk_matrix(self) + implicit none + class(comm_crosstalk), intent(in) :: self + + + end subroutine estimate_crosstalk_matrix + + subroutine remove_crosstalk_signal(self, sd, i) + implicit none + class(comm_crosstalk), intent(in) :: self + class(comm_scandata), intent(inout) :: sd + integer(i4b), intent(in) :: i + + end subroutine remove_crosstalk_signal + +end module comm_tod_crosstalk_mod diff --git a/commander3/src/comm_tod_dirbe_mod.f90 b/commander3/src/comm_tod_dirbe_mod.f90 index a7972c74d..8d36c471e 100644 --- a/commander3/src/comm_tod_dirbe_mod.f90 +++ b/commander3/src/comm_tod_dirbe_mod.f90 @@ -30,7 +30,8 @@ module comm_tod_DIRBE_mod ! process_DIRBE_tod(self, chaindir, chain, iter, handle, map_in, delta, map_out, rms_out) ! Routine which processes the time ordered data ! - use comm_tod_driver_mod + use comm_tod_driver_mod + use comm_tod_pixhist_mod implicit none private @@ -39,6 +40,7 @@ module comm_tod_DIRBE_mod type, extends(comm_tod) :: comm_dirbe_tod contains procedure :: process_tod => process_DIRBE_tod + procedure :: dumpToHDF_inst => dumpToHDF_DIRBE end type comm_dirbe_tod interface comm_dirbe_tod @@ -114,12 +116,19 @@ function constructor_dirbe(cpar, id, id_abs, info, tod_type) result(c) c%correct_orb = .false. c%orb_4pi_beam = .false. c%sample_zodi = cpar%sample_zodi .and. c%subtract_zodi ! Sample zodi parameters + c%use_moon_point = cpar%sample_moon_maps + c%use_earth_elon = cpar%sample_earth_maps c%symm_flags = .false. ! c%chisq_threshold = 100000000000.d0 !20.d0 ! 9.d0 c%chisq_threshold = 50000. c%nmaps = info%nmaps c%ndet = num_tokens(trim(cpar%ds_tod_dets(id_abs)), ",") c%sol_elong_range = cpar%zs_sol_elong + c%nside_pixhist = 64 + + c%gain_tune_sigma0 = .false. + c%gain_samprate = 1.d0 / 3600.d0 / 24.d0 + c%gain_sigma_0 = 0.005 nside_beam = 128 nmaps_beam = 1 @@ -156,10 +165,42 @@ function constructor_dirbe(cpar, id, id_abs, info, tod_type) result(c) !do i = 1, c%nscan ! c%scans(i)%d%baseline = 0.d0 !end do - + call timer%stop(TOD_INIT, id_abs) end function constructor_dirbe + + subroutine dumpToHDF_DIRBE(self, chainfile, path) + ! + ! Writes instrument-specific TOD parameters to existing chain file + ! + ! Arguments: + ! ---------- + ! self: derived class (comm_tod) + ! TOD object + ! chainfile: derived type (hdf_file) + ! Already open HDF file handle to existing chainfile + ! path: string + ! HDF path to current dataset, e.g., "000001/tod/030" + ! + ! Returns + ! ---------- + ! None + ! + implicit none + class(comm_dirbe_tod), intent(in) :: self + type(hdf_file), intent(in) :: chainfile + character(len=*), intent(in) :: path + + + if (self%myid == 0) then + if (self%map_solar_allocated == .true.) then + call write_hdf(chainfile, trim(adjustl(path))//'map_solar', self%map_solar) + end if + end if + + end subroutine dumpToHDF_DIRBE + !************************************************** ! Driver routine !************************************************** @@ -221,10 +262,11 @@ subroutine process_DIRBE_tod(self, chaindir, chain, iter, handle, map_in, delta, character(len=6) :: samptext, scantext character(len=512) :: prefix, postfix, prefix4D, prefix_atlas, postfix_atlas character(len=512), allocatable, dimension(:) :: slist + real(sp), dimension(9) :: flag_threshold real(sp), allocatable, dimension(:) :: procmask, procmask2, procmask_zodi real(sp), allocatable, dimension(:,:,:) :: d_calib real(sp), allocatable, dimension(:,:,:,:) :: map_sky, m_gain - real(dp), allocatable, dimension(:,:) :: chisq_S, m_buf + real(dp), allocatable, dimension(:,:) :: chisq_S, m_buf, freqmap real(dp), allocatable, dimension(:, :) :: A_T_A, A_T_A_reduced real(dp), allocatable, dimension(:) :: AY, AY_reduced, X real(dp), allocatable, dimension(:, :, :) :: s_therm_tot, s_scat_tot ! (n_tod_tot, ncomps, ndet) @@ -247,17 +289,35 @@ subroutine process_DIRBE_tod(self, chaindir, chain, iter, handle, map_in, delta, sample_abs_bandpass = .false. ! don't sample absolute bandpasses select_data = .false. !self%first_call ! only perform data selection the first time output_scanlist = mod(iter-1,10) == 0 ! only output scanlist every 10th iteration - sample_gain = .false. ! Gain sampling, LB TOD sims have perfect gain + !sample_gain = .true. !iter > 1 ! Gain sampling, LB TOD sims have perfect gain !!$ if (trim(self%freq) == '01' .or. trim(self%freq) == '02' .or. & !!$ & trim(self%freq) == '03' .or. & !!$ & trim(self%freq) == '09' .or. trim(self%freq) == '10') then !if (trim(self%freq(1:2)) == '09' .or. trim(self%freq(1:2)) == '10') then - if (trim(self%freq(1:2)) == '10') then + if (trim(self%freq(1:2)) == '09' .or. trim(self%freq(1:2)) == '10') then sample_ncorr = .true. + !sample_ncorr = .false. else sample_ncorr = .false. end if - + + if (trim(self%freq(1:2)) == '05' .or. trim(self%freq(1:2)) == '06') then + sample_gain = iter > 1 + else + sample_gain = .false. + end if + + if (trim(self%freq(1:2)) == '05' .or. trim(self%freq(1:2)) == '06' .or. & + & trim(self%freq(1:2)) == '07' .or. trim(self%freq(1:2)) == '08' .or. & + & trim(self%freq(1:2)) == '09' .or. trim(self%freq(1:2)) == '10') then + ! Pixhist Extreme RMS ranges Single Ranges Pointing + flag_threshold = [1.0, -20., -5.0, -3.0, -2.0, -1.5, 1.0, -0.30, 1.0] + else + ! Pixhist Extreme RMS ranges Single Ranges Pointing + flag_threshold = [1.0, -50., -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0] + !flag_threshold = [-1.0, -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0] + end if + ! Initialize local variables ndelta = size(delta,3) self%n_bp_prop = ndelta-1 @@ -280,7 +340,6 @@ subroutine process_DIRBE_tod(self, chaindir, chain, iter, handle, map_in, delta, call distribute_sky_maps(self, map_in, 1.e0, map_sky) ! uK to K allocate(m_gain(nmaps,self%nobs,0:self%ndet,1)) call distribute_sky_maps(self, map_gain, 1.e0, m_gain) ! uK to K - allocate(m_buf(0:npix-1,nmaps), procmask(0:npix-1), procmask2(0:npix-1)) call self%procmask%bcast_fullsky_map(m_buf); procmask = m_buf(:,1) call self%procmask2%bcast_fullsky_map(m_buf); procmask2 = m_buf(:,1) @@ -304,19 +363,23 @@ subroutine process_DIRBE_tod(self, chaindir, chain, iter, handle, map_in, delta, end if - !------------------------------------ ! Perform main sampling steps !------------------------------------ + ! Create pixel histograms + if (self%first_call) then + call compute_tod_pixhist(self, map_sky, m_gain, procmask, procmask2) + end if + ! Sample gain components in separate TOD loops; marginal with respect to n_corr if (sample_gain) then ! 'abscal': the global constant gain factor - call sample_calibration(self, 'abscal', handle, map_sky, m_gain, procmask, procmask2) + !call sample_calibration(self, 'abscal', handle, map_sky, m_gain, procmask, procmask2) ! 'relcal': the gain factor that is constant in time but varying between detectors ! call sample_calibration(self, 'relcal', handle, map_sky, m_gain, procmask, procmask2) ! 'deltaG': the time-variable and detector-variable gain - call sample_calibration(self, 'deltaG', handle, map_sky, m_gain, procmask, procmask2) + call sample_calibration(self, 'deltaG', handle, map_sky, m_gain, procmask2, procmask2, smooth=.true., mask_threshold=0.1d0) end if ! Prepare intermediate data structures @@ -337,17 +400,18 @@ subroutine process_DIRBE_tod(self, chaindir, chain, iter, handle, map_in, delta, ! Skip scan if no accepted data if (.not. any(self%scans(i)%d%accept)) cycle call wall_time(t1) - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, procmask_zodi, init_s_bp=.true.) + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, procmask_zodi, init_s_bp=.true.) ! Create dynamic mask if (self%first_call) then do j = 1, sd%ndet if (.not. self%scans(i)%d(j)%accept) cycle - call self%create_dynamic_mask(i, j, sd%tod(:,j)-real(self%scans(i)%d(j)%gain,sp)*sd%s_tot(:,j), [-10.,10.], sd%mask(:,j)) + call self%create_dynamic_mask(i, j, sd%pix(:,j,1), sd%tod(:,j), (sd%tod(:,j)-real(self%scans(i)%d(j)%gain,sp)*sd%s_tot(:,j))/self%scans(i)%d(j)%N_psd%sigma0, & + & sd%mask(:,j), sd%flag(:,j), flag_threshold, s_tot=sd%s_tot(:,j)) end do - call sd%dealloc + call dealloc_scan_data(sd) if (.not. any(self%scans(i)%d%accept)) cycle - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, procmask_zodi, init_s_bp=.true.) + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, procmask_zodi, init_s_bp=.true.) end if ! Sample correlated noise @@ -373,7 +437,7 @@ subroutine process_DIRBE_tod(self, chaindir, chain, iter, handle, map_in, delta, ! Compute chisquare for bandpass fit if (sample_abs_bandpass) call compute_chisq_abs_bp(self, i, sd, chisq_S) - + ! Compute binned map allocate(d_calib(self%output_n_maps, sd%ntod, sd%ndet)) d_calib = 0.d0 @@ -389,19 +453,21 @@ subroutine process_DIRBE_tod(self, chaindir, chain, iter, handle, map_in, delta, call open_hdf_file(trim(chaindir)//'/res_'//trim(self%label(1))//scantext//'.h5', tod_file, 'w') call write_hdf(tod_file, '/tod', sd%tod) call write_hdf(tod_file, '/pix', sd%pix(:,:,1)) + call write_hdf(tod_file, '/pix_sol', self%scans(i)%d(1)%pix_sol) call write_hdf(tod_file, '/todz', d_calib(1, :, :)) call write_hdf(tod_file, '/s_sky', sd%s_sky) - call write_hdf(tod_file, '/n_corr', sd%n_corr) - call write_hdf(tod_file, '/s_sl', sd%s_sl) - call write_hdf(tod_file, '/s_orb', sd%s_orb) + !call write_hdf(tod_file, '/n_corr', sd%n_corr) + !call write_hdf(tod_file, '/s_sl', sd%s_sl) + !call write_hdf(tod_file, '/s_orb', sd%s_orb) call write_hdf(tod_file, '/res', d_calib(2, :, :)) call write_hdf(tod_file, '/zodi', d_calib(7, :, :)) call write_hdf(tod_file, '/mask', sd%mask) + call write_hdf(tod_file, '/flag', sd%flag) call write_hdf(tod_file, '/sigma0', self%scans(i)%d(1)%N_psd%sigma0) - do k = 1, size(sd%s_zodi_therm, dim=2) - call int2string(k, scantext) - call write_hdf(tod_file , '/zodi'//scantext, d_calib(8 + k, :, :)) - end do + !do k = 1, size(sd%s_zodi_therm, dim=2) + ! call int2string(k, scantext) + ! call write_hdf(tod_file , '/zodi'//scantext, d_calib(8 + k, :, :)) + !end do call close_hdf_file(tod_file) end if end if @@ -409,6 +475,10 @@ subroutine process_DIRBE_tod(self, chaindir, chain, iter, handle, map_in, delta, ! Bin TOD call bin_TOD(self, i, sd%pix(:,:,1), sd%psi(:,:,1), sd%flag, d_calib, binmap) +!!$ do j = 1, binmap%nobs +!!$ if (binmap%A_map(1,j) > 0.) write(*,*) j, real(binmap%b_map(1,1,j),sp), real(binmap%A_map(1,j),sp), real(binmap%b_map(1,1,j)/binmap%A_map(1,j),sp) +!!$ end do + ! Update scan list call wall_time(t2) self%scans(i)%proctime = self%scans(i)%proctime + t2-t1 @@ -420,10 +490,13 @@ subroutine process_DIRBE_tod(self, chaindir, chain, iter, handle, map_in, delta, end if ! Clean up - call sd%dealloc + call dealloc_scan_data(sd) deallocate(d_calib) end do + ! Synchronize and output flagging statistics in first iteration + if (self%first_call) call self%report_dynamic_mask_stats + if (self%myid == 0) write(*,*) ' --> Finalizing maps, bp' ! Output latest scan list with new timing information diff --git a/commander3/src/comm_tod_driver_mod.f90 b/commander3/src/comm_tod_driver_mod.f90 index 1b7d562c7..08297a4c8 100644 --- a/commander3/src/comm_tod_driver_mod.f90 +++ b/commander3/src/comm_tod_driver_mod.f90 @@ -10,6 +10,7 @@ module comm_tod_driver_mod use comm_tod_jump_mod use comm_tod_adc_mod use comm_zodi_mod + use comm_tod_cray_mod use comm_shared_arr_mod use comm_huffman_mod use comm_4d_map_mod @@ -17,48 +18,16 @@ module comm_tod_driver_mod use omp_lib implicit none + ! Class for uncompressed data of a single detector over the full flight + type :: comm_detdata - ! Class for uncompressed data for a given scan - type :: comm_scandata - integer(i4b) :: ntod, ndet, nhorn, ndelta - real(sp), allocatable, dimension(:,:) :: tod ! Raw data - real(sp), allocatable, dimension(:,:) :: n_corr ! Correlated noise in V - real(sp), allocatable, dimension(:,:) :: s_sl ! Sidelobe correction - real(sp), allocatable, dimension(:,:) :: s_sky ! Stationary sky signal - real(sp), allocatable, dimension(:,:,:) :: s_sky_prop ! Stationary sky signal proposal for bandpass sampling - real(sp), allocatable, dimension(:,:) :: s_orb ! Orbital dipole - real(sp), allocatable, dimension(:,:) :: s_mono ! Detector monopole correction - real(sp), allocatable, dimension(:,:) :: s_calib ! Custom calibrator - real(sp), allocatable, dimension(:,:) :: s_calibA ! Custom calibrator - real(sp), allocatable, dimension(:,:) :: s_calibB ! Custom calibrator - real(sp), allocatable, dimension(:,:) :: s_bp ! Bandpass correction - real(sp), allocatable, dimension(:,:,:) :: s_bp_prop ! Bandpass correction proposal - real(sp), allocatable, dimension(:,:) :: s_zodi ! Zodiacal emission - real(sp), allocatable, dimension(:,:,:) :: s_zodi_scat ! Scattered sunlight contribution to zodi - real(sp), allocatable, dimension(:,:,:) :: s_zodi_therm ! Thermal zodiacal emission - real(sp), allocatable, dimension(:,:) :: s_inst ! Instrument-specific correction template - real(sp), allocatable, dimension(:,:) :: s_tot ! Total signal - real(sp), allocatable, dimension(:,:) :: s_gain ! Absolute calibrator - real(sp), allocatable, dimension(:,:) :: mask ! TOD mask (flags + main processing mask) - real(sp), allocatable, dimension(:,:) :: mask2 ! Small TOD mask, for bandpass sampling - real(sp), allocatable, dimension(:,:) :: mask_zodi ! Mask for sampling zodi - integer(i4b), allocatable, dimension(:,:,:) :: pix ! Discretized pointing - integer(i4b), allocatable, dimension(:,:,:) :: psi ! Discretized polarization angle - integer(i4b), allocatable, dimension(:,:) :: flag ! Quality flags - - real(sp), allocatable, dimension(:,:) :: s_totA ! Total signal, horn A (differential only) - real(sp), allocatable, dimension(:,:) :: s_totB ! Total signal, horn B (differential only) - real(sp), allocatable, dimension(:,:) :: s_gainA ! Total signal, horn A (differential only) - real(sp), allocatable, dimension(:,:) :: s_gainB ! Total signal, horn B (differential only) - real(sp), allocatable, dimension(:,:) :: s_orbA ! Orbital signal, horn A (differential only) - real(sp), allocatable, dimension(:,:) :: s_orbB ! Orbital signal, horn B (differential only) - integer(i4b) :: band ! Band ID - contains - procedure :: init_singlehorn => init_scan_data_singlehorn - procedure :: init_differential => init_scan_data_differential - procedure :: dealloc => dealloc_scan_data - end type comm_scandata - + integer(i4b) :: nscan + integer(i4b), allocatable, dimension(:) :: ntod, scans + real(sp), allocatable, dimension(:,:) :: tod + contains + procedure init_singlehorn => init_det_data_singlehorn + procedure dealloc => dealloc_det_data + end type comm_detdata contains @@ -66,10 +35,10 @@ module comm_tod_driver_mod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Scan data routines !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - subroutine init_scan_data_singlehorn(self, tod, scan, map_sky, map_gain, procmask, procmask2, procmask_zodi, & - & init_s_bp, init_s_bp_prop, init_s_sky_prop) + subroutine init_scan_data_singlehorn(sd, tod, scan, map_sky, map_gain, procmask, procmask2, procmask_zodi, & + & init_s_bp, init_s_bp_prop, init_s_sky_prop, skip_nonlin, skip_zodi, darkdata) implicit none - class(comm_scandata), intent(inout) :: self + class(comm_scandata), intent(inout) :: sd class(comm_tod), intent(inout) :: tod integer(i4b), intent(in) :: scan real(sp), dimension(1:,1:,0:,1:), intent(in) :: map_sky @@ -80,10 +49,16 @@ subroutine init_scan_data_singlehorn(self, tod, scan, map_sky, map_gain, procmas logical(lgt), intent(in), optional :: init_s_bp logical(lgt), intent(in), optional :: init_s_bp_prop logical(lgt), intent(in), optional :: init_s_sky_prop + logical(lgt), intent(in), optional :: skip_nonlin + logical(lgt), intent(in), optional :: skip_zodi + logical(lgt), intent(in), optional :: darkdata + integer(i4b) :: i, j, k, ndelta - logical(lgt) :: init_s_bp_, init_s_bp_prop_, init_s_sky_prop_ - + logical(lgt) :: init_s_bp_, init_s_bp_prop_, init_s_sky_prop_, skip_nonlin_, darkdata_, skip_zodi_ + call timer%start(TOD_ALLOC, tod%band) + + if (tod%nhorn /= 1) then write(*,*) 'Error: init_scan_data_singlehorn only applicable for 1-horn experiments' stop @@ -92,6 +67,10 @@ subroutine init_scan_data_singlehorn(self, tod, scan, map_sky, map_gain, procmas init_s_bp_ = .false.; if (present(init_s_bp)) init_s_bp_ = init_s_bp init_s_sky_prop_ = .false.; if (present(init_s_sky_prop)) init_s_sky_prop_ = init_s_sky_prop + skip_nonlin_ = .false.; if (present(skip_nonlin)) skip_nonlin_ = skip_nonlin + skip_zodi_ = .false.; if (present(skip_zodi)) skip_zodi_ = skip_zodi + darkdata_ = .false.; if (present(darkdata)) darkdata_ = darkdata + init_s_bp_prop_ = .false. if (present(init_s_bp_prop)) then init_s_bp_prop_ = init_s_bp_prop @@ -99,37 +78,38 @@ subroutine init_scan_data_singlehorn(self, tod, scan, map_sky, map_gain, procmas end if !if (.true. .or. tod%myid == 78) write(*,*) 'c1', tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires - self%ntod = tod%scans(scan)%ntod - self%ndet = tod%ndet - self%nhorn = tod%nhorn - self%ndelta = 0; if (init_s_sky_prop_ .or. init_s_bp_prop_) self%ndelta = size(map_sky,4) - self%band = tod%band + sd%ntod = tod%scans(scan)%ntod + sd%ndet = tod%ndet + sd%nhorn = tod%nhorn + sd%ndelta = 0; if (init_s_sky_prop_ .or. init_s_bp_prop_) sd%ndelta = size(map_sky,4) ! Allocate data structures - allocate(self%tod(self%ntod, self%ndet)) - allocate(self%n_corr(self%ntod, self%ndet)) - allocate(self%s_sl(self%ntod, self%ndet)) - allocate(self%s_sky(self%ntod, self%ndet)) - allocate(self%s_bp(self%ntod, self%ndet)) - allocate(self%s_orb(self%ntod, self%ndet)) - allocate(self%s_tot(self%ntod, self%ndet)) - allocate(self%s_gain(self%ntod, self%ndet)) - allocate(self%mask(self%ntod, self%ndet)) - allocate(self%pix(self%ntod, self%ndet, self%nhorn)) - allocate(self%psi(self%ntod, self%ndet, self%nhorn)) - allocate(self%flag(self%ntod, self%ndet)) - if (init_s_sky_prop_) allocate(self%s_sky_prop(self%ntod, self%ndet, 2:self%ndelta)) - if (init_s_bp_prop_) allocate(self%s_bp_prop(self%ntod, self%ndet, 2:self%ndelta)) - if (init_s_sky_prop_) allocate(self%mask2(self%ntod, self%ndet)) - if (tod%sample_mono) allocate(self%s_mono(self%ntod, self%ndet)) + allocate(sd%tod(sd%ntod, sd%ndet)) + allocate(sd%n_corr(sd%ntod, sd%ndet)) + allocate(sd%s_sl(sd%ntod, sd%ndet)) + allocate(sd%s_sky(sd%ntod, sd%ndet)) + allocate(sd%s_bp(sd%ntod, sd%ndet)) + allocate(sd%s_orb(sd%ntod, sd%ndet)) + allocate(sd%s_tot(sd%ntod, sd%ndet)) + allocate(sd%s_gain(sd%ntod, sd%ndet)) + allocate(sd%mask(sd%ntod, sd%ndet)) + allocate(sd%pix(sd%ntod, sd%ndet, sd%nhorn)) + allocate(sd%psi(sd%ntod, sd%ndet, sd%nhorn)) + allocate(sd%flag(sd%ntod, sd%ndet)) + if (init_s_sky_prop_) allocate(sd%s_sky_prop(sd%ntod, sd%ndet, 2:sd%ndelta)) + if (init_s_bp_prop_) allocate(sd%s_bp_prop(sd%ntod, sd%ndet, 2:sd%ndelta)) + if (init_s_sky_prop_) allocate(sd%mask2(sd%ntod, sd%ndet)) + if (tod%sample_mono) allocate(sd%s_mono(sd%ntod, sd%ndet)) + if (tod%apply_inst_corr) allocate(sd%s_inst(sd%ntod, sd%ndet)) + + if (darkdata_) then + allocate(sd%dark(sd%ntod, tod%ndark)) + end if + if (tod%subtract_zodi) then - call tod%clear_zodi_cache() - allocate(self%s_zodi(self%ntod, self%ndet)) - allocate(self%s_zodi_scat(self%ntod, tod%zodi_n_comps, self%ndet)) - allocate(self%s_zodi_therm(self%ntod, tod%zodi_n_comps, self%ndet)) - if (tod%sample_zodi) allocate(self%mask_zodi(self%ntod, self%ndet)) - endif - if (tod%apply_inst_corr) allocate(self%s_inst(self%ntod, self%ndet)) + allocate(sd%s_zodi(sd%ntod, sd%ndet)) + if (tod%sample_zodi) allocate(sd%mask_zodi(sd%ntod, sd%ndet)) + end if !call update_status(status, "todinit_alloc") call timer%stop(TOD_ALLOC, tod%band) @@ -137,32 +117,46 @@ subroutine init_scan_data_singlehorn(self, tod, scan, map_sky, map_gain, procmas ! Decompress pointing, psi and flags for current scan call timer%start(TOD_DECOMP, tod%band) - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - call tod%decompress_pointing_and_flags(scan, j, self%pix(:,j,:), & - & self%psi(:,j,:), self%flag(:,j)) + call tod%decompress_pointing_and_flags(scan, j, sd%pix(:,j,:), & + & sd%psi(:,j,:), sd%flag(:,j)) end do + +!!$ open(58,file='decomp.dat', recl=1024) +!!$ do j = 1, sd%ntod +!!$ write(58,*) j, sd%pix(j,1,1), sd%flag(j,1) +!!$ end do +!!$ close(58) + + + if(darkdata_) then + do j=1, tod%ndark + call tod%decompress_dark_data(scan, j, sd%dark(:,j)) + end do + end if + call timer%stop(TOD_DECOMP, tod%band) !call update_status(status, "todinit_decomp") !if (tod%myid == 78) write(*,*) 'c3', tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires - if (tod%symm_flags) call tod%symmetrize_flags(self%flag) + if (tod%symm_flags) call tod%symmetrize_flags(sd%flag) !call update_status(status, "todinit_symmflag") !if (.true. .or. tod%myid == 78) write(*,*) 'c4', tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires ! Prepare TOD if (tod%ndiode == 1) then call timer%start(TOD_DECOMP, tod%band) - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle if (tod%compressed_tod) then - call tod%decompress_tod(scan, j, self%tod(:,j)) + call tod%decompress_tod(scan, j, sd%tod(:,j)) else - self%tod(:,j) = tod%scans(scan)%d(j)%tod + sd%tod(:,j) = tod%scans(scan)%d(j)%tod end if end do call timer%stop(TOD_DECOMP, tod%band) else - call tod%diode2tod_inst(scan, map_sky, procmask, self%tod) + call tod%diode2tod_inst(scan, map_sky, procmask, sd%tod) end if !call update_status(status, "todinit_tod") !if (.true. .or. tod%myid == 78) write(*,*) 'c5', tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires @@ -170,54 +164,39 @@ subroutine init_scan_data_singlehorn(self, tod, scan, map_sky, map_gain, procmas ! Construct sky signal template call timer%start(TOD_PROJECT, tod%band) if (init_s_bp_) then - call project_sky(tod, map_sky(:,:,:,1), self%pix(:,:,1), self%psi(:,:,1), self%flag, & - & procmask, scan, self%s_sky, self%mask, s_bp=self%s_bp) - call project_sky(tod, map_gain(:,:,:,1), self%pix(:,:,1), self%psi(:,:,1), self%flag, & - & procmask, scan, self%s_gain, self%mask, s_bp=self%s_bp) + call project_sky(tod, map_sky(:,:,:,1), sd%pix(:,:,1), sd%psi(:,:,1), sd%flag, & + & procmask, scan, sd%s_sky, sd%mask, s_bp=sd%s_bp) + call project_sky(tod, map_gain(:,:,:,1), sd%pix(:,:,1), sd%psi(:,:,1), sd%flag, & + & procmask, scan, sd%s_gain, sd%mask, s_bp=sd%s_bp) else - call project_sky(tod, map_sky(:,:,:,1), self%pix(:,:,1), self%psi(:,:,1), self%flag, & - & procmask, scan, self%s_sky, self%mask) - call project_sky(tod, map_gain(:,:,:,1), self%pix(:,:,1), self%psi(:,:,1), self%flag, & - & procmask, scan, self%s_gain, self%mask) + call project_sky(tod, map_sky(:,:,:,1), sd%pix(:,:,1), sd%psi(:,:,1), sd%flag, & + & procmask, scan, sd%s_sky, sd%mask) + call project_sky(tod, map_gain(:,:,:,1), sd%pix(:,:,1), sd%psi(:,:,1), sd%flag, & + & procmask, scan, sd%s_gain, sd%mask) end if !call update_status(status, "todinit_sky") !if (tod%myid == 78) write(*,*) 'c6', tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires ! Set up (optional) bandpass sampling quantities (s_sky_prop, mask2 and bp_prop) if (init_s_bp_prop_) then - do j = 2, self%ndelta + do j = 2, sd%ndelta !if (.true. .or. tod%myid == 78) write(*,*) 'c61', j, tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires, size(map_sky,4) - call project_sky(tod, map_sky(:,:,:,j), self%pix(:,:,1), self%psi(:,:,1), self%flag, & - & procmask2, scan, self%s_sky_prop(:,:,j), self%mask2, s_bp=self%s_bp_prop(:,:,j)) + call project_sky(tod, map_sky(:,:,:,j), sd%pix(:,:,1), sd%psi(:,:,1), sd%flag, & + & procmask2, scan, sd%s_sky_prop(:,:,j), sd%mask2, s_bp=sd%s_bp_prop(:,:,j)) end do else if (init_s_sky_prop_) then - do j = 2, self%ndelta + do j = 2, sd%ndelta !if (.true. .or. tod%myid == 78) write(*,*) 'c62', j, tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires - call project_sky(tod, map_sky(:,:,:,j), self%pix(:,:,1), self%psi(:,:,1), self%flag, & - & procmask2, scan, self%s_sky_prop(:,:,j), self%mask2) + call project_sky(tod, map_sky(:,:,:,j), sd%pix(:,:,1), sd%psi(:,:,1), sd%flag, & + & procmask2, scan, sd%s_sky_prop(:,:,j), sd%mask2) end do end if - - ! ! Project zodi sampling mask to timestream - ! if (tod%subtract_zodi .and. tod%sample_zodi) then - ! if (.not. present(procmask_zodi)) stop "zodi processing mask is not present in init_scan_data_singlehorn but sample zodi is true" - ! do j = 1, self%ndet - ! do i = 1, tod%scans(scan)%ntod - ! self%mask_zodi(i, j) = procmask_zodi(self%pix(i, j, 1)) - ! if (iand(self%flag(i, j), tod%flag0) .ne. 0) self%mask_zodi(i, j) = 0. - ! end do - ! end do - ! end if call timer%stop(TOD_PROJECT, tod%band) - !call update_status(status, "todinit_bp") - !if (.true. .or. tod%myid == 78) write(*,*) 'c71', tod%myid, tod%correct_sl - !if (.true. .or. tod%myid == 78) write(*,*) 'c72', tod%myid, tod%ndet - !if (.true. .or. tod%myid == 78) write(*,*) 'c73', tod%myid, tod%slconv(1)%p%psires ! Perform sanity tests - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - if (all(self%mask(:,j) == 0)) tod%scans(scan)%d(j)%accept = .false. + if (all(sd%mask(:,j) == 0)) tod%scans(scan)%d(j)%accept = .false. if (tod%scans(scan)%d(j)%N_psd%sigma0 <= 0.d0) tod%scans(scan)%d(j)%accept = .false. end do !call update_status(status, "todinit_sanity") @@ -226,62 +205,58 @@ subroutine init_scan_data_singlehorn(self, tod, scan, map_sky, map_gain, procmas ! Construct orbital dipole template if (tod%correct_orb) then call timer%start(TOD_ORBITAL, tod%band) - call tod%construct_dipole_template(scan, self%pix(:,:,1), self%psi(:,:,1), self%s_orb) + call tod%construct_dipole_template(scan, sd%pix(:,:,1), sd%psi(:,:,1), sd%s_orb) call timer%stop(TOD_ORBITAL, tod%band) else - self%s_orb = 0. + sd%s_orb = 0. end if !if (.true. .or. tod%myid == 78) write(*,*) 'c9', tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires ! Construct zodical light template if (tod%subtract_zodi) then - call timer%start(TOD_ZODI, tod%band) - if (tod%myid == 0) write(*, fmt='(a24, i3, a1)') ' --> Simulating zodi: ', nint(real(scan-1, sp)/real(tod%nscan,sp) * 100, i4b), '%' - do j = 1, self%ndet -!!$ call get_zodi_emission(& -!!$ & tod=tod, & -!!$ & pix=self%pix(:, j, 1), & -!!$ & scan=scan, & -!!$ & det=j, & -!!$ & s_zodi_scat=self%s_zodi_scat(:, :, j), & -!!$ & s_zodi_therm=self%s_zodi_therm(:, :, j), & -!!$ & model=zodi_model & -!!$ &) -!!$ call get_s_zodi(& -!!$ & s_therm=self%s_zodi_therm(:, :, j), & -!!$ & s_scat=self%s_zodi_scat(:, :, j), & -!!$ & s_zodi=self%s_zodi(:, j), & -!!$ & emissivity=tod%zodi_emissivity, & -!!$ & albedo=tod%zodi_albedo & -!!$ &) - call get_s_tot_zodi(zodi_model, tod, j, scan, self%s_zodi(:, j), pix_dynamic=self%pix(:,j,:), pix_static=tod%scans(scan)%d(j)%pix_sol, s_scat=self%s_zodi_scat(:,:,j), s_therm=self%s_zodi_therm(:,:,j)) - end do - call timer%stop(TOD_ZODI, tod%band) + if (skip_zodi_) then + sd%s_zodi = 0. + else + call timer%start(TOD_ZODI, tod%band) + if (tod%myid == 0) write(*, fmt='(a24, i3, a1)') ' --> Computing zodi: ', nint(real(scan-1, sp)/real(tod%nscan,sp) * 100, i4b), '%' + do j = 1, sd%ndet + call get_s_tot_zodi(zodi_model, tod, j, scan, sd%s_zodi(:, j), pix_dynamic=sd%pix(:,j,:)) +!!$ if (tod%myid == 0) then +!!$ open(58,file='zodi.dat') +!!$ do k = 1, size(self%s_zodi(:,j)) +!!$ write(58,*) k, self%s_zodi(k,j), self%mask(k,j) +!!$ end do +!!$ close(58) +!!$ end if +!!$ call mpi_finalize(k) +!!$ stop + end do + call timer%stop(TOD_ZODI, tod%band) + end if end if - !if (.true. .or. tod%myid == 78) write(*,*) 'c10', tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires ! Construct sidelobe template !if (.true. .or. tod%myid == 78) write(*,*) 'd', tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires if (tod%correct_sl) then call timer%start(TOD_SL_INT, tod%band) - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle !if (.true. .or. tod%myid == 78) write(*,*) 'e', tod%myid, j, tod%slconv(j)%p%psires, tod%slconv(j)%p%psisteps call tod%construct_sl_template(tod%slconv(j)%p, & - & self%pix(:,j,1), self%psi(:,j,1), self%s_sl(:,j), tod%mbang(j)) - self%s_sl(:,j) = 2.d0 * self%s_sl(:,j) ! Scaling by a factor of 2, by comparison with LevelS. Should be understood + & sd%pix(:,j,1), sd%psi(:,j,1), sd%s_sl(:,j), tod%mbang(j)) + sd%s_sl(:,j) = 2.d0 * sd%s_sl(:,j) ! Scaling by a factor of 2, by comparison with LevelS. Should be understood end do call timer%stop(TOD_SL_INT, tod%band) else - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - self%s_sl(:,j) = 0. + sd%s_sl(:,j) = 0. end do end if !!$ if (tod%scanid(scan) == 3) then !!$ open(58,file='sidelobe_BP10.dat') -!!$ do k = 1, size(self%s_sl,1) -!!$ write(58,*) k, self%s_sl(k,1) +!!$ do k = 1, size(sd%s_sl,1) +!!$ write(58,*) k, sd%s_sl(k,1) !!$ end do !!$ close(58) !!$ end if @@ -291,45 +266,48 @@ subroutine init_scan_data_singlehorn(self, tod, scan, map_sky, map_gain, procmas ! Construct monopole correction template if (tod%sample_mono) then - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - !self%s_mono(:,j) = tod%mono(j) - self%s_mono(:,j) = 0.d0 ! Disabled for now + !sd%s_mono(:,j) = tod%mono(j) + sd%s_mono(:,j) = 0.d0 ! Disabled for now end do end if ! Generate and apply instrument-specific correction template if (tod%apply_inst_corr) then - call timer%start(TOD_INSTCORR, tod%band) - call tod%construct_corrtemp_inst(scan, self%pix(:,:,1), self%psi(:,:,1), self%s_inst) -!!$ do j = 1, self%ndet + call tod%construct_corrtemp_inst(scan, sd%pix(:,:,1), sd%psi(:,:,1), sd%s_inst) +!!$ do j = 1, sd%ndet !!$ if (.not. tod%scans(scan)%d(j)%accept) cycle -!!$ self%tod(:,j) = self%tod(:,j) - self%s_inst(:,j) +!!$ sd%tod(:,j) = sd%tod(:,j) - sd%s_inst(:,j) !!$ end do call timer%stop(TOD_INSTCORR, tod%band) end if !call update_status(status, "todinit_instcorr") ! Construct total sky signal - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle if (tod%subtract_zodi) then - self%s_tot(:,j) = self%s_sky(:,j) + self%s_sl(:,j) + self%s_orb(:,j) + self%s_zodi(:,j) + sd%s_tot(:,j) = sd%s_sky(:,j) + sd%s_sl(:,j) + sd%s_orb(:,j) + sd%s_zodi(:,j) else - self%s_tot(:,j) = self%s_sky(:,j) + self%s_sl(:,j) + self%s_orb(:,j) + sd%s_tot(:,j) = sd%s_sky(:,j) + sd%s_sl(:,j) + sd%s_orb(:,j) end if - if (tod%sample_mono) self%s_tot(:,j) = self%s_tot(:,j) + self%s_mono(:,j) - if (tod%apply_inst_corr) self%s_tot(:,j) = self%s_tot(:,j) + self%s_inst(:,j) + if (tod%sample_mono) sd%s_tot(:,j) = sd%s_tot(:,j) + sd%s_mono(:,j) + if (tod%apply_inst_corr) sd%s_tot(:,j) = sd%s_tot(:,j) + sd%s_inst(:,j) end do + + ! Apply non-linearity corrections + if (.not. skip_nonlin_) call tod%apply_nonlin_corr_inst(scan, sd) + !call update_status(status, "todinit_stot") end subroutine init_scan_data_singlehorn - subroutine init_scan_data_differential(self, tod, scan, map_sky, map_gain, procmask, procmask2, & + subroutine init_scan_data_differential(sd, tod, scan, map_sky, map_gain, procmask, procmask2, & & init_s_bp, init_s_bp_prop, init_s_sky_prop, polang) implicit none - class(comm_scandata), intent(inout) :: self + class(comm_scandata), intent(inout) :: sd class(comm_tod), intent(inout) :: tod integer(i4b), intent(in) :: scan real(sp), dimension(1:,1:,0:,1:), intent(in) :: map_sky @@ -364,213 +342,181 @@ subroutine init_scan_data_differential(self, tod, scan, map_sky, map_gain, procm init_s_sky_prop_ = init_s_bp_prop end if - self%ntod = tod%scans(scan)%ntod - self%ndet = tod%ndet - self%nhorn = tod%nhorn - self%ndelta = 0; if (init_s_sky_prop_ .or. init_s_bp_prop_) self%ndelta = size(map_sky,4) - self%band = tod%band + sd%ntod = tod%scans(scan)%ntod + sd%ndet = tod%ndet + sd%nhorn = tod%nhorn + sd%ndelta = 0; if (init_s_sky_prop_ .or. init_s_bp_prop_) sd%ndelta = size(map_sky,4) ! Allocate data structures - allocate(self%tod(self%ntod, self%ndet)) - allocate(self%n_corr(self%ntod, self%ndet)) - allocate(self%s_sl(self%ntod, self%ndet)) - allocate(self%s_sky(self%ntod, self%ndet)) - allocate(self%s_bp(self%ntod, self%ndet)) - allocate(self%s_orb(self%ntod, self%ndet)) - allocate(self%s_tot(self%ntod, self%ndet)) - allocate(self%s_totA(self%ntod, self%ndet)) - allocate(self%s_totB(self%ntod, self%ndet)) - allocate(self%s_orbA(self%ntod, self%ndet)) - allocate(self%s_orbB(self%ntod, self%ndet)) - allocate(self%s_gain(self%ntod, self%ndet)) - allocate(self%s_gainA(self%ntod, self%ndet)) - allocate(self%s_gainB(self%ntod, self%ndet)) - allocate(self%s_inst(self%ntod, self%ndet)) - allocate(self%mask(self%ntod, self%ndet)) - allocate(self%pix(self%ntod, 1, self%nhorn)) - allocate(self%psi(self%ntod, 1, self%nhorn)) - allocate(self%flag(self%ntod, 1)) - if (init_s_sky_prop_) allocate(self%s_sky_prop(self%ntod, self%ndet, 2:self%ndelta)) - if (init_s_bp_prop_) allocate(self%s_bp_prop(self%ntod, self%ndet, 2:self%ndelta)) - if (init_s_sky_prop_) allocate(self%mask2(self%ntod, self%ndet)) - if (tod%sample_mono) allocate(self%s_mono(self%ntod, self%ndet)) - ! if (tod%subtract_zodi) allocate(self%s_zodi(self%ntod, zodi%n_comps, self%ndet)) - self%s_tot = 0. - self%s_totA = 0. - self%s_totB = 0. - self%s_orb = 0. - self%s_orbA = 0. - self%s_orbB = 0. - self%s_bp = 0. - self%s_gain = 0. - self%s_gainA = 0. - self%s_gainB = 0. - - allocate(s_bufA(self%ntod, self%ndet)) - allocate(s_bufB(self%ntod, self%ndet)) - allocate(s_buf2A(self%ntod, self%ndet)) - allocate(s_buf2B(self%ntod, self%ndet)) - s_bufA = 0. - s_bufB = 0. - s_buf2A = 0. - s_buf2A = 0. - call timer%stop(TOD_ALLOC, tod%band) - + allocate(sd%tod(sd%ntod, sd%ndet)) + allocate(sd%n_corr(sd%ntod, sd%ndet)) + allocate(sd%s_sl(sd%ntod, sd%ndet)) + allocate(sd%s_sky(sd%ntod, sd%ndet)) + allocate(sd%s_bp(sd%ntod, sd%ndet)) + allocate(sd%s_orb(sd%ntod, sd%ndet)) + allocate(sd%s_orbA(sd%ntod, sd%ndet)) + allocate(sd%s_orbB(sd%ntod, sd%ndet)) + allocate(sd%s_tot(sd%ntod, sd%ndet)) + allocate(sd%s_totA(sd%ntod, sd%ndet)) + allocate(sd%s_totB(sd%ntod, sd%ndet)) + allocate(sd%s_gain(sd%ntod, sd%ndet)) + allocate(sd%s_gainA(sd%ntod, sd%ndet)) + allocate(sd%s_gainB(sd%ntod, sd%ndet)) + allocate(sd%mask(sd%ntod, sd%ndet)) + allocate(sd%pix(sd%ntod, 1, sd%nhorn)) + allocate(sd%psi(sd%ntod, 1, sd%nhorn)) + allocate(sd%flag(sd%ntod, 1)) + if (init_s_sky_prop_) allocate(sd%s_sky_prop(sd%ntod, sd%ndet, 2:sd%ndelta)) + if (init_s_bp_prop_) allocate(sd%s_bp_prop(sd%ntod, sd%ndet, 2:sd%ndelta)) + if (init_s_sky_prop_) allocate(sd%mask2(sd%ntod, sd%ndet)) + if (tod%sample_mono) allocate(sd%s_mono(sd%ntod, sd%ndet)) + if (tod%subtract_zodi) allocate(sd%s_zodi(sd%ntod, sd%ndet)) + sd%s_tot = 0. + sd%s_totA = 0. + sd%s_totB = 0. + sd%s_orb = 0. + sd%s_orbA = 0. + sd%s_orbB = 0. + sd%s_gain = 0. + sd%s_gainA = 0. + sd%s_gainB = 0. + + allocate(s_bufA(sd%ntod, sd%ndet)) + allocate(s_bufB(sd%ntod, sd%ndet)) + allocate(s_buf2A(sd%ntod, sd%ndet)) + allocate(s_buf2B(sd%ntod, sd%ndet)) ! Decompress pointing, psi and flags for current scan ! Only called for one detector, det=1, since the pointing and polarization ! angles are the same for all detectors - call timer%start(TOD_DECOMP, tod%band) - call tod%decompress_pointing_and_flags(scan, 1, self%pix(:,1,:), & - & self%psi(:,1,:), self%flag(:,1)) - call timer%stop(TOD_DECOMP, tod%band) + call tod%decompress_pointing_and_flags(scan, 1, sd%pix(:,1,:), & + & sd%psi(:,1,:), sd%flag(:,1)) ! Prepare TOD if (tod%ndiode == 1 .or. trim(tod%level) == 'L2') then - call timer%start(TOD_DECOMP, tod%band) - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle if (tod%compressed_tod) then - call tod%decompress_tod(scan, j, self%tod(:,j)) + call tod%decompress_tod(scan, j, sd%tod(:,j)) else - self%tod(:,j) = tod%scans(scan)%d(j)%tod + sd%tod(:,j) = tod%scans(scan)%d(j)%tod end if end do call timer%stop(TOD_DECOMP, tod%band) else - call tod%diode2tod_inst(scan, map_sky, procmask, self%tod) + call tod%diode2tod_inst(scan, map_sky, procmask, sd%tod) end if ! Construct sky signal template call timer%start(TOD_PROJECT, tod%band) if (init_s_bp_) then - call project_sky_differential(tod, map_sky(:,:,:,1), self%pix(:,1,:), & - & self%psi(:,1,:), self%flag(:,1), & - & procmask, scan, self%s_totA, self%s_totB, self%mask, & - & s_bpA=s_buf2A, s_bpB=s_buf2B) + call project_sky_differential(tod, map_sky(:,:,:,1), sd%pix(:,1,:), sd%psi(:,1,:), sd%flag(:,1), & + & procmask, scan, s_bufA, s_bufB, sd%mask, s_bpA=s_buf2A, s_bpB=s_buf2B) else - call project_sky_differential(tod, map_sky(:,:,:,1), self%pix(:,1,:), & - & self%psi(:,1,:), self%flag(:,1), & - & procmask, scan, self%s_totA, self%s_totB, self%mask) + call project_sky_differential(tod, map_sky(:,:,:,1), sd%pix(:,1,:), sd%psi(:,1,:), sd%flag(:,1), & + & procmask, scan, s_bufA, s_bufB, sd%mask) end if - call project_sky_differential(tod, map_gain(:,:,:,1), self%pix(:,1,:), & - & self%psi(:,1,:), self%flag(:,1), & - & procmask, scan, self%s_gainA, self%s_gainB, self%mask) - - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - self%s_sky(:,j) = (1.+tod%x_im(j))*self%s_totA(:,j) - (1.-tod%x_im(j))*self%s_totB(:,j) - self%s_tot(:,j) = self%s_sky(:,j) - self%s_gain(:,j) = (1.+tod%x_im(j))*self%s_gainA(:,j) - (1.-tod%x_im(j))*self%s_gainB(:,j) - if (init_s_bp_) self%s_bp(:,j) = (1.+tod%x_im(j))*s_buf2A(:,j) - (1.-tod%x_im(j))*s_buf2B(:,j) + sd%s_sky(:,j) = (1.+tod%x_im(j))*s_bufA(:,j) - (1.-tod%x_im(j))*s_bufB(:,j) + sd%s_totA(:,j) = sd%s_totA(:,j) + s_bufA(:,j) + sd%s_totB(:,j) = sd%s_totB(:,j) + s_bufB(:,j) + sd%s_tot(:,j) = sd%s_tot(:,j) + sd%s_sky(:,j) + if (init_s_bp_) sd%s_bp(:,j) = (1.+tod%x_im(j))*s_buf2A(:,j) - (1.-tod%x_im(j))*s_buf2B(:,j) end do ! Set up (optional) bandpass sampling quantities (s_sky_prop, mask2 and bp_prop) if (init_s_bp_prop_) then - do k = 2, self%ndelta - call project_sky_differential(tod, map_sky(:,:,:,k), self%pix(:,1,:), & - & self%psi(:,1,:), self%flag(:,1), & - & procmask2, scan, s_bufA, s_bufB, self%mask2, & - & s_bpA=s_buf2A, s_bpB=s_buf2B) - do j = 1, self%ndet + do k = 2, sd%ndelta + call project_sky_differential(tod, map_sky(:,:,:,k), sd%pix(:,1,:), sd%psi(:,1,:), sd%flag(:,1), & + & procmask2, scan, s_bufA, s_bufB, sd%mask2, s_bpA=s_buf2A, s_bpB=s_buf2B) + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - self%s_sky_prop(:,j,k) = (1.+tod%x_im(j))*s_bufA(:,j) - (1.-tod%x_im(j))*s_bufB(:,j) - if (init_s_bp_) then - self%s_bp_prop(:,j,k) = (1.+tod%x_im(j))*s_buf2A(:,j) - (1.-tod%x_im(j))*s_buf2B(:,j) - end if + sd%s_sky_prop(:,j,k) = (1.+tod%x_im(j))*s_bufA(:,j) - (1.-tod%x_im(j))*s_bufB(:,j) + if (init_s_bp_) sd%s_bp_prop(:,j,k) = (1.+tod%x_im(j))*s_buf2A(:,j) - (1.-tod%x_im(j))*s_buf2B(:,j) end do end do else if (init_s_sky_prop_) then - do k = 2, self%ndelta - call project_sky_differential(tod, map_sky(:,:,:,k), self%pix(:,1,:), self%psi(:,1,:), self%flag(:,1), & - & procmask2, scan, s_bufA, s_bufB, self%mask2) - do j = 1, self%ndet + do k = 2, sd%ndelta + call project_sky_differential(tod, map_sky(:,:,:,k), sd%pix(:,1,:), sd%psi(:,1,:), sd%flag(:,1), & + & procmask2, scan, s_bufA, s_bufB, sd%mask2) + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - self%s_sky_prop(:,j,k) = (1.+tod%x_im(j))*s_bufA(:,j) - (1.-tod%x_im(j))*s_bufB(:,j) + sd%s_sky_prop(:,j,k) = (1.+tod%x_im(j))*s_bufA(:,j) - (1.-tod%x_im(j))*s_bufB(:,j) end do end do end if call timer%stop(TOD_PROJECT, tod%band) ! Perform sanity tests - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - if (all(self%mask(:,j) == 0)) tod%scans(scan)%d%accept = .false. - if (tod%scans(scan)%d(j)%N_psd%sigma0 <= 0.d0) tod%scans(scan)%d%accept = .false. + if (all(sd%mask(:,j) == 0)) tod%scans(scan)%d(j)%accept = .false. + if (tod%scans(scan)%d(j)%N_psd%sigma0 <= 0.d0) tod%scans(scan)%d(j)%accept = .false. end do ! Construct orbital dipole template - ! This call calculates the dipole template assuming that all the detectors - ! are pointing at pixel A. The next line assumes they're all pointing at - ! pixel B. - ! The .true. refers to whether the orbital dipole (true) or solar dipole - ! (false) is used. - call timer%start(TOD_ORBITAL, tod%band) - call tod%construct_dipole_template_diff(scan, self%pix(:,:,1), self%psi(:,:,1), & - & .true., 1, self%s_orbA, 1d3) - call tod%construct_dipole_template_diff(scan, self%pix(:,:,2), self%psi(:,:,2), & - & .true., 2, self%s_orbB, 1d3) - self%s_totA = self%s_totA + self%s_orbA - self%s_totB = self%s_totB + self%s_orbB - do j = 1, self%ndet + call tod%construct_dipole_template_diff(scan, sd%pix(:,:,1), sd%psi(:,:,1), .true., 1, s_bufA, 1d3) + call tod%construct_dipole_template_diff(scan, sd%pix(:,:,2), sd%psi(:,:,2), .true., 2, s_bufB, 1d3) + sd%s_orbA = s_bufA + sd%s_orbB = s_bufB + sd%s_totA = sd%s_totA + sd%s_orbA + sd%s_totB = sd%s_totB + sd%s_orbB + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - self%s_orb(:,j) = (1.+tod%x_im(j))*self%s_orbA(:,j) - (1.-tod%x_im(j))*self%s_orbB(:,j) - self%s_tot(:,j) = self%s_tot(:,j) + self%s_orb(:,j) + sd%s_orb(:,j) = (1.+tod%x_im(j))*sd%s_orbA(:,j) - (1.-tod%x_im(j))*sd%s_orbB(:,j) + sd%s_tot(:,j) = sd%s_tot(:,j) + sd%s_orb(:,j) end do ! Construct zodical light template if (tod%subtract_zodi) then - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - ! call get_zodi_emission(tod, self%pix(:,1:1,1), scan, s_bufA) - ! call get_zodi_emission(tod, self%pix(:,1:1,2), scan, s_bufB) - ! self%s_zodi(:,j) = (1.+tod%x_im(j))*s_bufA(:,j) - (1.-tod%x_im(j))*s_bufB(:,j) - self%s_tot(:,j) = self%s_tot(:,j)! + self%s_zodi(:,:,j) - self%s_totA(:,j) = self%s_totA(:,j) + s_bufA(:,j) - self%s_totB(:,j) = self%s_totB(:,j) + s_bufB(:,j) + sd%s_tot(:,j) = sd%s_tot(:,j) + sd%s_zodi(:,j) + sd%s_totA(:,j) = sd%s_totA(:,j) + s_bufA(:,j) + sd%s_totB(:,j) = sd%s_totB(:,j) + s_bufB(:,j) end do - ! else - ! self%s_zodi = 0. end if ! Construct sidelobe template if (tod%correct_sl) then - call timer%start(TOD_SL_INT, tod%band) - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - call tod%construct_sl_template(tod%slconvA(j)%p, self%pix(:,1,1), self%psi(:,1,1), s_bufA(:,j), 0d0) - call tod%construct_sl_template(tod%slconvB(j)%p, self%pix(:,1,2), self%psi(:,1,2), s_bufB(:,j), 0d0) - self%s_sl(:,j) = (1d0+tod%x_im(j))*s_bufA(:,j) - (1d0-tod%x_im(j))*s_bufB(:,j) - self%s_tot(:,j) = self%s_tot(:,j) + self%s_sl(:,j) - self%s_totA(:,j) = self%s_totA(:,j) + s_bufA(:,j) - self%s_totB(:,j) = self%s_totB(:,j) + s_bufB(:,j) + !call tod%construct_sl_template(tod%slconv(1)%p, sd%pix(:,1,1), sd%psi(:,1,1), s_bufA(:,j), 1.5707963267948966192d0) + !call tod%construct_sl_template(tod%slconv(3)%p, sd%pix(:,1,2), sd%psi(:,1,2), s_bufB(:,j), -1.5707963267948966192d0) + call tod%construct_sl_template(tod%slconv(1)%p, sd%pix(:,1,1), sd%psi(:,1,1), s_bufA(:,j), polang) + call tod%construct_sl_template(tod%slconv(3)%p, sd%pix(:,1,2), sd%psi(:,1,2), s_bufB(:,j), -polang) + sd%s_sl(:,j) = (1d0+tod%x_im(j))*s_bufA(:,j) - (1d0-tod%x_im(j))*s_bufB(:,j) + sd%s_tot(:,j) = sd%s_tot(:,j) + sd%s_sl(:,j) + sd%s_totA(:,j) = sd%s_totA(:,j) + s_bufA(:,j) + sd%s_totB(:,j) = sd%s_totB(:,j) + s_bufB(:,j) end do call timer%stop(TOD_SL_INT, tod%band) else - self%s_sl = 0. + sd%s_sl = 0. end if ! Construct monopole correction template if (tod%sample_mono) then - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - !self%s_mono(:,j) = tod%mono(j) - self%s_mono(:,j) = 0.d0 ! Disabled for now - self%s_tot(:,j) = self%s_tot(:,j) + self%s_mono(:,j) - self%s_totA(:,j) = self%s_totA(:,j) + self%s_mono(:,j) - self%s_totB(:,j) = self%s_totB(:,j) + self%s_mono(:,j) + !sd%s_mono(:,j) = tod%mono(j) + sd%s_mono(:,j) = 0.d0 ! Disabled for now + sd%s_tot(:,j) = sd%s_tot(:,j) + sd%s_mono(:,j) + sd%s_totA(:,j) = sd%s_totA(:,j) + sd%s_mono(:,j) + sd%s_totB(:,j) = sd%s_totB(:,j) + sd%s_mono(:,j) end do else - self%s_mono = 0.d0 + sd%s_mono = 0.d0 end if ! Generate and apply instrument-specific correction template if (tod%apply_inst_corr) then call timer%start(TOD_INSTCORR, tod%band) - call tod%construct_corrtemp_inst(scan, self%pix(:,:,1), self%psi(:,:,1), self%s_inst) - do j = 1, self%ndet + call tod%construct_corrtemp_inst(scan, sd%pix(:,:,1), sd%psi(:,:,1), sd%s_inst) + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle - self%tod(:,j) = self%tod(:,j) - self%s_inst(:,j) + sd%tod(:,j) = sd%tod(:,j) - sd%s_inst(:,j) end do call timer%stop(TOD_INSTCORR, tod%band) end if @@ -578,18 +524,16 @@ subroutine init_scan_data_differential(self, tod, scan, map_sky, map_gain, procm ! Construct zodical light template if (tod%subtract_zodi) then call timer%start(TOD_ZODI, tod%band) - do j = 1, self%ndet + do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle ! call get_zodi_emission(tod, self%pix(:,1:1,1), scan, s_bufA) ! call get_zodi_emission(tod, self%pix(:,1:1,2), scan, s_bufB) ! self%s_zodi(:,j) = (1.+tod%x_im(j))*s_bufA(:,j) - (1.-tod%x_im(j))*s_bufB(:,j) - self%s_tot(:,j) = self%s_tot(:,j)! + self%s_zodi(:,j) - self%s_totA(:,j) = self%s_totA(:,j) + s_bufA(:,j) - self%s_totB(:,j) = self%s_totB(:,j) + s_bufB(:,j) + sd%s_tot(:,j) = sd%s_tot(:,j)! + sd%s_zodi(:,j) + sd%s_totA(:,j) = sd%s_totA(:,j) + s_bufA(:,j) + sd%s_totB(:,j) = sd%s_totB(:,j) + s_bufB(:,j) end do call timer%stop(TOD_ZODI, tod%band) - ! else - ! self%s_zodi = 0. end if ! Clean-up @@ -600,45 +544,100 @@ subroutine init_scan_data_differential(self, tod, scan, map_sky, map_gain, procm end subroutine init_scan_data_differential - subroutine dealloc_scan_data(self) + subroutine dealloc_scan_data(sd) implicit none - class(comm_scandata), intent(inout) :: self + class(comm_scandata), intent(inout) :: sd - call timer%start(TOD_ALLOC, self%band) - - self%ntod = -1; self%ndet = -1; self%nhorn = -1 + sd%ntod = -1; sd%ndet = -1; sd%nhorn = -1 ! Deallocate data structures - deallocate(self%tod, self%n_corr, self%s_sl, self%s_sky) - deallocate(self%s_orb, self%s_tot, self%mask, self%s_gain) - deallocate(self%pix, self%psi, self%flag) - if (allocated(self%s_sky_prop)) deallocate(self%s_sky_prop) - if (allocated(self%s_bp_prop)) deallocate(self%s_bp_prop) - if (allocated(self%s_bp)) deallocate(self%s_bp) - if (allocated(self%s_mono)) deallocate(self%s_mono) - if (allocated(self%mask2)) deallocate(self%mask2) - if (allocated(self%mask_zodi)) deallocate(self%mask_zodi) - if (allocated(self%s_zodi)) deallocate(self%s_zodi) - if (allocated(self%s_zodi_scat)) deallocate(self%s_zodi_scat) - if (allocated(self%s_zodi_therm)) deallocate(self%s_zodi_therm) - if (allocated(self%s_totA)) deallocate(self%s_totA) - if (allocated(self%s_totB)) deallocate(self%s_totB) - if (allocated(self%s_gainA)) deallocate(self%s_gainA) - if (allocated(self%s_gainB)) deallocate(self%s_gainB) - if (allocated(self%s_inst)) deallocate(self%s_inst) - if (allocated(self%s_orbA)) deallocate(self%s_orbA) - if (allocated(self%s_orbB)) deallocate(self%s_orbB) - call timer%stop(TOD_ALLOC, self%band) - + if (allocated(sd%tod)) deallocate(sd%tod) + if (allocated(sd%n_corr)) deallocate(sd%n_corr) + if (allocated(sd%s_sl)) deallocate(sd%s_sl) + if (allocated(sd%s_sky)) deallocate(sd%s_sky) + if (allocated(sd%s_orb)) deallocate(sd%s_orb) + if (allocated(sd%s_tot)) deallocate(sd%s_tot) + if (allocated(sd%mask)) deallocate(sd%mask) + if (allocated(sd%pix)) deallocate(sd%pix) + if (allocated(sd%psi)) deallocate(sd%psi) + if (allocated(sd%flag)) deallocate(sd%flag) + if (allocated(sd%s_sky_prop)) deallocate(sd%s_sky_prop) + if (allocated(sd%s_bp_prop)) deallocate(sd%s_bp_prop) + if (allocated(sd%s_bp)) deallocate(sd%s_bp) + if (allocated(sd%s_mono)) deallocate(sd%s_mono) + if (allocated(sd%mask2)) deallocate(sd%mask2) + if (allocated(sd%s_zodi)) deallocate(sd%s_zodi) + if (allocated(sd%mask_zodi)) deallocate(sd%mask_zodi) + if (allocated(sd%s_totA)) deallocate(sd%s_totA) + if (allocated(sd%s_totB)) deallocate(sd%s_totB) + if (allocated(sd%s_inst)) deallocate(sd%s_inst) + if (allocated(sd%s_orbA)) deallocate(sd%s_orbA) + if (allocated(sd%s_orbB)) deallocate(sd%s_orbB) + if (allocated(sd%s_gain)) deallocate(sd%s_gain) + if (allocated(sd%s_gainA)) deallocate(sd%s_gainA) + if (allocated(sd%s_gainB)) deallocate(sd%s_gainB) + if (allocated(sd%dark)) deallocate(sd%dark) end subroutine dealloc_scan_data + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! detdata routines + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + ! deallocates a det_data struture + subroutine dealloc_det_data(dd) + implicit none + class(comm_detdata), intent(inout) :: dd + + dd%nscan = -1 + if (allocated(dd%scans)) deallocate(dd%scans) + if (allocated(dd%ntod)) deallocate(dd%ntod) + if (allocated(dd%tod)) deallocate(dd%tod) + end subroutine dealloc_det_data + + ! initializes a det_data structure for a single detector over the entire flight + ! for a singlehorn experiment like planck + subroutine init_det_data_singlehorn(dd, tod, det) + implicit none + class(comm_detdata), intent(inout) :: dd + class(comm_tod), intent(inout) :: tod + integer(i4b), intent(in) :: det + + integer(i4b) :: i + + dd%nscan = tod%nscan + allocate(dd%ntod(dd%nscan)) + + do i = 1, tod%nscan + ! decompress tod into dd%tod array + dd%ntod(i) = tod%scans(i)%ntod + end do + + end subroutine init_det_data_singlehorn + + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Scandata 2 detdata + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + subroutine populate_sd_from_dd(sd, dd, scan, det) + implicit none + class(comm_scandata), intent(inout) :: sd + class(comm_detdata), intent(inout) :: dd + integer(i4b), intent(in) :: scan + integer(i4b), intent(in) :: det + + allocate(sd%tod(det, dd%ntod(scan))) + allocate(sd%s_inst(det, dd%ntod(scan))) + + end subroutine populate_sd_from_dd + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Sampling drivers etc. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine sample_calibration(tod, mode, handle, map_sky, map_gain, procmask, procmask2, & - & polang, smooth) + & polang, smooth, mask_threshold) ! ! Sample calibration modes ! Supported modes = {abscal, relcal, deltaG, imbal} @@ -668,8 +667,10 @@ subroutine sample_calibration(tod, mode, handle, map_sky, map_gain, procmask, pr real(sp), dimension(0:), intent(in) :: procmask, procmask2 real(dp), intent(in), optional :: polang logical(lgt), intent(in), optional :: smooth + real(dp), intent(in), optional :: mask_threshold integer(i4b) :: i, j, ext(2), ierr, timer_id + real(sp) :: threshold real(dp) :: t1, t2 real(dp), allocatable, dimension(:) :: A, b real(sp), allocatable, dimension(:,:) :: s_invsqrtN, mask_lowres, s_buf @@ -679,6 +680,7 @@ subroutine sample_calibration(tod, mode, handle, map_sky, map_gain, procmask, pr smooth_ = .true. + threshold = 0.9; if (present(mask_threshold)) threshold=mask_threshold if (present(smooth)) smooth_=smooth if (tod%myid == 0) write(*,*) '| --> Sampling calibration, mode = ', trim(mode) @@ -699,7 +701,7 @@ subroutine sample_calibration(tod, mode, handle, map_sky, map_gain, procmask, pr allocate(A(tod%ndet), b(tod%ndet)) A = 0.d0; b = 0.d0 else if (trim(mode) == 'deltaG') then - allocate(dipole_mod(tod%nscan_tot, tod%ndet)) + allocate(dipole_mod(tod%last_scan, tod%ndet)) dipole_mod = 0.d0 else write(*,*) 'Unsupported sampling mode!' @@ -710,17 +712,20 @@ subroutine sample_calibration(tod, mode, handle, map_sky, map_gain, procmask, pr do i = 1, tod%nscan - if (.not. any(tod%scans(i)%d%accept)) cycle + if (.not. any(tod%scans(i)%d%accept)) then + ! write(*,*) ' No accepted samples in scan = ', tod%scanid(i) + cycle + end if call wall_time(t1) ![Debug] if (tod%myid == 0) write(*,*) '| --> Preparing data ' !on, mode = ', trim(mode) ! Prepare data if (tod%nhorn == 1) then - call sd%init_singlehorn(tod, i, map_sky, map_gain, procmask, procmask2) + call init_scan_data_singlehorn(sd, tod, i, map_sky, map_gain, procmask, procmask2) else - call sd%init_differential(tod, i, map_sky, map_gain, procmask, procmask2, polang=polang) + call init_scan_data_differential(sd, tod, i, map_sky, map_gain, procmask, procmask2, polang=polang) end if - + ![Debug] if (tod%myid == 0) write(*,*) '| --> Setup filtered calibration signal'! m(mode) ! Set up filtered calibration signal, conditional contribution and mask call timer%start(timer_id, tod%band) @@ -730,7 +735,8 @@ subroutine sample_calibration(tod, mode, handle, map_sky, map_gain, procmask, pr allocate(mask_lowres(ext(1):ext(2), tod%ndet)) do j = 1, tod%ndet if (.not. tod%scans(i)%d(j)%accept) cycle - call tod%downsample_tod(sd%mask(:,j), ext, mask_lowres(:,j), threshold=0.9) + call tod%downsample_tod(sd%mask(:,j), ext, mask_lowres(:,j), threshold=threshold) + !if (size(sd%mask(:,j)) > 0) write(*,*) "fsky", sum(sd%mask(:,j))/size(sd%mask(:,j)), sum(mask_lowres(:,j))/size(mask_lowres(:,j)) if (trim(mode) == 'abscal') then if (trim(tod%abscal_comps) == 'orbital') then call tod%downsample_tod(sd%s_orb(:,j), ext, s_invsqrtN(:,j)) @@ -757,7 +763,8 @@ subroutine sample_calibration(tod, mode, handle, map_sky, map_gain, procmask, pr call tod%downsample_tod(s_buf(:,j), ext, s_invsqrtN(:,j)) end if end do - ! [Debug] if (tod%myid == 0) write(*,*) '| --> Passed the loop with downsampel tod'!(mode) + + ! [Debug] if (tod%myid == 0) write(*,*) '| --> Passed the loop with downsampls tod'!(mode) call multiply_inv_N(tod, i, s_invsqrtN, sampfreq=tod%samprate_lowres, pow=0.5d0) if (trim(mode) == 'abscal' .or. trim(mode) == 'relcal' .or. trim(mode) == 'imbal') then @@ -798,7 +805,7 @@ subroutine sample_calibration(tod, mode, handle, map_sky, map_gain, procmask, pr call wall_time(t2) tod%scans(i)%proctime = tod%scans(i)%proctime + t2-t1 tod%scans(i)%n_proctime = tod%scans(i)%n_proctime + 1 - call sd%dealloc + call dealloc_scan_data(sd) deallocate(s_invsqrtN, s_buf, mask_lowres) end do @@ -829,6 +836,55 @@ subroutine sample_calibration(tod, mode, handle, map_sky, map_gain, procmask, pr end subroutine sample_calibration + + ! Sample baseline + subroutine sample_baseline(tod, handle, map_sky, map_gain, procmask, procmask2) + implicit none + class(comm_tod), intent(inout) :: tod + type(planck_rng), intent(inout) :: handle + real(sp), dimension(0:,1:,1:,1:), intent(in) :: map_sky + real(sp), dimension(0:,1:,1:,1:), intent(in) :: map_gain + real(sp), dimension(0:), intent(in) :: procmask, procmask2 + + integer(i4b) :: i, j + real(dp) :: t1, t2 + type(comm_scandata) :: sd + + if (tod%myid == 0) write(*,*) ' --> Sampling baseline' + + do i = 1, tod%nscan + if (.not. any(tod%scans(i)%d%accept)) cycle + call wall_time(t1) + + ! Prepare data + if (tod%nhorn == 1) then + call init_scan_data_singlehorn(sd, tod, i, map_sky, map_gain, procmask, procmask2) + else + call init_scan_data_differential(sd, tod, i, map_sky, map_gain, procmask, procmask2) + end if + + do j = 1, tod%ndet + ! Return the data to its raw state + sd%tod(:,j) = sd%tod(:,j) + tod%scans(i)%d(j)%baseline + + ! Estimate the baseline and sample it if requested + tod%scans(i)%d(j)%baseline =sum((sd%tod(:,j) - tod%scans(i)%d(j)%gain*sd%s_tot(:,j)) & + & *sd%mask(:,j))/sum(sd%mask(:,j)) + if (trim(tod%operation) == 'sample') then + tod%scans(i)%d(j)%baseline = tod%scans(i)%d(j)%baseline & + & + rand_gauss(handle)/sqrt(sum(sd%mask(:,j)*tod%scans(i)%d(j)%N_psd%sigma0**2)) + end if + end do + + ! Clean up + call wall_time(t2) + tod%scans(i)%proctime = tod%scans(i)%proctime + t2-t1 + tod%scans(i)%n_proctime = tod%scans(i)%n_proctime + 1 + call dealloc_scan_data(sd) + end do + + end subroutine sample_baseline + subroutine remove_bad_data(tod, scan, flag) ! ! Perform data selection on TOD object @@ -856,12 +912,12 @@ subroutine remove_bad_data(tod, scan, flag) if (.not. tod%scans(scan)%d(j)%accept) cycle if (count(iand(flag(:,j),tod%flag0) .ne. 0) > tod%accept_threshold*ntod) then ! Discard scans with less than 20% good data tod%scans(scan)%d(j)%accept = .false. - write(*, fmt='(a, i4, a, i8, a, i8)') ' | Reject scan = ', & + write(*, fmt='(a, i, a, i8, a, i8)') ' | Reject scan = ', & & tod%scanid(scan), ': ', count(iand(flag(:,j),tod%flag0) .ne. 0), & & ' flagged data out of', ntod else if (abs(tod%scans(scan)%d(j)%chisq) > tod%chisq_threshold .or. & ! Discard scans with high chisq or NaNs & isNaN(tod%scans(scan)%d(j)%chisq)) then - write(*,fmt='(a,i8,i5,a,f12.1)') ' | Reject scan, det = ', & + write(*,fmt='(a,i,i5,a,f12.1)') ' | Reject scan, det = ', & & tod%scanid(scan), j, ', chisq = ', tod%scans(scan)%d(j)%chisq tod%scans(scan)%d(j)%accept = .false. end if @@ -933,20 +989,27 @@ subroutine compute_calibrated_data(tod, scan, sd, d_calib, jump_template) ! d_calib(8,:,:) - instrument correction ! d_calib(9 - 9 + n_zodi_comps,:,:) - zodiacal light components implicit none - class(comm_tod), intent(in) :: tod - integer(i4b), intent(in) :: scan - type(comm_scandata), intent(in) :: sd - real(sp), dimension(:,:,:), intent(out) :: d_calib - real(sp), dimension(:,:), intent(in), optional :: jump_template + class(comm_tod), intent(inout) :: tod + integer(i4b), intent(in) :: scan + type(comm_scandata), intent(in) :: sd + real(sp), dimension(:,:,:), intent(out) :: d_calib + real(sp), dimension(:,:), intent(in), optional :: jump_template integer(i4b) :: i, j, k, nout real(dp) :: inv_gain ! write(*, *) "s_bp:", sd%s_sky(:,1) call timer%start(TOD_MAPBIN, tod%band) nout = size(d_calib,1) + d_calib = 0d0 do j = 1, sd%ndet if (.not. tod%scans(scan)%d(j)%accept) cycle inv_gain = 1.0 / tod%scans(scan)%d(j)%gain if (tod%compressed_tod) then +!!$ write(*,*) 'calib g', tod%scanid(scan), inv_gain +!!$ write(*,*) 'calib d', tod%scanid(scan), maxval(abs(sd%tod(:,j))) +!!$ write(*,*) 'calib n', tod%scanid(scan), maxval(abs(sd%n_corr(:,j))) +!!$ write(*,*) 'calib t', tod%scanid(scan), maxval(abs(sd%s_tot(:,j))) +!!$ write(*,*) 'calib s', tod%scanid(scan), maxval(abs(sd%s_sky(:,j))) +!!$ write(*,*) 'calib b', tod%scanid(scan), maxval(abs(sd%s_bp(:,j))) d_calib(1,:,j) = (sd%tod(:,j) - sd%n_corr(:,j)) & & * inv_gain - sd%s_tot(:,j) + sd%s_sky(:,j) - sd%s_bp(:,j) else @@ -963,18 +1026,20 @@ subroutine compute_calibrated_data(tod, scan, sd, d_calib, jump_template) if (tod%output_n_maps > 5) d_calib(6,:,j) = sd%s_sl(:,j) if ((tod%output_n_maps > 6) .and. allocated(sd%s_zodi)) d_calib(7,:,j) = sd%s_zodi(:,j) ! zodi if ((tod%output_n_maps > 7) .and. allocated(sd%s_inst)) d_calib(8,:,j) = (sd%s_inst(:,j) - sum(real(sd%s_inst(:,j),dp)/sd%ntod)) * inv_gain ! instrument specific - if ((tod%output_n_maps > 8) .and. allocated(sd%s_zodi_scat) .and. allocated(sd%s_zodi_therm)) then - do i = 1, size(sd%s_zodi_therm, dim=2) - !write(*,*) 'b',j,i, tod%scanid(scan), any(sd%s_zodi_scat(:,i:i,j)/=sd%s_zodi_scat(:,i:i,j)), any(sd%s_zodi_therm(:,i:i,j)/=sd%s_zodi_therm(:,i:i,j)) - call get_s_zodi(tod%id, sd%s_zodi_therm(:, i:i, j), sd%s_zodi_scat(:, i:i, j), d_calib(8 + i, :, j), comp_id=i) + if (tod%output_n_maps > 8) then + do i = 1, zodi_model%n_comps + call get_s_tot_zodi(zodi_model, tod, j, scan, d_calib(8+i,:,j), pix_dynamic=sd%pix(:,j,:), exclude_static='all', comp=i) end do end if ! Bandpass proposals + if(tod%n_bp_prop > 1) then do i = 1, nout-tod%output_n_maps d_calib(tod%output_n_maps+i,:,j) = d_calib(1,:,j) + sd%s_bp(:,j) - sd%s_bp_prop(:,j,i+1) end do + end if end do + call timer%stop(TOD_MAPBIN, tod%band) end subroutine compute_calibrated_data diff --git a/commander3/src/comm_tod_gain_smod.f90 b/commander3/src/comm_tod_gain_smod.f90 index ee5ba80d2..705deec56 100644 --- a/commander3/src/comm_tod_gain_smod.f90 +++ b/commander3/src/comm_tod_gain_smod.f90 @@ -100,13 +100,15 @@ module subroutine calculate_gain_mean_std_per_scan(tod, scan_id, s_invsqrtN, mas tod%scans(scan_id)%d(j)%gain = 0.d0 tod%scans(scan_id)%d(j)%dgain = 0.d0 else - if (present(mask_lowres)) then - tod%scans(scan_id)%d(j)%dgain = sum(s_invsqrtN(:,j) * residual(:,j) * mask_lowres(:,j)) - tod%scans(scan_id)%d(j)%gain_invsigma = sum(s_invsqrtN(:,j) ** 2 * mask_lowres(:,j)) - else - tod%scans(scan_id)%d(j)%dgain = sum(s_invsqrtN(:,j) * residual(:,j)) - tod%scans(scan_id)%d(j)%gain_invsigma = sum(s_invsqrtN(:,j) ** 2) - end if +!!$ if (present(mask_lowres)) then +!!$ tod%scans(scan_id)%d(j)%dgain = sum(s_invsqrtN(:,j) * residual(:,j) * mask_lowres(:,j)) +!!$ tod%scans(scan_id)%d(j)%gain_invsigma = sum(s_invsqrtN(:,j) ** 2 * mask_lowres(:,j)) +!!$ else +!!$ tod%scans(scan_id)%d(j)%dgain = sum(s_invsqrtN(:,j) * residual(:,j)) +!!$ tod%scans(scan_id)%d(j)%gain_invsigma = sum(s_invsqrtN(:,j) ** 2) +!!$ end if + tod%scans(scan_id)%d(j)%dgain = sum(r_fill(:) * s_tot(:,j) * mask(:,j)) / tod%scans(scan_id)%d(j)%N_psd%sigma0**2 + tod%scans(scan_id)%d(j)%gain_invsigma = sum(s_tot(:,j) * s_tot(:,j) * mask(:,j)) / tod%scans(scan_id)%d(j)%N_psd%sigma0**2 if (tod%scans(scan_id)%d(j)%gain_invsigma < 0.d0) then write(*,*) 'Warning: Not positive definite invN = ', tod%scanid(scan_id), j, tod%scans(scan_id)%d(j)%gain_invsigma end if @@ -126,23 +128,28 @@ module subroutine calculate_gain_mean_std_per_scan(tod, scan_id, s_invsqrtN, mas if (.false.) then call int2string(tod%scanid(scan_id), itext) !write(*,*) 'gain'//itext//' = ', tod%gain0(0) + tod%gain0(1), tod%scans(scan_id)%d(1)%dgain/tod%scans(scan_id)%d(1)%gain_invsigma - open(58,file='gain_delta_'//itext//'.dat') - do i = ext(1), ext(2) - write(58,*) i, residual(i,1) - end do - write(58,*) - write(58,*) - do i = 1, size(s_invsqrtN,1) - write(58,*) i, s_invsqrtN(i,1) - end do - write(58,*) - do i = 1, size(s_tot,1) - write(58,*) i, tod_arr(i, 1) - (tod%gain0(0) + tod%gain0(1)) * s_tot(i,1) - end do - write(58,*) - do i = 1, size(s_tot,1) - write(58,*) i, tod_arr(i, 1) + open(58,file='gain_delta_'//itext//'.dat', recl=1024) + write(58,*) "#", tod%scans(scan_id)%ntod, size(tod_arr), tod%gain0(0), tod%gain0(1), tod%scans(scan_id)%d(1)%dgain/tod%scans(scan_id)%d(1)%gain_invsigma + do i = 1, size(tod_arr) + write(58,*) i, r_fill(i), tod_arr(i,1), s_tot(i,1), mask(i,1) end do + +!!$ do i = ext(1), ext(2) +!!$ write(58,*) i, residual(i,1) +!!$ end do +!!$ write(58,*) +!!$ write(58,*) +!!$ do i = 1, size(s_invsqrtN,1) +!!$ write(58,*) i, s_invsqrtN(i,1) +!!$ end do +!!$ write(58,*) +!!$ do i = 1, size(s_tot,1) +!!$ write(58,*) i, tod_arr(i, 1) - (tod%gain0(0) + tod%gain0(1)) * s_tot(i,1) +!!$ end do +!!$ write(58,*) +!!$ do i = 1, size(s_tot,1) +!!$ write(58,*) i, tod_arr(i, 1) +!!$ end do close(58) end if @@ -179,7 +186,7 @@ module subroutine sample_smooth_gain(tod, handle, dipole_mods, smooth) if (present(smooth) ) smooth_ = smooth ndet = tod%ndet - nscan_tot = tod%nscan_tot + nscan_tot = tod%last_scan ! Collect all gain estimates on the root processor allocate(g(nscan_tot,ndet,2)) @@ -210,7 +217,7 @@ module subroutine sample_smooth_gain(tod, handle, dipole_mods, smooth) end do ! Perform poly-fit - allocate(xx(tod%nscan_tot), yy(tod%nscan_tot)) + allocate(xx(tod%last_scan), yy(tod%last_scan)) allocate(a(0:16)) do j = 1, tod%ndet xx = 0.d0 @@ -255,14 +262,14 @@ module subroutine sample_smooth_gain(tod, handle, dipole_mods, smooth) tod%gain_alpha(j) = -1.d0 ! Physically motivated value tod%gain_fknee(j) = tod%gain_samprate ! makes sigma_0 = true standard devation per sample - !if (j == 1) then - ! open(58,file='gain_in.dat') - ! do k = 1, size(g,1) - ! if (g(k,j,2) > 0) then - ! write(58,*) k, g(k,j,1)/g(k,j,2), 1/sqrt(g(k,j,2)) - ! end if - ! end do - ! close(58) + if (j == 1) then +!!$ open(58,file='gain_in.dat') +!!$ do k = 1, size(g,1) +!!$ if (g(k,j,2) > 0) then +!!$ write(58,*) k, g(k,j,1)/g(k,j,2), 1/sqrt(g(k,j,2)) +!!$ end if +!!$ end do +!!$ close(58) !write(*,*) '| psd = ', tod%gain_sigma_0(j), tod%gain_alpha(j), tod%gain_fknee(j) ! open(68,file='g.unf', form='unformatted') @@ -273,7 +280,7 @@ module subroutine sample_smooth_gain(tod, handle, dipole_mods, smooth) ! write(68) tod%gain_alpha(j) ! write(68) tod%gain_fknee(j) ! close(68) - !end if + end if sample_per_jump = .false. .and. (size(tod%jumplist(j, :)) > 2) if (sample_per_jump) then @@ -288,11 +295,12 @@ module subroutine sample_smooth_gain(tod, handle, dipole_mods, smooth) call wiener_filtered_gain(g(tod%jumplist(j, k):, j, 1), g(tod%jumplist(j, k):, j, 2), & & tod%gain_samprate, tod%gain_sigma_0(j), tod%gain_alpha(j), tod%gain_fknee(j), trim(tod%operation)=='sample', handle) else - call wiener_filtered_gain(g(:, j, 1), g(:, j, 2), tod%gain_samprate, tod%gain_sigma_0(j), tod%gain_alpha(j), & + call wiener_filtered_gain(g(:, j, 1), g(:, j, 2), tod%gain_samprate, 1000*tod%gain_sigma_0(j), tod%gain_alpha(j), & & tod%gain_fknee(j), trim(tod%operation)=='sample', handle) end if - ! Force flat average to zero + ! Force flat average to zero + !write(*,*) 'disabling gain mean subtraction' mu = 0.d0 denom = 0.d0 do k = 1, nscan_tot @@ -307,15 +315,15 @@ module subroutine sample_smooth_gain(tod, handle, dipole_mods, smooth) g(:,j,1) = g(:,j,1) - mu end where - !if (j == 1) then - ! open(58,file='gain_out.dat') - ! do k = 1, size(g,1) - ! if (g(k,j,2) > 0) then - ! write(58,*) k, g(k,j,1), 1/sqrt(g(k,j,2)) - ! end if - ! end do - ! close(58) - !end if + if (j == 1) then +!!$ open(58,file='gain_out.dat') +!!$ do k = 1, size(g,1) +!!$ if (g(k,j,2) > 0) then +!!$ write(58,*) k, g(k,j,1), 1/sqrt(g(k,j,2)) +!!$ end if +!!$ end do +!!$ close(58) + end if end do !!$ call mpi_finalize(ierr) !!$ stop @@ -469,7 +477,7 @@ module subroutine sample_abscal_from_orbital(tod, handle, A_abs, b_abs) tod%gain0(0) = tod%gain0(0) + 1.d0/sqrt(sum(A)) * rand_gauss(handle) end if if (tod%verbosity > 1) then - write(*,fmt='(a,f12.8)') ' | abscal = ', tod%gain0(0) + write(*,*) '| abscal = ', tod%gain0(0) !write(*,*) 'sum(b), sum(A) = ', sum(b), sum(A) end if end if @@ -1275,7 +1283,7 @@ module subroutine sample_gain_psd(tod, handle) integer*8 :: plan_fwd, plan_back ndet = tod%ndet - nscan_tot = tod%nscan_tot + nscan_tot = tod%last_scan ! Collect gains on all processors allocate(g(nscan_tot,ndet)) g = 0.d0 @@ -1556,8 +1564,10 @@ module function psd_loglike(sigma_0, fknee, alpha, gain_ps, freqs) end if !lambda = 1e8 call calculate_invcov(sigma_0, alpha, fknee, freqs, inv_N_corr) - - psd_loglike = -sum(gain_ps(1:2000) * inv_N_corr(1:2000) - log(inv_N_corr(1:2000))) !- lambda*sigma_0 + + + !TODO: fix this hardcoding issue here + psd_loglike = -sum(gain_ps(2:2000) * inv_N_corr(2:2000) - log(inv_N_corr(2:2000))) !- lambda*sigma_0 !write(*,*) sigma_0, sum(gain_ps(2:) * inv_N_corr(2:) - log(inv_N_corr(2:)))!, lambda*sigma_0 end function psd_loglike diff --git a/commander3/src/comm_tod_hfi_mod.f90 b/commander3/src/comm_tod_hfi_mod.f90 index fe93be7f6..8064d48de 100644 --- a/commander3/src/comm_tod_hfi_mod.f90 +++ b/commander3/src/comm_tod_hfi_mod.f90 @@ -18,7 +18,7 @@ ! along with Commander3. If not, see . ! !================================================================================ -module comm_tod_HFI_mod +module comm_tod_hfi_mod ! Module which contains all the HFI time ordered data processing and routines ! for a given frequency band ! @@ -31,30 +31,41 @@ module comm_tod_HFI_mod ! Routine which processes the time ordered data ! use comm_tod_driver_mod + use comm_tod_cray_mod + use comm_conviqt_mod + use comm_tod_crosstalk_mod implicit none private - public comm_HFI_tod + public comm_hfi_tod - type, extends(comm_tod) :: comm_HFI_tod + type, extends(comm_tod) :: comm_hfi_tod + real(sp), allocatable, dimension(:,:) :: mod_phase + class(comm_crosstalk), pointer :: xtalk contains - procedure :: process_tod => process_HFI_tod - procedure :: read_tod_inst => read_tod_inst_HFI - procedure :: read_scan_inst => read_scan_inst_HFI - procedure :: initHDF_inst => initHDF_HFI - procedure :: dumpToHDF_inst => dumpToHDF_HFI - end type comm_HFI_tod - - interface comm_HFI_tod + procedure :: process_tod => process_hfi_tod + procedure :: read_tod_inst => read_tod_inst_hfi + procedure :: read_scan_inst => read_scan_inst_hfi + procedure :: initHDF_inst => initHDF_hfi + procedure :: dumpToHDF_inst => dumpToHDF_hfi + procedure :: construct_corrtemp_inst => construct_corrtemp_hfi + procedure :: apply_nonlin_corr_inst => apply_nonlin_corr_hfi + + procedure, private :: stitch_hfi_dc_level + procedure, private :: hfi_dark_correction + procedure, private :: estimate_hfi_4k_lines + end type comm_hfi_tod + + interface comm_hfi_tod procedure constructor_hfi - end interface comm_HFI_tod + end interface comm_hfi_tod -contains +interface !************************************************** ! Constructor !************************************************** - function constructor_hfi(cpar, id, id_abs, info, tod_type) result(c) + module function constructor_hfi(cpar, id, id_abs, info, tod_type) result(c) ! ! Constructor function that gathers all the instrument parameters in a pointer ! and constructs the objects @@ -80,85 +91,14 @@ function constructor_hfi(cpar, id, id_abs, info, tod_type) result(c) integer(i4b), intent(in) :: id, id_abs class(comm_mapinfo), target :: info character(len=128), intent(in) :: tod_type - class(comm_HFI_tod), pointer :: c - - integer(i4b) :: i, j, nside_beam, lmax_beam, nmaps_beam, ierr - logical(lgt) :: pol_beam - - ! Allocate object - allocate(c) - - ! Set up noise PSD type and priors - c%freq = cpar%ds_label(id_abs) - c%n_xi = 3 - c%noise_psd_model = 'oof' - allocate(c%xi_n_P_uni(c%n_xi,2)) - allocate(c%xi_n_P_rms(c%n_xi)) - - ! just so that it actually runs - c%xi_n_P_uni(2,:) = [0.010d0, 0.45d0] ! fknee - c%xi_n_P_uni(3,:) = [-2.5d0, -0.4d0] ! alpha - !c%xi_n_nu_fit = [0.d0, 1.225d0] ! I took it from freq=30 for LFI, so not true - - c%xi_n_P_rms = [-1.d0, 0.1d0, 0.2d0] ! [sigma0, fknee, alpha]; sigma0 is not used - - ! Initialize common parameters - call c%tod_constructor(cpar, id, id_abs, info, tod_type) - - ! Initialize instrument-specific parameters - c%samprate_lowres = 1.d0 ! Lowres samprate in Hz - c%nhorn = 1 - c%compressed_tod = .true. - c%correct_sl = .false. - c%correct_orb = .true. - c%orb_4pi_beam = .false. - c%symm_flags = .false. - c%chisq_threshold = 1000.d0 !20.d0 ! 9.d0 - c%nmaps = info%nmaps - c%ndet = num_tokens(cpar%ds_tod_dets(id_abs), "," ) - c%ntime = 1 - c%HFI_flag = .true. - c%partner = -1 - - nside_beam = 512 - nmaps_beam = 3 - pol_beam = .true. - c%nside_beam = nside_beam - - ! Get detector labels - call get_tokens(cpar%ds_tod_dets(id_abs), ",", c%label) - - ! Read the actual TOD - call c%read_tod(c%label) - - ! Initialize bandpass mean and proposal matrix - !call c%initialize_bp_covar(trim(cpar%datadir)//'/'//cpar%ds_tod_bp_init(id_abs)) - - ! Construct lookup tables - call c%precompute_lookups() - - ! Load the instrument file - call c%load_instrument_file(nside_beam, nmaps_beam, pol_beam, cpar%comm_chain) - - ! Allocate sidelobe convolution data structures - !allocate(c%slconv(c%ndet), c%orb_dp) - - allocate(c%orb_dp) - c%orb_dp => comm_orbdipole(c%mbeam) - - ! Initialize all baseline corrections to zero - do i = 1, c%nscan - do j = 1, c%ndet - c%scans(i)%d(j)%baseline = 0.d0 - end do - end do + class(comm_hfi_tod), pointer :: c end function constructor_hfi !************************************************** ! Driver routine !************************************************** - subroutine process_HFI_tod(self, chaindir, chain, iter, handle, map_in, delta, map_out, rms_out, map_gain) + module subroutine process_hfi_tod(self, chaindir, chain, iter, handle, map_in, delta, map_out, rms_out, map_gain) ! ! Routine that processes the HFI time ordered data. ! Samples absolute and relative bandpass, gain and correlated noise in time domain, @@ -196,7 +136,7 @@ subroutine process_HFI_tod(self, chaindir, chain, iter, handle, map_in, delta, m ! Final output rms map after TOD processing combined for all detectors implicit none - class(comm_HFI_tod), intent(inout) :: self + class(comm_hfi_tod), intent(inout) :: self character(len=*), intent(in) :: chaindir integer(i4b), intent(in) :: chain, iter type(planck_rng), intent(inout) :: handle @@ -205,238 +145,95 @@ subroutine process_HFI_tod(self, chaindir, chain, iter, handle, map_in, delta, m class(comm_map), intent(inout) :: map_out ! Combined output map class(comm_map), intent(inout) :: rms_out ! Combined output rms type(map_ptr), dimension(1:,1:), intent(inout), optional :: map_gain ! (ndet,1) + end subroutine process_hfi_tod - real(dp) :: t1, t2 - integer(i4b) :: i, j, k, l, ierr, ndelta, nside, npix, nmaps - logical(lgt) :: select_data, sample_abs_bandpass, sample_rel_bandpass, output_scanlist - type(comm_binmap) :: binmap - type(comm_scandata) :: sd - character(len=4) :: ctext, myid_text - character(len=6) :: samptext, scantext - character(len=512) :: prefix, postfix, prefix4D, filename - character(len=512), allocatable, dimension(:) :: slist - real(sp), allocatable, dimension(:) :: procmask, procmask2, sigma0 - real(sp), allocatable, dimension(:,:) :: s_buf - real(sp), allocatable, dimension(:,:,:) :: d_calib - real(sp), allocatable, dimension(:,:,:,:) :: map_sky, m_gain - real(dp), allocatable, dimension(:,:) :: chisq_S, m_buf - - call int2string(iter, ctext) - call update_status(status, "tod_start"//ctext) - - ! Toggle optional operations - sample_rel_bandpass = size(delta,3) > 1 ! Sample relative bandpasses if more than one proposal sky - sample_abs_bandpass = .false. ! don't sample absolute bandpasses - select_data = self%first_call ! only perform data selection the first time - output_scanlist = mod(iter-1,10) == 0 ! only output scanlist every 10th iteration - - ! Initialize local variables - ndelta = size(delta,3) - self%n_bp_prop = ndelta - nside = map_out%info%nside - nmaps = map_out%info%nmaps - npix = 12*nside**2 - self%output_n_maps = 3 - if (self%output_aux_maps > 0) then - if (mod(iter-1,self%output_aux_maps) == 0) self%output_n_maps = 7 - end if - - call int2string(chain, ctext) - call int2string(iter, samptext) - call int2string(self%myid, myid_text) - prefix = trim(chaindir) // '/tod_' // trim(self%freq) // '_' - postfix = '_c' // ctext // '_k' // samptext // '.fits' - - ! Distribute maps - allocate(map_sky(nmaps,self%nobs,0:self%ndet,ndelta)) - call distribute_sky_maps(self, map_in, 1.e-6, map_sky) ! uK to K - allocate(m_gain(nmaps,self%nobs,0:self%ndet,1)) - call distribute_sky_maps(self, map_gain, 1.e-6, m_gain) ! uK to K - - ! Distribute processing masks - allocate(m_buf(0:npix-1,nmaps), procmask(0:npix-1), procmask2(0:npix-1)) - call self%procmask%bcast_fullsky_map(m_buf); procmask = m_buf(:,1) - call self%procmask2%bcast_fullsky_map(m_buf); procmask2 = m_buf(:,1) - deallocate(m_buf) - - ! Precompute far sidelobe Conviqt structures - !if (self%correct_sl) then - ! if (self%myid == 0) write(*,*) 'Precomputing sidelobe convolved sky' - ! do i = 1, self%ndet - !TODO: figure out why this is rotated - ! call map_in(i,1)%p%YtW() ! Compute sky a_lms - ! self%slconv(i)%p => comm_conviqt(self%myid_shared, self%comm_shared, & - ! & self%myid_inter, self%comm_inter, self%slbeam(i)%p%info%nside, & - ! & 100, 3, 100, self%slbeam(i)%p, map_in(i,1)%p, 2) - ! end do - !end if -! write(*,*) 'qqq', self%myid -! if (.true. .or. self%myid == 78) write(*,*) 'a', self%myid, self%correct_sl, self%ndet, self%slconv(1)%p%psires -!!$ call mpi_finalize(ierr) -!!$ stop - - call update_status(status, "tod_init") - - !------------------------------------ - ! Perform main sampling steps - !------------------------------------ - - ! Sample gain components in separate TOD loops; marginal with respect to n_corr - !call sample_calibration(self, 'abscal', handle, map_sky, procmask, procmask2) - !call sample_calibration(self, 'relcal', handle, map_sky, procmask, procmask2) - !call sample_calibration(self, 'deltaG', handle, map_sky, procmask, procmask2) - - ! Prepare intermediate data structures - call binmap%init(self, .true., sample_rel_bandpass) - if (sample_abs_bandpass .or. sample_rel_bandpass) then - allocate(chisq_S(self%ndet,size(delta,3))) - chisq_S = 0.d0 - end if - if (output_scanlist) then - allocate(slist(self%nscan)) - slist = '' - end if - ! Perform loop over scans - if (self%myid == 0) write(*,*) ' --> Sampling ncorr, xi_n, maps' - do i = 1, self%nscan - - ! Skip scan if no accepted data - if (.not. any(self%scans(i)%d%accept)) cycle - call wall_time(t1) + module subroutine sample_hfi_baselines(self, tod, scan, handle, subtract_s_tot) - ! Prepare data - if (sample_rel_bandpass) then -! if (.true. .or. self%myid == 78) write(*,*) 'b', self%myid, self%correct_sl, self%ndet, self%slconv(1)%p%psires - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_bp_prop=.true.) - else if (sample_abs_bandpass) then - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_sky_prop=.true.) - else - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true.) - end if - allocate(s_buf(sd%ntod,sd%ndet)) - - ! Calling Simulation Routine - if (self%enable_tod_simulations) then - call simulate_tod(self, i, sd%s_tot, sd%n_corr, handle) - call sd%dealloc - cycle - end if - - ! Sample correlated noise - call sample_n_corr(self, sd%tod, handle, i, sd%mask, sd%s_tot, sd%n_corr, sd%pix(:,:,1), dospike=.true.) - - ! Compute noise spectrum parameters - call sample_noise_psd(self, sd%tod, handle, i, sd%mask, sd%s_tot, sd%n_corr) - - ! Compute chisquare - do j = 1, sd%ndet - if (.not. self%scans(i)%d(j)%accept) cycle - call self%compute_tod_chisq(i, j, sd%mask(:,j), sd%s_sky(:,j), sd%s_sl(:,j) + sd%s_orb(:,j), sd%n_corr(:,j), tod=sd%tod(:, j)) - end do - - ! Select data - if (select_data) call remove_bad_data(self, i, sd%flag) - - ! Compute chisquare for bandpass fit - if (sample_abs_bandpass) call compute_chisq_abs_bp(self, i, sd, chisq_S) - - ! Compute binned map - allocate(d_calib(self%output_n_maps,sd%ntod, sd%ndet)) - call compute_calibrated_data(self, i, sd, d_calib) - - ! Output 4D map; note that psi is zero-base in 4D maps, and one-base in Commander - if (self%output_4D_map > 0) then - if (mod(iter-1,self%output_4D_map) == 0) then - allocate(sigma0(sd%ndet)) - do j = 1, sd%ndet - sigma0(j) = self%scans(i)%d(j)%N_psd%sigma0/self%scans(i)%d(j)%gain - end do - call output_4D_maps_hdf(trim(chaindir) // '/tod_4D_chain'//ctext//'_proc' // myid_text // '.h5', & - & samptext, self%scanid(i), self%nside, self%npsi, & - & self%label, self%horn_id, real(self%polang*180/pi,sp), sigma0, & - & sd%pix(:,:,1), sd%psi(:,:,1)-1, d_calib(1,:,:), iand(sd%flag,self%flag0), & - & self%scans(i)%d(:)%accept) - deallocate(sigma0) - end if - end if - - ! Bin TOD - call bin_TOD(self, i, sd%pix(:,:,1), sd%psi(:,:,1), sd%flag, d_calib, binmap) - - ! Update scan list - call wall_time(t2) - self%scans(i)%proctime = self%scans(i)%proctime + t2-t1 - self%scans(i)%n_proctime = self%scans(i)%n_proctime + 1 - if (output_scanlist) then - write(slist(i),*) self%scanid(i), '"',trim(self%hdfname(i)), & - & '"', real(self%scans(i)%proctime/self%scans(i)%n_proctime,sp),& - & real(self%spinaxis(i,:),sp) - end if - - ! Clean up - call sd%dealloc - deallocate(s_buf, d_calib) - - end do - - if (self%myid == 0) write(*,*) ' --> Finalizing maps, bp' - - ! Output latest scan list with new timing information - if (output_scanlist) call self%output_scan_list(slist) - - ! Solve for maps - call synchronize_binmap(binmap, self) - if (sample_rel_bandpass) then - if (self%nmaps > 1) then - call finalize_binned_map(self, binmap, rms_out, 1.d6, chisq_S=chisq_S, mask=procmask2) - else - call finalize_binned_map_unpol(self, binmap, rms_out, 1.d6, chisq_S=chisq_s, mask=procmask2) - end if - else - if(self%nmaps > 1) then - call finalize_binned_map(self, binmap, rms_out, 1.d6) - else - call finalize_binned_map_unpol(self, binmap, rms_out, 1.d6) - end if - end if - map_out%map = binmap%outmaps(1)%p%map - - ! Sample bandpass parameters - if (sample_rel_bandpass .or. sample_abs_bandpass) then - call sample_bp(self, iter, delta, map_sky, handle, chisq_S) - self%bp_delta = delta(:,:,1) - end if - - ! Output maps to disk - call map_out%writeFITS(trim(prefix)//'map'//trim(postfix)) - call rms_out%writeFITS(trim(prefix)//'rms'//trim(postfix)) - if (self%output_n_maps > 1) call binmap%outmaps(2)%p%writeFITS(trim(prefix)//'res'//trim(postfix)) - if (self%output_n_maps > 2) call binmap%outmaps(3)%p%writeFITS(trim(prefix)//'ncorr'//trim(postfix)) - if (self%output_n_maps > 3) call binmap%outmaps(4)%p%writeFITS(trim(prefix)//'bpcorr'//trim(postfix)) - if (self%output_n_maps > 4) call binmap%outmaps(5)%p%writeFITS(trim(prefix)//'orb'//trim(postfix)) - if (self%output_n_maps > 5) call binmap%outmaps(6)%p%writeFITS(trim(prefix)//'sl'//trim(postfix)) - if (self%output_n_maps > 6) call binmap%outmaps(7)%p%writeFITS(trim(prefix)//'zodi'//trim(postfix)) - - ! Clean up - call binmap%dealloc() - if (allocated(slist)) deallocate(slist) - deallocate(map_sky, procmask, procmask2) - if (self%correct_sl) then - do i = 1, self%ndet - call self%slconv(i)%p%dealloc(); deallocate(self%slconv(i)%p) - end do - end if - - ! Parameter to check if this is first time routine has been - self%first_call = .false. - - call update_status(status, "tod_end"//ctext) + ! + ! Estimates baselines for MODULATED data, separate for odd and even samples + ! + ! Arguments: + ! ---------- + ! self: derived class (comm_scandata) + ! HFI-specific TOD object + ! tod: comm_tod derived type + ! contains TOD-specific information + ! scan: scan ID + ! handle: planck_rng derived type + ! Healpix definition for random number generation + ! so that the same sequence can be resumed later on from that same + ! point + ! + ! + ! Returns + ! ---------- + ! None, but updates tod%scans(scan)%d(:)%baseline (for odd samples) + ! tod%scans(scan)%d(:)%baseline2 (for even samples) + ! tod%scans(scan)%d(:)%gain (temporary solution) + ! + implicit none + class(comm_scandata), intent(in) :: self + class(comm_hfi_tod), intent(inout) :: tod + integer(i4b), intent(in) :: scan + type(planck_rng), intent(inout) :: handle + logical(lgt), intent(in), optional :: subtract_s_tot + end subroutine sample_hfi_baselines + + module subroutine set_modulation_phase(self, tod, scan) + ! + ! Estimates baselines for MODULATED data, separate for odd and even samples + ! + ! Arguments: + ! ---------- + ! self: derived class (comm_scandata) + ! HFI-specific TOD object + ! tod: comm_tod derived type + ! contains TOD-specific information + ! scan: scan ID + ! handle: planck_rng derived type + ! Healpix definition for random number generation + ! so that the same sequence can be resumed later on from that same + ! point + ! + ! + ! Returns + ! ---------- + ! None, but updates tod%scans(scan)%d(:)%baseline1 (for odd samples) + ! tod%scans(scan)%d(:)%baseline2 (for even samples) + ! tod%scans(scan)%d(:)%gain (temporary solution) + ! + implicit none + class(comm_scandata), intent(in) :: self + class(comm_hfi_tod), intent(inout) :: tod + integer(i4b), intent(in) :: scan + end subroutine set_modulation_phase + - end subroutine process_HFI_tod + module subroutine demodulate_tod(self, tod, scan) + ! + ! Demodulate HFI TOD + ! + ! Arguments: + ! ---------- + ! self: derived class (comm_scandata) + ! HFI-specific TOD object + ! tod: comm_tod derived type + ! contains TOD-specific information + ! scan: Scan ID + ! + ! Returns + ! ---------- + ! None, but updates self%tod + ! + implicit none + class(comm_scandata), intent(inout) :: self + class(comm_hfi_tod), intent(in) :: tod + integer(i4b), intent(in) :: scan + end subroutine demodulate_tod - subroutine read_tod_inst_HFI(self, file) + module subroutine read_tod_inst_hfi(self, file) ! ! Reads HFI-specific common fields from TOD fileset ! @@ -454,9 +251,9 @@ subroutine read_tod_inst_HFI(self, file) implicit none class(comm_HFI_tod), intent(inout) :: self type(hdf_file), intent(in), optional :: file - end subroutine read_tod_inst_HFI + end subroutine read_tod_inst_hfi - subroutine read_scan_inst_HFI(self, file, slabel, detlabels, scan) + module subroutine read_scan_inst_hfi(self, file, slabel, detlabels, scan) ! ! Reads HFI-specific scan information from TOD fileset ! @@ -483,9 +280,9 @@ subroutine read_scan_inst_HFI(self, file, slabel, detlabels, scan) character(len=*), intent(in) :: slabel character(len=*), dimension(:), intent(in) :: detlabels class(comm_scan), intent(inout) :: scan - end subroutine read_scan_inst_HFI + end subroutine read_scan_inst_hfi - subroutine initHDF_HFI(self, chainfile, path) + module subroutine initHDF_hfi(self, chainfile, path) ! ! Initializes HFI-specific TOD parameters from existing chain file ! @@ -506,9 +303,9 @@ subroutine initHDF_HFI(self, chainfile, path) class(comm_HFI_tod), intent(inout) :: self type(hdf_file), intent(in) :: chainfile character(len=*), intent(in) :: path - end subroutine initHDF_HFI + end subroutine initHDF_hfi - subroutine dumpToHDF_HFI(self, chainfile, path) + module subroutine dumpToHDF_hfi(self, chainfile, path) ! ! Writes HFI-specific TOD parameters to existing chain file ! @@ -529,6 +326,112 @@ subroutine dumpToHDF_HFI(self, chainfile, path) class(comm_HFI_tod), intent(in) :: self type(hdf_file), intent(in) :: chainfile character(len=*), intent(in) :: path - end subroutine dumpToHDF_HFI + end subroutine dumpToHDF_hfi + + module subroutine construct_corrtemp_hfi(self, scan, pix, psi, s) + ! Construct an LFI instrument-specific correction template; for now contains 1Hz template only + ! + ! Arguments: + ! ---------- + ! self: comm_tod object + ! + ! scan: int + ! scan number + ! pix: int + ! index for pixel + ! psi: int + ! integer label for polarization angle + ! + ! Returns: + ! -------- + ! s: real (sp) + ! output template timestream + implicit none + class(comm_hfi_tod), intent(in) :: self + integer(i4b), intent(in) :: scan + integer(i4b), dimension(:,:), intent(in) :: pix, psi + real(sp), dimension(:,:), intent(out) :: s + end subroutine construct_corrtemp_hfi + + module subroutine apply_nonlin_corr_hfi(self, scan, sd) + ! Construct and apply HFI instrument-specific non-linear corrections + ! + ! Arguments: + ! ---------- + ! self: comm_tod object + ! + ! scan: int + ! scan number + ! + ! sd: comm_scandata + ! structure holding the scan data + ! + ! Returns: + ! -------- + ! s: real (sp) + ! output template timestream + implicit none + class(comm_hfi_tod), intent(in) :: self + integer(i4b), intent(in) :: scan + class(comm_scandata), intent(inout) :: sd + end subroutine apply_nonlin_corr_hfi + + module subroutine stitch_hfi_dc_level(self, scan, sd) + ! Construct and apply HFI instrument-specific non-linear corrections + ! + ! Arguments: + ! ---------- + ! self: comm_tod object + ! + ! scan: int + ! scan number + ! sd: comm_scandata object + ! structure holding the data for each scan + ! + implicit none + class(comm_hfi_tod), intent(in) :: self + integer(i4b), intent(in) :: scan + class(comm_scandata), intent(inout) :: sd + end subroutine stitch_hfi_dc_level + + module subroutine hfi_dark_correction(self, scan, sd) + ! Construct and apply HFI instrument-specific corrections + ! from dark bolometer timestreams + ! + ! Arguments: + ! ---------- + ! self: comm_tod object + ! + ! scan: int + ! scan number + ! sd: comm_scandata object + ! structure holding the data for each scan + ! + implicit none + class(comm_hfi_tod), intent(in) :: self + integer(i4b), intent(in) :: scan + class(comm_scandata), intent(inout) :: sd + end subroutine hfi_dark_correction + + module subroutine estimate_hfi_4k_lines(self, scan, sd) + ! Construct and apply HFI instrument-specific corrections + ! from 4k lines + ! + ! Arguments: + ! ---------- + ! self: comm_tod object + ! + ! scan: int + ! scan number + ! sd: comm_scandata object + ! structure holding the data for each scan + ! + implicit none + class(comm_hfi_tod), intent(in) :: self + integer(i4b), intent(in) :: scan + class(comm_scandata), intent(inout) :: sd + end subroutine estimate_hfi_4k_lines + +end interface -end module comm_tod_HFI_mod +end module comm_tod_hfi_mod diff --git a/commander3/src/comm_tod_hfi_smod.f90 b/commander3/src/comm_tod_hfi_smod.f90 new file mode 100644 index 000000000..c55c76f14 --- /dev/null +++ b/commander3/src/comm_tod_hfi_smod.f90 @@ -0,0 +1,980 @@ +!================================================================================ +! +! Copyright (C) 2020 Institute of Theoretical Astrophysics, University of Oslo. +! +! This file is part of Commander3. +! +! Commander3 is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! Commander3 is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with Commander3. If not, see . +! +!================================================================================ +submodule (comm_tod_hfi_mod) comm_tod_hfi_mod +contains + + !************************************************** + ! Constructor + !************************************************** + module function constructor_hfi(cpar, id, id_abs, info, tod_type) result(c) + ! + ! Constructor function that gathers all the instrument parameters in a pointer + ! and constructs the objects + ! + ! Arguments: + ! ---------- + ! cpar: derived type + ! Object containing parameters from the parameterfile. + ! id_abs: integer + ! The index of the current band within the parameters, related to cpar + ! info: map_info structure + ! Information about the maps for this band, like how the maps are distributed in memory + ! tod_type: string + ! Instrument specific tod type + ! + ! Returns + ! ---------- + ! constructor: pointer + ! Pointer that contains all instrument data + + implicit none + type(comm_params), intent(in) :: cpar + integer(i4b), intent(in) :: id, id_abs + class(comm_mapinfo), target :: info + character(len=128), intent(in) :: tod_type + class(comm_HFI_tod), pointer :: c + + integer(i4b) :: i, j, k, nside_beam, lmax_beam, nmaps_beam, ierr + logical(lgt) :: pol_beam + + logical(lgt), dimension(:,:), allocatable :: correlations + + ! Allocate object + allocate(c) + + ! Set up noise PSD type and priors + c%freq = cpar%ds_label(id_abs) + c%n_xi = 3 + !c%noise_psd_model = 'white' ! Using white noise until we get better estimates of the actual noise PSD + c%noise_psd_model = 'oof' ! Not fitted parameters yet + allocate(c%xi_n_P_uni(c%n_xi,2)) + allocate(c%xi_n_P_rms(c%n_xi)) + allocate(c%xi_n_nu_fit(c%n_xi,2)) + ! just so that it actually runs + c%xi_n_P_uni(2,:) = [0.001d0, 1.0d0] ! fknee + c%xi_n_P_uni(3,:) = [-2.5d0, -0.4d0] ! alpha + !do k = 1, c%n_xi + ! c%xi_n_nu_fit(k,:) = [0.d0, 3*1.225d0] ! Placeholder + !end do + + !TODO: These numbers are made up, we should refine them + c%xi_n_nu_fit(1,:) = [3.d0, 10.d0] + c%xi_n_nu_fit(2,:) = [0.d0, 1.25d0] + c%xi_n_nu_fit(3,:) = [0.d0, 1.25d0] + !c%xi_n_P_rms = [-1.d0, 0.1d0, 0.2d0] ! [sigma0, fknee, alpha]; sigma0 is not used + c%xi_n_P_rms = [-1.d0, 0.1d0, -1d0] ! [sigma0, fknee, alpha]; sigma0 is not used + !c%xi_n_P_rms = [-1.d0] ! [sigma0]; sigma0 is not used + + c%n_cray_temps = 3 + + c%ndiode = 1 + + ! Initialize common parameters + call c%tod_constructor(cpar, id, id_abs, info, tod_type) + + ! Initialize instrument-specific parameters + c%samprate_lowres = 18. ! Lowres samprate in Hz; 10 times lower than the intrinsic HFI rate for now + c%nhorn = 1 + c%compressed_tod = .true. + c%correct_sl = .false. + if(.true. .or. c%freq(1:3) == '545' .or. c%freq(1:3) == '857') then !currently no sidelobe models + c%correct_sl = .false. + else + c%correct_sl = .true. + end if + c%correct_orb = .true. + c%apply_inst_corr = .true. + c%orb_4pi_beam = .false. + c%symm_flags = .false. + c%sample_zodi = cpar%sample_zodi .and. c%subtract_zodi ! Sample zodi parameters + c%chisq_threshold = 1000.d0 !20.d0 ! 9.d0 + c%nmaps = info%nmaps + c%ndet = num_tokens(cpar%ds_tod_dets(id_abs), "," ) + c%ntime = 1 + c%partner = -1 + !TODO: set the number of dark bolometers to be correct + c%ndark = 1 + + nmaps_beam = 3 + pol_beam = .true. + c%nside_beam = 512 + + ! Get detector labels + call get_tokens(cpar%ds_tod_dets(id_abs), ",", c%label) + + ! Read the actual TOD + call c%read_tod(c%label) + + ! Initialize bandpass mean and proposal matrix + !call c%initialize_bp_covar(trim(cpar%datadir)//'/'//cpar%ds_tod_bp_init(id_abs)) + + ! Construct lookup tables + call c%precompute_lookups() + + ! Load the instrument file + call c%load_instrument_file(c%nside_beam, nmaps_beam, pol_beam, cpar%comm_chain) + + ! Allocate sidelobe convolution data structures + if(c%correct_sl) allocate(c%slconv(c%ndet), c%orb_dp) + + allocate(c%orb_dp) + !c%orb_dp => comm_orbdipole(c%mbeam) ! HKE: Removed mbeam for now due to crash; should be fixed + c%orb_dp => comm_orbdipole(comm=c%comm) + + ! Initialize all baseline corrections to zero + do i = 1, c%nscan + do j = 1, c%ndet + c%scans(i)%d(j)%baseline = 0.d0 + end do + end do + + ! Allocate modulation phase + allocate(c%mod_phase(c%ndet,c%nscan)) + c%mod_phase = 1.0 + + ! initialize crosstalk class + allocate(correlations(c%ndet, c%ndet)) + correlations = .true. + + ! allocate(c%xtalk) + c%xtalk => comm_crosstalk(correlations) + + + end function constructor_hfi + + !************************************************** + ! Driver routine + !************************************************** + module subroutine process_HFI_tod(self, chaindir, chain, iter, handle, map_in, delta, map_out, rms_out, map_gain) + ! + ! Routine that processes the HFI time ordered data. + ! Samples absolute and relative bandpass, gain and correlated noise in time domain, + ! perform data selection, correct for sidelobes, compute chisquare and outputs maps and rms. + ! Writes maps to disc in fits format + ! + ! Arguments: + ! ---------- + ! self: pointer of comm_HFI_tod class + ! Points to output of the constructor + ! chaindir: string + ! Directory for output files + ! chain: integer + ! Index number of the chain being run + ! iter: integer + ! Gibbs iteration number + ! handle: planck_rng derived type + ! Healpix definition for random number generation + ! so that the same sequence can be resumed later on from that same point + ! map_in: array + ! Array of dimension (ndet,ndelta) with pointer to maps, + ! with both access to maps and changing them. + ! ndet is the number of detectors and + ! ndelta is the number of bandpass deltas being considered + ! delta: array + ! Array of bandpass corrections with dimensions (0:ndet,npar,ndelta) + ! where ndet is number of detectors, npar is number of parameters + ! and ndelta is the number of bandpass deltas being considered + ! + ! Returns: + ! ---------- + ! map_out: comm_map class + ! Final output map after TOD processing combined for all detectors + ! rms_out: comm_map class + ! Final output rms map after TOD processing combined for all detectors + + implicit none + class(comm_HFI_tod), intent(inout) :: self + character(len=*), intent(in) :: chaindir + integer(i4b), intent(in) :: chain, iter + type(planck_rng), intent(inout) :: handle + type(map_ptr), dimension(1:,1:), intent(inout) :: map_in ! (ndet,ndelta) + real(dp), dimension(0:,1:,1:), intent(inout) :: delta ! (0:ndet,npar,ndelta) BP corrections + class(comm_map), intent(inout) :: map_out ! Combined output map + class(comm_map), intent(inout) :: rms_out ! Combined output rms + type(map_ptr), dimension(1:,1:), intent(inout), optional :: map_gain ! (ndet,1) + + real(dp) :: t1, t2 + integer(i4b) :: i, j, k, l, ierr, ndelta, nside, npix, nmaps + logical(lgt) :: select_data, sample_gain, sample_ncorr, sample_abs_bandpass, sample_rel_bandpass, output_scanlist, sample_zodi, output_zodi_comps + type(comm_binmap) :: binmap + type(comm_scandata) :: sd + type(comm_detdata) :: dd + character(len=4) :: ctext, myid_text + character(len=6) :: samptext, scantext + character(len=512) :: prefix, postfix, prefix4D, filename + character(len=512), allocatable, dimension(:) :: slist + real(sp), dimension(9) :: flag_threshold + real(sp), allocatable, dimension(:) :: procmask, procmask2, procmask_zodi, sigma0 + real(sp), allocatable, dimension(:,:) :: s_buf + real(sp), allocatable, dimension(:,:,:) :: d_calib + real(sp), allocatable, dimension(:,:,:,:) :: map_sky, m_gain + real(dp), allocatable, dimension(:,:) :: chisq_S, m_buf + + call int2string(iter, ctext) + call update_status(status, "tod_start"//ctext) + + ! Toggle optional operations + sample_rel_bandpass = size(delta,3) > 1 ! Sample relative bandpasses if more than one proposal sky + sample_abs_bandpass = .false. ! don't sample absolute bandpasses + sample_gain = .true. + sample_ncorr = iter > 1 !.true. + sample_zodi = self%sample_zodi .and. self%subtract_zodi ! Sample zodi parameters + output_zodi_comps = self%output_zodi_comps .and. self%subtract_zodi ! Output zodi components + select_data = self%first_call ! only perform data selection the first time + output_scanlist = mod(iter-1,10) == 0 ! only output scanlist every 10th iteration + + ! Pixhist Single abs/RMS RMS ranges Single Ranges Pointing + flag_threshold = [ -1.0, 20.0, 5.0, 1.5, 2.0, -1.0, 1.0, -1.0, -1.0] + + ! Initialize local variables + ndelta = size(delta,3) + self%n_bp_prop = ndelta + nside = map_out%info%nside + nmaps = map_out%info%nmaps + npix = 12*nside**2 + self%output_n_maps = 3 + if (self%output_aux_maps > 0 .or. .true.) then + if (mod(iter-1,self%output_aux_maps) == 0) self%output_n_maps = 7 + end if + if (output_zodi_comps) self%output_n_maps = self%output_n_maps + zodi_model%n_comps + + call int2string(chain, ctext) + call int2string(iter, samptext) + call int2string(self%myid, myid_text) + prefix = trim(chaindir) // '/tod_' // trim(self%freq) // '_' + postfix = '_c' // ctext // '_k' // samptext // '.fits' + + ! Distribute maps + allocate(map_sky(nmaps,self%nobs,0:self%ndet,ndelta)) + allocate(m_gain(nmaps,self%nobs,0:self%ndet,1)) + call distribute_sky_maps(self, map_gain, 1.e0, m_gain) ! in K_cmb + call distribute_sky_maps(self, map_in, 1.e0, map_sky) ! already in K_cmb + + ! Distribute processing masks + allocate(m_buf(0:npix-1,nmaps), procmask(0:npix-1), procmask2(0:npix-1)) + call self%procmask%bcast_fullsky_map(m_buf); procmask = m_buf(:,1) + call self%procmask2%bcast_fullsky_map(m_buf); procmask2 = m_buf(:,1) + if (self%sample_zodi .and. self%subtract_zodi) then + allocate(procmask_zodi(0:npix-1)) + call self%procmask_zodi%bcast_fullsky_map(m_buf); procmask_zodi = m_buf(:,1) + end if + deallocate(m_buf) + + call map_in(1,1)%p%writeFITS(trim(self%outdir) // "/input_sky_model_"//trim(self%label(1))//".fits") + !call self%procmask%writeFITS("mask.fits") + + ! Precompute far sidelobe Conviqt structures + if (self%correct_sl) then + if (self%myid == 0) write(*,*) 'Precomputing sidelobe convolved sky' + do i = 1, self%ndet + !TODO: figure out why this is rotated + call map_in(i,1)%p%YtW() ! Compute sky a_lms + self%slconv(i)%p => comm_conviqt(self%myid_shared, self%comm_shared, & + & self%myid_inter, self%comm_inter, self%slbeam(i)%p%info%nside, & + & 100, 3, 100, self%slbeam(i)%p, map_in(i,1)%p, 2) + end do + end if +! write(*,*) 'qqq', self%myid +! if (.true. .or. self%myid == 78) write(*,*) 'a', self%myid, self%correct_sl, self%ndet, self%slconv(1)%p%psires +!!$ call mpi_finalize(ierr) +!!$ stop + + call update_status(status, "tod_init") + + !------------------------------------ + ! Perform main sampling steps + !------------------------------------ + + ! estimate A/B detector crosstalk coeficients + call self%xtalk%estimate_crosstalk_matrix() + + ! Fit per-chunk low-level non-linearity parameters + do i = 1, self%nscan + ! Skip scan if no accepted data + if (.not. any(self%scans(i)%d%accept)) cycle + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, procmask_zodi, skip_nonlin=.true., darkdata=.true.) + +!!$ open(58,file='res.dat', recl=1024) +!!$ do j = 1, sd%ntod +!!$ write(58,*) j, sd%tod(j,1), sd%pix(j,1,1), sd%flag(j,1) +!!$ end do +!!$ close(58) + + ! Subtract A/B detector crosstalk + ! Not implemented yet + + call self%xtalk%remove_crosstalk_signal(sd, i) + + ! Estimate modulation baselines; separate for odd and even samples + if (self%first_call) then + call sample_hfi_baselines(sd, self, i, handle, subtract_s_tot=.false.) + else + call sample_hfi_baselines(sd, self, i, handle) + end if + + ! Fix modulation phase + if (self%first_call) call set_modulation_phase(sd, self, i) + + ! Fix dc level jumps + call self%stitch_hfi_dc_level(i, sd) + + ! Dark bolometer drift correction + call self%hfi_dark_correction(i, sd) + + ! 4k Line corrections + call self%estimate_hfi_4k_lines(i, sd) + + + ! Clean up + call dealloc_scan_data(sd) + end do + +!!$ call mpi_finalize(ierr) +!!$ stop + + ! Fit global timestream contaminants + + ! Subtract cosmic ray contribution + do j=1, self%ndet + + call init_det_data_singlehorn(dd, self, j) + + call self%cray(j)%p%build_cray_templates() + +!!$ do i=1, self%nscan +!!$ call populate_sd_from_dd(sd, dd, i, j) +!!$ +!!$ call self%cray(j)%p%fit_cray_amplitudes(sd%tod(j,:), sd%s_inst(j, :)) +!!$ +!!$ call dealloc_scan_data(sd) +!!$ end do + + call dd%dealloc + end do + + ! Estimate ADC corrections + ! Not implemented yet + + ! Fit bolometer transfer function parameters? + ! Not implemented yet + + + ! NOW Sample high level tod components that require cleaned data + + ! Sample gain components in separate TOD loops; marginal with respect to n_corr + if (sample_gain) then + ! TODO: Also sample non-linear gain response here? + call sample_calibration(self, 'abscal', handle, map_sky, m_gain, procmask2, procmask2) + call sample_calibration(self, 'relcal', handle, map_sky, m_gain, procmask, procmask2) + call sample_calibration(self, 'deltaG', handle, map_sky, m_gain, procmask, procmask2) + end if + + + ! Prepare intermediate data structures + call binmap%init(self, .true., .false.)!, nplus2=.true.) + if (sample_abs_bandpass .or. sample_rel_bandpass) then + allocate(chisq_S(self%ndet,size(delta,3))) + chisq_S = 0.d0 + end if + if (output_scanlist) then + allocate(slist(self%nscan)) + slist = '' + end if + + ! Fit higher-level corrections + if (self%myid == 0) write(*,*) ' --> Sampling ncorr, xi_n, maps' + do i = 1, self%nscan + + ! Skip scan if no accepted data + if (.not. any(self%scans(i)%d%accept)) cycle + call wall_time(t1) + + ! Prepare data + if (sample_rel_bandpass) then + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, procmask_zodi, init_s_bp=.true., init_s_bp_prop=.true.) + else if (sample_abs_bandpass) then + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, procmask_zodi, init_s_bp=.true., init_s_sky_prop=.true.) + else + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, procmask_zodi, init_s_bp=.true.) + end if + + ! Create dynamic mask + if (self%first_call) then + ! Estimate sigma0 for masking + sd%n_corr = 0.d0 + call sample_noise_psd(self, sd%tod, handle, i, sd%mask, sd%s_tot, sd%n_corr, only_sigma0=.true.) + + ! Create mask + do j = 1, sd%ndet + if (.not. self%scans(i)%d(j)%accept) cycle + call self%create_dynamic_mask(i, j, sd%pix(:,j,1), sd%tod(:,j), (sd%tod(:,j)-real(self%scans(i)%d(j)%gain,sp)*sd%s_tot(:,j))/self%scans(i)%d(j)%N_psd%sigma0, & + & sd%mask(:,j), sd%flag(:,j), flag_threshold) + end do + call dealloc_scan_data(sd) + if (.not. any(self%scans(i)%d%accept)) cycle + + ! Update scan data with new flagging + if (sample_rel_bandpass) then + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, procmask_zodi, init_s_bp=.true., init_s_bp_prop=.true.) + else if (sample_abs_bandpass) then + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, procmask_zodi, init_s_bp=.true., init_s_sky_prop=.true.) + else + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, procmask_zodi, init_s_bp=.true.) + end if + end if + + ! Sample correlated noise + if (sample_ncorr) then + call sample_n_corr(self, sd%tod, handle, i, sd%mask, sd%s_tot, sd%n_corr, sd%pix(:,:,1), nomono=.true.) + call sample_noise_psd(self, sd%tod, handle, i, sd%mask, sd%s_tot, sd%n_corr) + else + sd%n_corr = 0.d0 + call sample_noise_psd(self, sd%tod, handle, i, sd%mask, sd%s_tot, sd%n_corr, only_sigma0=.true.) + end if + + ! Compute chisquare + do j = 1, sd%ndet + if (.not. self%scans(i)%d(j)%accept) cycle + call self%compute_tod_chisq(i, j, sd%mask(:,j), sd%s_sky(:,j), sd%s_sl(:,j) + sd%s_orb(:,j), sd%n_corr(:,j), tod=sd%tod(:, j)) + end do + + ! Select data + !if (select_data) call remove_bad_data(self, i, sd%flag) + + ! Compute chisquare for bandpass fit + !if (sample_abs_bandpass) call compute_chisq_abs_bp(self, i, sd, chisq_S) + + ! Compute calibrated TOD for mapmaking + allocate(d_calib(self%output_n_maps,sd%ntod, sd%ndet)) + d_calib = 0.d0 + call compute_calibrated_data(self, i, sd, d_calib) + + if (self%scanid(i) == 500) then + open(58,file='res'//samptext//'.dat', recl=1024) + do j = 1, sd%ntod + write(58,*) j, sd%tod(j,1), sd%n_corr(j,1), d_calib(1,j,1), d_calib(2,j,1), 1-(sd%flag(j,1)/maxval(sd%flag(:,1))), self%psi(sd%psi(j,1,1))*RAD2DEG, self%psi(sd%psi(j,2,1))*RAD2DEG, self%psi(sd%psi(j,3,1))*RAD2DEG, self%psi(sd%psi(j,4,1))*RAD2DEG + end do + close(58) + end if + + ! Bin TOD + call bin_TOD(self, i, sd%pix(:,:,1), sd%psi(:,:,1), sd%flag, d_calib, binmap) + + ! Update scan list + call wall_time(t2) + self%scans(i)%proctime = self%scans(i)%proctime + t2-t1 + self%scans(i)%n_proctime = self%scans(i)%n_proctime + 1 + if (output_scanlist) then + write(slist(i),*) self%scanid(i), '"',trim(self%hdfname(i)), & + & '"', real(self%scans(i)%proctime/self%scans(i)%n_proctime,sp),& + & real(self%spinaxis(i,:),sp) + end if + + ! Clean up + call dealloc_scan_data(sd) + deallocate(d_calib) + + end do + + + if (self%myid == 0) write(*,*) ' --> Finalizing maps, bp' + + ! Output latest scan list with new timing information + if (output_scanlist) call self%output_scan_list(slist) + + ! Solve for maps + ! TODO: update mapmaker to n+2 maps + ! TODO: handle bolometer transfer function in the mapmaking + call synchronize_binmap(binmap, self) + if (sample_rel_bandpass) then + if (self%nmaps > 1) then + !call finalize_binned_map_nplus2(self, binmap, rms_out, 1.d0, chisq_S=chisq_S, mask=procmask2, correct_transfer=.true.) + call finalize_binned_map(self, binmap, rms_out, 1.d0, chisq_S=chisq_S, mask=procmask2) + else + call finalize_binned_map_unpol(self, binmap, rms_out, 1.d0, chisq_S=chisq_s, mask=procmask2, correct_transfer=.true.) + end if + else + if(self%nmaps > 1) then + call finalize_binned_map(self, binmap, rms_out, 1.d0) + else + call finalize_binned_map_unpol(self, binmap, rms_out, 1.d0) + end if + end if + map_out%map = binmap%outmaps(1)%p%map + + ! Sample bandpass parameters + if (sample_rel_bandpass .or. sample_abs_bandpass) then + call sample_bp(self, iter, delta, map_sky, handle, chisq_S) + self%bp_delta = delta(:,:,1) + end if + + ! Output maps to disk + call map_out%writeFITS(trim(prefix)//'map'//trim(postfix)) + call rms_out%writeFITS(trim(prefix)//'rms'//trim(postfix)) + if (self%output_n_maps > 1) call binmap%outmaps(2)%p%writeFITS(trim(prefix)//'res'//trim(postfix)) + if (self%output_n_maps > 2) call binmap%outmaps(3)%p%writeFITS(trim(prefix)//'ncorr'//trim(postfix)) + if (self%output_n_maps > 3) call binmap%outmaps(4)%p%writeFITS(trim(prefix)//'bpcorr'//trim(postfix)) + if (self%output_n_maps > 4) call binmap%outmaps(5)%p%writeFITS(trim(prefix)//'orb'//trim(postfix)) +!!$ if (self%output_n_maps > 5) call binmap%outmaps(6)%p%writeFITS(trim(prefix)//'sl'//trim(postfix)) +!!$ if (self%output_n_maps > 6) call binmap%outmaps(7)%p%writeFITS(trim(prefix)//'zodi'//trim(postfix)) +!!$ if (self%output_n_maps > 8 .and. self%subtract_zodi .and. output_zodi_comps) then +!!$ do i = 1, zodi_model%n_comps +!!$ call binmap%outmaps(8+i)%p%writeFITS(trim(prefix)//'zodi_'//trim(zodi_model%comp_labels(i))//trim(postfix)) +!!$ end do +!!$ endif + + ! Clean up + call binmap%dealloc() + if (allocated(slist)) deallocate(slist) + deallocate(map_sky, procmask, procmask2, m_gain) + if (self%correct_sl) then + do i = 1, self%ndet + call self%slconv(i)%p%dealloc(); deallocate(self%slconv(i)%p) + end do + end if + + ! Parameter to check if this is first time routine has been + self%first_call = .false. + + call update_status(status, "tod_end"//ctext) + + end subroutine process_HFI_tod + + + module subroutine sample_hfi_baselines(self, tod, scan, handle, subtract_s_tot) + ! + ! Estimates baselines for MODULATED data, separate for odd and even samples + ! + ! Arguments: + ! ---------- + ! self: derived class (comm_scandata) + ! HFI-specific TOD object + ! tod: comm_tod derived type + ! contains TOD-specific information + ! scan: scan ID + ! handle: planck_rng derived type + ! Healpix definition for random number generation + ! so that the same sequence can be resumed later on from that same + ! point + ! + ! + ! Returns + ! ---------- + ! None, but updates tod%scans(scan)%d(:)%baseline (for odd samples) + ! tod%scans(scan)%d(:)%baseline2 (for even samples) + ! tod%scans(scan)%d(:)%gain (temporary solution) + ! + implicit none + class(comm_scandata), intent(in) :: self + class(comm_hfi_tod), intent(inout) :: tod + integer(i4b), intent(in) :: scan + type(planck_rng), intent(inout) :: handle + logical(lgt), intent(in), optional :: subtract_s_tot + + real(dp) :: eta, A1, A2, x, b1, b2, sgn,gal_mean + integer(i4b) :: i, j, n + logical(lgt) :: sub_s + + sub_s = .true.; if (present(subtract_s_tot)) sub_s = subtract_s_tot + + + ! tod%scans(scan)%d(i)%gain - the gain constant over a scan [real number] + ! sd = self --- self%s_tot - sky signal model + ! self%s_tot(self%ntod, self%ndet) - how s_tot structured + + if (tod%scanid(scan) == 500) open(58,file='baseline.dat', recl=1024) + do i = 1, tod%ndet + if (.not. tod%scans(scan)%d(i)%accept) cycle + sgn = tod%mod_phase(i,scan) + + ! Odd samples + A1 = 0.d0; b1 = 0; gal_mean = 0.d0; n = 0 + do j = 1, self%ntod, 2 + if (self%mask(j,i) == 0) cycle + A1 = A1 + 1.d0 + b1 = b1 + self%tod(j,i) + if (sub_s) b1 = b1 - sgn*tod%scans(scan)%d(i)%gain * self%s_tot(j,i) + if (tod%scanid(scan) == 500) write(58,*) j, self%tod(j,i), self%tod(j,i) - sgn*tod%scans(scan)%d(i)%gain * self%s_tot(j,i) + end do + A1 = A1 / tod%scans(scan)%d(i)%N_psd%sigma0**2 + b1 = b1 / tod%scans(scan)%d(i)%N_psd%sigma0**2 + tod%scans(scan)%d(i)%baseline1 = b1/A1 + rand_gauss(handle)/sqrt(A1) + + ! Even samples + if (tod%scanid(scan) == 500) write(58,*) + A2 = 0.d0; b2 = 0.d0 + do j = 2, self%ntod, 2 + if (self%mask(j,i) == 0) cycle + A2 = A2 + 1.d0 + b2 = b2 + self%tod(j,i) + if (sub_s) b2 = b2 + sgn*tod%scans(scan)%d(i)%gain * self%s_tot(j,i) + if (tod%scanid(scan) == 500) write(58,*) j, self%tod(j,i), self%tod(j,i) + sgn*tod%scans(scan)%d(i)%gain * self%s_tot(j,i) + end do + A2 = A2 / tod%scans(scan)%d(i)%N_psd%sigma0**2 + b2 = b2 / tod%scans(scan)%d(i)%N_psd%sigma0**2 + tod%scans(scan)%d(i)%baseline2 = b2/A2 + rand_gauss(handle)/sqrt(A2) + + !write(*,'(a,i8,3f16.3)') "baseline =", tod%scanid(scan), tod%scans(scan)%d(i)%baseline1, tod%scans(scan)%d(i)%baseline2, sgn + + end do + if (tod%scanid(scan) == 500) close(58) + + end subroutine sample_hfi_baselines + + module subroutine set_modulation_phase(self, tod, scan) + ! + ! Estimates baselines for MODULATED data, separate for odd and even samples + ! + ! Arguments: + ! ---------- + ! self: derived class (comm_scandata) + ! HFI-specific TOD object + ! tod: comm_tod derived type + ! contains TOD-specific information + ! scan: scan ID + ! handle: planck_rng derived type + ! Healpix definition for random number generation + ! so that the same sequence can be resumed later on from that same + ! point + ! + ! + ! Returns + ! ---------- + ! None, but updates tod%scans(scan)%d(:)%baseline1 (for odd samples) + ! tod%scans(scan)%d(:)%baseline2 (for even samples) + ! tod%scans(scan)%d(:)%gain (temporary solution) + ! + implicit none + class(comm_scandata), intent(in) :: self + class(comm_hfi_tod), intent(inout) :: tod + integer(i4b), intent(in) :: scan + + real(dp) :: mu, n + integer(i4b) :: i, j + + do i = 1, tod%ndet + if (.not. tod%scans(scan)%d(i)%accept) cycle + + mu = 0.d0; n = 0.d0 + do j = 1, self%ntod, 2 + if (self%pix(j,i,1) > 0.48*tod%info%npix .and. self%pix(j,i,1) < 0.52*tod%info%npix) then + if (mod(j,2) == 1) then + mu = mu + (self%tod(j,1)-tod%scans(scan)%d(i)%baseline1) + else + mu = mu - (self%tod(j,1)-tod%scans(scan)%d(i)%baseline2) + end if + n = n + 1.d0 + end if + end do + + if (n == 0) then + write(*,*) "set_modulation_phase: no samples crossing the galactic plane. Scan disabled = ", tod%scanid(scan) + tod%scans(scan)%d(i)%accept = .false. + else + mu = mu/n + + ! saving the phase to the tod object + if (mu < 0.d0) then + tod%mod_phase(i,scan) = -1 + end if + end if + end do + + end subroutine set_modulation_phase + + + module subroutine demodulate_tod(self, tod, scan) + ! + ! Demodulate HFI TOD + ! + ! Arguments: + ! ---------- + ! self: derived class (comm_scandata) + ! HFI-specific TOD object + ! tod: comm_tod derived type + ! contains TOD-specific information + ! scan: Scan ID + ! + ! Returns + ! ---------- + ! None, but updates self%tod + ! + implicit none + class(comm_scandata), intent(inout) :: self + class(comm_hfi_tod), intent(in) :: tod + integer(i4b), intent(in) :: scan + + integer(i4b) :: i, j + real(sp) :: sgn + +!!$ open(58,file='tod_adc.dat') +!!$ do j = 1, self%ntod +!!$ write(58,*) j, self%tod(j,1) +!!$ end do +!!$ close(58) + + do i = 1, tod%ndet + if (.not. tod%scans(scan)%d(i)%accept) cycle + sgn = tod%mod_phase(i,scan) + + ! Subtract baselines and flip sign of every other sample + do j = 1, self%ntod + if (mod(j,2) == 1) then + self%tod(j,i) = sgn*(self%tod(j,i) - tod%scans(scan)%d(i)%baseline1) + else + self%tod(j,i) = -sgn*(self%tod(j,i) - tod%scans(scan)%d(i)%baseline2) + end if + end do + + end do + +!!$ open(58,file='tod.dat') +!!$ do j = 1, self%ntod +!!$ write(58,*) j, self%tod(j,1), self%mask(j,1) +!!$ end do +!!$ close(58) + + end subroutine demodulate_tod + + + module subroutine read_tod_inst_HFI(self, file) + ! + ! Reads HFI-specific common fields from TOD fileset + ! + ! Arguments: + ! ---------- + ! self: derived class (comm_HFI_tod) + ! HFI-specific TOD object + ! file: derived type (hdf_file) + ! Already open HDF file handle; only root includes this + ! + ! Returns + ! ---------- + ! None, but updates self + ! + implicit none + class(comm_HFI_tod), intent(inout) :: self + type(hdf_file), intent(in), optional :: file + end subroutine read_tod_inst_HFI + + module subroutine read_scan_inst_HFI(self, file, slabel, detlabels, scan) + ! + ! Reads HFI-specific scan information from TOD fileset + ! + ! Arguments: + ! ---------- + ! self: derived class (comm_HFI_tod) + ! HFI-specific TOD object + ! file: derived type (hdf_file) + ! Already open HDF file handle + ! slabel: string + ! Scan label, e.g., "000001/" + ! detlabels: string (array) + ! Array of detector labels, e.g., ["27M", "27S"] + ! scan: derived class (comm_scan) + ! Scan object + ! + ! Returns + ! ---------- + ! None, but updates scan object + ! + implicit none + class(comm_HFI_tod), intent(in) :: self + type(hdf_file), intent(in) :: file + character(len=*), intent(in) :: slabel + character(len=*), dimension(:), intent(in) :: detlabels + class(comm_scan), intent(inout) :: scan + end subroutine read_scan_inst_HFI + + module subroutine initHDF_HFI(self, chainfile, path) + ! + ! Initializes HFI-specific TOD parameters from existing chain file + ! + ! Arguments: + ! ---------- + ! self: derived class (comm_HFI_tod) + ! HFI-specific TOD object + ! chainfile: derived type (hdf_file) + ! Already open HDF file handle to existing chainfile + ! path: string + ! HDF path to current dataset, e.g., "000001/tod/030" + ! + ! Returns + ! ---------- + ! None + ! + implicit none + class(comm_HFI_tod), intent(inout) :: self + type(hdf_file), intent(in) :: chainfile + character(len=*), intent(in) :: path + end subroutine initHDF_HFI + + module subroutine dumpToHDF_HFI(self, chainfile, path) + ! + ! Writes HFI-specific TOD parameters to existing chain file + ! + ! Arguments: + ! ---------- + ! self: derived class (comm_HFI_tod) + ! HFI-specific TOD object + ! chainfile: derived type (hdf_file) + ! Already open HDF file handle to existing chainfile + ! path: string + ! HDF path to current dataset, e.g., "000001/tod/030" + ! + ! Returns + ! ---------- + ! None + ! + implicit none + class(comm_HFI_tod), intent(in) :: self + type(hdf_file), intent(in) :: chainfile + character(len=*), intent(in) :: path + end subroutine dumpToHDF_HFI + + module subroutine construct_corrtemp_hfi(self, scan, pix, psi, s) + ! Construct an LFI instrument-specific correction template; for now contains 1Hz template only + ! + ! Arguments: + ! ---------- + ! self: comm_tod object + ! + ! scan: int + ! scan number + ! pix: int + ! index for pixel + ! psi: int + ! integer label for polarization angle + ! + ! Returns: + ! -------- + ! s: real (sp) + ! output template timestream + implicit none + class(comm_hfi_tod), intent(in) :: self + integer(i4b), intent(in) :: scan + integer(i4b), dimension(:,:), intent(in) :: pix, psi + real(sp), dimension(:,:), intent(out) :: s + + integer(i4b) :: i, j, k, nbin, b + real(dp) :: dt, t_tot, t + + s = 0. + + end subroutine construct_corrtemp_hfi + + module subroutine apply_nonlin_corr_hfi(self, scan, sd) + ! Construct and apply HFI instrument-specific non-linear corrections + ! + ! Arguments: + ! ---------- + ! self: comm_tod object + ! + ! scan: int + ! scan number + ! + ! sd: comm_scandata + ! structure holding the scan data + ! + ! Returns: + ! -------- + ! s: real (sp) + ! output template timestream + implicit none + class(comm_hfi_tod), intent(in) :: self + integer(i4b), intent(in) :: scan + class(comm_scandata), intent(inout) :: sd + + ! Apply ADC corrections to raw self%tod + ! Not implemented yet + + ! Demodulate TOD + call demodulate_tod(sd, self, scan) + + end subroutine apply_nonlin_corr_hfi + + module subroutine stitch_hfi_dc_level(self, scan, sd) + ! Construct and apply HFI instrument-specific non-linear corrections + ! + ! Arguments: + ! ---------- + ! self: comm_tod object + ! + ! scan: int + ! scan number + ! sd: comm_scandata object + ! structure holding the data for each scan + ! + implicit none + class(comm_hfi_tod), intent(in) :: self + integer(i4b), intent(in) :: scan + class(comm_scandata), intent(inout) :: sd + + !estimate dc levels between jumps and then update sd%tod to be flat + + end subroutine stitch_hfi_dc_level + + module subroutine hfi_dark_correction(self, scan, sd) + ! Construct and apply HFI instrument-specific corrections + ! from dark bolometer timestreams + ! + ! Arguments: + ! ---------- + ! self: comm_tod object + ! + ! scan: int + ! scan number + ! sd: comm_scandata object + ! structure holding the data for each scan + ! + implicit none + class(comm_hfi_tod), intent(in) :: self + integer(i4b), intent(in) :: scan + class(comm_scandata), intent(inout) :: sd + + !estimate dark correction then update sd%tod to be flat + + end subroutine hfi_dark_correction + + module subroutine estimate_hfi_4k_lines(self, scan, sd) + ! Construct and apply HFI instrument-specific corrections + ! from 4k lines + ! + ! Arguments: + ! ---------- + ! self: comm_tod object + ! + ! scan: int + ! scan number + ! sd: comm_scandata object + ! structure holding the data for each scan + ! + implicit none + class(comm_hfi_tod), intent(in) :: self + integer(i4b), intent(in) :: scan + class(comm_scandata), intent(inout) :: sd + + !estimate 4k line signal + + end subroutine estimate_hfi_4k_lines + + +end submodule comm_tod_hfi_mod diff --git a/commander3/src/comm_tod_lb_mod.f90 b/commander3/src/comm_tod_lb_mod.f90 index 48d9874de..09a2f08da 100644 --- a/commander3/src/comm_tod_lb_mod.f90 +++ b/commander3/src/comm_tod_lb_mod.f90 @@ -32,6 +32,7 @@ module comm_tod_LB_mod ! use comm_tod_mod use comm_tod_driver_mod + use comm_conviqt_mod implicit none !private @@ -327,11 +328,11 @@ subroutine process_LB_tod(self, chaindir, chain, iter, handle, map_in, delta, ma ! Prepare data if (sample_rel_bandpass) then ! if (.true. .or. self%myid == 78) write(*,*) 'b', self%myid, self%correct_sl, self%ndet, self%slconv(1)%p%psires - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_bp_prop=.true.) + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_bp_prop=.true.) else if (sample_abs_bandpass) then - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_sky_prop=.true.) + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_sky_prop=.true.) else - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true.) + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true.) end if allocate(s_buf(sd%ntod,sd%ndet)) @@ -377,7 +378,7 @@ subroutine process_LB_tod(self, chaindir, chain, iter, handle, map_in, delta, ma end if ! Clean up - call sd%dealloc + call dealloc_scan_data(sd) deallocate(s_buf, d_calib) end do diff --git a/commander3/src/comm_tod_lfi_mod.f90 b/commander3/src/comm_tod_lfi_mod.f90 index be1b8ad82..481051563 100644 --- a/commander3/src/comm_tod_lfi_mod.f90 +++ b/commander3/src/comm_tod_lfi_mod.f90 @@ -31,6 +31,7 @@ module comm_tod_lfi_mod ! process_LFI_tod(self, chaindir, chain, iter, handle, map_in, delta, map_out, rms_out) ! Routine which processes the time ordered data ! + use comm_conviqt_mod use comm_tod_driver_mod implicit none diff --git a/commander3/src/comm_tod_lfi_smod.f90 b/commander3/src/comm_tod_lfi_smod.f90 index 7b9e5b1eb..b15e9b284 100644 --- a/commander3/src/comm_tod_lfi_smod.f90 +++ b/commander3/src/comm_tod_lfi_smod.f90 @@ -65,7 +65,7 @@ module function constructor_lfi(handle, cpar, id, id_abs, info, tod_type) result logical(lgt) :: pol_beam character(len=50) :: name character(len=6) :: itext - character(len=512) :: chainfile, path + character(len=2048) :: chainfile, path type(hdf_file) :: init_file real(dp), dimension(:), allocatable :: nus @@ -531,10 +531,10 @@ module function constructor_lfi(handle, cpar, id, id_abs, info, tod_type) result call update_status(status, "init_noise_filter_from_chain") ! init the noise filter from chain if we are not computing it - if(trim(res%init_from_HDF) == 'default') then - call get_chainfile_and_samp(cpar%init_chain_prefix, chainfile, initsamp) - else if(trim(res%init_from_HDF) == 'none') then + if(trim(res%init_from_HDF) == 'none' .or. cpar%init_chain_prefix == 'none') then chainfile = "" + else if(trim(res%init_from_HDF) == 'default') then + call get_chainfile_and_samp(cpar%init_chain_prefix, chainfile, initsamp) else call get_chainfile_and_samp(res%init_from_HDF, chainfile, initsamp) end if @@ -658,7 +658,7 @@ module subroutine process_lfi_tod(self, chaindir, chain, iter, handle, map_in, d type(comm_scandata) :: sd character(len=4) :: ctext, myid_text character(len=6) :: samptext, scantext - character(len=512) :: prefix, postfix, prefix4D, filename, Sfilename + character(len=512) :: prefix, postfix, prefix4D, filename, Sfilename, prefix_nplus2 character(len=512), allocatable, dimension(:) :: slist real(sp), allocatable, dimension(:) :: procmask, procmask2, sigma0 real(sp), allocatable, dimension(:,:,:) :: d_calib @@ -672,30 +672,36 @@ module subroutine process_lfi_tod(self, chaindir, chain, iter, handle, map_in, d call timer%start(TOD_ALLOC, self%band) ! Toggle optional operations - sample_rel_bandpass = .not. self%sample_abs_bp .or. (size(delta,3) > 1 .and. mod(iter,2) == 0) ! Sample relative bandpasses if more than one proposal sky - sample_abs_bandpass = self%sample_abs_bp .and. (size(delta,3) > 1 .and. mod(iter,2) == 1) ! sample absolute bandpasses + sample_rel_bandpass = .false. !.not. self%sample_abs_bp .or. (size(delta,3) > 1 .and. mod(iter,2) == 0) ! Sample relative bandpasses if more than one proposal sky + sample_abs_bandpass = self%sample_abs_bp .and. (size(delta,3) > 1 .and. mod(iter,2) == 1) ! sample absolute bandpasses sample_polang = .false. select_data = self%first_call ! only perform data selection the first time output_scanlist = mod(iter-1,1) == 0 ! only output scanlist every 10th iteration - sample_rel_bandpass = sample_rel_bandpass .and. .not. self%enable_tod_simulations + sample_rel_bandpass = .false. !sample_rel_bandpass .and. .not. self%enable_tod_simulations sample_abs_bandpass = sample_abs_bandpass .and. .not. self%enable_tod_simulations ! Initialize local variables ndelta = size(delta,3) self%n_bp_prop = ndelta-1 nside = map_out%info%nside + nmaps = map_out%info%nmaps + if(nmaps > 3) nmaps = 3 + npix = 12*nside**2 self%output_n_maps = 3 if (self%output_aux_maps > 0) then if (mod(iter-1,self%output_aux_maps) == 0) self%output_n_maps = 8 end if + !self%output_n_maps = 1 + call int2string(chain, ctext) call int2string(iter, samptext) call int2string(self%myid, myid_text) prefix = trim(chaindir) // '/tod_' // trim(self%freq) // '_' + prefix_nplus2 = trim(chaindir) // '/tod_' postfix = '_c' // ctext // '_k' // samptext // '.fits' ! Distribute maps @@ -768,11 +774,15 @@ module subroutine process_lfi_tod(self, chaindir, chain, iter, handle, map_in, d call sample_calibration(self, 'abscal', handle, map_sky, m_gain, procmask, procmask2); call update_status(status, "tod_gain1") call sample_calibration(self, 'relcal', handle, map_sky, m_gain, procmask, procmask2); call update_status(status, "tod_gain2") call sample_calibration(self, 'deltaG', handle, map_sky, m_gain, procmask, procmask2); call update_status(status, "tod_gain3") - !call sample_gain_psd(self, handle) + call sample_gain_psd(self, handle) end if ! Prepare intermediate data structures - call binmap%init(self, .true., sample_rel_bandpass) + if(self%map_type == 'nplus2') then + call binmap%init(self, .true., .false., nplus2=.true.) + else if (self%map_type == 'binned') then + call binmap%init(self, .true., sample_rel_bandpass) + end if if (sample_abs_bandpass .or. sample_rel_bandpass) then call timer%start(TOD_ALLOC, self%band) allocate(chisq_S(self%ndet,size(delta,3))) @@ -795,11 +805,11 @@ module subroutine process_lfi_tod(self, chaindir, chain, iter, handle, map_in, d ! Prepare data if (sample_rel_bandpass) then ! if (.true. .or. self%myid == 78) write(*,*) 'b', self%myid, self%correct_sl, self%ndet, self%slconv(1)%p%psires - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_bp_prop=.true.) + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_bp_prop=.true.) else if (sample_abs_bandpass) then - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_sky_prop=.true.) + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_sky_prop=.true.) else - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true.) + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true.) end if ! Make simulations, or draw correlated noise @@ -867,7 +877,7 @@ module subroutine process_lfi_tod(self, chaindir, chain, iter, handle, map_in, d end if ! Clean up - call sd%dealloc + call dealloc_scan_data(sd) call timer%start(TOD_ALLOC, self%band) deallocate(d_calib) call timer%stop(TOD_ALLOC, self%band) @@ -888,10 +898,21 @@ module subroutine process_lfi_tod(self, chaindir, chain, iter, handle, map_in, d if (sample_rel_bandpass) then Sfilename = trim(prefix) // 'Smap'// trim(postfix) call finalize_binned_map(self, binmap, rms_out, 1.d6, chisq_S=chisq_S, mask=procmask2) + map_out%map = binmap%outmaps(1)%p%map + else if(self%map_type == 'nplus2') then + call finalize_binned_map_nplus2(self, binmap, rms_out, 1.d6) + !Q+U maps + map_out%map(:,2:3) = binmap%outmaps(1)%p%map(:,2:3) + do i = 1, self%ndet + ! I maps for each detector + map_out%map(:,i+3) = binmap%outmaps(i)%p%map(:,1) + end do + ! mean I map + map_out%map(:,1) = 0.d0 else call finalize_binned_map(self, binmap, rms_out, 1.d6) + map_out%map = binmap%outmaps(1)%p%map end if - map_out%map = binmap%outmaps(1)%p%map ! Sample bandpass parameters if (sample_rel_bandpass .or. sample_abs_bandpass) then @@ -899,17 +920,37 @@ module subroutine process_lfi_tod(self, chaindir, chain, iter, handle, map_in, d self%bp_delta = delta(:,:,1) end if - call timer%start(TOD_WRITE) - ! Output maps to disk - call map_out%writeFITS(trim(prefix)//'map'//trim(postfix)) - call rms_out%writeFITS(trim(prefix)//'rms'//trim(postfix)) - if (self%output_n_maps > 1) call binmap%outmaps(2)%p%writeFITS(trim(prefix)//'res'//trim(postfix)) - if (self%output_n_maps > 2) call binmap%outmaps(3)%p%writeFITS(trim(prefix)//'ncorr'//trim(postfix)) - if (self%output_n_maps > 3) call binmap%outmaps(4)%p%writeFITS(trim(prefix)//'bpcorr'//trim(postfix)) - if (self%output_n_maps > 4) call binmap%outmaps(5)%p%writeFITS(trim(prefix)//'orb'//trim(postfix)) - if (self%output_n_maps > 5) call binmap%outmaps(6)%p%writeFITS(trim(prefix)//'sl'//trim(postfix)) - if (self%output_n_maps > 6) call binmap%outmaps(7)%p%writeFITS(trim(prefix)//'zodi'//trim(postfix)) - if (self%output_n_maps > 7) call binmap%outmaps(8)%p%writeFITS(trim(prefix)//'1hz'//trim(postfix)) + call timer%start(TOD_WRITE) + if(self%map_type == 'binned') then + ! Output maps to disk + call map_out%writeFITS(trim(prefix)//'map'//trim(postfix)) + call rms_out%writeFITS(trim(prefix)//'rms'//trim(postfix)) + if (self%output_n_maps > 1) call binmap%outmaps(2)%p%writeFITS(trim(prefix)//'res'//trim(postfix)) + if (self%output_n_maps > 2) call binmap%outmaps(3)%p%writeFITS(trim(prefix)//'ncorr'//trim(postfix)) + if (self%output_n_maps > 3) call binmap%outmaps(4)%p%writeFITS(trim(prefix)//'bpcorr'//trim(postfix)) + if (self%output_n_maps > 4) call binmap%outmaps(5)%p%writeFITS(trim(prefix)//'orb'//trim(postfix)) + if (self%output_n_maps > 5) call binmap%outmaps(6)%p%writeFITS(trim(prefix)//'sl'//trim(postfix)) + if (self%output_n_maps > 6) call binmap%outmaps(7)%p%writeFITS(trim(prefix)//'zodi'//trim(postfix)) + if (self%output_n_maps > 7) call binmap%outmaps(8)%p%writeFITS(trim(prefix)//'1hz'//trim(postfix)) + else if(self%map_type == 'nplus2') then + do i = 1, self%ndet + call binmap%outmaps(i)%p%writeFITS(trim(prefix_nplus2) // trim(self%label(i)) //"_map"//trim(postfix)) + ! copy rms map for each detector into outmaps(0) + binmap%outmaps(i)%p%map(:,1) = rms_out%map(:,i) + binmap%outmaps(i)%p%map(:,2:3) = rms_out%map(:,self%ndet+1:self%ndet+2) + call binmap%outmaps(i)%p%writeFITS(trim(prefix_nplus2) // trim(self%label(i)) //"_rms"//trim(postfix)) + !call rms_out%writeFITS + if(self%output_n_maps > 1) call binmap%outmaps(i+self%ndet)%p%writeFITS(trim(prefix_nplus2) // trim(self%label(i)) //"_res"//trim(postfix)) + if(self%output_n_maps > 2) call binmap%outmaps(i+2*self%ndet)%p%writeFITS(trim(prefix_nplus2) // trim(self%label(i)) //"_ncorr"//trim(postfix)) + if(self%output_n_maps > 3) call binmap%outmaps(i+3*self%ndet)%p%writeFITS(trim(prefix_nplus2) // trim(self%label(i)) //"_bpcorr"//trim(postfix)) + if(self%output_n_maps > 4) call binmap%outmaps(i+4*self%ndet)%p%writeFITS(trim(prefix_nplus2) // trim(self%label(i)) //"_orb"//trim(postfix)) + if(self%output_n_maps > 5) call binmap%outmaps(i+5*self%ndet)%p%writeFITS(trim(prefix_nplus2) // trim(self%label(i)) //"_sl"//trim(postfix)) + if(self%output_n_maps > 6) call binmap%outmaps(i+6*self%ndet)%p%writeFITS(trim(prefix_nplus2) // trim(self%label(i)) //"_zodi"//trim(postfix)) + if(self%output_n_maps > 7) call binmap%outmaps(i+7*self%ndet)%p%writeFITS(trim(prefix_nplus2) // trim(self%label(i)) //"_1hz"//trim(postfix)) + end do + else + if (self%myid == 0) write(*,*) "Unknown map_type in LFI output:", self%map_type + end if call timer%stop(TOD_WRITE) ! Clean up @@ -1544,13 +1585,13 @@ module subroutine dumpToHDF_lfi(self, chainfile, path) real(dp), allocatable, dimension(:,:,:) :: R, R_tot real(dp), allocatable, dimension(:,:,:,:) :: ref_filter, adc_corr - allocate(amp(self%nscan_tot,self%ndet), amp_tot(self%nscan_tot,self%ndet)) + allocate(amp(self%last_scan,self%ndet), amp_tot(self%last_scan,self%ndet)) amp = 0.d0 amp(self%scanid,:) = self%spike_amplitude call mpi_reduce(amp, amp_tot, size(amp), MPI_DOUBLE_PRECISION, MPI_SUM, 0, self%info%comm, ierr) if (trim(self%level) == 'L1') then - allocate(R(self%nscan_tot,self%ndet,size(self%R,3)),R_tot(self%nscan_tot,self%ndet,size(self%R,3))) + allocate(R(self%last_scan,self%ndet,size(self%R,3)),R_tot(self%last_scan,self%ndet,size(self%R,3))) R = 0.d0 R(self%scanid,:,:) = self%R call mpi_reduce(R, R_tot, size(R), MPI_DOUBLE_PRECISION, MPI_SUM, 0, self%info%comm, ierr) @@ -1636,7 +1677,7 @@ module subroutine sample_1Hz_spikes(tod, handle, map_sky, m_gain, procmask, proc ! Prepare data tod%apply_inst_corr = .false. ! Disable 1Hz correction for just this call - call sd%init_singlehorn(tod, i, map_sky, m_gain, procmask, procmask2) + call init_scan_data_singlehorn(sd, tod, i, map_sky, m_gain, procmask, procmask2) tod%apply_inst_corr = .true. ! Enable 1Hz correction again call timer%start(TOD_1HZ, tod%band) @@ -1693,7 +1734,7 @@ module subroutine sample_1Hz_spikes(tod, handle, map_sky, m_gain, procmask, proc !!$ end if ! Clean up - call sd%dealloc + call dealloc_scan_data(sd) deallocate(res) call timer%stop(TOD_1HZ, tod%band) end do diff --git a/commander3/src/comm_tod_mapmaking_mod.f90 b/commander3/src/comm_tod_mapmaking_mod.f90 index eeb60d1f9..fd629ca00 100644 --- a/commander3/src/comm_tod_mapmaking_mod.f90 +++ b/commander3/src/comm_tod_mapmaking_mod.f90 @@ -21,11 +21,12 @@ module comm_tod_mapmaking_mod use comm_tod_mod use comm_shared_arr_mod + use comm_map_mod implicit none type comm_binmap integer(i4b) :: ncol, n_A, nout, nobs, npix, numprocs_shared, chunk_size - logical(lgt) :: shared, solve_S + logical(lgt) :: shared, solve_S, solve_nplus2 type(shared_2d_dp) :: sA_map type(shared_3d_dp) :: sb_map class(map_ptr), allocatable, dimension(:) :: outmaps @@ -39,13 +40,15 @@ module comm_tod_mapmaking_mod contains - subroutine init_binmap(self, tod, shared, solve_S) + subroutine init_binmap(self, tod, shared, solve_S, nplus2) implicit none - class(comm_binmap), intent(inout) :: self - class(comm_tod), intent(in) :: tod - logical(lgt), intent(in) :: shared, solve_S + class(comm_binmap), intent(inout) :: self + class(comm_tod), intent(in) :: tod + logical(lgt), intent(in) :: shared, solve_S + logical(lgt), optional, intent(in) :: nplus2 integer(i4b) :: i, ierr + class(comm_mapinfo), allocatable :: mapinfo_nplus2 call timer%start(TOD_ALLOC, tod%band) self%nobs = tod%nobs @@ -54,11 +57,29 @@ subroutine init_binmap(self, tod, shared, solve_S) self%npix = tod%info%npix self%numprocs_shared = tod%numprocs_shared self%chunk_size = self%npix/self%numprocs_shared + self%solve_nplus2 = .false. + if(present(nplus2)) self%solve_nplus2 = nplus2 + if (solve_S) then + if(self%solve_nplus2) then + write(*,*) "Cannot solve for spurious maps and n+2 mapmaking" + stop + end if self%ncol = tod%nmaps + tod%ndet - 1 self%n_A = tod%nmaps*(tod%nmaps+1)/2 + 4*(tod%ndet-1) self%nout = tod%output_n_maps + tod%n_bp_prop !write(*,*) 'hei!', size(tod%bp_delta,2) + else if(self%solve_nplus2) then + if(tod%nmaps /= tod%ndet + 3) then + write(*,*) "Cannot use n+2 mapmaking for nmaps=", tod%nmaps + stop + end if + self%ncol = tod%nmaps - 1 + self%n_A = 3*tod%ndet + 3 + self%nout = tod%output_n_maps *tod%ndet + + mapinfo_nplus2 = comm_mapinfo(tod%info%comm, tod%info%nside, tod%info%lmax, 3, tod%info%pol) + else self%ncol = tod%nmaps self%n_A = tod%nmaps*(tod%nmaps+1)/2 @@ -67,7 +88,11 @@ subroutine init_binmap(self, tod, shared, solve_S) !write(*,*) 'nout = ', tod%output_n_maps, self%nout allocate(self%outmaps(self%nout)) do i = 1, self%nout - self%outmaps(i)%p => comm_map(tod%info) + if(self%solve_nplus2)then + self%outmaps(i)%p => comm_map(mapinfo_nplus2) + else + self%outmaps(i)%p => comm_map(tod%info) + end if end do allocate(self%A_map(self%n_A,self%nobs), self%b_map(self%nout,self%ncol,self%nobs)) self%A_map = 0.d0; self%b_map = 0.d0 @@ -185,7 +210,8 @@ subroutine bin_TOD(tod, scan, pix, psi, flag, data, binmap) nout = size(data,1) do det = 1, size(pix,2) ! loop over all the detectors if (.not. tod%scans(scan)%d(det)%accept) cycle - off = 6 + 4*(det-1) + off = tod%output_n_maps + 4*(det-1) + if(binmap%solve_nplus2) off = 6 + 3*(det-2) inv_sigmasq = (tod%scans(scan)%d(det)%gain/tod%scans(scan)%d(det)%N_psd%sigma0)**2 do t = 1, size(pix,1) @@ -194,18 +220,27 @@ subroutine bin_TOD(tod, scan, pix, psi, flag, data, binmap) pix_ = tod%pix2ind(pix(t,det)) ! pixel index for pix t and detector det psi_ = psi(t,det) - binmap%A_map(1,pix_) = binmap%A_map(1,pix_) + 1.d0 * inv_sigmasq + if((.not. binmap%solve_nplus2) .or. det == 1) then + binmap%A_map(1,pix_) = binmap%A_map(1,pix_) + 1.d0 * inv_sigmasq + end if if(tod%nmaps > 1) then - binmap%A_map(2,pix_) = binmap%A_map(2,pix_) + tod%cos2psi(psi_) * inv_sigmasq + if((.not. binmap%solve_nplus2) .or. det == 1) then + binmap%A_map(2,pix_) = binmap%A_map(2,pix_) + tod%cos2psi(psi_) * inv_sigmasq + binmap%A_map(4,pix_) = binmap%A_map(4,pix_) + tod%sin2psi(psi_) * inv_sigmasq + end if + binmap%A_map(3,pix_) = binmap%A_map(3,pix_) + tod%cos2psi(psi_)**2 * inv_sigmasq - binmap%A_map(4,pix_) = binmap%A_map(4,pix_) + tod%sin2psi(psi_) * inv_sigmasq binmap%A_map(5,pix_) = binmap%A_map(5,pix_) + tod%cos2psi(psi_)*tod%sin2psi(psi_) * inv_sigmasq binmap%A_map(6,pix_) = binmap%A_map(6,pix_) + tod%sin2psi(psi_)**2 * inv_sigmasq !binmap%A_map(1,pix_) = binmap%A_map(8,pix_) + 1.d0 end if do i = 1, nout - binmap%b_map(i,1,pix_) = binmap%b_map(i,1,pix_) + data(i,t,det) * inv_sigmasq + if((.not. binmap%solve_nplus2) .or. det == 1) then + binmap%b_map(i,1,pix_) = binmap%b_map(i,1,pix_) + data(i,t,det) * inv_sigmasq + else + binmap%b_map(i,det+2,pix_) = binmap%b_map(i,det+2,pix_) + data(i,t,det) * inv_sigmasq + end if if(tod%nmaps > 1) then binmap%b_map(i,2,pix_) = binmap%b_map(i,2,pix_) + data(i,t,det) * tod%cos2psi(psi_) * inv_sigmasq binmap%b_map(i,3,pix_) = binmap%b_map(i,3,pix_) + data(i,t,det) * tod%sin2psi(psi_) * inv_sigmasq @@ -222,8 +257,20 @@ subroutine bin_TOD(tod, scan, pix, psi, flag, data, binmap) do i = 1, nout binmap%b_map(i,det+3,pix_) = binmap%b_map(i,det+3,pix_) + data(i,t,det) * inv_sigmasq end do - end if - + else if(binmap%solve_nplus2 .and. det > 1) then + binmap%A_map(off+1,pix_) = binmap%A_map(off+1,pix_) + 1.d0 *inv_sigmasq + binmap%A_map(off+2,pix_) = binmap%A_map(off+2,pix_) + tod%cos2psi(psi_) * inv_sigmasq + binmap%A_map(off+3,pix_) = binmap%A_map(off+3,pix_) + tod%sin2psi(psi_) * inv_sigmasq + end if + +! if(pix_ == 1 .and. det==2) then +! write(*,*) "Id", tod%myid +! write(*,*) "A" +! write(*,*) binmap%A_map(:,pix_) +! write(*,*) "B" +! write(*,*) binmap%b_map(1, :, pix_) +! end if + end do end do @@ -481,7 +528,7 @@ subroutine compute_Ax(tod, x_imarr, pmask, comp_S, M_diag, split, x, y, x_in, y_ end subroutine compute_Ax - subroutine finalize_binned_map_unpol(tod, binmap, rms, scale, chisq_S, mask) + subroutine finalize_binned_map_unpol(tod, binmap, rms, scale, chisq_S, mask, correct_transfer) ! ! Routine to finalize temperature-only binned maps ! @@ -501,6 +548,7 @@ subroutine finalize_binned_map_unpol(tod, binmap, rms, scale, chisq_S, mask) real(dp), intent(in) :: scale real(dp), dimension(1:,1:), intent(out), optional :: chisq_S real(sp), dimension(0:), intent(in), optional :: mask + logical(lgt), intent(in), optional :: correct_transfer integer(i4b) :: i, j, k, nmaps, ierr, ndet, ncol, n_A, off, ndelta @@ -509,6 +557,10 @@ subroutine finalize_binned_map_unpol(tod, binmap, rms, scale, chisq_S, mask) real(dp), allocatable, dimension(:,:,:) :: b_tot, bs_tot real(dp), allocatable, dimension(:) :: W, eta real(dp), allocatable, dimension(:,:) :: A_tot + logical(lgt) :: correct_transfer_ + + correct_transfer_ = .false. + if(present(correct_transfer)) correct_transfer_ = correct_transfer myid = tod%myid nprocs= tod%numprocs @@ -603,6 +655,171 @@ subroutine finalize_binned_map_unpol(tod, binmap, rms, scale, chisq_S, mask) end subroutine finalize_binned_map_unpol + subroutine finalize_binned_map_nplus2(tod, binmap, rms, scale, mask, correct_transfer) + ! + ! Routine to finalize the binned maps + ! Makes one T map per detector but joint Q+U maps + ! + ! Arguments: + ! ---------- + ! tod: + ! binmap: + ! rms: + ! scale + ! mask + ! + implicit none + class(comm_tod), intent(in) :: tod + type(comm_binmap), intent(inout) :: binmap + class(comm_map), intent(inout) :: rms + real(dp), intent(in) :: scale + real(sp), dimension(0:), intent(in), optional :: mask + logical(lgt), intent(in), optional :: correct_transfer + + logical(lgt) :: correct_transfer_ + integer(i4b) :: i, j, k, p, nmaps, ierr, ndet, ncol, n_A, off, ndelta + integer(i4b) :: det, nout, np0, comm, myid, nprocs + real(dp), allocatable, dimension(:,:) :: A_inv, As_inv + real(dp), allocatable, dimension(:,:,:) :: b_tot, bs_tot + real(dp), allocatable, dimension(:) :: W, eta, b_copy + real(dp), allocatable, dimension(:,:) :: A_tot + + correct_transfer_ = .false. + if(present(correct_transfer)) correct_transfer_ = correct_transfer + + myid = tod%myid + nprocs= tod%numprocs + comm = tod%comm + np0 = tod%info%np + nout = size(binmap%sb_map%a,dim=1) + nmaps = tod%info%nmaps + ndet = tod%ndet + n_A = size(binmap%sA_map%a,dim=1) + ncol = size(binmap%sb_map%a,dim=2) + + allocate(b_copy(ndet+2)) + + if(tod%myid == 0) then + write(*,*) 'A_start', tod%myid, binmap%sA_map%a(:,1) + write(*,*) 'B_start', tod%myid, binmap%sb_map%a(1,:,1) + end if + + ! Collect contributions from all nodes + call mpi_win_fence(0, binmap%sA_map%win, ierr) + if (binmap%sA_map%myid_shared == 0) then + do i = 1, size(binmap%sA_map%a, 1) + call mpi_allreduce(MPI_IN_PLACE, binmap%sA_map%a(i, :), size(binmap%sA_map%a, 2), & + & MPI_DOUBLE_PRECISION, MPI_SUM, binmap%sA_map%comm_inter, ierr) + end do + end if + call mpi_win_fence(0, binmap%sA_map%win, ierr) + call mpi_win_fence(0, binmap%sb_map%win, ierr) + if (binmap%sb_map%myid_shared == 0) then + do i = 1, size(binmap%sb_map%a, 1) + call mpi_allreduce(mpi_in_place, binmap%sb_map%a(i, :, :), size(binmap%sb_map%a(1, :, :)), & + & MPI_DOUBLE_PRECISION, MPI_SUM, binmap%sb_map%comm_inter, ierr) + end do + end if + call mpi_win_fence(0, binmap%sb_map%win, ierr) + + allocate (A_tot(n_A, 0:np0 - 1), b_tot(nout, ndet+2, 0:np0 - 1), bs_tot(nout, ncol, 0:np0 - 1), W(nmaps), eta(nmaps)) + A_tot = binmap%sA_map%a(:, tod%info%pix + 1) + b_tot(:,:,0:np0-1) = binmap%sb_map%a(:, 1:ndet+2, tod%info%pix + 1) + bs_tot = binmap%sb_map%a(:, :, tod%info%pix + 1) + + ! Solve for local map and rms + allocate (A_inv(ndet+2, ndet+2), As_inv(ncol, ncol)) + do i = 0, np0 - 1 + if (all(b_tot(1, :, i) == 0.d0)) then + rms%map(i, :) = 0.d0 + do k = 1, nout + binmap%outmaps(k)%p%map(i, :) = 0.d0 + end do + cycle + end if + + A_inv = 0.d0 + ! First detector T + A_inv(1, 1) = A_tot(1,i) + A_inv(1, ndet+1) = A_tot(2,i) + A_inv(1, ndet+2) = A_tot(4,i) + A_inv(ndet+1, 1) = A_tot(2,i) + A_inv(ndet+2, 1) = A_tot(4,i) + ! Other detectors T + do j=2, ndet + A_inv(j,j) = A_tot(7+3*(j-2), i) + A_inv(j,ndet+1) = A_tot(8+3*(j-2), i) + A_inv(j,ndet+2) = A_tot(9+3*(j-2), i) + A_inv(ndet+1,j) = A_inv(j,ndet+1) + A_inv(ndet+2,j) = A_inv(j,ndet+2) + end do + + ! Polarization + A_inv(ndet+1,ndet+1) = A_tot(3, i) + A_inv(ndet+2,ndet+2) = A_tot(6, i) + A_inv(ndet+1,ndet+2) = A_tot(5, i) + A_inv(ndet+2,ndet+1) = A_tot(5, i) + + if(tod%myid == 0 .and. i==0) write(*,*) "A for pix=", i + do j=1, ndet+2 + if(tod%myid == 0 .and. i==0) write(*,*) A_inv(:, j) + end do + + ! Can I return the condition number? + call invert_singular_matrix(A_inv, 1d-12) + if(tod%myid == 0 .and. i==0) write(*,*) "A^-1" + do j=1, ndet+2 + if(tod%myid == 0 .and. i ==0) write(*,*) A_inv(:, j) + end do + + do k = 1, tod%output_n_maps + b_copy(1) = b_tot(k, 1, i) + b_copy(2:ndet) = b_tot(k, 4:ndet+2, i) + b_copy(ndet+1) = b_tot(k, 2, i) + b_copy(ndet+2) = b_tot(k, 3, i) + if(tod%myid == 0 .and. k == 1 .and. i == 0) write(*,*) "B" + if(tod%myid == 0 .and. k == 1 .and. i == 0) write(*,*) b_copy + b_tot(k, 1:ndet+2, i) = matmul(A_inv, b_copy) + end do + + if(tod%myid == 0 .and. i == 0) write(*,*) "A^-1 B" + if(tod%myid == 0 .and. i == 0) write(*,*) b_tot(1,:,i) + + ! Store map in correct units + do p = 1, tod%ndet + do k = 1, tod%output_n_maps + ! T component + binmap%outmaps((k-1) * tod%ndet + p)%p%map(i, 1) = b_tot(k, p, i)*scale + ! Joint Q/U component copied into each map + binmap%outmaps((k-1) * tod%ndet + p)%p%map(i, 2) = b_tot(k, tod%ndet+1, i) + binmap%outmaps((k-1) * tod%ndet + p)%p%map(i, 3) = b_tot(k, tod%ndet+2, i) + + end do + end do + + ! Store N in correct units + if (rms%info%nmaps == tod%ndet + 3) then + ! Diagonal matrix; store RMS + do j = 2, rms%info%nmaps + rms%map(i,j) = sqrt(A_inv(j-1, j-1))*scale + end do + else + write(*,*) "Wrong RMS map size in finalize_binned_map_nplus2" + end if + !else if (rms%info%nmaps == 4) then + ! Block-diagonal T + QU; store N + ! rms%map(i,1) = A_inv(1,1)*scale**2 + ! rms%map(i,2) = A_inv(2,2)*scale**2 + ! rms%map(i,3) = A_inv(3,3)*scale**2 + ! rms%map(i,4) = A_inv(2,3)*scale**2 + !end if + end do + + deallocate (A_inv, As_inv, A_tot, b_tot, bs_tot, W, eta, b_copy) + + + end subroutine finalize_binned_map_nplus2 + subroutine finalize_binned_map(tod, binmap, rms, scale, chisq_S, mask) ! diff --git a/commander3/src/comm_tod_mod.f90 b/commander3/src/comm_tod_mod.f90 index 84b78fb30..853ede730 100644 --- a/commander3/src/comm_tod_mod.f90 +++ b/commander3/src/comm_tod_mod.f90 @@ -22,12 +22,18 @@ module comm_tod_mod use comm_fft_mod use comm_huffman_mod use comm_conviqt_mod + use comm_tod_cray_mod use comm_tod_orbdipole_mod use comm_tod_noise_psd_mod use comm_shared_arr_mod + use comm_utils + use comm_bp_mod USE ISO_C_BINDING implicit none + private + public comm_tod, comm_scan, comm_detscan, comm_scandata, initialize_tod_mod, fill_masked_region, fill_all_masked, tod_pointer, distribute_sky_maps + ! Structure for individual detectors type :: comm_detscan character(len=30) :: label ! Detector label @@ -36,6 +42,7 @@ module comm_tod_mod real(dp) :: chisq real(dp) :: chisq_prop real(dp) :: chisq_masked + real(dp) :: baseline1, baseline2 logical(lgt) :: accept class(comm_noise_psd), pointer :: N_psd ! Noise PSD object real(sp), allocatable, dimension(:) :: tod ! Detector values in time domain, (ntod) @@ -43,7 +50,7 @@ module comm_tod_mod real(sp), allocatable, dimension(:,:) :: diode ! (ndiode, ntod) array of undifferenced data type(byte_pointer), allocatable, dimension(:) :: zdiode ! pointers to the compressed undifferenced diode data, len (ndiode) byte, allocatable, dimension(:) :: flag ! Compressed detector flag; 0 is accepted, /= 0 is rejected - integer(i4b), allocatable, dimension(:,:) :: mask_dyn ! Dynamic online-generated mask, (2,ntod), each row gives a range of masked samples + integer(i4b), allocatable, dimension(:,:) :: mask_dyn ! Dynamic online-generated mask, (2,ntod), each row gives a range of masked sample type(byte_pointer), allocatable, dimension(:) :: pix ! pointer array of pixels length nhorn type(byte_pointer), allocatable, dimension(:) :: psi ! pointer array of psi, length nhorn integer(i4b), allocatable, dimension(:,:) :: offset_range ! Beginning and end tod index of every offset region @@ -51,20 +58,32 @@ module comm_tod_mod integer(i4b), allocatable, dimension(:,:) :: jumpflag_range ! Beginning and end tod index of regions where jumps occur real(dp), allocatable, dimension(:) :: baseline ! Polynomial coefficients for baseline function integer(i4b), allocatable, dimension(:,:) :: pix_sol ! Discretized pointing in solar centric coordinates, for zodi and sidelobe mapping - integer(i4b), allocatable, dimension(:,:) :: psi_sol ! Discretized polarization angle in solar centric coordinates, for zodi and sidelobe mapping + integer(i4b), allocatable, dimension(:,:) :: pix_moon ! Discretized pointing in Moon centric coordinates, for zodi and sidelobe mapping + real(sp), allocatable, dimension(:,:) :: earth_elon ! Earth elongation, for sidelobe mapping and masking ! Zodi sampling structures (downsampled and precomputed quantities. only allocated if zodi sampling is true) - logical(lgt), allocatable, dimension(:) :: zodi_glitch_mask - integer(i4b), allocatable, dimension(:) :: downsamp_pix - real(sp), allocatable, dimension(:) :: downsamp_tod - real(sp), allocatable, dimension(:) :: downsamp_sky - real(sp), allocatable, dimension(:) :: downsamp_zodi - real(sp), allocatable, dimension(:, :) :: downsamp_scat - real(sp), allocatable, dimension(:, :) :: downsamp_therm - real(sp), allocatable, dimension(:, :) :: downsamp_point ! (ntod,{lat_gal, lon_gal, lat_ecl, lon_ecl, solar elongation} - - real(sp), allocatable, dimension(:, :) :: s_scat_lowres - real(sp), allocatable, dimension(:, :) :: s_therm_lowres + logical(lgt), allocatable, dimension(:,:) :: zodi_sampgroup_mask + integer(i4b), allocatable, dimension(:) :: downsamp_pix_full + real(sp), allocatable, dimension(:) :: downsamp_tod_full + real(sp), allocatable, dimension(:) :: downsamp_sky_full + real(sp), allocatable, dimension(:,:) :: downsamp_point_full ! (ntod,{lat_gal, lon_gal, lat_ecl, lon_ecl, solar elongation} + real(sp), allocatable, dimension(:) :: downsamp_obs_time_full ! downsampled_obs_time used for zodi sampling +!!$ real(sp), allocatable, dimension(:) :: downsamp_zodi_full +!!$ real(sp), allocatable, dimension(:, :) :: downsamp_scat_full +!!$ real(sp), allocatable, dimension(:, :) :: downsamp_therm_full +!!$ real(sp), allocatable, dimension(:, :) :: s_scat_lowres_full +!!$ real(sp), allocatable, dimension(:, :) :: s_therm_lowres_full + + integer(i4b), allocatable, dimension(:) :: downsamp_pix + real(sp), allocatable, dimension(:) :: downsamp_tod + real(sp), allocatable, dimension(:) :: downsamp_sky + real(sp), allocatable, dimension(:,:) :: downsamp_point ! (ntod,{lat_gal, lon_gal, lat_ecl, lon_ecl, solar elongation} + real(sp), allocatable, dimension(:) :: downsamp_obs_time ! downsampled_obs_time used for zodi sampling +!!$ real(sp), allocatable, dimension(:) :: downsamp_zodi +!!$ real(sp), allocatable, dimension(:, :) :: downsamp_scat +!!$ real(sp), allocatable, dimension(:, :) :: downsamp_therm +!!$ real(sp), allocatable, dimension(:, :) :: s_scat_lowres +!!$ real(sp), allocatable, dimension(:, :) :: s_therm_lowres end type comm_detscan ! Stores information about all detectors at once @@ -75,17 +94,22 @@ module comm_tod_mod real(dp) :: n_proctime = 0 ! Number of completed loops real(dp) :: v_sun(3) ! Observatory velocity relative to Sun in km/s real(dp) :: t0(3) ! MJD, OBT, SCET for start of chunk - real(dp) :: t1(3) ! MJD, OBT, SCET for end f chunk + real(dp) :: t1(3) ! MJD, OBT, SCET for end of chunk real(dp) :: x0_obs(3) ! Observatory position (x,y,z) for start of chunk - real(dp) :: x1_obs(3) ! Observatory position (x,y,z) for end f chunk - real(dp) :: x0_earth(3) ! Observatory position (x,y,z) for start of chunk - real(dp) :: x1_earth(3) ! Observatory position (x,y,z) for end f chunk + real(dp) :: x1_obs(3) ! Observatory position (x,y,z) for end of chunk + real(dp) :: x0_earth(3) ! Earth position (x,y,z) for start of chunk + real(dp) :: x1_earth(3) ! Earth position (x,y,z) for end of chunk + + real(dp), allocatable, dimension(:,:) :: xarr_moon ! Moon positions + real(dp), allocatable, dimension(:,:) :: xarr_earth ! Earth positions + real(dp), allocatable, dimension(:,:) :: xarr_obs ! Observatory positions + real(dp), allocatable, dimension(:) :: time_arr ! Observatory positions + integer(i4b) :: n_interp ! Number of points used to interpolate type(huffcode) :: hkey ! Huffman decompression key type(huffcode) :: todkey ! Huffman decompression key integer(i4b) :: chunk_num ! Absolute number of chunk in the data files integer(i4b), allocatable, dimension(:,:) :: zext ! Extension of compressed diode arrays - real(sp), allocatable, dimension(:) :: downsamp_obs_time ! downsampled_obs_time used for zodi sampling class(comm_detscan), allocatable, dimension(:) :: d ! Array of all detectors end type comm_scan @@ -126,8 +150,9 @@ module comm_tod_mod integer(i4b) :: flag0 integer(i4b) :: n_xi ! Number of noise parameters integer(i4b) :: ntime ! Number of time values + integer(i4b) :: ndark = 0 ! number of dark bolometers + integer(i4b) :: n_cray_temps = 0 ! number of classes of cosmic rays we have integer(i4b) :: baseline_order ! Polynomial order for baseline - real(dp) :: central_freq !Central frequency real(dp) :: samprate, samprate_lowres ! Sample rate in Hz real(dp) :: chisq_threshold ! Quality threshold in sigma @@ -136,7 +161,6 @@ module comm_tod_mod logical(lgt) :: apply_inst_corr logical(lgt) :: sample_abs_bp logical(lgt) :: symm_flags - logical(lgt) :: HFI_flag class(comm_orbdipole), pointer :: orb_dp real(dp), allocatable, dimension(:) :: gain0 ! Mean gain real(dp), allocatable, dimension(:) :: polang ! Detector polarization angle @@ -150,13 +174,15 @@ module comm_tod_mod real(dp), allocatable, dimension(:) :: prop_bp_mean ! proposal matrix, sigma(ndelta), for mean real(sp), allocatable, dimension(:,:) :: xi_n_P_uni ! Uniform prior for noise PSD parameters real(sp), allocatable, dimension(:) :: xi_n_P_rms ! RMS for active noise PSD prior - real(sp), allocatable, dimension(:,:) :: xi_n_nu_fit ! Frequency range used to fit noise PSD parameters + real(sp), allocatable, dimension(:,:) :: xi_n_nu_fit ! Frequency range used to fit noise PSD parameters, (xi_n, 2) integer(i4b) :: nside, nside_param ! Nside for pixelized pointing + integer(i4b) :: nside_pixhist ! Nside for pixel histograms integer(i4b) :: nobs, nobs_lowres ! Number of observed pixels for this core integer(i4b) :: n_bp_prop ! Number of consecutive bandpass proposals in each main iteration; should be 2 for MH integer(i4b) :: output_n_maps ! Output n_maps character(len=512) :: init_from_HDF ! Read from HDF file character(len=512) :: datadir + character(len=512) :: map_type ! type of mapmaker to use, {nplus2, binned, differential} integer(i4b) :: output_4D_map ! Output 4D maps integer(i4b) :: output_aux_maps ! Output auxiliary maps integer(i4b) :: halfring_split ! Type of halfring split 0=None, 1=HR1, 2=HR2 @@ -164,6 +190,8 @@ module comm_tod_mod logical(lgt) :: sample_zodi ! Sample zodi model parameters (defined in the parameter file) logical(lgt) :: output_zodi_comps ! Output zodi components logical(lgt) :: use_solar_point ! Compute solar centric pointing, for zodi or sidelobe mapping + logical(lgt) :: use_moon_point ! Compute Moon centric pointing, for zodi or sidelobe mapping + logical(lgt) :: use_earth_elon ! Compute Earth elongation real(sp) :: sol_elong_range(2) ! Acceptable solar elongation range logical(lgt) :: correct_sl ! Subtract sidelobes logical(lgt) :: correct_orb ! Subtract CMB dipole @@ -192,14 +220,23 @@ module comm_tod_mod class(comm_map), pointer :: procmask_zodi => null() ! Mask for sampling zodi !class(comm_map), pointer :: mask_solar => null() ! Solar centric/sidelobe mask real(dp), allocatable, dimension(:,:) :: mask_solar ! Solar centric/sidelobe mask + real(dp), allocatable, dimension(:,:) :: mask_moon ! Moon centric/sidelobe mask + real(dp), allocatable, dimension(:) :: mask_earth ! Earth centric/sidelobe mask; elongation only logical(lgt) :: map_solar_allocated + logical(lgt) :: map_moon_allocated + logical(lgt) :: map_earth_allocated real(dp), pointer, dimension(:,:) :: map_solar ! Full-sky solar centric/sidelobe model + real(dp), pointer, dimension(:,:) :: map_moon ! Full-sky Moon centric/sidelobe model + real(dp), pointer, dimension(:) :: map_earth ! Earth elongation centric/sidelobe model + integer(i4b), dimension(-1:9) :: mask_dyn_stats = 0 ! Statistics for dynamic mask (ntod_tot, ncut_base, ncut_1, ncut_2,...) + real(sp), allocatable, dimension(:,:) :: pixhist ! TOD summary from histograms; {mean, rms, nhit, min, max}, NESTED ordering ! class(comm_map), pointer :: map_solar => null() ! Solar centric/sidelobe model class(comm_mapinfo), pointer :: info => null() ! Map definition class(comm_mapinfo), pointer :: slinfo => null() ! Sidelobe map info class(comm_mapinfo), pointer :: mbinfo => null() ! Main beam map info class(map_ptr), allocatable, dimension(:) :: slbeam, mbeam ! Sidelobe beam data (ndet) - class(conviqt_ptr), allocatable, dimension(:) :: slconv ! SL-convolved maps (ndet) + class(conviqt_ptr), allocatable, dimension(:) :: slconv ! SL-convolved maps (ndet) + class(cray_ptr), allocatable, dimension(:) :: cray ! cosmic ray templates class(conviqt_ptr), allocatable, dimension(:) :: slconvA, slconvB ! SL-convolved maps (ndet) real(dp), allocatable, dimension(:,:) :: bp_delta ! Bandpass parameters (0:ndet, npar) real(dp), allocatable, dimension(:,:) :: spinaxis ! For load balancing @@ -229,13 +266,14 @@ module comm_tod_mod real(dp) :: gain_alpha_std ! std for metropolis-hastings sampling integer(i4b), allocatable, dimension(:) :: split + ! Bandpass, pointer to comm_data%bp + class(comm_bp_ptr), allocatable, dimension(:) :: bp + ! Zodi parameters and spline objects integer(i4b) :: zodi_n_comps ! real(sp), allocatable, dimension(:, :, :) :: zodi_scat_cache, zodi_therm_cache ! Cached s_zodi array for a given processor - real(sp), allocatable, dimension(:, :, :) :: zodi_scat_cache, zodi_therm_cache ! Cache for zodi - real(sp), allocatable, dimension(:, :, :) :: zodi_scat_cache_lowres, zodi_therm_cache_lowres ! Cache for lowresolution zodi (used for sampling) - real(dp) :: zodi_cache_time, zodi_init_cache_time! Time of cached zodi array !real(dp), allocatable, dimension(:) :: zodi_emissivity, zodi_albedo ! sampled parameters + integer(i4b) :: zodi_cache_nobs_lowres real(dp), allocatable, dimension(:, :) :: zodi_spl_phase_coeffs real(dp), allocatable, dimension(:) :: zodi_spl_solar_irradiance, zodi_phase_func_normalization type(spline_type), allocatable :: zodi_b_nu_spl_obj(:) @@ -255,6 +293,7 @@ module comm_tod_mod procedure(process_tod), deferred :: process_tod procedure :: construct_sl_template procedure :: construct_corrtemp_inst + procedure :: apply_nonlin_corr_inst procedure :: construct_dipole_template procedure :: construct_dipole_template_diff procedure :: output_scan_list @@ -265,6 +304,7 @@ module comm_tod_mod procedure :: decompress_pointing_and_flags procedure :: decompress_tod procedure :: decompress_diodes + procedure :: decompress_dark_data procedure :: tod_constructor procedure :: load_instrument_file procedure :: load_instrument_inst @@ -274,11 +314,11 @@ module comm_tod_mod procedure :: apply_map_precond procedure :: collect_v_sun procedure :: precompute_zodi_lookups - procedure :: clear_zodi_cache procedure :: create_dynamic_mask + procedure :: report_dynamic_mask_stats procedure :: get_s_static end type comm_tod - + abstract interface subroutine process_tod(self, chaindir, chain, iter, handle, map_in, delta, map_out, rms_out, map_gain) import i4b, comm_tod, comm_map, map_ptr, dp, planck_rng @@ -299,6 +339,42 @@ end subroutine process_tod class(comm_tod), pointer :: p => null() end type tod_pointer + ! Class for uncompressed data for a given scan + type :: comm_scandata + integer(i4b) :: ntod, ndet, nhorn, ndelta + real(sp), allocatable, dimension(:,:) :: tod ! Raw data + real(sp), allocatable, dimension(:,:) :: n_corr ! Correlated noise in V + real(sp), allocatable, dimension(:,:) :: s_sl ! Sidelobe correction + real(sp), allocatable, dimension(:,:) :: s_sky ! Stationary sky signal + real(sp), allocatable, dimension(:,:,:) :: s_sky_prop ! Stationary sky signal proposal for bandpass sampling + real(sp), allocatable, dimension(:,:) :: s_orb ! Orbital dipole + real(sp), allocatable, dimension(:,:) :: s_mono ! Detector monopole correction + real(sp), allocatable, dimension(:,:) :: s_calib ! Custom calibrator + real(sp), allocatable, dimension(:,:) :: s_calibA ! Custom calibrator + real(sp), allocatable, dimension(:,:) :: s_calibB ! Custom calibrator + real(sp), allocatable, dimension(:,:) :: s_bp ! Bandpass correction + real(sp), allocatable, dimension(:,:,:) :: s_bp_prop ! Bandpass correction proposal + real(sp), allocatable, dimension(:,:) :: s_zodi ! Zodiacal emission + real(sp), allocatable, dimension(:,:) :: s_inst ! Instrument-specific correction template + real(sp), allocatable, dimension(:,:) :: s_tot ! Total signal + real(sp), allocatable, dimension(:,:) :: s_gain ! Absolute calibrator + real(sp), allocatable, dimension(:,:) :: mask ! TOD mask (flags + main processing mask) + real(sp), allocatable, dimension(:,:) :: mask2 ! Small TOD mask, for bandpass sampling + real(sp), allocatable, dimension(:,:) :: mask_zodi ! Mask for sampling zodi + integer(i4b), allocatable, dimension(:,:,:) :: pix ! Discretized pointing + integer(i4b), allocatable, dimension(:,:,:) :: psi ! Discretized polarization angle + integer(i4b), allocatable, dimension(:,:) :: flag ! Quality flags + real(sp), allocatable, dimension(:,:) :: s_totA ! Total signal, horn A (differential only) + real(sp), allocatable, dimension(:,:) :: s_totB ! Total signal, horn B (differential only) + real(sp), allocatable, dimension(:,:) :: s_gainA ! Total signal, horn A (differential only) + real(sp), allocatable, dimension(:,:) :: s_gainB ! Total signal, horn B (differential only) + real(sp), allocatable, dimension(:,:) :: s_orbA ! Orbital signal, horn A (differential only) + real(sp), allocatable, dimension(:,:) :: s_orbB ! Orbital signal, horn B (differential only) + real(sp), allocatable, dimension(:,:) :: dark ! Dark bolometer signals + integer(i4b) :: band ! Band ID + end type comm_scandata + + contains subroutine initialize_tod_mod(cpar) @@ -346,6 +422,7 @@ subroutine tod_constructor(self, cpar, id, id_abs, info, tod_type) character(len=128), intent(in) :: tod_type integer(i4b) :: i, ndelta, ierr, unit + real(sp) :: elon character(len=512) :: datadir, solar_init self%id = id @@ -370,6 +447,7 @@ subroutine tod_constructor(self, cpar, id, id_abs, info, tod_type) self%flag0 = cpar%ds_tod_flag(id_abs) self%abscal_comps = cpar%ds_tod_abscal(id_abs) self%nscan_tot = cpar%ds_tod_tot_numscan(id_abs) + self%map_type = cpar%ds_tod_map_type(id_abs) self%output_4D_map = cpar%output_4D_map_nth_iter self%output_aux_maps = cpar%output_aux_maps self%output_zodi_comps = cpar%zs_output_comps @@ -385,13 +463,17 @@ subroutine tod_constructor(self, cpar, id, id_abs, info, tod_type) self%sample_abs_bp = .false. self%zodiband = -1 self%sol_elong_range = [0., 180.] - + self%sample_mono = .false. + self%nside_pixhist = -1 + if (cpar%include_tod_zodi) then self%subtract_zodi = cpar%ds_tod_subtract_zodi(self%band) self%zodi_n_comps = cpar%zs_ncomps self%sample_zodi = cpar%sample_zodi .and. self%subtract_zodi end if self%use_solar_point = self%subtract_zodi + self%use_moon_point = .false. + self%use_earth_elon = .false. if (trim(self%tod_type)=='SPIDER') then self%orbital = .false. @@ -399,7 +481,9 @@ subroutine tod_constructor(self, cpar, id, id_abs, info, tod_type) self%orbital = .true. end if - if (trim(self%noise_psd_model) == 'oof') then + if (trim(self%noise_psd_model) == 'white') then + self%n_xi = 1 ! {sigma0} + else if (trim(self%noise_psd_model) == 'oof') then self%n_xi = 3 ! {sigma0, fknee, alpha} else if (trim(self%noise_psd_model) == '2oof') then self%n_xi = 5 ! {sigma0, fknee, alpha, fknee2, alpha2} @@ -448,10 +532,21 @@ subroutine tod_constructor(self, cpar, id, id_abs, info, tod_type) self%procmask_zodi => comm_map(self%info, self%procmaskfzodi) end if if (trim(cpar%ds_tod_solar_mask(id_abs)) /= 'none') then - !self%mask_solar => comm_map(self%info, cpar%ds_tod_solar_mask(id_abs)) allocate(self%mask_solar(0:12*self%nside_param**2-1,1)) call read_map(cpar%ds_tod_solar_mask(id_abs), self%mask_solar) end if + if (trim(cpar%ds_tod_moon_mask(id_abs)) /= 'none') then + allocate(self%mask_moon(0:12*self%nside_param**2-1,1)) + call read_map(cpar%ds_tod_moon_mask(id_abs), self%mask_moon) + end if + if (trim(cpar%ds_tod_earth_mask(id_abs)) /= 'none') then + allocate(self%mask_earth(NBIN_EARTH_ELON)) + open(58,file=trim(cpar%ds_tod_earth_mask(id_abs))) + do i = 1, NBIN_EARTH_ELON + read(58,*) elon, self%mask_earth(i) + end do + close(58) + end if do i = 0, self%info%np-1 if (any(self%procmask%map(i,:) < 0.5d0)) then @@ -514,6 +609,15 @@ subroutine tod_constructor(self, cpar, id, id_abs, info, tod_type) ! Allocate orbital dipole object; this should go in the experiment files, since it must be done after beam init !allocate(self%orb_dp) !self%orb_dp => comm_orbdipole(self%mbeam) + + ! Init cosmic ray template removal + if(self%n_cray_temps > 0) then + allocate(self%cray(self%ndet)) + do i = 1, self%ndet + self%cray(i)%p => comm_cray(self%n_cray_temps) + end do + end if + end subroutine tod_constructor subroutine precompute_lookups(self) @@ -533,28 +637,35 @@ subroutine precompute_lookups(self) real(dp) :: f_fill, f_fill_lim(3), theta, phi integer(i4b) :: i, j, k, l, ierr - integer(i4b), allocatable, dimension(:) :: pix + integer(i4b), allocatable, dimension(:) :: pix, psi ! Construct observed pixel array allocate(self%pix2ind(0:12*self%nside**2-1)) self%pix2ind = -2 do i = 1, self%nscan - allocate(pix(self%scans(i)%ntod)) + allocate(pix(self%scans(i)%ntod), psi(self%scans(i)%ntod)) if (self%nhorn == 2) then - if (self%use_solar_point) allocate(self%scans(i)%d(1)%pix_sol(self%scans(i)%ntod,self%nhorn), self%scans(i)%d(1)%psi_sol(self%scans(i)%ntod,self%nhorn)) + if (self%use_solar_point) allocate(self%scans(i)%d(1)%pix_sol(self%scans(i)%ntod,self%nhorn)) + if (self%use_moon_point) allocate(self%scans(i)%d(1)%pix_moon(self%scans(i)%ntod,self%nhorn)) + if (self%use_earth_elon) allocate(self%scans(i)%d(1)%earth_elon(self%scans(i)%ntod,self%nhorn)) do l = 1, self%nhorn call huffman_decode2_int(self%scans(i)%hkey, self%scans(i)%d(1)%pix(l)%p, pix) self%pix2ind(pix(1)) = -1 do k = 2, self%scans(i)%ntod self%pix2ind(pix(k)) = -1 end do - if (self%use_solar_point) then - call compute_solar_centered_pointing(self, i, j, pix, 0*pix, self%scans(i)%d(j)%pix_sol(:,l), self%scans(i)%d(j)%psi_sol(:,l)) + if (self%use_solar_point) call compute_solar_centered_pointing(self, i, 1, pix, self%scans(i)%d(1)%pix_sol(:,l)) + if (self%use_moon_point) then + call huffman_decode2_int(self%scans(i)%hkey, self%scans(i)%d(1)%psi(l)%p, psi) + call compute_moon_centered_pointing(self, i, 1, pix, psi, self%scans(i)%d(1)%pix_moon(:,l)) end if + if (self%use_earth_elon) call compute_earth_elongation(self, i, 1, pix, self%scans(i)%d(1)%earth_elon(:,l)) end do else do j = 1, self%ndet - if (self%use_solar_point) allocate(self%scans(i)%d(j)%pix_sol(self%scans(i)%ntod,self%nhorn), self%scans(i)%d(j)%psi_sol(self%scans(i)%ntod,self%nhorn)) + if (self%use_solar_point) allocate(self%scans(i)%d(j)%pix_sol(self%scans(i)%ntod,self%nhorn)) + if (self%use_moon_point) allocate(self%scans(i)%d(j)%pix_moon(self%scans(i)%ntod,self%nhorn)) + if (self%use_earth_elon) allocate(self%scans(i)%d(j)%earth_elon(self%scans(i)%ntod,self%nhorn)) do l = 1, self%nhorn call huffman_decode(self%scans(i)%hkey, self%scans(i)%d(j)%pix(l)%p, pix) self%pix2ind(pix(1)) = -1 @@ -566,13 +677,16 @@ subroutine precompute_lookups(self) end if self%pix2ind(pix(k)) = -1 end do - if (self%use_solar_point) then - call compute_solar_centered_pointing(self, i, j, pix, 0*pix, self%scans(i)%d(j)%pix_sol(:,l), self%scans(i)%d(j)%psi_sol(:,l)) + if (self%use_solar_point) call compute_solar_centered_pointing(self, i, j, pix, self%scans(i)%d(j)%pix_sol(:,l)) + if (self%use_moon_point) then + call huffman_decode2_int(self%scans(i)%hkey, self%scans(i)%d(j)%psi(l)%p, psi) + call compute_moon_centered_pointing(self, i, j, pix, psi, self%scans(i)%d(j)%pix_moon(:,l)) end if + if (self%use_earth_elon) call compute_earth_elongation(self, i, j, pix, self%scans(i)%d(j)%earth_elon(:,l)) end do end do end if - deallocate(pix) + deallocate(pix,psi) end do self%nobs = count(self%pix2ind == -1) allocate(self%ind2pix(self%nobs)) @@ -620,6 +734,7 @@ subroutine load_instrument_file(self, nside_beam, nmaps_beam, pol_beam, comm_cha integer(i4b) :: lmax_beam, lmax_sl, i type(comm_mapinfo), pointer :: info_beam + if(len(trim(self%instfile)) == 0) then write(*,*) "Cannot open instrument file with empty name for tod: " // self%tod_type end if @@ -634,17 +749,27 @@ subroutine load_instrument_file(self, nside_beam, nmaps_beam, pol_beam, comm_cha call read_hdf(h5_file, trim(adjustl(self%label(1)))//'/'//'sllmax', lmax_sl) call read_hdf(h5_file, trim(adjustl(self%label(1)))//'/'//'beamlmax', lmax_beam) - self%slinfo => comm_mapinfo(comm_chain, nside_beam, lmax_sl, nmaps_beam, pol_beam) - self%mbinfo => comm_mapinfo(comm_chain, nside_beam, lmax_beam, nmaps_beam, pol_beam) + if(lmax_sl > 0) then + self%slinfo => comm_mapinfo(comm_chain, nside_beam, lmax_sl, nmaps_beam, pol_beam) + end if + + if(lmax_beam > 0) then + self%mbinfo => comm_mapinfo(comm_chain, nside_beam, lmax_beam, nmaps_beam, pol_beam) + end if do i = 1, self%ndet call read_hdf(h5_file, trim(adjustl(self%label(i)))//'/'//'fwhm', self%fwhm(i)) call read_hdf(h5_file, trim(adjustl(self%label(i)))//'/'//'elip', self%elip(i)) call read_hdf(h5_file, trim(adjustl(self%label(i)))//'/'//'psi_ell', self%psi_ell(i)) call read_hdf(h5_file, trim(adjustl(self%label(i)))//'/'//'centFreq', self%nu_c(i)) - !self%slbeam(i)%p => comm_map(self%slinfo, h5_file, .true., "sl", trim(self%label(i))) - !self%mbeam(i)%p => comm_map(self%mbinfo, h5_file, .true., "beam", trim(self%label(i))) - !call self%mbeam(i)%p%Y() + if(lmax_sl > 0) then + self%slbeam(i)%p => comm_map(self%slinfo, h5_file, .true., "sl", trim(self%label(i))) + end if + + if(lmax_beam > 0) then + self%mbeam(i)%p => comm_map(self%mbinfo, h5_file, .true., "beam", trim(self%label(i))) + call self%mbeam(i)%p%Y() + end if end do call close_hdf_file(h5_file) @@ -833,7 +958,9 @@ subroutine read_tod(self, detlabels, datadir) & MPI_DOUBLE_PRECISION, MPI_SUM, self%comm, ierr) call mpi_allreduce(MPI_IN_PLACE, ns, self%ndet+1, & & MPI_INTEGER, MPI_SUM, self%comm, ierr) + self%gain0(0) = sum(self%gain0)/sum(ns) + where (ns > 0) self%gain0 = self%gain0 / ns - self%gain0(0) end where @@ -909,9 +1036,9 @@ subroutine read_hdf_scan(self, tod, filename, scan, ndet, detlabels, nhorn, ndio character(len=*), dimension(:), intent(in) :: detlabels character(len=*), dimension(:,:), intent(in) :: diode_names - integer(i4b) :: i,j,k,l, n, m, ext(1) + integer(i4b) :: i,j,k,l, n, m, ext(1), setsize(1) real(sp) :: nu - real(dp) :: scalars(4) + real(dp) :: scalars(4), time character(len=6) :: slabel character(len=128) :: field type(hdf_file) :: file @@ -946,10 +1073,28 @@ subroutine read_hdf_scan(self, tod, filename, scan, ndet, detlabels, nhorn, ndio ! Read common scan data call read_hdf(file, slabel // "/common/vsun", self%v_sun, opt=.true.) + + call get_size_hdf(file, slabel // "/common/time", setsize) + + if(setsize(1) == 3) then + call read_hdf(file, slabel // "/common/time", self%t0) + else + call read_hdf(file, slabel // "/common/time", time) + self%t0(2) = time + end if + + + if (hdf_group_exists(file, slabel // "/common/time_end")) then + call get_size_hdf(file, slabel // "/common/time_end", setsize) + if (setsize(1) == 3) then + call read_hdf(file, slabel // "/common/time_end", self%t1) + else + self%t1 = 0 + end if + else + self%t1 = 0 + end if - ! Read in time at the start and end of each scan (if available) - call read_hdf(file, slabel // "/common/time", self%t0) - call read_hdf(file, slabel // "/common/time_end", self%t1, opt=.true.) ! HKE: LFI files should be regenerated with (x,y,z) info ! Read in satellite and earth position at the start and end of each scan (if available) @@ -958,6 +1103,18 @@ subroutine read_hdf_scan(self, tod, filename, scan, ndet, detlabels, nhorn, ndio call read_hdf(file, slabel // "/common/earthpos", self%x0_earth, opt=.true.) call read_hdf(file, slabel // "/common/earthpos_end", self%x1_earth, opt=.true.) + if (hdf_group_exists(file, slabel // "/common/time_len")) then + ! This specifically creates an array of length n_interp for the use of calculating accurate positions for avoiding the moon. + ! Can be generalized, but for now assumes that each location has the same time array. + call read_hdf(file, slabel // "/" // "common/time_len", self%n_interp, opt=.true.) + allocate(self%xarr_moon(3,self%n_interp), self%xarr_obs(3,self%n_interp), self%xarr_earth(3,self%n_interp)) + allocate(self%time_arr(self%n_interp)) + call read_hdf(file, slabel // "/common/time_arr", self%time_arr) + call read_hdf(file, slabel // "/common/moonpos_arr", self%xarr_moon) + call read_hdf(file, slabel // "/common/earthpos_arr", self%xarr_obs) + call read_hdf(file, slabel // "/common/satpos_arr", self%xarr_earth) + end if + ! Read detector scans allocate(self%d(ndet), buffer_sp(n)) if (tod%ndiode > 1 .and. tod%compressed_tod) allocate(self%zext(tod%ndet,tod%ndiode)) @@ -973,8 +1130,10 @@ subroutine read_hdf_scan(self, tod, filename, scan, ndet, detlabels, nhorn, ndio self%d(i)%gain_def = scalars(1) self%d(i)%gain = scalars(1) - xi_n(1:3) = scalars(2:4) - xi_n(1) = xi_n(1) * self%d(i)%gain_def ! Convert sigma0 to uncalibrated units + xi_n(1) = scalars(2) * self%d(i)%gain_def ! Convert sigma0 to uncalibrated units + if (tod%n_xi >= 3) then + xi_n(2:3) = scalars(3:4) + end if self%d(i)%gain = self%d(i)%gain_def self%d(i)%accept = .true. @@ -983,24 +1142,23 @@ subroutine read_hdf_scan(self, tod, filename, scan, ndet, detlabels, nhorn, ndio self%d(i)%baseline = 0. end if - if (trim(tod%noise_psd_model) == 'oof') then - self%d(i)%N_psd => comm_noise_psd(xi_n, tod%xi_n_P_rms, tod%xi_n_P_uni, tod%xi_n_nu_fit) + if (trim(tod%noise_psd_model) == 'white') then + self%d(i)%N_psd => comm_noise_psd_white(xi_n, tod%xi_n_P_rms, tod%xi_n_P_uni, tod%xi_n_nu_fit) + else if (trim(tod%noise_psd_model) == 'oof') then + self%d(i)%N_psd => comm_noise_psd_oof(xi_n, tod%xi_n_P_rms, tod%xi_n_P_uni, tod%xi_n_nu_fit) else if (trim(tod%noise_psd_model) == '2oof') then xi_n(4) = 1e-4 ! fknee2 (Hz); arbitrary value xi_n(5) = -1.000 ! alpha2; arbitrary value self%d(i)%N_psd => comm_noise_psd_2oof(xi_n, tod%xi_n_P_rms, tod%xi_n_P_uni, tod%xi_n_nu_fit) - else if (trim(tod%noise_psd_model) == 'oof_gauss') then xi_n(4) = 0.00d0 xi_n(5) = 1.35d0 xi_n(6) = 0.40d0 self%d(i)%N_psd => comm_noise_psd_oof_gauss(xi_n, tod%xi_n_P_rms, tod%xi_n_P_uni, tod%xi_n_nu_fit) - else if (trim(tod%noise_psd_model) == 'oof_quad') then xi_n(4) = 0d0 xi_n(5) = 0d0 self%d(i)%N_psd => comm_noise_psd_oof_quad(xi_n, tod%xi_n_P_rms, tod%xi_n_P_uni, tod%xi_n_nu_fit) - !!$ open(58,file='noise.dat') !!$ nu = 0.001d0 !!$ do while (.true.) @@ -1010,7 +1168,6 @@ subroutine read_hdf_scan(self, tod, filename, scan, ndet, detlabels, nhorn, ndio !!$ end do !!$ close(58) !!$ stop - end if deallocate(xi_n) @@ -1096,10 +1253,13 @@ subroutine read_hdf_scan(self, tod, filename, scan, ndet, detlabels, nhorn, ndio call hufmak_precomp_int(hsymb,htree,self%hkey) deallocate(hsymb, htree) if (tod%compressed_tod) then - call read_alloc_hdf(file, slabel // "/common/huffsymb2", hsymb_sp) +!!$ call read_alloc_hdf(file, slabel // "/common/todsymb", hsymb) +!!$ call read_alloc_hdf(file, slabel // "/common/todtree", htree) + !TODO: this needs to be generalized to work for both floats and ints + call read_alloc_hdf(file, slabel // "/common/huffsymb2", hsymb) call read_alloc_hdf(file, slabel // "/common/hufftree2", htree) - call hufmak_precomp_sp(hsymb_sp,htree,self%todkey) - deallocate(hsymb_sp, htree) + call hufmak_precomp_int(hsymb,htree,self%todkey) + deallocate(hsymb, htree) end if ! Read instrument-specific infomation @@ -1194,10 +1354,6 @@ subroutine read_hdf_scan_data(self, tod, filename, scan, ndet, detlabels, nhorn, end if end if else ! ndiode > 1 per tod - if(tod%compressed_tod .eqv. .false.) then - - else - end if if (tod%compressed_tod) then allocate(self%d(i)%zdiode(ndiode)) call read_hdf_vlen(file, slabel // '/' // trim(field) // '/diodes', self%d(i)%zdiode) @@ -1473,7 +1629,6 @@ subroutine get_scan_ids(self, filelist) end subroutine get_scan_ids - subroutine dumpToHDF(self, chainfile, iter, map, rms) implicit none class(comm_tod), intent(inout) :: self @@ -1592,6 +1747,8 @@ subroutine dumpToHDF(self, chainfile, iter, map, rms) end subroutine dumpToHDF + + subroutine initHDF(self, chainfile, iter, map, rms) implicit none class(comm_tod), intent(inout) :: self @@ -1625,8 +1782,30 @@ subroutine initHDF(self, chainfile, iter, map, rms) call read_hdf(chainfile, trim(adjustl(path))//'gain_sigma_0', self%gain_sigma_0) call read_hdf(chainfile, trim(adjustl(path))//'gain_fknee', self%gain_fknee) call read_hdf(chainfile, trim(adjustl(path))//'gain_alpha', self%gain_alpha) + if (self%map_solar_allocated == .true.) then + if (hdf_group_exists(chainfile, trim(adjustl(path))//'map_solar')) then + call read_hdf(chainfile, trim(adjustl(path))//'map_solar', self%map_solar) + else + write(*,*) 'Solar map field not in existing chain, keeping default' + end if + end if + if (self%map_moon_allocated == .true.) then + if (hdf_group_exists(chainfile, trim(adjustl(path))//'map_moon')) then + call read_hdf(chainfile, trim(adjustl(path))//'map_moon', self%map_moon) + else + write(*,*) 'Moon map field not in existing chain, keeping default' + end if + end if + if (self%map_earth_allocated == .true.) then + if (hdf_group_exists(chainfile, trim(adjustl(path))//'map_earth')) then + call read_hdf(chainfile, trim(adjustl(path))//'map_earth', self%map_earth) + else + write(*,*) 'Earth map field not in existing chain, keeping default' + end if + end if end if + call mpi_bcast(output, size(output), MPI_DOUBLE_PRECISION, 0, & & self%comm, ierr) call mpi_bcast(self%bp_delta, size(self%bp_delta), MPI_DOUBLE_PRECISION, 0, & @@ -1888,6 +2067,23 @@ subroutine construct_corrtemp_inst(self, scan, pix, psi, s) end subroutine construct_corrtemp_inst + subroutine apply_nonlin_corr_inst(self, scan, sd) + ! Apply an instrument-specific non_linear corrections + ! + ! Arguments: + ! ---------- + ! self: comm_tod object + ! + implicit none + class(comm_tod), intent(in) :: self + integer(i4b), intent(in) :: scan + class(comm_scandata), intent(inout) :: sd + + return + + end subroutine apply_nonlin_corr_inst + + subroutine construct_dipole_template(self, scan, pix, psi, s_dip) ! construct a CMB dipole template in the time domain ! @@ -2414,6 +2610,33 @@ subroutine decompress_pointing_and_flags(self, scan, det, pix, psi, flag) end subroutine decompress_pointing_and_flags + subroutine decompress_dark_data(self, scan, det, dark) + ! Decompress dark tods + ! + ! Inputs: + ! ---------- + ! self: comm_tod + ! + ! scan: integer + ! scan integer label + ! det: integer + ! dark detector number + ! + ! Returns: + ! ---------- + ! dark : real(sp) (ntod, ndark) + ! dark bolometer data + + implicit none + class(comm_tod), intent(in) :: self + integer(i4b), intent(in) :: scan, det + real(sp), dimension(:), intent(out) :: dark + + dark = 0.0 + !TODO: this + + end subroutine decompress_dark_data + subroutine decompress_diodes(self, scan, det, diodes, flag, pix, psi) ! Decompress per-diode tod information ! @@ -2514,17 +2737,26 @@ subroutine decompress_tod(self, scan, det, tod) real(sp), dimension(:), intent(out) :: tod byte, allocatable, dimension(:) :: test - - call huffman_decode2_sp(self%scans(scan)%todkey, self%scans(scan)%d(det)%ztod, tod) + integer(i4b), allocatable, dimension(:) :: tod_int + + if( index(self%instlabel, 'LFI') /= 0) then ! raw data is naturally a float + call huffman_decode2_sp(self%scans(scan)%todkey, self%scans(scan)%d(det)%ztod, tod) + else ! raw data is an int + allocate(tod_int(size(tod))) + !write(*,*) self%scans(scan)%d(det)%label, self%scans(scan)%chunk_num, size(self%scans(scan)%d(det)%ztod) + call huffman_decode2_int(self%scans(scan)%todkey, self%scans(scan)%d(det)%ztod, tod_int) + tod = real(tod_int, sp) + deallocate(tod_int) + endif end subroutine decompress_tod - subroutine compute_solar_centered_pointing(tod, scan, det, pix, psi, pix_sol, psi_sol) + subroutine compute_solar_centered_pointing(tod, scan, det, pix, pix_sol) implicit none class(comm_tod), intent(in) :: tod integer(i4b), intent(in) :: scan, det - integer(i4b), dimension(:),intent(in) :: pix, psi - integer(i4b), dimension(:),intent(out) :: pix_sol, psi_sol + integer(i4b), dimension(:),intent(in) :: pix + integer(i4b), dimension(:),intent(out) :: pix_sol integer(i4b) :: i, j real(dp) :: alpha, lat, lon, vec(3), vec0(3), M_sun(3,3), x_sun(3), theta_sun, phi_sun, M_ecl2gal(3,3) @@ -2544,10 +2776,82 @@ subroutine compute_solar_centered_pointing(tod, scan, det, pix, psi, pix_sol, ps vec0 = matmul(M_sun, vec0) ! Solar-centered coordinates call vec2pix_ring(tod%nside, vec0, pix_sol(j)) end do - psi_sol = 0 ! Not computed yet end subroutine compute_solar_centered_pointing + subroutine compute_moon_centered_pointing(tod, scan, det, pix, psi, pix_moon) + implicit none + class(comm_tod), intent(in) :: tod + integer(i4b), intent(in) :: scan, det + integer(i4b), dimension(:),intent(in) :: pix, psi + integer(i4b), dimension(:),intent(out) :: pix_moon + + integer(i4b) :: i, j, b, n + real(dp) :: psi0, dt, t0, t + real(dp) :: x_moon(3), x_obs(3), x_obs2moon(3), theta0, phi0, alpha, vec(3), vec0(3), M(3,3), M_ecl2gal(3,3) + + call ecl_to_gal_rot_mat(M_ecl2gal) + n = tod%scans(scan)%n_interp + t0 = tod%scans(scan)%time_arr(1) + dt = (tod%scans(scan)%time_arr(n)-t0)/(n-1) + + do j = 1, tod%scans(scan)%ntod + t = tod%scans(scan)%t0(1) + (j-1.d0)/tod%samprate / (24.d0*3600.d0) + b = max(min(int((t-t0)/dt), n-1),1) + + alpha = (t-tod%scans(scan)%time_arr(b))/(tod%scans(scan)%time_arr(b+1)-tod%scans(scan)%time_arr(b)) + x_obs = (1.d0-alpha) * tod%scans(scan)%xarr_obs(:,b) + alpha * tod%scans(scan)%xarr_obs(:,b+1) ! Observatory position at time t in heliocentric/Ecliptic coordinates + x_moon = (1.d0-alpha) * tod%scans(scan)%xarr_moon(:,b) + alpha * tod%scans(scan)%xarr_moon(:,b+1) ! Moon position at time t in heliocentric/Ecliptic coordinates + + x_obs2moon = x_moon - x_obs ! Earth position relative to observatory in Ecliptic coordinates + x_obs2moon = x_obs2moon / sqrt(sum(x_obs2moon**2)) ! Unit vector + x_obs2moon = matmul(M_ecl2gal, x_obs2moon) ! Moon position in Galactic coordinates + + ! Compute pointing in Moon centered coordinates + psi0 = psi(j) * 2.d0*pi/4096.d0 ! Fix this + call pix2ang_ring(tod%nside, pix(j), theta0, phi0) ! Galactic coordinates + call compute_euler_matrix_zyz(-psi0, -theta0, -phi0, M) + vec = matmul(M, x_obs2moon) + call vec2pix_ring(tod%nside, vec, pix_moon(j)) + end do + + end subroutine compute_moon_centered_pointing + + subroutine compute_earth_elongation(tod, scan, det, pix, earth_elon) + implicit none + class(comm_tod), intent(in) :: tod + integer(i4b), intent(in) :: scan, det + integer(i4b), dimension(:),intent(in) :: pix + real(sp), dimension(:),intent(out) :: earth_elon + + integer(i4b) :: i, j, b, n + real(dp) :: dt, t0, t + real(dp) :: x_obs2earth(3), x_obs(3), x_earth(3), alpha, lat, lon, vec(3), vec0(3), M_sun(3,3), x_sun(3), theta_sun, phi_sun, M_ecl2gal(3,3) + + call ecl_to_gal_rot_mat(M_ecl2gal) + n = tod%scans(scan)%n_interp + t0 = tod%scans(scan)%time_arr(1) + dt = (tod%scans(scan)%time_arr(n)-t0)/(n-1) + + do j = 1, tod%scans(scan)%ntod + t = tod%scans(scan)%t0(1) + (j-1.d0)/tod%samprate / (24.d0*3600.d0) + b = max(min(int((t-t0)/dt), n-1),1) + + alpha = (t-tod%scans(scan)%time_arr(b))/(tod%scans(scan)%time_arr(b+1)-tod%scans(scan)%time_arr(b)) + x_obs = (1.d0-alpha) * tod%scans(scan)%xarr_obs(:,b) + alpha * tod%scans(scan)%xarr_obs(:,b+1) ! Observatory position at time t in heliocentric/Ecliptic coordinates + x_earth = (1.d0-alpha) * tod%scans(scan)%xarr_earth(:,b) + alpha * tod%scans(scan)%xarr_earth(:,b+1) ! Moon position at time t in heliocentric/Ecliptic coordinates + + x_obs2earth = x_earth - x_obs ! Earth position relative to observatory in Ecliptic coordinates + x_obs2earth = x_obs2earth / sqrt(sum(x_obs2earth**2)) ! Unit vector + + call pix2vec_ring(tod%nside, pix(j), vec0) ! Satellite pointing in Galactic coordinates + vec0 = matmul(transpose(M_ecl2gal), vec0) ! Satellite pointing in Ecliptic coordinates + + earth_elon(j) = acos(max(min(sum(vec0 * x_obs2earth),1.d0),-1.d0)) + end do + + end subroutine compute_earth_elongation + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Subroutine to save time-ordered-data chunk @@ -2838,7 +3142,10 @@ subroutine precompute_zodi_lookups(self, cpar) ! filter out non zero values t0_packed = pack(t0, t0 /= 0.) t1_packed = pack(t1, t1 /= 0.) - if (size(t0_packed) /= size(t1_packed)) stop "t0 and t1 are not the same size" + if (size(t0_packed) /= size(t1_packed)) then + write(*,*) "Irregularity in number of unique start/end-times of tods, ", size(t0_packed), ' versus ', size(t1_packed), ' needed for zodi/tod interpolation' + stop + end if allocate(x0_obs_packed(3, size(t0_packed)), x1_obs_packed(3, size(t0_packed))) @@ -2873,18 +3180,11 @@ subroutine precompute_zodi_lookups(self, cpar) call spline_simple(self%x_earth_spline(i), time, x_earth(i, :)) end do - self%zodi_init_cache_time = self%scans(1)%t0(1) - call self%clear_zodi_cache() - !allocate spectral quantities allocate(self%zodi_b_nu_spl_obj(self%ndet)) - ! allocate cache files and precompute ecliptic unit vectors + ! precompute ecliptic unit vectors call ecl_to_gal_rot_mat(rotation_matrix) - allocate(self%zodi_scat_cache(self%nobs, self%zodi_n_comps, self%ndet)) - allocate(self%zodi_therm_cache(self%nobs, self%zodi_n_comps, self%ndet)) - self%zodi_scat_cache = -1.d0 - self%zodi_therm_cache = -1.d0 allocate(self%ind2vec_ecl(3, self%nobs)) do i = 1, self%nobs self%ind2vec_ecl(:,i) = matmul(self%ind2vec(:,i), rotation_matrix) @@ -2893,7 +3193,7 @@ subroutine precompute_zodi_lookups(self, cpar) ! If zodi sampling is turned on we precompute lowres zodi lookups if (.not. cpar%sample_zodi) return ! Skip if zodi nside = tod nside - if (self%nside == zodi_nside) return + !if (self%nside == zodi_nside) return n_subpix = (self%nside / zodi_nside)**2 npix_lowres = 12*zodi_nside**2 @@ -2909,132 +3209,434 @@ subroutine precompute_zodi_lookups(self, cpar) end subroutine precompute_zodi_lookups - subroutine clear_zodi_cache(self, obs_time) - ! Clears the zodi tod cache used to look up already computed zodi values. - ! - ! This cache has an associate time of observation since the cache is only valid - ! if the time between the observations are small enough for the observer to not - ! have moved significantly. - class(comm_tod), intent(inout) :: self - real(dp), intent(in), optional :: obs_time - - self%zodi_scat_cache = -1.d0 - self%zodi_therm_cache = -1.d0 - if (present(obs_time)) then - self%zodi_cache_time = obs_time - else - self%zodi_cache_time = self%zodi_init_cache_time - end if - if (allocated(self%zodi_therm_cache_lowres)) then - self%zodi_scat_cache_lowres = -1.d0 - self%zodi_therm_cache_lowres = -1.d0 - end if - end subroutine clear_zodi_cache - - subroutine create_dynamic_mask(self, scan, det, res, rms_range, mask) + ! Cut definitions: + ! threshold(1) = Pixel histogram outliers; tod%pixhist must be allocated; any positive value enables this + ! threshold(2) = Extreme outlier in white noise sigma; inside flagging mask; typically set to a high value + ! threshold(3) = Outlier in observed residual sigma, only single samples and outside flagging mask + ! threshold(4) = Excess variance in windows of 5 samples + ! threshold(5) = Excess variance in windows of 50 samples + ! threshold(6) = Excess variance in windows of 500 samples + ! threshold(7) = Isolated samples; any positive value enables this + ! threshold(8) = Long chunks with many masked samples + ! threshold(9) = Pointing cuts (solar, moon, Earth); any positive value enables this + ! + ! Values are given in units of sigma; negative value disables a given test + subroutine create_dynamic_mask(self, scan, det, pix, tod, res, mask, flag, threshold, s_tot) implicit none class(comm_tod), intent(inout) :: self integer(i4b), intent(in) :: scan, det - real(sp), dimension(:), intent(in) :: res - real(sp), dimension(2), intent(in) :: rms_range + integer(i4b), dimension(:), intent(in) :: pix + real(sp), dimension(:), intent(in) :: tod, res real(sp), dimension(:), intent(inout) :: mask + integer(i4b), dimension(:), intent(inout) :: flag + real(sp), dimension(9), intent(in) :: threshold + real(sp), dimension(:), intent(in), optional :: s_tot + - logical(lgt) :: cut - integer(i4b) :: i, j, k, n, ntod, nmax - real(dp) :: box_width, rms, vec(3), elon + integer(i4b) :: i, j, k, n, pix_nest, ntod, nmax, window, ntot, iter, ncut, b_elon, output_scan, flag_dyn, q + real(dp) :: rms0 + real(sp) :: var0, gain + logical(lgt), allocatable, dimension(:) :: cut integer(i4b), allocatable, dimension(:,:) :: bad, buffer - !real(dp), allocatable, dimension(:,:) :: mask_solar + real(sp), allocatable, dimension(:) :: mask_dyn, var_window + + if (sum(mask) == 0) return + + output_scan = -1 !116 + flag_dyn = 2**30 + ntod = size(res) + ntot = count(iand(flag,self%flag0) .eq. 0) + nmax = 1000 + gain = self%scans(scan)%d(det)%gain + self%mask_dyn_stats(-1) = self%mask_dyn_stats(-1) + ntod + self%mask_dyn_stats( 0) = self%mask_dyn_stats( 0) + ntod - ntot ! Number of samples removed by base flagging + + !write(*,fmt='(a,a,i6,i4,a,f8.5,i8,i8)') ' Dynamic mask, base flags -- ', trim(self%freq), self%scanid(scan), det, ' = ', real(ntod-ntot,sp) / ntod, ntod - ntod = size(res) - nmax = 1000 + ! Generate dynamic mask + allocate(mask_dyn(ntod)) + mask_dyn = 1.0 + + if (output_scan == self%scanid(scan)) then + open(58, file='flag_stage0.dat') + do i = 1, ntod + if (iand(flag(i),self%flag0) .eq. 0) write(58,*) i, res(i) + end do + close(58) + end if + + if (threshold(1) > 0) then + ! Pixel histogram outliers + q = (self%nside / self%nside_pixhist)**2 + ncut = 0 + do i = 1, ntod + if (iand(flag(i),self%flag0) .eq. 0) then + call ring2nest(self%nside, pix(i), pix_nest) + pix_nest = pix_nest / q + if (tod(i) < self%pixhist(4,pix_nest) .or. tod(i) > self%pixhist(5,pix_nest)) then + mask_dyn(i) = 0. + mask(i) = 0. + flag(i) = flag(i) + flag_dyn + ncut = ncut + 1 + end if + end if + end do + !write(*,fmt='(a,a,i6,i4,a,f8.5,i8,i8)') ' Dynamic mask, pixhist -- ', trim(self%freq), self%scanid(scan), det, ' = ', real(ncut,sp) / ntod, ncut + self%mask_dyn_stats(1) = self%mask_dyn_stats(1) + ncut + end if + + if (threshold(2) > 0) then + ! Extreme outliers + ncut = 0 + do i = 1, ntod + if (iand(flag(i),self%flag0) .eq. 0 .and. abs(res(i)) > threshold(2)) then + mask_dyn(i) = 0. + mask(i) = 0. + flag(i) = flag(i) + flag_dyn + ncut = ncut + 1 + end if + end do + !write(*,fmt='(a,a,i6,i4,a,f8.5,i8,i8)') ' Dynamic mask, extreme -- ', trim(self%freq), self%scanid(scan), det, ' = ', real(ncut,sp) / ntod, ncut + self%mask_dyn_stats(2) = self%mask_dyn_stats(2) + ncut + end if + + ! Single sample outlier cut; potentially iterate in order to adjust the threshold rms + if (threshold(3) > 0.) then + allocate(cut(ntod)) + ncut = 0 + if (output_scan == self%scanid(scan)) open(58, file='flag_stage2.dat') + do iter = 1, 1 +!!$ ! Compute full-scan, masked rms0 +!!$ rms0 = 0.d0 +!!$ n = 0 +!!$ do i = 1, ntod +!!$ if (mask(i) == 1.) then +!!$ rms0 = rms0 + res(i)**2 +!!$ n = n + 1 +!!$ end if +!!$ end do +!!$ rms0 = 0.; if (n > 1) rms0 = sqrt(rms0/(n-1)) +!!$ !write(*,*) 'iter = ', iter, ' -- rms0 = ', rms0 + + do i = 1, ntod + cut(i) = (mask(i) == 1. .and. abs(res(i)) > threshold(3)) + if (output_scan == self%scanid(scan) .and. mask(i) == 1.) write(58,*) i, res(i), count(cut(i:i) == 1.) + end do + + ! Apply RMS selection criterium + if (cut(1) .and. (.not. cut(2) .or. mask(2) == 0.)) then + mask_dyn(1) = 0. + mask(1) = 0. + flag(1) = flag(1) + flag_dyn + ncut = ncut + 1 + end if + do i = 2, ntod-1 + if (cut(i) .and. (.not. cut(i-1) .or. mask(i-1) == 0.) .and. (.not. cut(i+1) .or. mask(i+1) == 0.)) then + mask_dyn(i) = 0. + mask(i) = 0. + flag(i) = flag(i) + flag_dyn + ncut = ncut + 1 + end if + end do + if (cut(ntod) .and. (.not. cut(ntod-1) .or. mask(ntod-1) == 0.)) then + mask_dyn(ntod) = 0. + mask(ntod) = 0. + flag(ntod) = flag(ntod) + flag_dyn + ncut = ncut + 1 + end if + end do + if (output_scan == self%scanid(scan)) close(58) + deallocate(cut) + !write(*,fmt='(a,a,i6,i4,a,f8.5,i8,i8)') ' Dynamic mask, single spikes-- ', trim(self%freq), self%scanid(scan), det, ' = ', real(ncut,sp) / ntod, ncut + self%mask_dyn_stats(3) = self%mask_dyn_stats(3) + end if - ! Compute rms - rms = 0.d0 - n = 0 - do i = 1, ntod - if (mask(i) /= 1.) cycle - rms = rms + res(i)**2 - n = n + 1 - end do - rms = sqrt(rms/(n-1)) + if (threshold(4) > 0.) then + ! Look for excess variance excess in small windows; typically cosmic rays and other short glitches + allocate(var_window(ntod)) + window = 5 + call compute_running_variance(res, mask, window, var_window, var_mean=var0, mean_full=.true.) + var_window = sqrt(var_window) + var0 = sqrt(var0) + ncut = 0 + if (output_scan == self%scanid(scan)) open(58, file='flag_stage3.dat') + do i = 1, ntod + if (output_scan == self%scanid(scan) .and. mask(i) == 1.) write(58,*) i, res(i), var_window(i), var_window(i)/(threshold(4)*var0), threshold(4)*var0 + if (mask(i) == 1. .and. var_window(i) > threshold(4)*var0) then + do k = max(i-window,1), min(i+window,ntod) + if (iand(flag(k),self%flag0) .eq. 0) then + mask_dyn(k) = 0. + mask(k) = 0. + flag(k) = flag(k) + flag_dyn + ncut = ncut + 1 + end if + end do + end if + end do + if (output_scan == self%scanid(scan)) close(58) + deallocate(var_window) + !write(*,fmt='(a,a,i6,i4,a,f8.5,i8,i8)') ' Dynamic mask, small window -- ', trim(self%freq), self%scanid(scan), det, ' = ', real(ncut,sp) / ntod, ncut + self%mask_dyn_stats(4) = self%mask_dyn_stats(4) + ncut + end if -! write(*,*) 'a' - ! Get full-sky mask -! if (associated(self%mask_solar)) then -! allocate(mask_solar(0:12*self%nside**2-1,1)) -! call self%mask_solar%bcast_fullsky_map(mask_solar) -! end if + if (threshold(5) > 0.) then + ! Look for excess variance excess in intermediate windows + allocate(var_window(ntod)) + window = 50 + call compute_running_variance(res, mask, window, var_window, var_mean=var0, mean_full=.true.) + var_window = sqrt(var_window) + ncut = 0 + if (output_scan == self%scanid(scan)) open(58, file='flag_stage4.dat') + do i = 1, ntod + if (output_scan == self%scanid(scan) .and. mask(i) == 1.) write(58,*) i, res(i), var_window(i), var_window(i)/(threshold(5)*var0) + if (mask(i) == 1. .and. var_window(i) > threshold(5)*var0) then + do k = max(i-window,1), min(i+window,ntod) + if (iand(flag(k),self%flag0) .eq. 0) then + !if (mask(k) == 1) then + mask_dyn(k) = 0. + mask(k) = 0. + flag(k) = flag(k) + flag_dyn + ncut = ncut + 1 + end if + end do + end if + end do + if (output_scan == self%scanid(scan)) close(58) + deallocate(var_window) + !write(*,fmt='(a,a,i6,i4,a,f8.5,i8,i8)') ' Dynamic mask, broad window -- ', trim(self%freq), self%scanid(scan), det, ' = ', real(ncut,sp) / ntod, ncut + self%mask_dyn_stats(5) = self%mask_dyn_stats(5) + ncut + end if - -! write(*,*) 'b' - ! Look for strong outliers and masked samples, save bad ranges - allocate(bad(2,nmax)) - bad = -1 - n = 0 - do i = 1, ntod - - ! Apply RMS selection criterium - if (mask(i) == 1) then - cut = res(i) < rms_range(1)*rms .or. res(i) > rms_range(2)*rms - else - cut = .false. - end if - - ! Apply solar mask selection criterium -! call pix2vec_ring(self%nside, self%scans(scan)%d(det)%pix_sol(i,1), vec) -! elon = acos(min(max(vec(1),-1.d0),1.d0)) * 180.d0/pi ! The Sun is at (1,0,0) - ! cut = cut .or. elon < self%sol_elong_range(1) .or. elon > self%sol_elong_range(2) - if (allocated(self%mask_solar)) then - cut = cut .or. (self%mask_solar(self%scans(scan)%d(det)%pix_sol(i,1),1) < 0.5) - end if +!!$ open(58, file='var4.dat') +!!$ do i = 1, ntod +!!$ if (iand(flag(i),self%flag0) .eq. 0) write(58,*) i, res(i), flag(i) +!!$ end do +!!$ close(58) + + if (threshold(6) > 0.) then + ! Look for excess variance excess in large windows + allocate(var_window(ntod)) + window = 500 + call compute_running_variance(res, mask, window, var_window, var_mean=var0, mean_full=.true.) + var_window = sqrt(var_window) + ncut = 0 + if (output_scan == self%scanid(scan)) open(58, file='flag_stage5.dat') + do i = 1, ntod + if (output_scan == self%scanid(scan) .and. mask(i) == 1.) write(58,*) i, res(i), var_window(i), var_window(i)/(threshold(6)*var0) + if (mask(i) == 1. .and. var_window(i) > threshold(6)*var0) then + do k = max(i-window,1), min(i+window,ntod) + if (iand(flag(k),self%flag0) .eq. 0) then + !if (mask(k) == 1) then + mask_dyn(k) = 0. + mask(k) = 0. + flag(k) = flag(k) + flag_dyn + ncut = ncut + 1 + end if + end do + end if + end do + if (output_scan == self%scanid(scan)) close(58) + deallocate(var_window) + !write(*,fmt='(a,a,i6,i4,a,f8.5,i8,i8)') ' Dynamic mask, 500 window -- ', trim(self%freq), self%scanid(scan), det, ' = ', real(ncut,sp) / ntod, ncut + self%mask_dyn_stats(6) = self%mask_dyn_stats(6) + ncut + end if - if (cut) then - ! Start new range if not already active - if (bad(1,n+1) == -1) bad(1,n+1) = i - mask(i) = 0. - else - ! Close active range - if (bad(1,n+1) /= -1 .and. bad(2,n+1) == -1) then - bad(2,n+1) = i-1 - n = n+1 - end if - end if - - ! Increase array size if needed - if (n == nmax) then - nmax = 2*nmax - allocate(buffer(2,nmax)) - buffer = -1 - buffer(:,1:nmax/2) = bad - deallocate(bad) - allocate(bad(2,nmax)) - bad = buffer - deallocate(buffer) - end if - end do + if (threshold(7) > 0.) then + ! Remove isolated samples + ncut = 0 + if (iand(flag(1),self%flag0) .eq. 0 .and. iand(flag(2),self%flag0) .ne. 0) then + mask_dyn(1) = 0. + mask(1) = 0. + flag(1) = flag(1) + flag_dyn + ncut = ncut + 1 + end if + do i = 2, ntod-1 + if (iand(flag(i-1),self%flag0) .ne. 0 .and. iand(flag(i),self%flag0) .eq. 0 .and. iand(flag(i+1),self%flag0) .ne. 0) then + mask_dyn(i) = 0. + mask(i) = 0. + flag(i) = flag(i) + flag_dyn + ncut = ncut + 1 + end if + end do + if (iand(flag(ntod),self%flag0) .eq. 0 .and. iand(flag(ntod-1),self%flag0) .ne. 0) then + mask_dyn(ntod) = 0. + mask(ntod) = 0. + flag(ntod) = flag(ntod) + flag_dyn + ncut = ncut + 1 + end if + !write(*,fmt='(a,a,i6,i4,a,f8.5,i8,i8)') ' Dynamic mask, single samp -- ', trim(self%freq), self%scanid(scan), det, ' = ', real(ncut,sp) / ntod, ncut + self%mask_dyn_stats(7) = self%mask_dyn_stats(7) + ncut + end if - ! Close open range if needed at the end - if (bad(1,n+1) /= -1 .and. bad(2,n+1) == -1) then - bad(2,n+1) = ntod - n = n+1 - end if - + if (threshold(8) > 0.) then + ! Remove consecutive chunks with many flagged samples + window = 2000 + ncut = 0 + if (output_scan == self%scanid(scan)) open(58, file='flag_stage7.dat') + do i = 1, ntod + if (output_scan == self%scanid(scan)) write(58,*) i, res(i), iand(flag(k),self%flag0) .eq. 0 + j = max(i-window,1) + k = min(i+window,ntod) + if (count(flag(j:k) == flag_dyn)/real(k-j+1,sp) > threshold(8)) then + do k = max(i-window,1), min(i+window,ntod) + if (iand(flag(k),self%flag0) .eq. 0) then + mask_dyn(k) = 0. + mask(k) = 0. + flag(k) = flag(k) + flag_dyn + ncut = ncut + 1 + end if + end do + end if + end do + if (output_scan == self%scanid(scan)) close(58) + !write(*,fmt='(a,a,i6,i4,a,f8.5,i8,i8)') ' Dynamic mask, consecutive -- ', trim(self%freq), self%scanid(scan), det, ' = ', real(ncut,sp) / ntod, ncut + self%mask_dyn_stats(8) = self%mask_dyn_stats(8) + ncut + end if + + if (output_scan == self%scanid(scan)) then + open(58, file='flag_stage7.dat') + do i = 1, ntod + if (present(s_tot)) then + if (iand(flag(i),self%flag0) .eq. 0) write(58,*) i, res(i), s_tot(i) + else + if (iand(flag(i),self%flag0) .eq. 0) write(58,*) i, res(i) + end if + end do + close(58) + end if + + ! Solar-centric mask + if (threshold(9) > 0.) then + ncut = 0 + if (allocated(self%mask_solar) .and. self%use_solar_point) then + do i = 1, ntod + if (iand(flag(i),self%flag0) .ne. 0) cycle + if (self%mask_solar(self%scans(scan)%d(det)%pix_sol(i,1),1) < 0.5) then + mask_dyn(i) = 0. + mask(i) = 0. + flag(i) = flag(i) + flag_dyn + ncut = ncut+1 + end if + end do + end if + if (allocated(self%mask_moon) .and. self%use_moon_point) then + do i = 1, ntod + if (iand(flag(i),self%flag0) .ne. 0) cycle + if (self%mask_moon(self%scans(scan)%d(det)%pix_moon(i,1),1) < 0.5) then + mask_dyn(i) = 0. + mask(i) = 0. + flag(i) = flag(i) + flag_dyn + ncut = ncut+1 + end if + end do + end if + if (allocated(self%mask_earth) .and. self%use_earth_elon) then + do i = 1, ntod + if (iand(flag(i),self%flag0) .ne. 0) cycle + b_elon = max(min(int(self%scans(scan)%d(det)%earth_elon(i,1)/(pi/NBIN_EARTH_ELON)),NBIN_EARTH_ELON),1) + if (self%mask_earth(b_elon) < 0.5) then + mask_dyn(i) = 0. + mask(i) = 0. + flag(i) = flag(i) + flag_dyn + ncut = ncut+1 + end if + end do + end if + + !write(*,fmt='(a,a,i6,i4,a,f8.5,i8,i8)') ' Dynamic mask, solar elong -- ', trim(self%freq), self%scanid(scan), det, ' = ', real(ncut,sp) / ntod, ncut + self%mask_dyn_stats(9) = self%mask_dyn_stats(9) + ncut + end if + + if (output_scan == self%scanid(scan)) then + open(58, file='flag_stage8.dat') + do i = 1, ntod + if (present(s_tot)) then + if (iand(flag(i),self%flag0) .eq. 0) write(58,*) i, res(i), s_tot(i) + else + if (iand(flag(i),self%flag0) .eq. 0) write(58,*) i, res(i) + end if + end do + close(58) + end if + + ! Compress and store dynamic mask + allocate(bad(2,nmax)) + bad = -1 + n = 0 + do i = 1, ntod + if (mask_dyn(i) == 0.) then + ! Start new range if not already active + if (bad(1,n+1) == -1) bad(1,n+1) = i + else + ! Close active range + if (bad(1,n+1) /= -1 .and. bad(2,n+1) == -1) then + bad(2,n+1) = i-1 + n = n+1 + end if + end if + + ! Increase array size if needed + if (n == nmax) then + nmax = 2*nmax + allocate(buffer(2,nmax)) + buffer = -1 + buffer(:,1:nmax/2) = bad + deallocate(bad) + allocate(bad(2,nmax)) + bad = buffer + deallocate(buffer) + end if + end do + + ! Close open range if needed at the end + if (bad(1,n+1) /= -1 .and. bad(2,n+1) == -1) then + bad(2,n+1) = ntod + n = n+1 + end if + ! Store final array - if (n > 0) then - allocate(self%scans(scan)%d(det)%mask_dyn(2,n)) - self%scans(scan)%d(det)%mask_dyn = bad(:,1:n) -!!$ do i = 1, n -!!$ write(*,*) i, bad(:,i) -!!$ end do - !write(*,fmt='(a,i6,a,i6,i4)') ' Removing ', n, ' ranges in dynamic mask for scan, det', self%scanid(scan), det - end if + if (n > 0) then + allocate(self%scans(scan)%d(det)%mask_dyn(2,n)) + self%scans(scan)%d(det)%mask_dyn = bad(:,1:n) + !write(*,fmt='(a,a,i6,i4,a,f8.5,i8,i8)') ' Dynamic mask, total -- ', trim(self%freq), self%scanid(scan), det, ' = ', real(count(iand(flag,self%flag0) .ne. 0),sp) / ntod, count(iand(flag,self%flag0) .ne. 0), ntod + end if - -! write(*,*) 'c' - deallocate(bad) -! if (allocated(mask_solar)) deallocate(mask_solar) - end subroutine + if (count(iand(flag,self%flag0) .eq. 0) == 0) then + write(*,fmt='(a,a,i6,i4)') ' Dynamic mask, scan rejected = ', trim(self%freq), self%scanid(scan), det + self%scans(scan)%d(det)%accept = .false. + end if + + deallocate(bad, mask_dyn) + end subroutine create_dynamic_mask + subroutine report_dynamic_mask_stats(self) + implicit none + class(comm_tod), intent(in) :: self + + integer(i4b) :: ierr, ntod + + ! Synchronize stats across cores + call mpi_allreduce(MPI_IN_PLACE, self%mask_dyn_stats, size(self%mask_dyn_stats), MPI_INTEGER, MPI_SUM, self%comm, ierr) + + if (self%myid == 0) then + ntod = self%mask_dyn_stats(-1) + write(*,fmt='(a,a,a)') 'TOD flagging stats for ', trim(self%freq), ' ( frac, ntot )' + write(*,fmt='(a,f8.5,i16)') ' Total number of samples = ', real(self%mask_dyn_stats(-1),sp)/ntod, ntod + write(*,fmt='(a,f8.5,i16)') ' Base flagging = ', real(self%mask_dyn_stats( 0),sp)/ntod, self%mask_dyn_stats( 0) + write(*,fmt='(a,f8.5,i16)') ' Dynamic mask, pixhist = ', real(self%mask_dyn_stats( 1),sp)/ntod, self%mask_dyn_stats( 1) + write(*,fmt='(a,f8.5,i16)') ' Dynamic mask, extreme = ', real(self%mask_dyn_stats( 2),sp)/ntod, self%mask_dyn_stats( 2) + write(*,fmt='(a,f8.5,i16)') ' Dynamic mask, single spikes = ', real(self%mask_dyn_stats( 3),sp)/ntod, self%mask_dyn_stats( 3) + write(*,fmt='(a,f8.5,i16)') ' Dynamic mask, 5 window = ', real(self%mask_dyn_stats( 4),sp)/ntod, self%mask_dyn_stats( 4) + write(*,fmt='(a,f8.5,i16)') ' Dynamic mask, 50 window = ', real(self%mask_dyn_stats( 5),sp)/ntod, self%mask_dyn_stats( 5) + write(*,fmt='(a,f8.5,i16)') ' Dynamic mask, 500 window = ', real(self%mask_dyn_stats( 6),sp)/ntod, self%mask_dyn_stats( 6) + write(*,fmt='(a,f8.5,i16)') ' Dynamic mask, single samp = ', real(self%mask_dyn_stats( 7),sp)/ntod, self%mask_dyn_stats( 7) + write(*,fmt='(a,f8.5,i16)') ' Dynamic mask, consecutive = ', real(self%mask_dyn_stats( 8),sp)/ntod, self%mask_dyn_stats( 8) + write(*,fmt='(a,f8.5,i16)') ' Dynamic mask, solar mask = ', real(self%mask_dyn_stats( 9),sp)/ntod, self%mask_dyn_stats( 9) + write(*,fmt='(a,f8.5,i16)') ' Final accept ratio = ', real(ntod-sum(self%mask_dyn_stats(0:9)),sp)/ntod, ntod-sum(self%mask_dyn_stats(0:9)) + end if + + end subroutine report_dynamic_mask_stats + subroutine distribute_sky_maps(tod, map_in, scale, map_out, map_full) implicit none class(comm_tod), intent(in) :: tod @@ -3066,7 +3668,7 @@ subroutine distribute_sky_maps(tod, map_in, scale, map_out, map_full) end if end do do k = 1, tod%nobs - do l = 1, tod%nmaps + do l = 1, nmaps map_out(l,k,0,j) = sum(map_out(l,k,1:tod%ndet,j))/tod%ndet end do end do @@ -3079,7 +3681,7 @@ subroutine distribute_sky_maps(tod, map_in, scale, map_out, map_full) end subroutine distribute_sky_maps - subroutine get_s_static(self, band, point, s) + subroutine get_s_static(self, band, s, point_solar, point_moon, earth_elon) ! Evaluates the solar centric TOD ! ! Parameters: @@ -3091,19 +3693,40 @@ subroutine get_s_static(self, band, point, s) implicit none class(comm_tod), intent(in) :: self integer(i4b), intent(in) :: band - integer(i4b), dimension(:), intent(in) :: point real(sp), dimension(:), intent(out) :: s + integer(i4b), dimension(:), intent(in), optional :: point_solar + integer(i4b), dimension(:), intent(in), optional :: point_moon + real(sp), dimension(:), intent(in), optional :: earth_elon + + real(sp) :: elon + integer(i4b) :: i, bin - integer(i4b) :: i + ! Initialize to zero + s = 0. - if (.not. associated(self%map_solar)) then - s = 0.d0 - return + ! Solar contribution + if (present(point_solar) .and. associated(self%map_solar)) then + do i = 1, size(s) + s(i) = s(i) + self%map_solar(point_solar(i),1) + end do + end if + + ! Moon contribution + if (present(point_moon) .and. associated(self%map_moon)) then + do i = 1, size(s) + s(i) = s(i) + self%map_moon(point_moon(i),1) + end do + end if + + ! Earth contribution + if (present(earth_elon) .and. associated(self%map_earth)) then + write(*,*) 'Solar elongation correction not yet implemented' + !do i = 1, size(s) + ! elon = 0. + ! bin = 1 + ! s(i) = s(i) + self%map_earth(bin) + !end do end if - - do i = 1, size(s) - s(i) = self%map_solar(point(i),1) - end do end subroutine get_s_static diff --git a/commander3/src/comm_tod_noise_mod.f90 b/commander3/src/comm_tod_noise_mod.f90 index e13bd3a3f..e01ef6022 100644 --- a/commander3/src/comm_tod_noise_mod.f90 +++ b/commander3/src/comm_tod_noise_mod.f90 @@ -21,6 +21,8 @@ module comm_tod_noise_mod use comm_tod_mod use InvSamp_mod + use comm_tod_noise_psd_mod + use comm_status_mod implicit none @@ -70,15 +72,15 @@ subroutine sample_n_corr(self, tod, handle, scan, mask, s_sub, n_corr, pix, freq logical(lgt), intent(in), optional :: nomono integer(i4b) :: i, j, l, k, n, m, nomp, ntod, ndet, err, omp_get_max_threads - integer(i4b) :: nfft, nbuff, j_end, j_start + integer(i4b) :: nfft, nbuff, j_end, j_start, ndof integer*8 :: plan_fwd, plan_back logical(lgt) :: init_masked_region, end_masked_region, pcg_converged, nomono_ real(sp) :: sigma_0, alpha, nu_knee, samprate, gain, mean, N_wn, N_c, nu - real(dp) :: power, fft_norm + real(dp) :: power, fft_norm, var1, var2 character(len=1024) :: filename real(sp), allocatable, dimension(:) :: dt complex(spc), allocatable, dimension(:) :: dv - real(sp), allocatable, dimension(:) :: d_prime, ncorr2 + real(sp), allocatable, dimension(:) :: d_prime, ncorr2, ps call timer%start(TOD_NCORR, self%band) @@ -100,7 +102,7 @@ subroutine sample_n_corr(self, tod, handle, scan, mask, s_sub, n_corr, pix, freq call timer%stop(TOT_FFT) call timer%start(TOT_FFT) - allocate(dt(nfft), dv(0:n-1), d_prime(ntod), ncorr2(ntod)) + allocate(dt(nfft), dv(0:n-1), ps(0:n-1), d_prime(ntod), ncorr2(ntod)) call sfftw_plan_dft_r2c_1d(plan_fwd, nfft, dt, dv, fftw_estimate + fftw_unaligned) call sfftw_plan_dft_c2r_1d(plan_back, nfft, dv, dt, fftw_estimate + fftw_unaligned) call timer%stop(TOT_FFT) @@ -158,12 +160,38 @@ subroutine sample_n_corr(self, tod, handle, scan, mask, s_sub, n_corr, pix, freq ! Remove monopole if requested by user if (nomono_) d_prime = d_prime - sum(d_prime*mask(:,i))/sum(mask(:,i)) + + ! Output power spectrum of signal-subtracted gap-filled TOD to disk + if (.false. .and. self%scanid(scan) == 5012) then + !dt = (tod(:,i) - self%scans(scan)%d(i)%gain * s_tot(:,i))*mask(:,i) + dt(1:ntod) = d_prime(:) + dt(2*ntod:ntod+1:-1) = dt(1:ntod) + call sfftw_execute_dft_r2c(plan_fwd, dt, dv) + open(58,file='noise_psd.dat', recl=1024) + do l = 1, n-1 + ps(l) = abs(dv(l)) ** 2 / ntod + write(58,*) l*(samprate/2)/(n-1), ps(l), self%scans(scan)%d(i)%N_psd%eval_full(real(l*(samprate/2)/(n-1),sp)) + end do + close(58) + end if pcg_converged = .false. call get_ncorr_sm_cg(handle, d_prime, ncorr2, mask(:,i), self%scans(scan)%d(i)%N_psd, samprate, nfft, plan_fwd, plan_back, pcg_converged, self%scanid(scan), i, trim(self%freq), nomono_) n_corr(:,i) = ncorr2(:) + ! Check goodness-of-fit + var1 = 0.d0; var2 = 0.d0 + do j = 1, ntod + if (mask(j,i) == 1.) then + var1 = var1 + (d_prime(j)-ncorr2(j))**2 + var2 = var2 + d_prime(j)**2 + end if + end do + pcg_converged = pcg_converged .and. var1 < var2 + if (.not. pcg_converged) then + !write(*,*) 'Ncorr PCG failed, scan = ', self%scanid(scan), ', RMS ratio = ', sqrt(var1/var2) + ! Preparing for fft dt(1:ntod) = d_prime(:) dt(2*ntod:ntod+1:-1) = dt(1:ntod) @@ -202,24 +230,25 @@ subroutine sample_n_corr(self, tod, handle, scan, mask, s_sub, n_corr, pix, freq call timer%stop(TOT_FFT) dt = dt / nfft n_corr(:,i) = dt(1:ntod) + else + !write(*,*) 'Ncorr PCG accepted, scan = ', self%scanid(scan), ', RMS ratio = ', sqrt(var1/var2) end if - !if (.true. .and. mod(self%scanid(scan),100) == 1) then - ! write(filename, "(A, I0.3, A, I0.3, 3A)") 'ncorr_tods_new/ncorr_times', self%scanid(scan), '_', i, '_',trim(self%freq),'_final_hundred.dat' - ! open(65,file=trim(filename),status='REPLACE') - ! do j = 1, ntod - ! if (present(tod_arr)) then - ! write(65, '(14(E15.6E3))') n_corr(j,i), s_sub(j,i), mask(j,i), d_prime(j), real(tod_arr(j,i),sp), self%scans(scan)%d(i)%gain, self%scans(scan)%d(i)%N_psd%alpha, self%scans(scan)%d(i)%N_psd%fknee, self%scans(scan)%d(i)%N_psd%sigma0, self%scans(scan)%d(i)%N_psd%alpha_def, self%scans(scan)%d(i)%N_psd%fknee_def, self%scans(scan)%d(i)%N_psd%sigma0_def, self%samprate, ncorr2(j) - ! else - ! write(65, '(14(E15.6E3))') n_corr(j,i), s_sub(j,i), mask(j,i), d_prime(j), self%scans(scan)%d(i)%tod(j), self%scans(scan)%d(i)%gain, self%scans(scan)%d(i)%N_psd%alpha, self%scans(scan)%d(i)%N_psd%fknee, self%scans(scan)%d(i)%N_psd%sigma0, self%scans(scan)%d(i)%N_psd%alpha_def, self%scans(scan)%d(i)%N_psd%fknee_def, self%scans(scan)%d(i)%N_psd%sigma0_def, self%samprate, ncorr2(j) - ! end if - ! end do - ! close(65) - ! !stop - !end if + !if (.true. .and. mod(self%scanid(scan),1000) == 1) then + !if (.true. .and. self%scanid(scan) == 5013) then + if (.false.) then + write(filename, "(A, I0.3, A, I0.3, 3A)") 'ncorr_times', self%scanid(scan), '_', i, '_',trim(self%freq),'.dat' + open(65,file=trim(filename),status='REPLACE',recl=1024) + do j = 1, ntod + !write(65, '(i8,6(E15.6E3))') j, n_corr(j,i), s_sub(j,i), mask(j,i), d_prime(j), self%scans(scan)%d(i)%tod(j), ncorr2(j) + write(65, '(i8,7(E15.6E3))') j, d_prime(j), n_corr(j,i), ncorr2(j), sigma_0, ((d_prime(j)-n_corr(j,i))/sigma_0)**2, ((d_prime(j)-ncorr2(j))/sigma_0)**2, mask(j,i) + end do + close(65) + !stop + end if end do - deallocate(dt, dv) + deallocate(dt, dv, ps) deallocate(d_prime) deallocate(ncorr2) @@ -268,17 +297,20 @@ subroutine get_ncorr_sm_cg(handle, d_prime, ncorr, mask, N_psd, samprate, nfft, allocate(x(ntod), b(ntod), r(ntod), d(ntod), Mr(ntod), Ad(ntod)) allocate(u(nmask), bp(nmask), xp(nmask), rp(nmask), p(nmask)) - if (nomono) then - invNcorr(0) = 1d12 - else +! if (nomono) then +! invNcorr(0) = 1d12 +! else invNcorr(0) = 0.d0 - end if +! end if invM(0) = 1.d0 + !open(58,file='N_psd.dat', recl=1024) do l = 1, n-1 freq = l*(samprate/2)/(n-1) invNcorr(l) = N_psd%sigma0**2 / N_psd%eval_corr(freq) invM(l) = 1.d0 / (1.d0 + invNcorr(l)) + !write(58,*) freq, N_psd%sigma0**2, N_psd%eval_corr(freq), invM(l) end do + !close(58) j = 1 do i = 1, ntod @@ -324,6 +356,7 @@ subroutine get_ncorr_sm_cg(handle, d_prime, ncorr, mask, N_psd, samprate, nfft, xp = xp + alp*p rp = rp - alp * Ad(u) r2new = sum(rp**2) + !write(*,*) 'CG ncorr -- ', k, r2new, sigma_bp if (sqrt(abs(r2new)) < eps * sigma_bp * nmask) then ! average error in each datapoint < eps * sigma_bp converged = .true. exit @@ -337,6 +370,9 @@ subroutine get_ncorr_sm_cg(handle, d_prime, ncorr, mask, N_psd, samprate, nfft, x = Ad ncorr = x * N_psd%sigma0 + + ! Subtract monopole + if (nomono) ncorr = ncorr - sum(ncorr*mask)/sum(mask) deallocate(invNcorr, invM) deallocate(x, b, r, d, Mr, Ad) @@ -470,7 +506,7 @@ subroutine sample_noise_psd(self, tod, handle, scan, mask, s_tot, n_corr, freqma samprate = self%samprate n_gibbs = 1 threshold = 5.d0 ! Remove outliers - outscan = -1 !92 + outscan = 5013 !-1 !92 ! Sample sigma_0 from pairwise differenced TOD do i = 1, ndet @@ -628,6 +664,7 @@ subroutine multiply_inv_N(tod, scan, buffer, sampfreq, pow, off) logical(lgt) :: off_ real(sp), allocatable, dimension(:,:) :: dt complex(spc), allocatable, dimension(:,:) :: dv + class(comm_noise_psd), pointer :: N_psd ntod = size(buffer, 1) ndet = size(buffer, 2) @@ -637,7 +674,26 @@ subroutine multiply_inv_N(tod, scan, buffer, sampfreq, pow, off) pow_ = 1.d0; if (present(pow)) pow_ = pow off_ = .false.; if (present(off)) off_ = off samprate = real(tod%samprate,sp); if (present(sampfreq)) samprate = real(sampfreq,sp) - + + ! Check if white noise is requested; in that case, skip FFTs + N_psd => tod%scans(scan)%d(1)%N_psd + select type (N_psd) + class is (comm_noise_psd_white) + do i = 1, ndet + if (.not. tod%scans(scan)%d(i)%accept) then + buffer(:,i) = 0.d0 + else + buffer(:,i) = buffer(:,i) / (tod%scans(scan)%d(i)%N_psd%sigma0**2 * samprate / tod%samprate)**pow_ + end if + if (off_) then + ! Subtract offset + buffer(:,i) = buffer(:,i) - sum(buffer(:,i))/size(buffer(:,i)) + end if + end do + return + end select + + ! If not white noise, perform the multiplication in Fourier space allocate(dt(2*ntod,m), dv(0:n-1,m)) call timer%start(TOT_FFT) call sfftw_plan_many_dft_r2c(plan_fwd, 1, 2*ntod, m, dt, & diff --git a/commander3/src/comm_tod_noise_psd_mod.f90 b/commander3/src/comm_tod_noise_psd_mod.f90 index 8f9a5a516..93a01dac9 100644 --- a/commander3/src/comm_tod_noise_psd_mod.f90 +++ b/commander3/src/comm_tod_noise_psd_mod.f90 @@ -32,7 +32,7 @@ module comm_tod_noise_psd_mod implicit none private - public comm_noise_psd, comm_noise_psd_2oof, comm_noise_psd_oof_gauss, comm_noise_psd_oof_quad + public comm_noise_psd, comm_noise_psd_white, comm_noise_psd_oof, comm_noise_psd_2oof, comm_noise_psd_oof_gauss, comm_noise_psd_oof_quad integer(i4b), parameter :: SIGMA0 = 1 integer(i4b), parameter :: FKNEE = 2 @@ -45,7 +45,7 @@ module comm_tod_noise_psd_mod integer(i4b), parameter :: SLOPE = 4 integer(i4b), parameter :: QUADRATIC = 5 - type :: comm_noise_psd + type, abstract :: comm_noise_psd ! ! Class definition for basic 1/f noise PSD model ! @@ -60,16 +60,73 @@ module comm_tod_noise_psd_mod logical(lgt) :: apply_filter ! If we should apply the spline filter to the noise output type(spline_type) :: modulation_filter ! The filter multiplied to the output noise contains - procedure :: eval_full => eval_noise_psd_full - procedure :: eval_corr => eval_noise_psd_corr + procedure(eval_noise_psd_full), deferred :: eval_full + procedure(eval_noise_psd_corr), deferred :: eval_corr procedure :: init_common end type comm_noise_psd - interface comm_noise_psd - procedure constructor_oof - end interface comm_noise_psd - - + abstract interface + function eval_noise_psd_full(self, nu) + import comm_noise_psd, sp + ! + ! Evaluation routine for general noise PSD object; both correlated and uncorrelated components + ! + ! Arguments + ! --------- + ! self: derived type (comm_noise_psd) + ! Basic noise PSD object + ! nu: sp (scalar) + ! Frequency (in Hz) at which to evaluate PSD + ! + implicit none + class(comm_noise_psd), intent(in) :: self + real(sp), intent(in) :: nu + real(sp) :: eval_noise_psd_full + end function eval_noise_psd_full + end interface + + abstract interface + function eval_noise_psd_corr(self, nu) + import comm_noise_psd, sp + ! + ! Evaluation routine for general noise PSD object; correlated noise only + ! + ! Arguments + ! --------- + ! self: derived type (comm_noise_psd) + ! Basic noise PSD object + ! nu: sp (scalar) + ! Frequency (in Hz) at which to evaluate PSD + ! + implicit none + class(comm_noise_psd), intent(in) :: self + real(sp), intent(in) :: nu + real(sp) :: eval_noise_psd_corr + end function eval_noise_psd_corr + end interface + + ! ####################################### + ! Specific noise class definition + ! ####################################### + + type, extends(comm_noise_psd) :: comm_noise_psd_white + ! + ! Class definition for white noise PSD model + ! + contains + procedure :: eval_full => eval_noise_psd_white_full + procedure :: eval_corr => eval_noise_psd_white_corr + end type comm_noise_psd_white + + type, extends(comm_noise_psd) :: comm_noise_psd_oof + ! + ! Class definition for basic 1/f noise PSD model + ! + contains + procedure :: eval_full => eval_noise_psd_oof_full + procedure :: eval_corr => eval_noise_psd_oof_corr + end type comm_noise_psd_oof + type, extends(comm_noise_psd) :: comm_noise_psd_2oof ! ! Class definition for 2-component 1/f noise PSD model @@ -79,6 +136,7 @@ module comm_tod_noise_psd_mod procedure :: eval_corr => eval_noise_psd_2oof_corr end type comm_noise_psd_2oof + type, extends(comm_noise_psd) :: comm_noise_psd_oof_gauss ! ! Class definition for 2-component 1/f + Gauss noise PSD model @@ -97,6 +155,14 @@ module comm_tod_noise_psd_mod procedure :: eval_corr => eval_noise_psd_oof_quad_corr end type comm_noise_psd_oof_quad + interface comm_noise_psd_white + procedure constructor_white + end interface comm_noise_psd_white + + interface comm_noise_psd_oof + procedure constructor_oof + end interface comm_noise_psd_oof + interface comm_noise_psd_2oof procedure constructor_2oof end interface comm_noise_psd_2oof @@ -108,9 +174,135 @@ module comm_tod_noise_psd_mod interface comm_noise_psd_oof_quad procedure constructor_oof_quad end interface comm_noise_psd_oof_quad - + contains + subroutine init_common(self, P_active_mean, P_active_rms, P_uni, nu_fit, filter) + ! Contains common initialization for all classes of noise model + ! + ! Arguments: + ! + ! self : comm_tod_noise_psd_mod + ! The noise model object to initialize + implicit none + class(comm_noise_psd), target, intent(inout) :: self + real(sp), dimension(:), intent(in) :: P_active_mean + real(sp), dimension(:), intent(in) :: P_active_rms + real(sp), dimension(:,:), intent(in) :: P_uni + real(sp), dimension(:,:), intent(in) :: nu_fit + real(dp), optional, dimension(:,:), intent(in) :: filter + + allocate(self%xi_n(self%npar)) + allocate(self%P_uni(self%npar,2)) + allocate(self%P_active(self%npar,2)) + allocate(self%P_lognorm(self%npar)) + + self%xi_n = P_active_mean + self%P_uni = P_uni + self%P_active(:,1) = P_active_mean + self%P_active(:,2) = P_active_rms + self%nu_fit = nu_fit + + self%sigma0 => self%xi_n(1) + + if(.not. present(filter)) then + self%apply_filter = .false. + else + self%apply_filter = .true. + end if + + if(self%apply_filter) then + call spline(self%modulation_filter, filter(1,:), filter(2,:)) + end if + end subroutine + + function constructor_white(P_active_mean, P_active_rms, P_uni, nu_fit, filter) + ! + ! Constructor for basic white noise PSD object, where + ! + ! P(nu) = sigma0^2 + ! + ! Arguments + ! --------- + ! xi_n_def: sp (array) + ! 3-element array containing default {sigma0, alpha, fknee}, where + ! [sigma0] = du/volts/tod unit, [alpha] = 1, and [fknee] = Hz + ! P_uni: sp (2D array) + ! Array containing absolute upper and lower limits for each parameter (npar,upper/lower) + ! P_active: sp (2D array) + ! Array containing informative priors for each parameter (npar,mean/rms) + ! nu_fit: sp (2-element array) + ! Array with [nu_min,nu_max] in Hz, defining ranged used for fittig non-linear parameters + ! + ! filter : dp of size (2, :), optional + ! The noise filter to apply, in the form (x(:), y(:)). Regions + ! outside x(1) -> x(n) will not be filtered. Omit this if you + ! don't want filtering + + implicit none + real(sp), dimension(:), intent(in) :: P_active_mean + real(sp), dimension(:), intent(in) :: P_active_rms + real(sp), dimension(:,:), intent(in) :: P_uni + real(sp), dimension(:,:), intent(in) :: nu_fit + real(dp), optional, dimension(:,:), intent(in) :: filter + class(comm_noise_psd_white), pointer :: constructor_white + + allocate(constructor_white) + + constructor_white%npar = 1 + + call constructor_white%init_common(P_active_mean, P_active_rms, P_uni, nu_fit, filter) + + constructor_white%P_lognorm = [.false.] ! [sigma0] + + end function constructor_white + + function eval_noise_psd_white_full(self, nu) + ! + ! Evaluation routine for basic white noise PSD object + ! + ! Arguments + ! --------- + ! self: derived type (comm_noise_psd) + ! Basic noise PSD object + ! nu: sp (scalar) + ! Frequency (in Hz) at which to evaluate PSD + ! + implicit none + class(comm_noise_psd_white), intent(in) :: self + real(sp), intent(in) :: nu + real(sp) :: eval_noise_psd_white_full + + eval_noise_psd_white_full = self%xi_n(SIGMA0)**2 + + if(self%apply_filter) then + if(nu >= self%modulation_filter%x(1) .and. nu <= self%modulation_filter%x(size(self%modulation_filter%x))) then + eval_noise_psd_white_full = eval_noise_psd_white_full * splint(self%modulation_filter, dble(nu)) + end if + end if + + end function eval_noise_psd_white_full + + function eval_noise_psd_white_corr(self, nu) + ! + ! Evaluation routine for basic white noise PSD object; correlated noise only, so this returns zero + ! + ! Arguments + ! --------- + ! self: derived type (comm_noise_psd) + ! Basic noise PSD object + ! nu: sp (scalar) + ! Frequency (in Hz) at which to evaluate PSD + ! + implicit none + class(comm_noise_psd_white), intent(in) :: self + real(sp), intent(in) :: nu + real(sp) :: eval_noise_psd_white_corr + + eval_noise_psd_white_corr = 0. + + end function eval_noise_psd_white_corr + function constructor_oof(P_active_mean, P_active_rms, P_uni, nu_fit, filter) ! ! Constructor for basic 1/f noise PSD object, where @@ -140,7 +332,7 @@ function constructor_oof(P_active_mean, P_active_rms, P_uni, nu_fit, filter) real(sp), dimension(:,:), intent(in) :: P_uni real(sp), dimension(:,:), intent(in) :: nu_fit real(dp), optional, dimension(:,:), intent(in) :: filter - class(comm_noise_psd), pointer :: constructor_oof + class(comm_noise_psd_oof), pointer :: constructor_oof allocate(constructor_oof) @@ -155,50 +347,9 @@ function constructor_oof(P_active_mean, P_active_rms, P_uni, nu_fit, filter) constructor_oof%P_lognorm = [.false., .true., .false.] ! [sigma0, fknee, alpha] - end function constructor_oof - - subroutine init_common(self, P_active_mean, P_active_rms, P_uni, nu_fit, filter) - ! Contains common initialization for all classes of noise model - ! - ! Arguments: - ! - ! self : comm_tod_noise_psd_mod - ! The noise model object to initialize - implicit none - class(comm_noise_psd), target, intent(inout) :: self - real(sp), dimension(:), intent(in) :: P_active_mean - real(sp), dimension(:), intent(in) :: P_active_rms - real(sp), dimension(:,:), intent(in) :: P_uni - real(sp), dimension(:,:), intent(in) :: nu_fit - real(dp), optional, dimension(:,:), intent(in) :: filter - - allocate(self%xi_n(self%npar)) - allocate(self%P_uni(self%npar,2)) - allocate(self%P_active(self%npar,2)) - allocate(self%P_lognorm(self%npar)) - - self%xi_n = P_active_mean - self%P_uni = P_uni - self%P_active(:,1) = P_active_mean - self%P_active(:,2) = P_active_rms - self%nu_fit = nu_fit - - self%sigma0 => self%xi_n(1) - - if(.not. present(filter)) then - self%apply_filter = .false. - else - self%apply_filter = .true. - end if - - if(self%apply_filter) then - call spline(self%modulation_filter, filter(1,:), filter(2,:)) - end if - - - end subroutine + end function constructor_oof - function eval_noise_psd_full(self, nu) + function eval_noise_psd_oof_full(self, nu) ! ! Evaluation routine for basic 1/f noise PSD object ! @@ -210,21 +361,21 @@ function eval_noise_psd_full(self, nu) ! Frequency (in Hz) at which to evaluate PSD ! implicit none - class(comm_noise_psd), intent(in) :: self + class(comm_noise_psd_oof), intent(in) :: self real(sp), intent(in) :: nu - real(sp) :: eval_noise_psd_full + real(sp) :: eval_noise_psd_oof_full - eval_noise_psd_full = self%xi_n(SIGMA0)**2 * (1. + (nu/self%xi_n(FKNEE))**self%xi_n(ALPHA)) + eval_noise_psd_oof_full = self%xi_n(SIGMA0)**2 * (1. + (nu/self%xi_n(FKNEE))**self%xi_n(ALPHA)) if(self%apply_filter) then if(nu >= self%modulation_filter%x(1) .and. nu <= self%modulation_filter%x(size(self%modulation_filter%x))) then - eval_noise_psd_full = eval_noise_psd_full * splint(self%modulation_filter, dble(nu)) + eval_noise_psd_oof_full = eval_noise_psd_oof_full * splint(self%modulation_filter, dble(nu)) end if end if - end function eval_noise_psd_full + end function eval_noise_psd_oof_full - function eval_noise_psd_corr(self, nu) + function eval_noise_psd_oof_corr(self, nu) ! ! Evaluation routine for basic 1/f noise PSD object; correlated noise only ! @@ -236,19 +387,19 @@ function eval_noise_psd_corr(self, nu) ! Frequency (in Hz) at which to evaluate PSD ! implicit none - class(comm_noise_psd), intent(in) :: self + class(comm_noise_psd_oof), intent(in) :: self real(sp), intent(in) :: nu - real(sp) :: eval_noise_psd_corr + real(sp) :: eval_noise_psd_oof_corr - eval_noise_psd_corr = self%xi_n(SIGMA0)**2 * (nu/self%xi_n(FKNEE))**self%xi_n(ALPHA) + eval_noise_psd_oof_corr = self%xi_n(SIGMA0)**2 * (nu/self%xi_n(FKNEE))**self%xi_n(ALPHA) if(self%apply_filter) then if(nu >= self%modulation_filter%x(1) .and. nu <= self%modulation_filter%x(size(self%modulation_filter%x))) then - eval_noise_psd_corr = eval_noise_psd_corr * splint(self%modulation_filter, dble(nu)) + eval_noise_psd_oof_corr = eval_noise_psd_oof_corr * splint(self%modulation_filter, dble(nu)) end if end if - end function eval_noise_psd_corr + end function eval_noise_psd_oof_corr function constructor_2oof(P_active_mean, P_active_rms, P_uni, nu_fit, filter) ! diff --git a/commander3/src/comm_tod_pixhist_mod.f90 b/commander3/src/comm_tod_pixhist_mod.f90 new file mode 100644 index 000000000..81f61f5bd --- /dev/null +++ b/commander3/src/comm_tod_pixhist_mod.f90 @@ -0,0 +1,201 @@ +module comm_tod_pixhist_mod + use comm_tod_mod + use comm_tod_driver_mod + implicit none + + private + public compute_tod_pixhist + + integer(i4b), parameter :: NBIN_HIST = 100 + integer(i4b), parameter :: MAX_ITER_HIST = 20 + integer(i4b), parameter :: CUTOFF_N_EMPTY = 20 + +contains + + subroutine compute_tod_pixhist(tod, map_sky, map_gain, procmask, procmask2) + implicit none + class(comm_tod), intent(inout) :: tod + real(sp), dimension(0:,1:,1:,1:), intent(in) :: map_sky + real(sp), dimension(0:,1:,1:,1:), intent(in) :: map_gain + real(sp), dimension(0:), intent(in) :: procmask, procmask2 + + integer(i4b) :: i, j, k, ierr, pix, npix_hist, q, bin(1), iter, nhit, hit, n_empty, j_cut + real(sp) :: val, center, mu, sigma + logical(lgt) :: refine + type(comm_scandata) :: sd + character(len=6) :: pix_text + integer(i4b), allocatable, dimension(:,:) :: hist + real(sp), allocatable, dimension(:) :: delta + real(sp), dimension(NBIN_HIST) :: x, P + + if (tod%nhorn /= 1) then + write(*,*) 'compute_tod_pixhist does not support multi-horn data' + stop + end if + + npix_hist = 12*tod%nside_pixhist**2 + q = (tod%nside / tod%nside_pixhist)**2 + + ! Find absolute min and max per low-res pixel + allocate(tod%pixhist(5,0:npix_hist-1)) ! (mu, rms, nhit, min, max) + allocate(delta(0:npix_hist-1)) ! (mu, rms, nhit, min, max) + allocate(hist(0:NBIN_HIST,0:npix_hist-1)) + tod%pixhist = 0. + tod%pixhist(4,:) = 1e30 + tod%pixhist(5,:) = -1e30 + do i = 1, tod%nscan + if (.not. any(tod%scans(i)%d%accept)) cycle + call init_scan_data_singlehorn(sd, tod, i, map_sky, map_gain, procmask, procmask2, skip_zodi=.true.) + do j = 1, tod%ndet + if (.not. tod%scans(i)%d(j)%accept) cycle + do k = 1, sd%ntod + if (iand(sd%flag(k,j), tod%flag0) .ne. 0) cycle + call ring2nest(tod%nside, sd%pix(k,j,1), pix) + pix = pix / q + tod%pixhist(4,pix) = min(tod%pixhist(4,pix), sd%tod(k,j)) + tod%pixhist(5,pix) = max(tod%pixhist(5,pix), sd%tod(k,j)) + end do + end do + + ! Clean up + call dealloc_scan_data(sd) + end do + call mpi_allreduce(MPI_IN_PLACE, tod%pixhist(4,:), size(tod%pixhist(4,:)), MPI_REAL, MPI_MIN, tod%comm, ierr) + call mpi_allreduce(MPI_IN_PLACE, tod%pixhist(5,:), size(tod%pixhist(5,:)), MPI_REAL, MPI_MAX, tod%comm, ierr) + delta = (tod%pixhist(5,:)-tod%pixhist(4,:))/NBIN_HIST + + refine = .true. + iter = 0 + do while (refine) + iter = iter + 1 + !if (tod%myid == 0) write(*,*) 'Pixhist, band = ', trim(tod%freq), ', iter = ', iter + + ! Build histogram + hist = 0. + do i = 1, tod%nscan + if (.not. any(tod%scans(i)%d%accept)) cycle + call init_scan_data_singlehorn(sd, tod, i, map_sky, map_gain, procmask, procmask2, skip_zodi=.true.) + do j = 1, tod%ndet + if (.not. tod%scans(i)%d(j)%accept) cycle + do k = 1, sd%ntod + if (iand(sd%flag(k,j), tod%flag0) .ne. 0) cycle + call ring2nest(tod%nside, sd%pix(k,j,1), pix) + pix = pix / q + if (delta(pix) == 0.) cycle ! 0 or 1 samples in current pixel + bin = int((sd%tod(k,j)-tod%pixhist(4,pix))/delta(pix))+1 + if (bin(1) < 1 .or. bin(1) > NBIN_HIST) bin(1) = 0 ! Sample out of range; discarded + hist(bin(1),pix) = hist(bin(1),pix) + 1 + end do + end do + + ! Clean up + call dealloc_scan_data(sd) + end do + call mpi_allreduce(MPI_IN_PLACE, hist, size(hist), MPI_INTEGER, MPI_SUM, tod%comm, ierr) + + if (iter >= MAX_ITER_HIST) exit + + ! Check histogram quality, and refine limits + refine = .false. + do i = 0, npix_hist-1 + if (delta(i) == 0.) cycle ! 0 or 1 samples in current pixel + + nhit = sum(hist(1:NBIN_HIST,i)) + if (nhit == 0) cycle + ! Cut bins from low side + j = 1 + j_cut = -1 + hit = 0 + n_empty = 0 + do while (hit < nhit/4) + if (hist(j,i) == 0) then + n_empty = n_empty + 1 + else + if (n_empty >= CUTOFF_N_EMPTY) then + j_cut = j + refine = .true. + end if + n_empty = 0 + end if + hit = hit + hist(j,i) + j = j+1 + end do + if (j_cut /= -1) tod%pixhist(4,i) = tod%pixhist(4,i) + (j_cut-2)*delta(i) + + ! Cut bins from high side + j = NBIN_HIST + j_cut = -1 + hit = 0 + n_empty = 0 + do while (hit < nhit/4) + if (hist(j,i) == 0) then + n_empty = n_empty + 1 + else + if (n_empty >= CUTOFF_N_EMPTY) then + j_cut = j + refine = .true. + end if + n_empty = 0 + end if + hit = hit + hist(j,i) + j = j-1 + end do + if (j_cut /= -1) tod%pixhist(5,i) = tod%pixhist(5,i) - (NBIN_HIST-j_cut-1)*delta(i) + + ! Update bin width + delta(i) = (tod%pixhist(5,i)-tod%pixhist(4,i))/NBIN_HIST + !if (delta(i) == 0.) write(*,*) "zero", i, tod%pixhist(4,i), tod%pixhist(5,i), hist(:,i) + end do + end do + + ! Define cuts and output some histograms to disk + do i = 0, npix_hist-1 + if (delta(i) == 0.) then + ! 0 or 1 samples in current pixel; accept anything + tod%pixhist(1,i) = 0. + tod%pixhist(2,i) = 0. + tod%pixhist(3,i) = 0. + tod%pixhist(4,i) = -1e30 + tod%pixhist(5,i) = 1e30 + cycle + end if + + nhit = sum(hist(1:NBIN_HIST,i)) + if (nhit == 0) cycle + do j = 1, NBIN_HIST + x(j) = tod%pixhist(4,i) + (j-0.5) * delta(i) + end do + P = real(hist(1:NBIN_HIST,i),sp) / real(nhit,sp) / delta(i) + + mu = sum(P * x) * delta(i) + sigma = sqrt(sum(P * (x-mu)**2) * delta(i)) + tod%pixhist(1,i) = mu + tod%pixhist(2,i) = sigma + tod%pixhist(3,i) = nhit + tod%pixhist(4,i) = mu - 4.0*sigma + tod%pixhist(5,i) = mu + 4.0*sigma + + if (tod%myid == 0 .and. mod(i,1000)==0) then + call int2string(i,pix_text) + open(58,file='pixhist'//pix_text//'.dat', recl=1024) + write(58,*) '# pixhist =', tod%pixhist(:,i) + do j = 1, NBIN_HIST + write(58,*) x(j), P(j) + end do + write(58,*) + write(58,*) tod%pixhist(4,i), 0. + write(58,*) tod%pixhist(4,i), 2.*maxval(P) + write(58,*) + write(58,*) tod%pixhist(5,i), 0. + write(58,*) tod%pixhist(5,i), 2.*maxval(P) + end if + end do + if (tod%myid == 0) write(*,fmt='(a,a,a,i6)') ' --> Pixhist, band = ', trim(tod%freq), ', numiter = ', iter + + deallocate(delta, hist) + + end subroutine compute_tod_pixhist + + + +end module comm_tod_pixhist_mod diff --git a/commander3/src/comm_tod_pointing_mod.f90 b/commander3/src/comm_tod_pointing_mod.f90 index 8e0bd67fe..c988aec87 100644 --- a/commander3/src/comm_tod_pointing_mod.f90 +++ b/commander3/src/comm_tod_pointing_mod.f90 @@ -20,6 +20,7 @@ !================================================================================ module comm_tod_pointing_mod use comm_tod_mod + use comm_utils implicit none contains @@ -44,6 +45,8 @@ subroutine project_sky(tod, map, pix, psi, flag, pmask, scan_id, & ! T - temperature; Q, U - Stoke's parameters ! if (tod%myid == 78) write(*,*) 'c611', tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires + + nmap = SIZE(map, 1) do det = 1, tod%ndet if (.not. tod%scans(scan_id)%d(det)%accept) then @@ -64,9 +67,8 @@ subroutine project_sky(tod, map, pix, psi, flag, pmask, scan_id, & & map(2,p,det) * tod%cos2psi(psi(i,det)) + & & map(3,p,det) * tod%sin2psi(psi(i,det)) else if (nmap == 1) then - s_sky(i,det) = map(1,p,det) ! HFI 545 thing - end if - + s_sky(i,det) = map(1,p,det) ! Unpolarized channel + end if !if (tod%myid == 78 .and. p == 7863) write(*,*) 'c61122', tod%myid, tod%correct_sl, tod%ndet, tod%slconv(1)%p%psires, i, p tmask(i,det) = pmask(pix(i,det)) @@ -93,7 +95,6 @@ subroutine project_sky(tod, map, pix, psi, flag, pmask, scan_id, & end do end do end if - end subroutine project_sky ! Sky signal template diff --git a/commander3/src/comm_tod_quiet_smod.f90 b/commander3/src/comm_tod_quiet_smod.f90 index 44bb59a87..0fc71c2e7 100644 --- a/commander3/src/comm_tod_quiet_smod.f90 +++ b/commander3/src/comm_tod_quiet_smod.f90 @@ -274,15 +274,15 @@ end function constructor_quiet if (sample_rel_bandpass) then !call sd%init_differential(self, i, map_sky, procmask, procmask2, & ! & init_s_bp=.true., init_s_bp_prop=.true.) - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_bp_prop=.true.) + call sd%init_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_bp_prop=.true.) else if (sample_abs_bandpass) then ! call sd%init_differential(self, i, map_sky, procmask, procmask2, & ! & init_s_bp=.true., init_s_sky_prop=.true.) - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_bp_prop=.true.) + call sd%init_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_bp_prop=.true.) else ! call sd%init_differential(self, i, map_sky, procmask, procmask2, & ! & init_s_bp=.true.) - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true.) + call sd%init_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true.) end if allocate(s_buf(sd%ntod,sd%ndet)) diff --git a/commander3/src/comm_tod_spider_mod.f90 b/commander3/src/comm_tod_spider_mod.f90 index 965742727..0ce85d0db 100644 --- a/commander3/src/comm_tod_spider_mod.f90 +++ b/commander3/src/comm_tod_spider_mod.f90 @@ -31,6 +31,7 @@ module comm_tod_SPIDER_mod ! Routine which processes the time ordered data ! use comm_tod_driver_mod + use comm_conviqt_mod implicit none private diff --git a/commander3/src/comm_tod_spider_smod.f90 b/commander3/src/comm_tod_spider_smod.f90 index cc63187a6..704cd5109 100644 --- a/commander3/src/comm_tod_spider_smod.f90 +++ b/commander3/src/comm_tod_spider_smod.f90 @@ -380,18 +380,18 @@ module subroutine process_SPIDER_tod(self, chaindir, chain, iter, handle, map_in ! Prepare data if (sample_rel_bandpass) then ! if (.true. .or. self%myid == 78) write(*,*) 'b', self%myid, self%correct_sl, self%ndet, self%slconv(1)%p%psires - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_bp_prop=.true.) + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_bp_prop=.true.) else if (sample_abs_bandpass) then - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_sky_prop=.true.) + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true., init_s_sky_prop=.true.) else - call sd%init_singlehorn(self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true.) + call init_scan_data_singlehorn(sd, self, i, map_sky, m_gain, procmask, procmask2, init_s_bp=.true.) end if allocate(s_buf(sd%ntod,sd%ndet)) ! Calling Simulation Routine if (self%enable_tod_simulations) then call simulate_tod(self, i, sd%s_tot, sd%n_corr, handle) - call sd%dealloc + call dealloc_scan_data(sd) cycle end if @@ -660,7 +660,7 @@ module subroutine process_SPIDER_tod(self, chaindir, chain, iter, handle, map_in end if ! Clean up - call sd%dealloc + call dealloc_scan_data(sd) deallocate(s_buf, d_calib) deallocate(s_jump, jumps, tod_gapfill, jump_calib, test_array) diff --git a/commander3/src/comm_tod_wmap_mod.f90 b/commander3/src/comm_tod_wmap_mod.f90 index 261a2c3db..17979d53b 100644 --- a/commander3/src/comm_tod_wmap_mod.f90 +++ b/commander3/src/comm_tod_wmap_mod.f90 @@ -30,6 +30,7 @@ module comm_tod_WMAP_mod ! process_WMAP_tod(self, chaindir, chain, iter, handle, map_in, delta, map_out, rms_out) ! Routine which processes the time ordered data use comm_tod_driver_mod + use comm_conviqt_mod implicit none private @@ -540,11 +541,11 @@ subroutine process_WMAP_tod(self, chaindir, chain, iter, handle, map_in, delta, call update_status(status, "baseline") do i = 1, self%nscan if (.not. any(self%scans(i)%d%accept)) cycle - call sd%init_differential(self, i, map_sky, m_gain, procmask, procmask2) + call init_scan_data_differential(sd, self, i, map_sky, m_gain, procmask, procmask2) call timer%start(TOD_BASELINE, self%band) - call sample_baseline(self, i, sd%tod, sd%s_tot, sd%mask, handle) + call sample_baseline_WMAP(self, i, sd%tod, sd%s_tot, sd%mask, handle) call timer%stop(TOD_BASELINE, self%band) - call sd%dealloc + call dealloc_scan_data(sd) end do self%apply_inst_corr = .true. @@ -609,11 +610,11 @@ subroutine process_WMAP_tod(self, chaindir, chain, iter, handle, map_in, delta, & real(self%spinaxis(i,:),sp) end if if (select_data) then - call sd%init_differential(self, i, map_sky, m_gain, procmask, procmask2, & + call init_scan_data_differential(sd, self, i, map_sky, m_gain, procmask, procmask2, & & init_s_bp=bp_corr) n_tot = n_tot + sd%ntod/1000 n_flag = n_flag + sd%ntod/1000 - call sd%dealloc + call dealloc_scan_data(sd) end if cycle end if @@ -621,26 +622,14 @@ subroutine process_WMAP_tod(self, chaindir, chain, iter, handle, map_in, delta, ! Prepare data if (sample_rel_bandpass) then - call sd%init_differential(self, i, map_sky, m_gain, procmask, procmask2, & + call init_scan_data_differential(sd, self, i, map_sky, m_gain, procmask, procmask2, & & init_s_bp=.true., init_s_bp_prop=.true.) else if (sample_abs_bandpass) then - call sd%init_differential(self, i, map_sky, m_gain, procmask, procmask2, & + call init_scan_data_differential(sd, self, i, map_sky, m_gain, procmask, procmask2, & & init_s_bp=.true., init_s_sky_prop=.true.) else - call sd%init_differential(self, i, map_sky, m_gain, procmask, procmask2, & - & init_s_bp=bp_corr) - end if - - call timer%start(TOD_ALLOC, self%band) - allocate(s_buf(sd%ntod,sd%ndet)) - call timer%stop(TOD_ALLOC, self%band) - - ! Make simulations or Sample correlated noise - if (self%enable_tod_simulations) then - call simulate_tod(self, i, sd%s_tot, sd%n_corr, handle) - else - call sample_n_corr(self, sd%tod, handle, i, sd%mask, sd%s_tot, sd%n_corr, sd%pix(:,1,:), dospike=.false.) - !sd%n_corr = 0. + call init_scan_data_differential(sd, self, i, map_sky, m_gain, procmask, procmask2, & + & init_s_bp=.true.) end if @@ -749,7 +738,7 @@ subroutine process_WMAP_tod(self, chaindir, chain, iter, handle, map_in, delta, end if ! Clean up - call sd%dealloc + call dealloc_scan_data(sd) call timer%start(TOD_ALLOC, self%band) deallocate(s_buf, d_calib) call timer%stop(TOD_ALLOC, self%band) @@ -1225,7 +1214,7 @@ subroutine apply_wmap_precond(self, map, map_out) end subroutine apply_wmap_precond - subroutine sample_baseline(tod, scan, raw, s_tot, mask, handle) + subroutine sample_baseline_WMAP(tod, scan, raw, s_tot, mask, handle) ! Sample LFI specific 1Hz spikes shapes and amplitudes ! ! Arguments: @@ -1271,7 +1260,7 @@ subroutine sample_baseline(tod, scan, raw, s_tot, mask, handle) deallocate(x, y) - end subroutine sample_baseline + end subroutine sample_baseline_WMAP subroutine construct_corrtemp_wmap(self, scan, pix, psi, s) ! Construct an WMAP instrument-specific correction template; for now contains baseline diff --git a/commander3/src/comm_utils.f90 b/commander3/src/comm_utils.f90 index 4f1e01ef4..65ced8c75 100644 --- a/commander3/src/comm_utils.f90 +++ b/commander3/src/comm_utils.f90 @@ -40,9 +40,21 @@ module comm_utils !include "mpif.h" include 'fftw3.f' + interface compute_running_variance + module procedure compute_running_variance_sp, compute_running_variance_dp + end interface compute_running_variance + + interface median + module procedure median_sp, median_dp + end interface median + + interface read_map + module procedure read_map_dp, read_map_sp + end interface read_map + contains - function median(array) result(res) + function median_dp(array) result(res) implicit none real(dp) :: array(:), res real(dp), dimension(:), allocatable :: tmp @@ -52,7 +64,19 @@ function median(array) result(res) call QuickSort_real(tmp) res = tmp(size(tmp)/2+1) deallocate(tmp) - end function median + end function median_dp + + function median_sp(array) result(res) + implicit none + real(sp) :: array(:), res + real(dp), dimension(:), allocatable :: tmp + + allocate(tmp(size(array))) + tmp = array + call QuickSort_real(tmp) + res = tmp(size(tmp)/2+1) + deallocate(tmp) + end function median_sp function getlun() implicit none @@ -522,7 +546,7 @@ subroutine touch(file) !!$ end subroutine allocate_map - subroutine read_map(filename, map) + subroutine read_map_dp(filename, map) implicit none character(len=*), intent(in) :: filename @@ -547,7 +571,34 @@ subroutine read_map(filename, map) end do end if - end subroutine read_map + end subroutine read_map_dp + + subroutine read_map_sp(filename, map) + implicit none + + character(len=*), intent(in) :: filename + real(sp), dimension(0:,1:), intent(out) :: map + + integer(i4b) :: nside, nmaps, ordering, i, npix, nmaps_in, nside_in + integer(i8b) :: temp_i + + npix = size(map(:,1)) + nmaps = size(map(0,:)) + nside = nint(sqrt(real(npix,sp)/12.)) + + temp_i = getsize_fits(trim(filename), ordering=ordering, nside=nside_in, nmaps=nmaps_in) + if ((nmaps_in < nmaps) .or. (nside_in /= nside)) then + write(*,*) 'Incorrect nside or nmaps for file called ', trim(filename) + end if + + call input_map(filename, map, npix, nmaps, ignore_polcconv=.true.) + if (ordering == 2) then + do i = 1, nmaps + call convert_nest2ring(nside, map(:,i)) + end do + end if + + end subroutine read_map_sp ! Routine for initializing the monopole and dipoles subroutine initialize_mono_dipole(nside, pix, monopole, dipole) @@ -602,9 +653,9 @@ subroutine report_error(message) call mpi_comm_rank(MPI_COMM_WORLD, myid, ierr) - if (myid == 0) write(*,*) trim(message) - call mpi_finalize(ierr) - stop + write(*,*) trim(message) + + call mpi_abort(MPI_COMM_WORLD, 1, ierr) end subroutine report_error @@ -1482,4 +1533,187 @@ FUNCTION is_numeric(string) is_numeric = e == 0 END FUNCTION is_numeric + subroutine compute_running_variance_sp(x, mask, window, variance, var_mean, mean_full) + implicit none + real(sp), dimension(:), intent(in) :: x, mask + integer(i4b), intent(in) :: window + real(sp), dimension(:), intent(out) :: variance + real(sp), intent(out), optional :: var_mean + logical(lgt), intent(in), optional :: mean_full + + integer(i4b) :: i, j, k, l, n, m + real(sp) :: mu, mu_full + logical(lgt) :: mean_full_ + !integer(i4b), allocatable, dimension(:) :: m + + mean_full_ = .false.; if (present(mean_full)) mean_full_ = mean_full + + n = size(x) + + if (mean_full_) then + mu_full = median(x) +!!$ mu_full = 0. +!!$ m = 0 +!!$ do l = j, k +!!$ if (mask(l) == 1.) then +!!$ mu_full = mu_full + x(l) +!!$ m = m + 1 +!!$ end if +!!$ end do +!!$ if (m > 0) mu_full = mu_full / m + end if + + do i = 1, n + j = max(i-window,1) + k = min(i+window,n) + variance(i) = 0. + mu = 0. + m = 0 + do l = j, k + if (mask(l) == 1.) then + mu = mu + x(l) + m = m + 1 + end if + end do + if (m < 3) then + variance(i) = 0. + else + if (mean_full_) then + mu = mu_full + else + mu = mu / m + end if + do l = j, k + if (mask(l) == 1.) then + variance(i) = variance(i) + (x(l) - mu)**2 + end if + end do + variance(i) = variance(i) / (m-1) + end if + end do + +!!$ allocate(m(n)) +!!$ variance(1) = 0.d0 +!!$ m = 0 +!!$ do j = 1, window +!!$ if (mask(j) == 1.d0) then +!!$ variance(1) = variance(1) + x(j)**2 +!!$ m(1) = m(1) + 1 +!!$ end if +!!$ end do +!!$ +!!$ ! Compute running mean variance +!!$ do i = 2, n +!!$ variance(i) = variance(i-1) +!!$ m(i) = m(i-1) +!!$ k = i-window +!!$ if (k > 0) then +!!$ if (mask(k) == 1.d0) then +!!$ variance(i) = variance(i) - x(k)**2 +!!$ m(i) = m(i) - 1 +!!$ end if +!!$ end if +!!$ k = i+window +!!$ if (k <= n) then +!!$ if (mask(k) == 1.d0) then +!!$ variance(i) = variance(i) + x(k)**2 +!!$ m(i) = m(i) + 1 +!!$ end if +!!$ end if +!!$ end do +!!$ do i = 1, n +!!$ if (m(i) > 2) then +!!$ variance(i) = variance(i) / (m(i) - 1.d0) +!!$ else +!!$ variance(i) = 0.d0 +!!$ end if +!!$ end do + + ! Compute average variance if requested + if (present(var_mean)) then + var_mean = 0.d0 + j = 0 + do i = 1, n + if (mask(i) == 1.d0 .and. variance(i) > 0.) then + var_mean = var_mean + variance(i) + j = j+1 + !write(*,*) i, var_mean, j, var_mean/j + end if + end do + if (j > 0) var_mean = var_mean / j + end if + + !deallocate(m) + + end subroutine compute_running_variance_sp + + + + subroutine compute_running_variance_dp(x, mask, window, variance, var_mean) + implicit none + real(dp), dimension(:), intent(in) :: x, mask + integer(i4b), intent(in) :: window + real(dp), dimension(:), intent(out) :: variance + real(dp), intent(out), optional :: var_mean + + integer(i4b) :: i, j, k, n + integer(i4b), allocatable, dimension(:) :: m + + n = size(x) + + allocate(m(n)) + variance(1) = 0.d0 + m = 0 + do j = 1, window + if (mask(j) == 1.d0) then + variance(1) = variance(1) + x(j)**2 + m(1) = m(1) + 1 + end if + end do + + ! Compute running mean variance + do i = 2, n + variance(i) = variance(i-1) + m(i) = m(i-1) + k = i-window + if (k > 0) then + if (mask(k) == 1.d0) then + variance(i) = variance(i) - x(k)**2 + m(i) = m(i) - 1 + end if + end if + k = i+window + if (k <= n) then + if (mask(k) == 1.d0) then + variance(i) = variance(i) + x(k)**2 + m(i) = m(i) + 1 + end if + end if + end do + do i = 1, n + if (m(i) > 2) then + variance(i) = variance(i) / (m(i) - 1.d0) + else + variance(i) = 0.d0 + end if + end do + + ! Compute average variance if requested + if (present(var_mean)) then + var_mean = 0.d0 + j = 0 + do i = 1, n + if (mask(i) == 1.d0) then + var_mean = var_mean + variance(i) + j = j+1 + end if + end do + if (j > 0) var_mean = var_mean / j + end if + + deallocate(m) + + end subroutine compute_running_variance_dp + + end module comm_utils diff --git a/commander3/src/comm_zodi_comp_mod.f90 b/commander3/src/comm_zodi_comp_mod.f90 index d7df1b01b..d99f3e006 100644 --- a/commander3/src/comm_zodi_comp_mod.f90 +++ b/commander3/src/comm_zodi_comp_mod.f90 @@ -44,7 +44,7 @@ subroutine prior_interface(self, start_ind, prior, scale) class(ZodiComponent), intent(in) :: self integer(i4b), intent(in) :: start_ind real(dp), dimension(1:,1:), intent(inout) :: prior - real(dp), dimension(1:), intent(inout) :: scale + real(dp), dimension(1:,1:), intent(inout) :: scale end subroutine prior_interface subroutine p2m_interface(self, x) @@ -136,6 +136,26 @@ end subroutine m2p_interface procedure :: model2param => model2param_comet end type ZodiComet + type, extends(ZodiComponent) :: ZodiWrightCloudRing + real(dp) :: p1, p3, p4, p5, p6, p7, p8, p9, p10, p13, p14, p15, p16, p17, p18, p19 + contains + procedure :: init => init_WrightCloudRing + procedure :: get_density => get_density_WrightCloudRing + procedure :: init_priors_and_scales => init_WrightCloudRing_priors_and_scales + procedure :: param2model => param2model_WrightCloudRing + procedure :: model2param => model2param_WrightCloudRing + end type ZodiWrightCloudRing + + type, extends(ZodiComponent) :: ZodiWrightBand + real(dp) :: q1, q5, q6, q7, q8, R_1 + contains + procedure :: init => init_WrightBand + procedure :: get_density => get_density_WrightBand + procedure :: init_priors_and_scales => init_WrightBand_priors_and_scales + procedure :: param2model => param2model_WrightBand + procedure :: model2param => model2param_WrightBand + end type ZodiWrightBand + contains subroutine init_base_comp(self) @@ -177,44 +197,56 @@ subroutine init_interstellar(self) end subroutine init_interstellar subroutine init_fan(self) - class(ZodiFan) :: self - call self%init_base_comp() - end subroutine init_fan + class(ZodiFan) :: self + call self%init_base_comp() + end subroutine init_fan + + subroutine init_comet(self) + class(ZodiComet) :: self + call self%init_base_comp() + end subroutine init_comet + + subroutine init_WrightCloudRing(self) + class(ZodiWrightCloudRing) :: self + call self%init_base_comp() + end subroutine init_WrightCloudRing - subroutine init_comet(self) - class(ZodiComet) :: self - call self%init_base_comp() - end subroutine init_comet + subroutine init_WrightBand(self) + class(ZodiWrightBand) :: self + call self%init_base_comp() + end subroutine init_WrightBand - subroutine init_cloud_priors_and_scales(self, start_ind, prior, scale) - implicit none - class(ZodiCloud), intent(in) :: self - integer(i4b), intent(in) :: start_ind - real(dp), dimension(1:,1:), intent(inout) :: prior - real(dp), dimension(1:), intent(inout) :: scale + + subroutine init_cloud_priors_and_scales(self, start_ind, prior, scale) + implicit none + class(ZodiCloud), intent(in) :: self + integer(i4b), intent(in) :: start_ind + real(dp), dimension(1:,1:), intent(inout) :: prior + real(dp), dimension(1:,1:), intent(inout) :: scale ! Common parameters prior(:,start_ind+0) = [1.d-11, 1.d-5, 1.d-8, -1.d0] ! n_0 - scale(start_ind+0) = 1.d-9 + scale(start_ind+0,:) = [1.d-9, 4.d-9] prior(:,start_ind+1) = [-30.d0, 30.d0, 0.d0, -1.d0] ! Incl - scale(start_ind+1) = 1.d0 + scale(start_ind+1,:) = [1.d0, 0.03d0] prior(:,start_ind+2) = [-720.d0, 720.d0, 0.d0, -1.d0] ! Omega - scale(start_ind+2) = 1.d0 - prior(:,start_ind+3) = [-0.02d0, 0.02d0, 0.d0, -1.d0] ! ! X_0 - scale(start_ind+3) = 1.d0 + scale(start_ind+2,:) = [1.d0, 0.3d0] + !prior(:,start_ind+3) = [-0.02d0, 0.02d0, 0.d0, -1.d0] ! ! X_0 + prior(:,start_ind+3) = [-0.04d0, 0.04d0, 0.d0, -1.d0] ! ! X_0 + scale(start_ind+3,:) = [1.d0, 1d-3] prior(:,start_ind+4) = [-0.02d0, 0.02d0, 0.d0, -1.d0] ! ! Y_0 - scale(start_ind+4) = 1.d0 + scale(start_ind+4,:) = [1.d0, 0.8d-3] prior(:,start_ind+5) = [-0.02d0, 0.02d0, 0.d0, -1.d0] ! ! Z_0 - scale(start_ind+5) = 1.d0 + scale(start_ind+5,:) = [1.d0, 0.3d-3] ! Component-specific parameters prior(:,start_ind+6) = [1.d0, 2.d0, 1.34d0, -1.d0] ! alpha - scale(start_ind+6) = 1.d0 + scale(start_ind+6,:) = [1.d0, 0.02d0] prior(:,start_ind+7) = [3.d0, 5d0, 4.14d0, -1.d0] ! beta - scale(start_ind+7) = 1.d0 + scale(start_ind+7,:) = [1.d0, 0.05d0] prior(:,start_ind+8) = [0.3d0, 1.1d0, 0.942d0, -1.d0] ! gamma - scale(start_ind+8) = 1.d0 + scale(start_ind+8,:) = [1.d0, 0.03d0] prior(:,start_ind+9) = [0.1d0, 0.4d0, 0.189d0, -1.d0] ! mu - scale(start_ind+9) = 1.d0 + scale(start_ind+9,:) = [1.d0, 0.013d0] end subroutine init_cloud_priors_and_scales subroutine init_band_priors_and_scales(self, start_ind, prior, scale) @@ -222,30 +254,32 @@ subroutine init_band_priors_and_scales(self, start_ind, prior, scale) class(ZodiBand), intent(in) :: self integer(i4b), intent(in) :: start_ind real(dp), dimension(1:,1:), intent(inout) :: prior - real(dp), dimension(1:), intent(inout) :: scale + real(dp), dimension(1:,1:), intent(inout) :: scale ! Common parameters prior(:,start_ind+0) = [1.d-11, 1.d-5, 1.d-8, -1.d0] ! n_0 - scale(start_ind+0) = 1.d-9 + scale(start_ind+0,:) = [1.d-9, 0.2d-9] prior(:,start_ind+1) = [-30.d0, 30.d0, 0.d0, -1.d0] ! Incl - scale(start_ind+1) = 1.d0 + scale(start_ind+1,:) = [1.d0, 0.05d0] prior(:,start_ind+2) = [-720.d0, 720.d0, 0.d0, -1.d0] ! Omega - scale(start_ind+2) = 1.d0 - prior(:,start_ind+3) = [-0.3d0, 0.3d0, 0.d0, -1.d0] ! ! X_0 - scale(start_ind+3) = 1.d0 - prior(:,start_ind+4) = [-0.3d0, 0.3d0, 0.d0, -1.d0] ! ! Y_0 - scale(start_ind+4) = 1.d0 - prior(:,start_ind+5) = [-0.3d0, 0.3d0, 0.d0, -1.d0] ! ! Z_0 - scale(start_ind+5) = 1.d0 + scale(start_ind+2,:) = [1.d0, 2.d0] + prior(:,start_ind+3) = [-0.02d0, 0.02d0, 0.d0, -1.d0] ! ! X_0 + scale(start_ind+3,:) = [1.d0, 0.5d-3] + prior(:,start_ind+4) = [-0.02d0, 0.02d0, 0.d0, -1.d0] ! ! Y_0 + scale(start_ind+4,:) = [1.d0, 0.2d-3] + prior(:,start_ind+5) = [-0.02d0, 0.02d0, 0.d0, -1.d0] ! ! Z_0 + scale(start_ind+5,:) = [1.d0, 0.3d-3] ! Component-specific parameters prior(:,start_ind+6) = [0.d0, 30d0, 0d0, -1.d0] ! delta_zeta - scale(start_ind+6) = 1.d0 + scale(start_ind+6,:) = [1.d0, 0.14d0] prior(:,start_ind+7) = [0.8d0, 5.4d0, 4.14d0, -1.d0] ! delta_r - scale(start_ind+7) = 1.d0 - prior(:,start_ind+8) = [0.01d0, 2.5d0, 0.942d0, -1.d0] ! v - scale(start_ind+8) = 1.d0 - prior(:,start_ind+9) = [3.999d0, 4.001d0, 0.189d0, -1.d0] ! p - scale(start_ind+9) = 1.d0 + scale(start_ind+7,:) = [1.d0, 0.005d0] + !prior(:,start_ind+8) = [0.01d0, 1.5d0, 0.942d0, -1.d0] ! v + prior(:,start_ind+8) = [0.01d0, 3.d0, 0.942d0, -1.d0] ! v + scale(start_ind+8,:) = [1.d0, 0.1d0] + !prior(:,start_ind+9) = [3.99999d0, 4.000001d0, 0.189d0, -1.d0] ! p + prior(:,start_ind+9) = [2.d0, 6.d0, 0.189d0, -1.d0] ! p + scale(start_ind+9,:) = [1.d0, 1d-6] end subroutine init_band_priors_and_scales subroutine init_ring_priors_and_scales(self, start_ind, prior, scale) @@ -253,32 +287,32 @@ subroutine init_ring_priors_and_scales(self, start_ind, prior, scale) class(ZodiRing), intent(in) :: self integer(i4b), intent(in) :: start_ind real(dp), dimension(1:,1:), intent(inout) :: prior - real(dp), dimension(1:), intent(inout) :: scale + real(dp), dimension(1:,1:), intent(inout) :: scale ! Common parameters prior(:,start_ind+0) = [1.d-11, 1.d-5, 1.d-8, -1.d0] ! n_0 - scale(start_ind+0) = 1.d-9 + scale(start_ind+0,:) = [1.d-9, 1.d-11] prior(:,start_ind+1) = [-30.d0, 30.d0, 0.d0, -1.d0] ! Incl - scale(start_ind+1) = 1.d0 + scale(start_ind+1,:) = [1.d0, 0.1d0] prior(:,start_ind+2) = [-720.d0, 720.d0, 0.d0, -1.d0] ! Omega - scale(start_ind+2) = 1.d0 + scale(start_ind+2,:) = [1.d0, 1.d0] prior(:,start_ind+3) = [-0.001d0, 0.001d0, 0.d0, -1.d0] ! ! X_0 - scale(start_ind+3) = 1.d0 + scale(start_ind+3,:) = [1.d0, 1d-3] prior(:,start_ind+4) = [-0.001d0, 0.001d0, 0.d0, -1.d0] ! ! Y_0 - scale(start_ind+4) = 1.d0 + scale(start_ind+4,:) = [1.d0, 1d-3] prior(:,start_ind+5) = [-0.001d0, 0.001d0, 0.d0, -1.d0] ! ! Z_0 - scale(start_ind+5) = 1.d0 + scale(start_ind+5,:) = [1.d0, 1d-3] ! Component-specific parameters prior(:,start_ind+6) = [0.9d0, 1.1d0, 0d0, -1.d0] ! r - scale(start_ind+6) = 1.d0 + scale(start_ind+6,:) = [1.d0, 0.01d0] prior(:,start_ind+7) = [0.d0, 0.3d0, 0.2d0, -1.d0] ! delta_r - scale(start_ind+7) = 1.d0 + scale(start_ind+7,:) = [1.d0, 0.01d0] prior(:,start_ind+8) = [0.0d0, 0.2d0, 0.1d0, -1.d0] ! delta_z - scale(start_ind+8) = 1.d0 + scale(start_ind+8,:) = [1.d0, 0.01d0] prior(:,start_ind+9) = [-60.d-3, 60.d-3, 0.d0, -1.d0] ! theta - scale(start_ind+9) = 1.d0 + scale(start_ind+9,:) = [1.d0, 0.01d0] prior(:,start_ind+10) = [0.d0, 30.d0, 0.d0, -1.d0] ! sigma_theta - scale(start_ind+10) = 1.d0 + scale(start_ind+10,:) = [1.d0, 0.01d0] end subroutine init_ring_priors_and_scales subroutine init_feature_priors_and_scales(self, start_ind, prior, scale) @@ -286,32 +320,32 @@ subroutine init_feature_priors_and_scales(self, start_ind, prior, scale) class(ZodiFeature), intent(in) :: self integer(i4b), intent(in) :: start_ind real(dp), dimension(1:,1:), intent(inout) :: prior - real(dp), dimension(1:), intent(inout) :: scale + real(dp), dimension(1:,1:), intent(inout) :: scale ! Common parameters prior(:,start_ind+0) = [1.d-11, 1.d-5, 1.d-8, -1.d0] ! n_0 - scale(start_ind+0) = 1.d-9 + scale(start_ind+0,:) = [1.d-9, 1.d-11] prior(:,start_ind+1) = [-30.d0, 30.d0, 0.d0, -1.d0] ! Incl - scale(start_ind+1) = 1.d0 + scale(start_ind+1,:) = [1.d0, 0.1d0] prior(:,start_ind+2) = [-720.d0, 720.d0, 0.d0, -1.d0] ! Omega - scale(start_ind+2) = 1.d0 + scale(start_ind+2,:) = [1.d0, 1.d0] prior(:,start_ind+3) = [-0.001d0, 0.001d0, 0.d0, -1.d0] ! ! X_0 - scale(start_ind+3) = 1.d0 + scale(start_ind+3,:) = [1.d0, 1d-3] prior(:,start_ind+4) = [-0.001d0, 0.001d0, 0.d0, -1.d0] ! ! Y_0 - scale(start_ind+4) = 1.d0 + scale(start_ind+4,:) = [1.d0, 1d-3] prior(:,start_ind+5) = [-0.001d0, 0.001d0, 0.d0, -1.d0] ! ! Z_0 - scale(start_ind+5) = 1.d0 + scale(start_ind+5,:) = [1.d0, 1d-3] ! Component-specific parameters prior(:,start_ind+6) = [0.9d0, 1.1d0, 0d0, -1.d0] ! r - scale(start_ind+6) = 1.d0 + scale(start_ind+6,:) = [1.d0, 0.01d0] prior(:,start_ind+7) = [0.d0, 0.3d0, 0.2d0, -1.d0] ! delta_r - scale(start_ind+7) = 1.d0 + scale(start_ind+7,:) = [1.d0, 0.01d0] prior(:,start_ind+8) = [0.0d0, 0.2d0, 0.1d0, -1.d0] ! delta_z - scale(start_ind+8) = 1.d0 + scale(start_ind+8,:) = [1.d0, 0.01d0] prior(:,start_ind+9) = [-20.d0, 20.d0, 0.d0, -1.d0] ! theta - scale(start_ind+9) = 1.d0 + scale(start_ind+9,:) = [1.d0, 0.01d0] prior(:,start_ind+10) = [0.d0, 30.d0, 0.d0, -1.d0] ! sigma_theta - scale(start_ind+10) = 1.d0 + scale(start_ind+10,:) = [1.d0, 0.01d0] end subroutine init_feature_priors_and_scales subroutine init_interstellar_priors_and_scales(self, start_ind, prior, scale) @@ -319,26 +353,26 @@ subroutine init_interstellar_priors_and_scales(self, start_ind, prior, scale) class(ZodiInterstellar), intent(in) :: self integer(i4b), intent(in) :: start_ind real(dp), dimension(1:,1:), intent(inout) :: prior - real(dp), dimension(1:), intent(inout) :: scale + real(dp), dimension(1:,1:), intent(inout) :: scale ! Common parameters prior(:,start_ind+0) = [1.d-11, 1.d-5, 1.d-8, -1.d0] ! n_0 - scale(start_ind+0) = 1.d-9 + scale(start_ind+0,:) = [1.d-9, 1.d-11] prior(:,start_ind+1) = [0.d0, 00.d0, 0.d0, -1.d0] ! Incl - scale(start_ind+1) = 1.d0 + scale(start_ind+1,:) = [1.d0, 0.d0] prior(:,start_ind+2) = [0.d0, 0.d0, 0.d0, -1.d0] ! Omega - scale(start_ind+2) = 1.d0 + scale(start_ind+2,:) = [1.d0, 0.d0] prior(:,start_ind+3) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! X_0 - scale(start_ind+3) = 1.d0 + scale(start_ind+3,:) = [1.d0, 0.d0] prior(:,start_ind+4) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! Y_0 - scale(start_ind+4) = 1.d0 + scale(start_ind+4,:) = [1.d0, 0.d0] prior(:,start_ind+5) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! Z_0 - scale(start_ind+5) = 1.d0 + scale(start_ind+5,:) = [1.d0, 0.d0] ! Component-specific parameters prior(:,start_ind+6) = [0.d0, 0.0d0, 0d0, -1.d0] ! R, inactive - scale(start_ind+6) = 1.d0 + scale(start_ind+6,:) = [1.d0, 0.d0] prior(:,start_ind+7) = [0.d0, 0.0d0, 0.2d0, -1.d0] ! alpha, inactive - scale(start_ind+7) = 1.d0 + scale(start_ind+7,:) = [1.d0, 0.d0] end subroutine init_interstellar_priors_and_scales subroutine init_fan_priors_and_scales(self, start_ind, prior, scale) @@ -346,32 +380,32 @@ subroutine init_fan_priors_and_scales(self, start_ind, prior, scale) class(ZodiFan), intent(in) :: self integer(i4b), intent(in) :: start_ind real(dp), dimension(1:,1:), intent(inout) :: prior - real(dp), dimension(1:), intent(inout) :: scale + real(dp), dimension(1:,1:), intent(inout) :: scale ! Common parameters prior(:,start_ind+0) = [1.d-11, 1.d-5, 1.d-8, -1.d0] ! n_0 - scale(start_ind+0) = 1.d-9 + scale(start_ind+0,:) = [1.d-9, 1.d-11] prior(:,start_ind+1) = [0.d0, 10.d0, 0.d0, -1.d0] ! Incl - scale(start_ind+1) = 1.d0 + scale(start_ind+1,:) = [1.d0, 0.d0] prior(:,start_ind+2) = [-720.d0, 720.d0, 0.d0, -1.d0] ! Omega - scale(start_ind+2) = 1.d0 + scale(start_ind+2,:) = [1.d0, 0.d0] prior(:,start_ind+3) = [-0.02d0, 0.02d0, 0.d0, -1.d0] ! ! X_0 - scale(start_ind+3) = 1.d0 + scale(start_ind+3,:) = [1.d0, 0.d0] prior(:,start_ind+4) = [-0.02d0, 0.02d0, 0.d0, -1.d0] ! ! Y_0 - scale(start_ind+4) = 1.d0 + scale(start_ind+4,:) = [1.d0, 0.d0] prior(:,start_ind+5) = [-0.02d0, 0.02d0, 0.d0, -1.d0] ! ! Z_0 - scale(start_ind+5) = 1.d0 + scale(start_ind+5,:) = [1.d0, 0.d0] ! Component-specific parameters prior(:,start_ind+6) = [5d0, 15d0, 0d0, -1.d0] ! Q - scale(start_ind+6) = 1.d0 + scale(start_ind+6,:) = [1.d0, 0.d0] prior(:,start_ind+7) = [1.d0, 3d0, 0.2d0, -1.d0] ! P - scale(start_ind+7) = 1.d0 + scale(start_ind+7,:) = [1.d0, 0.d0] prior(:,start_ind+8) = [0.5d0, 2d0, 0.1d0, -1.d0] ! Gamma - scale(start_ind+8) = 1.d0 + scale(start_ind+8,:) = [1.d0, 0.d0] prior(:,start_ind+9) = [0.d0, 0.3d0, 0.d0, -1.d0] ! Z - scale(start_ind+9) = 1.d0 + scale(start_ind+9,:) = [1.d0, 0.d0] prior(:,start_ind+10) = [1.d0, 5.d0, 0.d0, -1.d0] ! R_max - scale(start_ind+10) = 1.d0 + scale(start_ind+10,:) = [1.d0, 0.d0] end subroutine init_fan_priors_and_scales subroutine init_comet_priors_and_scales(self, start_ind, prior, scale) @@ -379,32 +413,125 @@ subroutine init_comet_priors_and_scales(self, start_ind, prior, scale) class(ZodiComet), intent(in) :: self integer(i4b), intent(in) :: start_ind real(dp), dimension(1:,1:), intent(inout) :: prior - real(dp), dimension(1:), intent(inout) :: scale + real(dp), dimension(1:,1:), intent(inout) :: scale ! Common parameters prior(:,start_ind+0) = [1.d-11, 1.d-5, 1.d-8, -1.d0] ! n_0 - scale(start_ind+0) = 1.d-9 - prior(:,start_ind+1) = [0.d0, 00.d0, 0.d0, -1.d0] ! Incl - scale(start_ind+1) = 1.d0 + scale(start_ind+0,:) = [1.d-9, 0.d0] + prior(:,start_ind+1) = [0.d0, 0.d0, 0.d0, -1.d0] ! Incl + scale(start_ind+1,:) = [1.d0, 0.d0] prior(:,start_ind+2) = [0.d0, 0.d0, 0.d0, -1.d0] ! Omega - scale(start_ind+2) = 1.d0 + scale(start_ind+2,:) = [1.d0, 0.d0] prior(:,start_ind+3) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! X_0 - scale(start_ind+3) = 1.d0 + scale(start_ind+3,:) = [1.d0, 0.d0] prior(:,start_ind+4) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! Y_0 - scale(start_ind+4) = 1.d0 + scale(start_ind+4,:) = [1.d0, 0.d0] prior(:,start_ind+5) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! Z_0 - scale(start_ind+5) = 1.d0 + scale(start_ind+5,:) = [1.d0, 0.d0] ! Component-specific parameters prior(:,start_ind+6) = [1d0, 5d0, 0d0, -1.d0] ! P - scale(start_ind+6) = 1.d0 + scale(start_ind+6,:) = [1.d0, 0.d0] prior(:,start_ind+7) = [0.d0, 0.3d0, 0.2d0, -1.d0] ! z_mid - scale(start_ind+7) = 1.d0 + scale(start_ind+7,:) = [1.d0, 0.d0] prior(:,start_ind+8) = [0.5d0, 1.5d0, 0.1d0, -1.d0] ! R_inner - scale(start_ind+8) = 1.d0 + scale(start_ind+8,:) = [1.d0, 0.d0] prior(:,start_ind+9) = [1.5d0, 5.d0, 0.d0, -1.d0] ! R_outer - scale(start_ind+9) = 1.d0 + scale(start_ind+9,:) = [1.d0, 0.d0] end subroutine init_comet_priors_and_scales + ! See Appendix in Wright (1998) for details; https://iopscience.iop.org/article/10.1086/305345/pdf + subroutine init_WrightCloudRing_priors_and_scales(self, start_ind, prior, scale) + implicit none + class(ZodiWrightCloudRing), intent(in) :: self + integer(i4b), intent(in) :: start_ind + real(dp), dimension(1:,1:), intent(inout) :: prior + real(dp), dimension(1:,1:), intent(inout) :: scale + + ! Common parameters + prior(:,start_ind+0) = [1.d-11, 1.d-5, 1.d-8, -1.d0] ! n_0 + scale(start_ind+0,:) = [1.d-9, 4.d-9] + prior(:,start_ind+1) = [0.d0,0.d0, 0.d0, -1.d0] ! Incl -- don't fit in Wright model, it's part of the internal parameterization + scale(start_ind+1,:) = [1.d0, 0.d0] + prior(:,start_ind+2) = [0.d0, 0.d0, 0.d0, -1.d0] ! Omega + scale(start_ind+2,:) = [1.d0, 0.d0] + prior(:,start_ind+3) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! X_0 + scale(start_ind+3,:) = [1.d0, 0.d0] + prior(:,start_ind+4) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! Y_0 + scale(start_ind+4,:) = [1.d0, 0.d0] + prior(:,start_ind+5) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! Z_0 + scale(start_ind+5,:) = [1.d0, 0.d0] + ! Component-specific parameters + prior(:,start_ind+6) = [ 1.d0, 1.5d0, 1.2186d0, -1.d0] ! p1 - radial density exponent + scale(start_ind+6,:) = [1.d0, 0.01d0] + prior(:,start_ind+7) = [ 3.d0, 4d0, 3.6122d0, -1.d0] ! p3 - vertical "scale height" + scale(start_ind+7,:) = [1.d0, 0.01d0] + prior(:,start_ind+8) = [ 0.7d0, 1.1d0, 0.9285d0, -1.d0] ! p4 - vertical density exponent + scale(start_ind+8,:) = [1.d0, 0.01d0] + prior(:,start_ind+9) = [-1.8d0, -1.2d0, -1.4766d0, -1.d0] ! p5 - ln(sin i) at break + scale(start_ind+9,:) = [1.d0, 0.01d0] + prior(:,start_ind+10) = [ -1.d0, 1.d0, 0.3705d0, -1.d0] ! p6 - 10 x cloud pole x component + scale(start_ind+10,:) = [1.d0, 0.01d0] + prior(:,start_ind+11) = [ -1.d0, 1.d0, -0.0736d0, -1.d0] ! p7 - 10 x cloud pole y component + scale(start_ind+11,:) = [1.d0, 0.01d0] + prior(:,start_ind+12) = [ -1.d0, 1.d0, -0.0235d0, -1.d0] ! p8 - 10 x cloud offset x component + scale(start_ind+12,:) = [1.d0, 0.01d0] + prior(:,start_ind+13) = [-1.d0, 1.d0, -0.0081d0, -1.d0] ! p9 - 10 x cloud offset y component + scale(start_ind+13,:) = [1.d0, 0.01d0] + prior(:,start_ind+14) = [ 0.1d0, 3.d0, 0.7548d0, -1.d0] ! p10 - 10 x density contrast of Dermott ring + scale(start_ind+14,:) = [1.d0, 0.01d0] + prior(:,start_ind+15) = [ 0.1d0, 1.d0, 0.4284d0, -1.d0] ! p13 - "dimple" in Dermott ring + scale(start_ind+15,:) = [1.d0, 0.01d0] + prior(:,start_ind+16) = [ 0.d0, 50.d0, 27.7741d0, -1.d0] ! p14 - vertical scale for Dermott ring + scale(start_ind+16,:) = [1.d0, 1.d0] + prior(:,start_ind+17) = [-0.1d0, 0.1d0, -0.0251d0, -1.d0] ! p15 - spherical term in vertical density + scale(start_ind+17,:) = [1.d0, 0.01d0] + prior(:,start_ind+18) = [-0.2d0, 0.2d0, 0.0249d0, -1.d0] ! p16 - (sin i)**2 term in vertical density + scale(start_ind+18,:) = [1.d0, 0.01d0] + prior(:,start_ind+19) = [-0.2d0, 0.2d0, -0.0456d0, -1.d0] ! p17 - Additional density at sin i ~ 0.5 + scale(start_ind+19,:) = [1.d0, 0.01d0] + prior(:,start_ind+20) = [-0.2d0, 0.2d0, -0.1276d0, -1.d0] ! p18 - Additional density at sin i ~ 0.25 + scale(start_ind+20,:) = [1.d0, 0.01d0] + prior(:,start_ind+21) = [-0.2d0, 0.2d0, -0.0103d0, -1.d0] ! p19 - Additional density at sin i ~ 0.17 + scale(start_ind+21,:) = [1.d0, 0.01d0] + end subroutine init_WrightCloudRing_priors_and_scales + + ! See Appendix in Wright (1998) for details; https://iopscience.iop.org/article/10.1086/305345/pdf + subroutine init_WrightBand_priors_and_scales(self, start_ind, prior, scale) + implicit none + class(ZodiWrightBand), intent(in) :: self + integer(i4b), intent(in) :: start_ind + real(dp), dimension(1:,1:), intent(inout) :: prior + real(dp), dimension(1:,1:), intent(inout) :: scale + + ! Common parameters + prior(:,start_ind+0) = [1.d-11, 1.d-5, 1.d-9, -1.d0] ! n_0 + scale(start_ind+0,:) = [1.d-9, 4.d-9] + prior(:,start_ind+1) = [0.d0,0.d0, 0.d0, -1.d0] ! Incl -- don't fit in Wright model, these are part of the internal parameterization + scale(start_ind+1,:) = [1.d0, 0.d0] + prior(:,start_ind+2) = [0.d0, 0.d0, 0.d0, -1.d0] ! Omega + scale(start_ind+2,:) = [1.d0, 0.d0] + prior(:,start_ind+3) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! X_0 + scale(start_ind+3,:) = [1.d0, 0.d0] + prior(:,start_ind+4) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! Y_0 + scale(start_ind+4,:) = [1.d0, 0.d0] + prior(:,start_ind+5) = [0.d0, 0.d0, 0.d0, -1.d0] ! ! Z_0 + scale(start_ind+5,:) = [1.d0, 0.d0] + ! Component-specific parameters + prior(:,start_ind+6) = [ 1.d0, 2.0d0, 1.3849d0, -1.d0] ! q1 - 10 x (sin i)_max for band 1 + scale(start_ind+6,:) = [1.d0, 0.01d0] + prior(:,start_ind+7) = [-0.3d0, 0.3d0, 0.1735d0, -1.d0] ! q5 - 10 x band pole x component + scale(start_ind+7,:) = [1.d0, 0.01d0] + prior(:,start_ind+8) = [-0.3d0, 0.3d0, -0.2088d0, -1.d0] ! q6 - 10 x band pole y component + scale(start_ind+8,:) = [1.d0, 0.01d0] + prior(:,start_ind+9) = [-2.d0, 2.d0, -1.5723d0, -1.d0] ! q7 - 10 x band offset x component + scale(start_ind+9,:) = [1.d0, 0.1d0] + prior(:,start_ind+10) = [ -2.d0, 2.d0, -0.2225d0, -1.d0] ! q8 - 10 x band offset y component + scale(start_ind+10,:) = [1.d0, 0.01d0] + prior(:,start_ind+11) = [ 2.d0, 4.d0, 3.14d0, -1.d0] ! R_1 - Outer radius + scale(start_ind+11,:) = [1.d0, 0.01d0] + end subroutine init_WrightBand_priors_and_scales + + subroutine param2model_cloud(self, x) implicit none class(ZodiCloud), intent(inout) :: self @@ -627,6 +754,98 @@ subroutine model2param_comet(self, x) x(10) = self%R_outer end subroutine model2param_comet + subroutine param2model_WrightCloudRing(self, x) + implicit none + class(ZodiWrightCloudRing), intent(inout) :: self + real(dp), dimension(1:), intent(in) :: x + self%n_0 = x(1) + self%incl = x(2) + self%Omega = x(3) + self%x_0 = x(4) + self%y_0 = x(5) + self%z_0 = x(6) + self%p1 = x(7) + self%p3 = x(8) + self%p4 = x(9) + self%p5 = x(10) + self%p6 = x(11) + self%p7 = x(12) + self%p8 = x(13) + self%p9 = x(14) + self%p10 = x(15) + self%p13 = x(16) + self%p14 = x(17) + self%p15 = x(18) + self%p16 = x(19) + self%p17 = x(20) + self%p18 = x(21) + self%p19 = x(22) + end subroutine param2model_WrightCloudRing + + subroutine model2param_WrightCloudRing(self, x) + implicit none + class(ZodiWrightCloudRing), intent(in) :: self + real(dp), dimension(1:), intent(out) :: x + x(1) = self%n_0 + x(2) = self%incl + x(3) = self%Omega + x(4) = self%x_0 + x(5) = self%y_0 + x(6) = self%z_0 + x(7) = self%p1 + x(8) = self%p3 + x(9) = self%p4 + x(10) = self%p5 + x(11) = self%p6 + x(12) = self%p7 + x(13) = self%p8 + x(14) = self%p9 + x(15) = self%p10 + x(16) = self%p13 + x(17) = self%p14 + x(18) = self%p15 + x(19) = self%p16 + x(20) = self%p17 + x(21) = self%p18 + x(22) = self%p19 + end subroutine model2param_WrightCloudRing + + subroutine param2model_WrightBand(self, x) + implicit none + class(ZodiWrightBand), intent(inout) :: self + real(dp), dimension(1:), intent(in) :: x + self%n_0 = x(1) + self%incl = x(2) + self%Omega = x(3) + self%x_0 = x(4) + self%y_0 = x(5) + self%z_0 = x(6) + self%q1 = x(7) + self%q5 = x(8) + self%q6 = x(9) + self%q7 = x(10) + self%q8 = x(11) + self%R_1 = x(12) + end subroutine param2model_WrightBand + + subroutine model2param_WrightBand(self, x) + implicit none + class(ZodiWrightBand), intent(in) :: self + real(dp), dimension(1:), intent(out) :: x + x(1) = self%n_0 + x(2) = self%incl + x(3) = self%Omega + x(4) = self%x_0 + x(5) = self%y_0 + x(6) = self%z_0 + x(7) = self%q1 + x(8) = self%q5 + x(9) = self%q6 + x(10) = self%q7 + x(11) = self%q8 + x(12) = self%R_1 + end subroutine model2param_WrightBand + subroutine get_density_cloud(self, X_vec, theta, n_out) class(ZodiCloud) :: self @@ -836,5 +1055,97 @@ subroutine get_density_comet(self, X_vec, theta, n_out) n_out(i) = 0.37 * self%n_0 * f / R end do end subroutine get_density_comet - + + subroutine get_density_WrightCloudRing(self, X_vec, theta, n_out) + class(ZodiWrightCloudRing) :: self + real(dp), dimension(:, :), intent(in) :: X_vec + real(dp), intent(in) :: theta + real(dp), dimension(:), intent(out) :: n_out + integer(i4b) :: i + real(dp) :: R, z_c(3), o_c(3), R_c + real(dp) :: f, sin_i, Z, S + real(dp) :: x_D, y_D, z_D, L_D, A, D + + ! X_vec = r = position to evaluate model in heliocentric coordinates +!!$ open(58,file='n.dat', recl=1024) +!!$ write(*,*) 'p3', self%p3 +!!$ write(*,*) 'p4', self%p4 +!!$ write(*,*) 'p5', self%p5 +!!$ write(*,*) 'p6', self%p6 +!!$ write(*,*) 'p7', self%p7 +!!$ write(*,*) 'p8', self%p8 +!!$ write(*,*) 'p9', self%p9 +!!$ write(*,*) 'p10', self%p10 +!!$ write(*,*) 'p13', self%p13 +!!$ write(*,*) 'p14', self%p14 +!!$ write(*,*) 'p15', self%p15 +!!$ write(*,*) 'p16', self%p16 +!!$ write(*,*) 'p17', self%p17 +!!$ write(*,*) 'p18', self%p18 +!!$ write(*,*) 'p19', self%p19 + do i = 1, size(n_out) + R = sqrt(sum(X_vec(:,i)**2)) + z_c = [self%p6, self%p7, 10.d0] / sqrt(100.d0 + self%p6**2 + self%p7**2) + o_c = [self%p8/10.d0, self%p9/10.d0, 0.d0] + sin_i = sum(z_c*X_vec(:,i)) / R + R_c = R + sum(o_c * X_vec(:,i)) + + ! Cloud + S = exp(self%p5) + if (abs(sin_i) > S) then + Z = abs(sin_i) - 0.5d0*S + else + Z = 0.5d0*sin_i**2/S + end if + f = exp(-self%p3 * Z**self%p4) + self%p15 + self%p16 * sin_i**2 & + & + self%p17 * 4.d0*sin_i**2*exp( -4.d0*sin_i**2) & + & + self%p18 * 16.d0*sin_i**2*exp(-16.d0*sin_i**2) & + & + self%p19 * 36.d0*sin_i**2*exp(-36.d0*sin_i**2) + + ! Ring + x_D = X_vec(1,i)*cos(theta) + X_vec(2,i)*sin(theta) + y_D = X_vec(2,i)*cos(theta) - X_vec(1,i)*sin(theta) + z_D = X_vec(3,i) + L_D = abs(atan2(y_D, x_D) + 0.25d0) + if (L_D < 0.375d0) then + A = cos(8.d0*pi*L_d/3.d0) + else if (L_D < 0.75d0) then + A = 0.5d0*(cos(8.d0*pi*L_D/3)-1.d0) + else + A = 0.d0 + end if + D = exp(-56.5d0*(sqrt(x_D**2 + y_D**2) - 1.133d0 + 0.133d0 * self%p13 * exp(-4.d0*L_D**2))**2 - self%p14 * z_D**2/R**2) + + ! Total density + n_out(i) = self%n_0 * R/R_c * f * R_c**(-self%p1) * (1.d0 + 0.1d0 * self%p10 * D*(1.d0+A)) + !write(58,*) R, n_out(i), X_vec(:,i), sin_i, Z, f, self%n_0, R_c, self%p1, self%p10, D, A + end do +! close(58) +! stop + end subroutine get_density_WrightCloudRing + + subroutine get_density_WrightBand(self, X_vec, theta, n_out) + class(ZodiWrightBand) :: self + real(dp), dimension(:, :), intent(in) :: X_vec + real(dp), intent(in) :: theta + real(dp), dimension(:), intent(out) :: n_out + integer(i4b) :: i + real(dp) :: R, z_b(3), o_b(3), R_b, sin_i + + do i = 1, size(n_out) + R = sqrt(sum(X_vec(:,i)**2)) + z_b = [self%q5, self%q6, 10.d0] / sqrt(100.d0 + self%q5**2 + self%q6**2) + sin_i = sum(z_b*X_vec(:,i)) / R + o_b = [self%q7/10.d0, self%q8/10.d0, 0.d0] + R_b = R + sum(o_b * X_vec(:,i)) + + if (abs(sin_i) < 0.1d0*self%q1 .and. R_b < self%R_1) then + !n_out(i) = self%n_0 * R/R_b**2 * cosh(1.72d0*abs(sin_i)/(0.1d0*self%q1)) + n_out(i) = self%n_0 * R/R_b**2 * cosh(1.72d0*abs(sin_i)/self%q1) / pi + else + n_out(i) = 0.d0 + end if + end do + end subroutine get_density_WrightBand + end module comm_zodi_comp_mod diff --git a/commander3/src/comm_zodi_mod.f90 b/commander3/src/comm_zodi_mod.f90 index 0604be026..6065f150f 100644 --- a/commander3/src/comm_zodi_mod.f90 +++ b/commander3/src/comm_zodi_mod.f90 @@ -5,7 +5,7 @@ module comm_zodi_mod implicit none private - public initialize_zodi_mod, get_s_zodi, zodi_model, get_zodi_emission, update_zodi_splines, output_tod_params_to_hd5, read_tod_zodi_params, get_zodi_emissivity_albedo + public initialize_zodi_mod, zodi_model, get_zodi_emission, update_zodi_splines, output_tod_params_to_hd5, read_tod_zodi_params public get_s_tot_zodi, ZodiModel, zodi_model_to_ascii, ascii_to_zodi_model, print_zodi_model public band_monopole, band_update_monopole @@ -19,27 +19,27 @@ module comm_zodi_mod type :: ZodiModel class(ZodiComponentContainer), allocatable :: comps(:) character(len=24), allocatable :: comp_labels(:), general_labels(:), par_labels(:), par_labels_full(:) - integer(i4b) :: n_comps, n_params, n_common_params, n_general_params + character(len=24) :: phasefunc_type, bandpass_type + integer(i4b) :: n_comps, n_common_params, n_general_params, n_phase_params, numband logical(lgt) :: joint_mono real(dp) :: min_solar_elong, max_solar_elong + real(dp) :: nu_min_scatter, nu_max_thermal real(dp) :: T_0, delta real(dp), dimension(10) :: F_sun = [2.3405606d8, 1.2309874d8, 64292872d0, 35733824d0, 5763843d0, 1327989.4d0, 230553.73d0, 82999.336d0, 42346.605d0, 14409.608d0] * 1d-20 ! convert to specific intensity units - real(dp), dimension(10) :: C0 = [-0.94209999, -0.52670002, -0.4312, -0.4312, 0., 0., 0., 0., 0., 0.] - real(dp), dimension(10) :: C1 = [0.1214, 0.18719999, 0.1715, 0.1715, 0., 0., 0., 0., 0., 0.] - real(dp), dimension(10) :: C2 = [-0.1648, -0.59829998, -0.63330001, -0.63330001, 0., 0., 0., 0., 0., 0.] + real(dp), allocatable, dimension(:) :: par_phase integer(i4b) :: npar_tot integer(i4b), allocatable, dimension(:,:) :: theta_stat logical(lgt), allocatable, dimension(:,:) :: sampgroup_active_band integer(i4b), allocatable, dimension(:) :: theta2band real(dp), allocatable, dimension(:,:) :: theta_prior - real(dp), allocatable, dimension(:) :: theta_scale + real(dp), allocatable, dimension(:,:) :: theta_scale ! Stationary model ! real(dp), allocatable, dimension(:) :: amp_static ! real(dp), allocatable, dimension(:,:) :: map_static contains - procedure :: init_comps, init_general_params, model_to_chain, params_to_model2, model_to_params2, comp_from_chain, get_par_ind, init_general_priors_and_scales + procedure :: init_comps, init_general_params, model_to_chain, params_to_model, model_to_params, comp_from_chain, get_par_ind, init_general_priors_and_scales, get_phase_function end type ZodiModel type(ZodiModel), target :: zodi_model @@ -56,12 +56,17 @@ module comm_zodi_mod real(dp), allocatable :: T_grid(:), B_nu_integrals(:) type(ZodiCompLOS), allocatable, dimension(:) :: comp_LOS type(spline_type) :: earth_pos_spl_obj(3) + + real(dp), dimension(10) :: C0_K98 = [-0.94209999, -0.52670002, -0.4312, -0.4312, 0., 0., 0., 0., 0., 0.] + real(dp), dimension(10) :: C1_K98 = [0.1214, 0.18719999, 0.1715, 0.1715, 0., 0., 0., 0., 0., 0.] + real(dp), dimension(10) :: C2_K98 = [-0.1648, -0.59829998, -0.63330001, -0.63330001, 0., 0., 0., 0., 0., 0.] + contains subroutine initialize_zodi_mod(cpar) implicit none type(comm_params), intent(in) :: cpar - integer(i4b) :: i, j, k, ierr, ind, npar, ntok, gauss_degree + integer(i4b) :: i, j, k, ierr, ind, npar, ntok, gauss_degree, band real(dp) :: min_temp = 40.0, max_temp = 550.0 integer(i4b) :: n_interp_points = 100 character(len=256) :: file_path @@ -71,79 +76,117 @@ subroutine initialize_zodi_mod(cpar) ! Find number of bands and labels - numband = count(cpar%ds_active) - allocate(band_labels(numband),band_instlabels(numband),band_todtype(numband),band_nu_c(numband),band_monopole(numband),band_update_monopole(numband,0:cpar%zs_num_samp_groups)) - band_labels = pack(cpar%ds_label, cpar%ds_active) - band_instlabels = pack(cpar%ds_instlabel, cpar%ds_active) - band_todtype = pack(cpar%ds_tod_type, cpar%ds_active) - band_nu_c = pack(cpar%ds_nu_c, cpar%ds_active) - zodi_refband = cpar%zs_refband + numband = count(cpar%ds_active) + zodi_model%numband = numband + allocate(band_labels(numband),band_instlabels(numband),band_todtype(numband),band_nu_c(numband),band_monopole(numband),band_update_monopole(numband,0:cpar%zs_num_samp_groups)) + band_labels = pack(cpar%ds_label, cpar%ds_active) + band_instlabels = pack(cpar%ds_instlabel, cpar%ds_active) + band_todtype = pack(cpar%ds_tod_type, cpar%ds_active) + band_nu_c = pack(cpar%ds_nu_c, cpar%ds_active) + zodi_refband = cpar%zs_refband - ! Set model and zodi_mod parameters from cpar - zodi_model%n_comps = cpar%zs_ncomps - allocate(comp_params(zodi_model%n_comps, size(cpar%zs_comp_params, dim=1))) - zodi_model%general_labels = cpar%zodi_param_labels%general - zodi_model%comp_labels = cpar%zs_comp_labels(1:zodi_model%n_comps) - zodi_model%n_common_params = size(cpar%zodi_param_labels%common) - zodi_model%n_general_params = size(cpar%zodi_param_labels%general) - zodi_model%joint_mono = cpar%zs_joint_mono + ! Set model and zodi_mod parameters from cpar + zodi_model%nu_min_scatter = cpar%zs_nu_min_scatter * 1d9 + zodi_model%nu_max_thermal = cpar%zs_nu_max_thermal * 1d9 + zodi_model%phasefunc_type = cpar%zs_phasefunc + zodi_model%bandpass_type = cpar%zs_bandpass + zodi_model%n_comps = cpar%zs_ncomps + allocate(comp_params(zodi_model%n_comps, size(cpar%zs_comp_params, dim=1))) + zodi_model%general_labels = cpar%zodi_param_labels%general + zodi_model%comp_labels = cpar%zs_comp_labels(1:zodi_model%n_comps) + zodi_model%n_common_params = size(cpar%zodi_param_labels%common) + zodi_model%joint_mono = cpar%zs_joint_mono + + if (trim(zodi_model%phasefunc_type) == 'K98') then + zodi_model%n_phase_params = 3*numband + zodi_model%n_general_params = 2 + zodi_model%n_phase_params + allocate(zodi_model%par_phase(zodi_model%n_phase_params)) + do i = 1, numband + read(band_instlabels(i),*) band + if (band >= 1 .and. band <= 10) then + zodi_model%par_phase(band+0*numband) = C0_K98(band) + zodi_model%par_phase(band+1*numband) = C1_K98(band) + zodi_model%par_phase(band+2*numband) = C2_K98(band) + else + write(*,*) 'Invalid band label for K98 phase function = ', band_instlabels(i) + end if + end do + else if (trim(zodi_model%phasefunc_type) == 'Wright') then + zodi_model%n_phase_params = 2 + zodi_model%n_general_params = 2 + zodi_model%n_phase_params + allocate(zodi_model%par_phase(zodi_model%n_phase_params)) + zodi_model%par_phase(1) = -0.3133d0 ! p20 + zodi_model%par_phase(2) = 0.5749d0 ! p21 + else if (trim(zodi_model%phasefunc_type) == 'Hong') then + zodi_model%n_general_params = size(cpar%zodi_param_labels%general) + zodi_model%n_phase_params = 5 + allocate(zodi_model%par_phase(zodi_model%n_phase_params)) + zodi_model%par_phase(1) = 0.700d0 ! g_1 + zodi_model%par_phase(2) = -0.200d0 ! g_2 + zodi_model%par_phase(3) = -0.810d0 ! g_3 + zodi_model%par_phase(4) = 0.330d0 ! w_2 + zodi_model%par_phase(5) = 0.005d0 ! w_3 + else + write(*,*) 'Unsupported zodi phase function type:', trim(zodi_model%phasefunc_type) + stop + end if - comp_params = cpar%zs_comp_params(:, :, 1) - do i = 1, zodi_model%n_comps - if (trim(adjustl(cpar%zs_init_hdf(i))) /= 'none') then - call zodi_model%comp_from_chain(cpar, comp_params, i) - end if - end do - call zodi_model%init_comps(comp_params, cpar%zs_comp_types, cpar%zodi_param_labels) - call zodi_model%init_general_params(cpar%zs_general_params(:, 1)) - - ! Find total number of free parameters, and set up parameter mapping - zodi_model%npar_tot = zodi_model%n_general_params + 2*zodi_model%n_comps*numband + numband - zodi_model%comps(1)%start_ind = zodi_model%n_general_params + 1 - do i = 1, zodi_model%n_comps - zodi_model%npar_tot = zodi_model%npar_tot + zodi_model%comps(i)%npar - if (i < zodi_model%n_comps) then - zodi_model%comps(i+1)%start_ind = zodi_model%comps(i)%start_ind + & - & zodi_model%comps(i)%npar + 2*numband - end if - end do - - ! stat = 0 -> sample freely - ! stat = -1 -> fix to input - ! stat = -2 -> fix to zero - ! stat = -3 -> fix to unity - ! stat > 0 -> set equal to parameter stat - allocate(zodi_model%theta_stat(zodi_model%npar_tot,0:cpar%zs_num_samp_groups)) - allocate(zodi_model%theta2band(zodi_model%npar_tot)) - allocate(zodi_model%theta_prior(4,zodi_model%npar_tot)) ! [min,max,mean,rms] - allocate(zodi_model%theta_scale(zodi_model%npar_tot)) - allocate(zodi_model%par_labels(zodi_model%npar_tot)) - allocate(zodi_model%par_labels_full(zodi_model%npar_tot)) + comp_params = cpar%zs_comp_params(:, :, 1) + do i = 1, zodi_model%n_comps + if (trim(adjustl(cpar%zs_init_hdf(i))) /= 'none') then + call zodi_model%comp_from_chain(cpar, comp_params, i) + end if + end do + call zodi_model%init_comps(comp_params, cpar%zs_comp_types, cpar%zodi_param_labels) + call zodi_model%init_general_params(cpar%zs_general_params(:, 1)) + + ! Find total number of free parameters, and set up parameter mapping + zodi_model%npar_tot = zodi_model%n_general_params + 2*zodi_model%n_comps*numband + numband + zodi_model%comps(1)%start_ind = zodi_model%n_general_params + 1 + do i = 1, zodi_model%n_comps + zodi_model%npar_tot = zodi_model%npar_tot + zodi_model%comps(i)%npar + if (i < zodi_model%n_comps) then + zodi_model%comps(i+1)%start_ind = zodi_model%comps(i)%start_ind + & + & zodi_model%comps(i)%npar + 2*numband + end if + end do - ! Set up sampling groups - allocate(zodi_model%sampgroup_active_band(numband,cpar%zs_num_samp_groups)) - zodi_model%sampgroup_active_band = .false. - do i = 1, cpar%zs_num_samp_groups - call get_tokens(cpar%zs_samp_group_bands(i), ',', tokens, ntok) - do j = 1, ntok - k = get_string_index(band_labels, tokens(j)) - zodi_model%sampgroup_active_band(k,i) = .true. - end do - call samp_group2stat(cpar, i, zodi_model%sampgroup_active_band(:,i), zodi_model%theta_stat(:,i)) - end do - do i = 1, zodi_model%npar_tot - zodi_model%theta_stat(i,0) = maxval(zodi_model%theta_stat(i,1:cpar%zs_num_samp_groups)) - end do - do i = 1, numband - band_update_monopole(i,0) = any(band_update_monopole(i,1:cpar%zs_num_samp_groups)) - end do + ! stat = 0 -> sample freely + ! stat = -1 -> fix to input + ! stat = -2 -> fix to zero + ! stat = -3 -> fix to unity + ! stat > 0 -> set equal to parameter stat + allocate(zodi_model%theta_stat(zodi_model%npar_tot,0:cpar%zs_num_samp_groups)) + allocate(zodi_model%theta2band(zodi_model%npar_tot)) + allocate(zodi_model%theta_prior(4,zodi_model%npar_tot)) ! [min,max,mean,rms] + allocate(zodi_model%theta_scale(zodi_model%npar_tot,2)) + allocate(zodi_model%par_labels(zodi_model%npar_tot)) + allocate(zodi_model%par_labels_full(zodi_model%npar_tot)) + + ! Set up sampling groups + allocate(zodi_model%sampgroup_active_band(numband,cpar%zs_num_samp_groups)) + zodi_model%sampgroup_active_band = .false. + do i = 1, cpar%zs_num_samp_groups + call get_tokens(cpar%zs_samp_group_bands(i), ',', tokens, ntok) + do j = 1, ntok + k = get_string_index(band_labels, tokens(j)) + zodi_model%sampgroup_active_band(k,i) = .true. + end do + call samp_group2stat(cpar, i, zodi_model%sampgroup_active_band(:,i), zodi_model%theta_stat(:,i)) + end do + do i = 1, zodi_model%npar_tot + zodi_model%theta_stat(i,0) = maxval(zodi_model%theta_stat(i,1:cpar%zs_num_samp_groups)) + end do + do i = 1, numband + band_update_monopole(i,0) = any(band_update_monopole(i,1:cpar%zs_num_samp_groups)) + end do ! Initialize parameter-band mapping zodi_model%theta2band(1:zodi_model%n_general_params) = 0 ! General parameters affect all bands do i = 1, zodi_model%n_comps ind = zodi_model%comps(i)%start_ind npar = zodi_model%comps(i)%npar - zodi_model%theta2band(ind:ind+npar-1) = 0 ! Shape paraneters affect all band + zodi_model%theta2band(ind:ind+npar-1) = 0 ! Shape parameters affect all bands do j = 1, numband zodi_model%theta2band(ind+npar+j-1) = j ! Emissivity only affect band j zodi_model%theta2band(ind+npar+numband+j-1) = j ! The same for albedo @@ -153,10 +196,20 @@ subroutine initialize_zodi_mod(cpar) ! Initialize priors and scale factors call zodi_model%init_general_priors_and_scales(zodi_model%theta_prior, & & zodi_model%theta_scale) - zodi_model%par_labels(1:zodi_model%n_general_params) = & - & zodi_model%general_labels - zodi_model%par_labels_full(1:zodi_model%n_general_params) = & - & zodi_model%par_labels(1:zodi_model%n_general_params) + + if (trim(zodi_model%phasefunc_type) == 'Hong') then + zodi_model%par_labels(1:zodi_model%n_general_params) = & + & zodi_model%general_labels + zodi_model%par_labels_full(1:zodi_model%n_general_params) = & + & zodi_model%par_labels(1:zodi_model%n_general_params) + else + zodi_model%par_labels(1:2) = zodi_model%general_labels(1:2) + zodi_model%par_labels_full(1:2) = zodi_model%par_labels(1:2) + do i = 3, zodi_model%n_general_params + zodi_model%par_labels(i) = 'skip' + zodi_model%par_labels_full(i) = 'skip' + end do + end if do i = 1, zodi_model%n_comps ! Shape parameters ind = zodi_model%comps(i)%start_ind @@ -165,29 +218,34 @@ subroutine initialize_zodi_mod(cpar) zodi_model%par_labels(ind:ind+zodi_model%comps(i)%npar-1) = & & zodi_model%comps(i)%labels do j = ind, ind+zodi_model%comps(i)%npar-1 - zodi_model%par_labels(j) = & + zodi_model%par_labels_full(j) = & & trim(zodi_model%comp_labels(i))//':'//trim(zodi_model%par_labels(j)) end do ! Emissivity and albedo ind = zodi_model%comps(i)%start_ind + zodi_model%comps(i)%npar-1 do j = 1, numband - zodi_model%theta_prior(:,ind+j) = [0.d0, 5.d0, 1.d0, -1.d0] ! Emissivity - zodi_model%theta_scale(ind+j) = 1.d0 + zodi_model%theta_prior(:,ind+j) = [0.d0, 10.d0, 1.d0, -1.d0] ! Emissivity + zodi_model%theta_scale(ind+j,:) = [1.d0,0.1d0] zodi_model%par_labels(ind+j) = 'em@'//trim(band_labels(j)) zodi_model%par_labels_full(ind+j) = trim(zodi_model%comp_labels(i))//':em@'//trim(band_labels(j)) zodi_model%theta_prior(:,ind+numband+j) = [0.d0, 1.d0, 0.3d0, -1.d0] ! Albedo - zodi_model%theta_scale(ind+numband+j) = 1.d0 + zodi_model%theta_scale(ind+numband+j,:) = [1.d0, 0.01d0] zodi_model%par_labels(ind+numband+j) = 'al@'//trim(band_labels(j)) zodi_model%par_labels_full(ind+numband+j) = trim(zodi_model%comp_labels(i))//':al@'//trim(band_labels(j)) + + ! Set DIRBE emissivity rms by hand + if (trim(band_instlabels(j)) == '06') zodi_model%theta_scale(ind+j,:) = [1.d0,0.01d0] + if (trim(band_instlabels(j)) == '07') zodi_model%theta_scale(ind+j,:) = [1.d0,0.02d0] + if (trim(band_instlabels(j)) == '08') zodi_model%theta_scale(ind+j,:) = [1.d0,0.03d0] end do end do ! Monopoles do j = 1, numband ind = zodi_model%npar_tot - numband + j zodi_model%theta_prior(:,ind) = [0.d0, 1d30, 0.d0, -1.d0] ! Priors - zodi_model%theta_scale(ind) = 1.d0 + zodi_model%theta_scale(ind,:) = [1.d0,0.01d0] zodi_model%par_labels(ind) = 'm@'//trim(band_labels(j)) zodi_model%par_labels_full(ind) = 'm@'//trim(band_labels(j)) end do @@ -251,25 +309,40 @@ end subroutine initialize_zodi_mod subroutine init_general_params(self, general_params) class(ZodiModel), intent(inout) :: self real(dp), intent(in) :: general_params(:) - self%T_0 = general_params(1) + self%T_0 = general_params(1) self%delta = general_params(2) + if (self%phasefunc_type == 'Hong') then + self%par_phase(1:5) = general_params(3:7) + end if end subroutine subroutine init_general_priors_and_scales(self, prior, scale) implicit none class(ZodiModel), intent(in) :: self real(dp), dimension(1:,1:), intent(inout) :: prior - real(dp), dimension(1:), intent(inout) :: scale + real(dp), dimension(1:,1:), intent(inout) :: scale + + prior(:,1) = [250.d0, 330.d0, 286.d0, 5.d0] ! T_0 + scale(1,:) = [286.d0, 3.d0] + prior(:,2) = [0.3d0, 0.5d0, 0.467d0, 0.004d0] ! delta + scale(2,:) = [0.4d0, 0.01d0] + prior(:,3) = [-1d0, 1d0, 0.70d0, 0.1d0] ! g_1 + scale(3,:) = [1d0, 0.01d0] + prior(:,4) = [-1d0, 1d0, -0.20d0, 0.1d0] ! g_2 + scale(4,:) = [1d0, 0.01d0] + prior(:,5) = [-1d0, 1d0, -0.81d0, 0.1d0] ! g_3 + scale(5,:) = [1d0, 0.01d0] + prior(:,6) = [0d0, 1d0, 0.330d0, 0.1d0] ! w_2 + scale(6,:) = [1d0, 0.01d0] + prior(:,7) = [0d0, 1d0, 0.005d0, 0.0001d0] ! w_3 + scale(7,:) = [1d0, 0.0005d0] - prior(:,1) = [250.d0, 300.d0, 286.d0, 5.d0] ! T_0 - scale(1) = 286.d0 - prior(:,2) = [0.4d0, 0.5d0, 0.467d0, 0.004d0] ! delta - scale(2) = 0.4d0 end subroutine init_general_priors_and_scales - subroutine init_comps(self, params, comp_types, param_labels) + subroutine init_comps(self, params, comp_types, param_labels) + implicit none ! Initializes the components in the zodi model and computes the number of parameters in the model. class(ZodiModel), target, intent(inout) :: self real(dp), intent(in) :: params(:, :) @@ -277,7 +350,6 @@ subroutine init_comps(self, params, comp_types, param_labels) class(InterplanetaryDustParamLabels), intent(in) :: param_labels integer(i4b) :: i, ierr allocate (self%comps(self%n_comps)) - self%n_params = self%n_general_params ! NOTE: The order of the parameters in the `params` array must match the below order of readin do i = 1, self%n_comps !self%comps(i)%labels = [param_labels%common] @@ -395,92 +467,122 @@ subroutine init_comps(self, params, comp_types, param_labels) &) allocate(self%comps(i)%labels(10)) self%comps(i)%labels = [param_labels%common, param_labels%comet] + case ('wrightcloudring') + allocate (ZodiWrightCloudRing::self%comps(i)%c) + self%comps(i)%c = ZodiWrightCloudRing(& + & n_0=params(i, 1), & + & incl=params(i, 2), & + & Omega=params(i, 3), & + & x_0=params(i, 4), & + & y_0=params(i, 5), & + & z_0=params(i, 6), & + & p1=params(i, 7), & + & p3=params(i, 8), & + & p4=params(i, 9), & + & p5=params(i, 10), & + & p6=params(i, 11), & + & p7=params(i, 12), & + & p8=params(i, 13), & + & p9=params(i, 14), & + & p10=params(i, 15), & + & p13=params(i, 16), & + & p14=params(i, 17), & + & p15=params(i, 18), & + & p16=params(i, 19), & + & p17=params(i, 20), & + & p18=params(i, 21), & + & p19=params(i, 22) & + &) + allocate(self%comps(i)%labels(22)) + self%comps(i)%labels = [param_labels%common, param_labels%wrightcloudring] + case ('wrightband') + allocate (ZodiWrightBand::self%comps(i)%c) + self%comps(i)%c = ZodiWrightBand(& + & n_0=params(i, 1), & + & incl=params(i, 2), & + & Omega=params(i, 3), & + & x_0=params(i, 4), & + & y_0=params(i, 5), & + & z_0=params(i, 6), & + & q1=params(i, 7), & + & q5=params(i, 8), & + & q6=params(i, 9), & + & q7=params(i, 10), & + & q8=params(i, 11), & + & R_1=params(i, 12) & + &) + allocate(self%comps(i)%labels(12)) + self%comps(i)%labels = [param_labels%common, param_labels%wrightband] case default print *, 'Invalid zodi component type in zodi `init_from_params`:', trim(adjustl(comp_types(i))) stop end select self%comps(i)%npar = size(self%comps(i)%labels) call self%comps(i)%c%init() - self%n_params = self%n_params + size(self%comps(i)%labels) ! Initialize emissivity and albedo allocate(self%comps(i)%c%emissivity(numband),self%comps(i)%c%albedo(numband)) self%comps(i)%c%emissivity(numband) = 1.d0 self%comps(i)%c%albedo(numband) = 0.d0 end do - end subroutine + end subroutine init_comps - subroutine model_to_params2(self, x, labels) - ! Dumps a zodi model to a parameter vector `x`. If `labels` is present, it is populated with - ! the corresponding parameter labels. - class(ZodiModel), intent(in) :: self - real(dp), intent(out) :: x(:) - character(len=*), allocatable, optional, intent(inout) :: labels(:) - character(len=128), allocatable :: labels_copy(:), comp_label_upper(:) - integer(i4b) :: i, j, running_idx - - if (size(x) /= self%n_params) stop "Error: argument 'x' has the wrong size. must be `size(zodi_model%n_params)`" - if (present(labels)) then - if (allocated(labels)) stop "`labels` must not be allocated at the time of passing it in to `model_to_params`" - allocate(comp_label_upper(self%n_comps)) - end if + subroutine model_to_params(self, x, samp_group, labels) + implicit none + class(ZodiModel), intent(in) :: self + real(dp), dimension(:), intent(out) :: x + integer(i4b), intent(in), optional :: samp_group + character(len=*), allocatable, optional, intent(inout) :: labels(:) + + integer(i4b) :: i, j, idx + real(dp), allocatable, dimension(:) :: z + character(len=128), allocatable :: labels_copy(:), comp_label_upper(:) + + allocate(z(self%npar_tot)) + + if (present(labels)) then + if (allocated(labels)) stop "`labels` must not be allocated at the time of passing it in to `model_to_params`" + allocate(comp_label_upper(self%n_comps)) + end if + + ! General parameters + z(1) = self%T_0 + z(2) = self%delta + if (trim(self%phasefunc_type) == 'Hong') then + z(3:7) = self%par_phase(1:5) + end if + if (present(labels)) then + if (trim(self%phasefunc_type) == 'Hong') then + labels = self%general_labels + else + labels = self%general_labels(1:2) + do i = 1, self%n_phase_params + labels = [labels, "SKIP"] + end do + end if + end if + idx = self%n_general_params + + ! Component parameters + do i = 1, self%n_comps + ! Shape parameters + call self%comps(i)%c%model2param(z(idx+1:idx+self%comps(i)%npar)) + idx = idx + self%comps(i)%npar + + ! Emissivity and albedo + do j = 1, numband + if (band_todtype(j) == "none") then + z(idx +j) = 0.d0 + z(idx+numband+j) = 0.d0 + else + z(idx +j) = self%comps(i)%c%emissivity(j) + z(idx+numband+j) = self%comps(i)%c%albedo(j) + end if + end do + idx = idx + 2*numband - running_idx = 0 - do i = 1, self%n_comps - x(running_idx + 1) = self%comps(i)%c%n_0 - x(running_idx + 2) = self%comps(i)%c%incl - x(running_idx + 3) = self%comps(i)%c%Omega - x(running_idx + 4) = self%comps(i)%c%x_0 - x(running_idx + 5) = self%comps(i)%c%y_0 - x(running_idx + 6) = self%comps(i)%c%z_0 - running_idx = running_idx + self%n_common_params - select type (comp => self%comps(i)%c) - class is (ZodiCloud) - x(running_idx + 1) = comp%alpha - x(running_idx + 2) = comp%beta - x(running_idx + 3) = comp%gamma - x(running_idx + 4) = comp%mu - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiBand) - x(running_idx + 1) = comp%delta_zeta - x(running_idx + 2) = comp%delta_r - x(running_idx + 3) = comp%v - x(running_idx + 4) = comp%p - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiRing) - x(running_idx + 1) = comp%R_0 - x(running_idx + 2) = comp%sigma_r - x(running_idx + 3) = comp%sigma_z - x(running_idx + 4) = comp%theta_0 - x(running_idx + 5) = comp%sigma_theta - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiFeature) - x(running_idx + 1) = comp%R_0 - x(running_idx + 2) = comp%sigma_r - x(running_idx + 3) = comp%sigma_z - x(running_idx + 4) = comp%theta_0 - x(running_idx + 5) = comp%sigma_theta - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiInterstellar) - x(running_idx + 1) = comp%R - x(running_idx + 2) = comp%alpha - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiFan) - x(running_idx + 1) = comp%Q - x(running_idx + 2) = comp%P - x(running_idx + 3) = comp%gamma - x(running_idx + 4) = comp%Z_midplane_0 - x(running_idx + 5) = comp%R_outer - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiComet) - x(running_idx + 1) = comp%P - x(running_idx + 2) = comp%Z_midplane_0 - x(running_idx + 3) = comp%R_inner - x(running_idx + 4) = comp%R_outer - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - end select if (present(labels)) then labels_copy = self%comps(i)%labels comp_label_upper(i) = self%comp_labels(i) @@ -488,88 +590,113 @@ subroutine model_to_params2(self, x, labels) do j = 1, size(labels_copy) labels_copy(j) = trim(adjustl(comp_label_upper(i)))//'_'//trim(adjustl(labels_copy(j))) end do - labels = [labels, labels_copy] + labels = [labels, labels_copy] + ! Add placeholders for emissivity and albedo + do j = 1, numband + labels = [labels, ["skip","skip"]] + end do end if - end do - x(running_idx + 1) = self%T_0 - x(running_idx + 2) = self%delta - if (present(labels)) then - labels = [labels, self%general_labels] - end if - end subroutine model_to_params2 + end do + + ! Monopoles + do i = 1, numband + idx = idx+1 + if (band_todtype(i) /= "none") then + z(idx) = band_monopole(i) !get_monopole_amp(data(i)%label) + !write(*,*) 'get', i, trim(data(i)%label), z(idx) + else + z(idx) = 0.d0 + end if + if (present(labels)) labels = [labels, "skip"] + end do + + if (present(samp_group)) then + x = pack(z, self%theta_stat(:,samp_group)==0) + if (present(labels)) labels = pack(labels, self%theta_stat(:,samp_group)==0) + else + x = z + end if + deallocate(z) + + end subroutine model_to_params + + subroutine params_to_model(self, x, samp_group) + implicit none + class(ZodiModel), intent(inout) :: self + real(dp), dimension(:), intent(in) :: x + integer(i4b), intent(in), optional :: samp_group + + integer(i4b) :: i, j, idx + real(dp), allocatable, dimension(:) :: z, z_prev + + allocate(z(self%npar_tot)) + + ! Initialize full parameter vector + if (present(samp_group)) then + allocate(z_prev(self%npar_tot)) + call self%model_to_params(z_prev) + idx = 1 + do i = 1, self%npar_tot + if (self%theta_stat(i,samp_group) == 0) then + z(i) = x(idx) + idx = idx+1 + else if (self%theta_stat(i,samp_group) == -1) then + z(i) = z_prev(i) + else if (self%theta_stat(i,samp_group) == -2) then + z(i) = 0.d0 + else if (self%theta_stat(i,samp_group) == -3) then + z(i) = 1.d0 + end if + end do + do i = 1, self%npar_tot + if (self%theta_stat(i,samp_group) > 0) then + z(i) = z(self%theta_stat(i,samp_group)) + end if + end do + deallocate(z_prev) + else + z = x + end if + + ! General parameters + self%T_0 = z(1) + self%delta = z(2) + if (trim(self%phasefunc_type) == 'Hong') then + self%par_phase(1:5) = z(3:7) + end if + + ! Component parameters + idx = self%n_general_params + do i = 1, self%n_comps + ! Shape parameters + call self%comps(i)%c%param2model(z(idx+1:idx+self%comps(i)%npar)) + call self%comps(i)%c%init() + + ! Emissivity and albedo + idx = idx + self%comps(i)%npar + do j = 1, numband + if (band_todtype(j) /= "none") then + self%comps(i)%c%emissivity(j) = z(idx+j) + self%comps(i)%c%albedo(j) = z(idx+numband+j) + end if + end do + idx = idx + 2*numband + end do + + ! Monopoles + do i = 1, numband + idx = idx+1 + if (band_todtype(i) /= "none") then + band_monopole(i) = z(idx) + end if + end do + + deallocate(z) + + end subroutine params_to_model - subroutine params_to_model2(self, x) - ! Dumps a zodi model to a parameter vector `x`. - class(ZodiModel), intent(inout) :: self - real(dp), intent(in) :: x(:) - integer(i4b) :: i, running_idx - if (size(x) /= self%n_params) then - write(*,*) "Error: argument 'x' has the wrong size. must be `size(zodi_model%n_params)`", size(x), self%n_params - stop - end if - running_idx = 0 - do i = 1, self%n_comps - self%comps(i)%c%n_0 = x(running_idx + 1) - self%comps(i)%c%incl = mod(x(running_idx + 2), 360.) ! degree prior - self%comps(i)%c%Omega = mod(x(running_idx + 3), 360.) ! degree prior - self%comps(i)%c%x_0 = x(running_idx + 4) - self%comps(i)%c%y_0 = x(running_idx + 5) - self%comps(i)%c%z_0 = x(running_idx + 6) - running_idx = running_idx + self%n_common_params - - ! The order of these operations much match the order tabulated in the labels in `InterplanetaryDustParamLabels` - select type (comp => self%comps(i)%c) - class is (ZodiCloud) - comp%alpha = x(running_idx + 1) - comp%beta = x(running_idx + 2) - comp%gamma = x(running_idx + 3) - comp%mu = x(running_idx + 4) - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiBand) - comp%delta_zeta = mod(x(running_idx + 1), 360.) ! degree prior - comp%delta_r = x(running_idx + 2) - comp%v = x(running_idx + 3) - comp%p = x(running_idx + 4) - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiRing) - comp%R_0 = x(running_idx + 1) - comp%sigma_r = x(running_idx + 2) - comp%sigma_z = x(running_idx + 3) - comp%theta_0 = mod(x(running_idx + 4), 360.) ! degree prior - comp%sigma_theta = mod(x(running_idx + 5), 360.) ! degree prior - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiFeature) - comp%R_0 = x(running_idx + 1) - comp%sigma_r = x(running_idx + 2) - comp%sigma_z = x(running_idx + 3) - comp%theta_0 = mod(x(running_idx + 4), 360.) ! degree prior - comp%sigma_theta = mod(x(running_idx + 5), 360.) ! degree prior - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiInterstellar) - comp%R = x(running_idx + 1) - comp%alpha = x(running_idx + 2) - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiFan) - comp%Q = x(running_idx + 1) - comp%P = x(running_idx + 2) - comp%gamma = x(running_idx + 3) - comp%Z_midplane_0 = x(running_idx + 4) - comp%R_outer = x(running_idx + 5) - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - class is (ZodiComet) - comp%P = x(running_idx + 1) - comp%Z_midplane_0 = x(running_idx + 2) - comp%R_inner = x(running_idx + 3) - comp%R_outer = x(running_idx + 4) - running_idx = running_idx + size(self%comps(i)%labels) - self%n_common_params - end select - call self%comps(i)%c%init() - end do - self%T_0 = x(running_idx + 1) - self%delta = x(running_idx + 2) - end subroutine params_to_model2 subroutine model_to_chain(self, cpar, iter) ! Dumps the zodi model to the chain file @@ -606,10 +733,16 @@ subroutine model_to_chain(self, cpar, iter) comp_group_path = trim(adjustl(zodi_path))//'/comps' call create_hdf_group(file, trim(adjustl(comp_group_path))) - allocate(params(self%n_params)) - call self%model_to_params2(params, labels) - - param_idx = 0 + allocate(params(self%npar_tot)) + call self%model_to_params(params, labels=labels) + + do i = 1, self%n_general_params + if (trim(labels(i)) == 'skip' .or. trim(labels(i)) == 'SKIP') cycle + param_label = trim(adjustl(general_group_path))//'/'//trim(adjustl(self%general_labels(i))) + call write_hdf(file, trim(adjustl(param_label)), params(i)) + end do + + param_idx = self%n_general_params do i = 1, self%n_comps comp_path = trim(adjustl(comp_group_path))//'/'//trim(adjustl(self%comp_labels(i)))//'/' call create_hdf_group(file, trim(adjustl(comp_path))) @@ -622,11 +755,6 @@ subroutine model_to_chain(self, cpar, iter) call write_hdf(file, trim(adjustl(comp_path))//'/emissivity', self%comps(i)%c%emissivity) call write_hdf(file, trim(adjustl(comp_path))//'/albedo', self%comps(i)%c%albedo) end do - if (param_idx + self%n_general_params /= self%n_params) stop "Error: param_idx + self%n_general_params /= self%n_params" - do i = 1, self%n_general_params - param_label = trim(adjustl(general_group_path))//'/'//trim(adjustl(self%general_labels(i))) - call write_hdf(file, trim(adjustl(param_label)), params(param_idx + i)) - end do ! Static component !path = trim(adjustl(zodi_path))//'/static' @@ -652,7 +780,7 @@ subroutine comp_from_chain(self, cpar, params, comp_idx) type(hdf_file) :: file character(len=32), allocatable :: param_labels(:) - character(len=512) :: chainfile, group_name + character(len=2048) :: chainfile, group_name if (cpar%myid == cpar%root) then if (trim(cpar%zs_init_hdf(comp_idx)) == 'default') then @@ -735,41 +863,45 @@ subroutine comp_from_chain(self, cpar, params, comp_idx) ! end subroutine model_from_chain - subroutine get_s_zodi(band, s_therm, s_scat, s_zodi, comp_id) - ! Evaluates the zodiacal signal (eq. 20 in ZodiPy paper [k98 model]) given - ! integrated thermal zodiacal emission and scattered zodiacal light. - ! - ! Parameters: - ! ----------- - ! s_scat : - ! Integrated contribution from scattered sunlight light. - ! s_therm : - ! Integrated contribution from thermal interplanetary dust emission. - ! s_zodi : - ! Zodiacal signal. - ! emissivity : - ! Emissivity of the zodiacal components. - ! albedo : - ! Albedo of the zodiacal components. - implicit none - integer(i4b), intent(in) :: band - real(sp), dimension(:, :), intent(in) :: s_scat, s_therm - real(sp), dimension(:), intent(out) :: s_zodi - integer(i4b), intent(in), optional :: comp_id - - integer(i4b) :: i, first - real(dp) :: al, em - - first = 1; if (present(comp_id)) first = comp_id - - s_zodi = 0. - do i = first, first+size(s_therm,2)-1 - al = zodi_model%comps(i)%c%albedo(band) - em = zodi_model%comps(i)%c%emissivity(band) - !write(*,*) i, em, al, any(s_scat(:,i)/=s_scat(:,i)), any(s_therm(:,i)/=s_therm(:,i)) - s_zodi = s_zodi + ((s_scat(:,i-first+1) * al) + (1. - al) * em * s_therm(:,i-first+1)) - end do - end subroutine get_s_zodi +!!$ subroutine get_s_zodi(band, s_therm, s_scat, s_zodi, comp_id) +!!$ ! Evaluates the zodiacal signal (eq. 20 in ZodiPy paper [k98 model]) given +!!$ ! integrated thermal zodiacal emission and scattered zodiacal light. +!!$ ! +!!$ ! Parameters: +!!$ ! ----------- +!!$ ! s_scat : +!!$ ! Integrated contribution from scattered sunlight light. +!!$ ! s_therm : +!!$ ! Integrated contribution from thermal interplanetary dust emission. +!!$ ! s_zodi : +!!$ ! Zodiacal signal. +!!$ ! emissivity : +!!$ ! Emissivity of the zodiacal components. +!!$ ! albedo : +!!$ ! Albedo of the zodiacal components. +!!$ implicit none +!!$ integer(i4b), intent(in) :: band +!!$ real(sp), dimension(:, :), intent(in) :: s_scat, s_therm +!!$ real(sp), dimension(:), intent(out) :: s_zodi +!!$ integer(i4b), intent(in), optional :: comp_id +!!$ +!!$ integer(i4b) :: i, first +!!$ real(dp) :: al, em +!!$ +!!$ first = 1; if (present(comp_id)) first = comp_id +!!$ +!!$ s_zodi = 0. +!!$ do i = first, first+size(s_therm,2)-1 +!!$ al = zodi_model%comps(i)%c%albedo(band) +!!$ em = zodi_model%comps(i)%c%emissivity(band) +!!$ !write(*,*) i, em, al, any(s_scat(:,i)/=s_scat(:,i)), any(s_therm(:,i)/=s_therm(:,i)) +!!$ if (trim(zodi_model%phasefunc_type) == 'Wright') then +!!$ s_zodi = s_zodi + ((s_scat(:,i-first+1) * al) + em * s_therm(:,i-first+1)) +!!$ else +!!$ s_zodi = s_zodi + ((s_scat(:,i-first+1) * al) + (1. - al) * em * s_therm(:,i-first+1)) +!!$ end if +!!$ end do +!!$ end subroutine get_s_zodi function get_par_ind(self, comp, comp_str, param, em_band, al_band, em_string, al_string, mono_band, mono_string) @@ -836,7 +968,7 @@ subroutine samp_group2stat(cpar, samp_group, active, stat) integer(i4b), dimension(:), intent(inout) :: stat integer(i4b) :: i, c, j, k, first, last, n_params, n, m, ind, em_global, al_global, c_to, c_from, band - character(len=128) :: tokens(100), comp_param(2), wire_from(2), wire_to(2), label, param_label_tokens(10), em_from(2), em_to(2) + character(len=128) :: tokens(100), comp_param(2), wire_from(2), wire_to(2), label, param_label_tokens(10), em_from(2), em_to(2), al_from(2), al_to(2) character(len=2048) :: str ! Default: Fix everything at input @@ -856,7 +988,7 @@ subroutine samp_group2stat(cpar, samp_group, active, stat) label = comp_param(1) call get_tokens(label, '@', comp_param, num=n) if (n == 1) then - ! General parameter + ! General ind = zodi_model%get_par_ind(param=comp_param(1)) stat(ind) = 0 else if (n == 2) then @@ -866,6 +998,8 @@ subroutine samp_group2stat(cpar, samp_group, active, stat) if (active(band) .and. band_todtype(band) /= 'none') then !ind = zodi_model%get_par_ind(mono_band=band) band_update_monopole(band,samp_group) = .true. + ind = zodi_model%get_par_ind(mono_band=band) + stat(ind) = 0 end if cycle else @@ -919,7 +1053,7 @@ subroutine samp_group2stat(cpar, samp_group, active, stat) ind = zodi_model%get_par_ind(comp=zodi_model%comps(c), em_string=comp_param(2)) stat(ind) = 0 end if - else if (trim(label(1:2)) == 'al') then + else if (trim(label(1:2)) == 'al' .and. trim(label) /= 'alpha') then ! Albedo call get_tokens(label, '@', comp_param, num=n) if (n == 1) then @@ -945,12 +1079,12 @@ subroutine samp_group2stat(cpar, samp_group, active, stat) end do ! Set up monopoles - do i = 1, numband - if (active(i) .and. band_todtype(i) /= 'none') then - ind = zodi_model%get_par_ind(mono_band=i) - stat(ind) = 0 - end if - end do +!!$ do i = 1, numband +!!$ if (active(i) .and. band_todtype(i) /= 'none') then +!!$ ind = zodi_model%get_par_ind(mono_band=i) +!!$ stat(ind) = 0 +!!$ end if +!!$ end do ! Apply explicit parameter wiring call get_tokens(cpar%zs_wiring, ',', tokens, n_params) @@ -995,6 +1129,26 @@ subroutine samp_group2stat(cpar, samp_group, active, stat) c_to = zodi_model%get_par_ind(comp_str=wire_to(1), em_string=em_to(2)) stat(c_from) = c_to end if + else if (trim(wire_from(2)(1:2)) == 'al') then + call get_tokens(wire_from(2), '@', al_from, num=n) + call get_tokens(wire_to(2), '@', al_to, num=n) + if (n == 1) then + ! Attach all bands + do c = 1, numband + if (.not. active(c)) cycle + c_from = zodi_model%get_par_ind(comp_str=wire_from(1), al_band=c) + c_to = zodi_model%get_par_ind(comp_str=wire_to(1), al_band=c) + stat(c_from) = c_to + end do + else + ! Attach specified band + j = get_string_index(band_labels, al_from(2)) + k = get_string_index(band_labels, al_to(2)) + if (.not. active(j) .or. .not. active(k)) cycle + c_from = zodi_model%get_par_ind(comp_str=wire_from(1), al_string=al_from(2)) + c_to = zodi_model%get_par_ind(comp_str=wire_to(1), al_string=al_to(2)) + stat(c_from) = c_to + end if else write(*,*) 'Unsupported zodi wire = ', trim(tokens(i)) stop @@ -1093,7 +1247,8 @@ end subroutine samp_group2stat - subroutine get_zodi_emission(tod, pix, scan, det, s_zodi_scat, s_zodi_therm, model, always_scattering, use_lowres_pointing, comp) + subroutine get_zodi_emission(tod, pix, scan, det, model, s_zodi, use_lowres_pointing, comp) + implicit none ! Returns the predicted zodiacal emission for a scan (chunk of time-ordered data). ! ! Parameters @@ -1112,8 +1267,6 @@ subroutine get_zodi_emission(tod, pix, scan, det, s_zodi_scat, s_zodi_therm, mod ! Contribution from thermal interplanetary dust emission. ! model : type(ZodiModel) ! The zodiacal emission model. - ! always_scattering : logical(lgt), optional - ! If present, this overrides the default behavior of only including scattering when the albedo is non-zero. ! use_lowres_pointing : logical(lgt), optional ! If present, the input pixels are converted to low resolution pixels before evaluating the zodiacal emission. ! comp : integer(i4b), optional @@ -1126,105 +1279,84 @@ subroutine get_zodi_emission(tod, pix, scan, det, s_zodi_scat, s_zodi_therm, mod ! s_zodi_therm : real(sp), dimension(ntod, ncomps, ndet) ! Contribution from thermal interplanetary dust emission. ! - class(comm_tod), intent(inout) :: tod - integer(i4b), intent(in) :: pix(:), scan, det - real(sp), dimension(:, :), intent(inout) :: s_zodi_scat, s_zodi_therm - type(ZodiModel), intent(in) :: model - logical(lgt), intent(in), optional :: always_scattering, use_lowres_pointing - integer(i4b), intent(in), optional :: comp - - integer(i4b) :: i, j, k, l, pix_at_zodi_nside, lookup_idx, n_tod, ierr, cache_hits - logical(lgt) :: scattering, use_lowres - real(dp) :: earth_lon, R_obs, R_min, R_max, dt_tod, obs_time, phase_normalization, C0, C1, C2, lat, lon + class(comm_tod), intent(inout) :: tod + integer(i4b), dimension(:), intent(in) :: pix + integer(i4b), intent(in) :: scan, det + type(ZodiModel), intent(in) :: model + real(sp), dimension(:), intent(out) :: s_zodi + logical(lgt), intent(in), optional :: use_lowres_pointing + integer(i4b), intent(in), optional :: comp + + integer(i4b) :: i, j, k, l, pix_at_zodi_nside, lookup_idx, n_tod, ierr + logical(lgt) :: scattering, thermal, use_lowres + real(dp) :: earth_lon, R_obs, R_min, R_max, dt_tod, obs_time, lat, lon, s_tot, s_scat, s_therm, al, em real(dp) :: unit_vector(3), obs_pos(3), earth_pos(3) - !real(dp), dimension(gauss_degree) :: R_LOS, T_LOS, density_LOS, solar_flux_LOS, scattering_angle, phase_function, b_nu_LOS - - s_zodi_scat = 0. - s_zodi_therm = 0. - n_tod = size(pix, dim=1) - - dt_tod = (1./tod%samprate)*SECOND_TO_DAY ! dt between two samples in units of days (assumes equispaced tods) - obs_pos = tod%scans(scan)%x0_obs - earth_pos = tod%scans(scan)%x0_earth - R_obs = norm2(obs_pos) - obs_time = tod%scans(scan)%t0(1) - earth_lon = atan(earth_pos(2), earth_pos(1)) - - C0 = zodi_model%C0(tod%zodiband) - C1 = zodi_model%C1(tod%zodiband) - C2 = zodi_model%C2(tod%zodiband) - phase_normalization = get_phase_normalization(C0, C1, C2) - if (present(always_scattering)) then - scattering = always_scattering - else - scattering = .false. - do i = 1, zodi_model%n_comps - if (zodi_model%comps(i)%c%emissivity(tod%id) > EPS) then - scattering = .true. - exit - end if - end do - end if - ! select the correct cache - if (present(use_lowres_pointing)) then - if (tod%nside == zodi_nside) then - use_lowres = .false. - else - if (.not. allocated(tod%zodi_therm_cache_lowres)) stop "zodi cache not allocated. `use_lowres_pointing` should only be true when sampling zodi." - if (.not. allocated(tod%scans(scan)%downsamp_obs_time)) then - print *, tod%zodiband, scan, "lowres obs_time not allocated" - stop - end if - use_lowres = .true. - end if + real(dp), allocatable, dimension(:) :: b_nu + + integer(i4b) :: cache_hits + real(sp), allocatable, dimension(:,:) :: cache + real(dp) :: cache_time, init_cache_time + + use_lowres = .false.; if (present(use_lowres_pointing)) use_lowres = use_lowres_pointing + n_tod = size(pix) + dt_tod = (1./tod%samprate)*SECOND_TO_DAY ! dt between two samples in units of days (assumes equispaced tods) + obs_pos = tod%scans(scan)%x0_obs + earth_pos = tod%scans(scan)%x0_earth + R_obs = norm2(obs_pos) + obs_time = tod%scans(scan)%t0(1) + earth_lon = atan(earth_pos(2), earth_pos(1)) + scattering = tod%central_freq >= model%nu_min_scatter + thermal = tod%central_freq <= model%nu_max_thermal + + ! Initialize cache + if (use_lowres) then + allocate(cache(tod%zodi_cache_nobs_lowres, tod%ndet)) else - use_lowres = .false. + allocate(cache(tod%nobs, tod%ndet)) end if - !use_lowres = .false. - + cache_time = tod%scans(1)%t0(1) + cache = -1 + cache_hits = 0 !!$ open(58,file="zodi.dat",recl=1024) do i = 1, n_tod ! Reset cache if time between last cache update and current time is larger than `delta_t_reset`. ! NOTE: this cache is only effective if the scans a core handles are in chronological order. if (use_lowres) then - obs_time = tod%scans(scan)%downsamp_obs_time(i) + obs_time = tod%scans(scan)%d(det)%downsamp_obs_time_full(i) else obs_time = obs_time + dt_tod ! assumes a time continuous TOD end if - if ((obs_time - tod%zodi_cache_time) >= delta_t_reset) then + + ! Reset cache + if ((obs_time - cache_time) >= delta_t_reset) then do j = 1, 3 earth_pos(j) = splint_simple(tod%x_earth_spline(j), obs_time) - obs_pos(j) = splint_simple(tod%x_obs_spline(j), obs_time) + obs_pos(j) = splint_simple(tod%x_obs_spline(j), obs_time) end do - R_obs = norm2(obs_pos) - earth_lon = atan(earth_pos(2), earth_pos(1)) - call tod%clear_zodi_cache(obs_time) + R_obs = norm2(obs_pos) + earth_lon = atan(earth_pos(2), earth_pos(1)) + cache = -1 + cache_time = obs_time end if ! Get lookup index for cache. If the pixel is already cached, used that value. if (use_lowres) then - lookup_idx = tod%pix2ind_lowres(tod%udgrade_pix_zodi(pix(i))) - if (tod%zodi_therm_cache_lowres(lookup_idx, 1, det) > 0.d0) then - if (scattering) s_zodi_scat(i, :) = tod%zodi_scat_cache_lowres(lookup_idx, :, det) - s_zodi_therm(i, :) = tod%zodi_therm_cache_lowres(lookup_idx, :, det) - cache_hits = cache_hits + 1 - cycle - end if + lookup_idx = tod%pix2ind_lowres(tod%udgrade_pix_zodi(pix(i))) unit_vector = tod%ind2vec_ecl_lowres(:, lookup_idx) else - lookup_idx = tod%pix2ind(pix(i)) - !write(*,*) 'q1', tod%scanid(scan), lookup_idx - !write(*,*) 'q2', tod%scanid(scan), lookup_idx, pix(i), det, tod%zodi_therm_cache(lookup_idx, 1, det) - if (tod%zodi_therm_cache(lookup_idx, 1, det) > 0.d0) then - if (scattering) s_zodi_scat(i, :) = tod%zodi_scat_cache(lookup_idx, :, det) - s_zodi_therm(i, :) = tod%zodi_therm_cache(lookup_idx, :, det) - cache_hits = cache_hits + 1 - cycle - end if + lookup_idx = tod%pix2ind(pix(i)) unit_vector = tod%ind2vec_ecl(:, lookup_idx) end if + + if (cache(lookup_idx, det) > 0.d0) then + s_zodi(i) = cache(lookup_idx, det) + cache_hits = cache_hits + 1 + cycle + end if + ! If not present in cache, compute signal for each zodi component from scratch, and add signals together + s_tot = 0. do k = 1, model%n_comps ! If comp is present we only evaluate the zodi emission for that component. ! If comp == 0 then we evaluate the zodi emission for all components. @@ -1238,9 +1370,9 @@ subroutine get_zodi_emission(tod, pix, scan, det, s_zodi_scat, s_zodi_therm, mod do l = 1, 3 ! Convert quadrature range from [-1, 1] to [R_min, R_max] - comp_LOS(k)%X_unit(l, :) = (0.5 * (R_max - R_MIN)) * comp_LOS(k)%gauss_nodes + (0.5 * (R_max + R_MIN)) - comp_LOS(k)%X_unit(l, :) = comp_LOS(k)%X_unit(l, :) * unit_vector(l) - comp_LOS(k)%X(l, :) = comp_LOS(k)%X_unit(l, :) + obs_pos(l) + comp_LOS(k)%X_unit(l,:) = (0.5 * (R_max - R_MIN)) * comp_LOS(k)%gauss_nodes + (0.5 * (R_max + R_MIN)) + comp_LOS(k)%X_unit(l,:) = comp_LOS(k)%X_unit(l, :) * unit_vector(l) + comp_LOS(k)%X(l,:) = comp_LOS(k)%X_unit(l, :) + obs_pos(l) end do comp_LOS(k)%R = norm2(comp_LOS(k)%X, dim=1) !!$ do l = 1, size(comp_LOS(k)%R) @@ -1252,34 +1384,54 @@ subroutine get_zodi_emission(tod, pix, scan, det, s_zodi_scat, s_zodi_therm, mod !!$ write(*,*) 'X_unit', comp_LOS(k)%X_unit(:,l) !!$ end if !!$ end do - + + ! Compute phase function if scattering is included if (scattering) then - comp_LOS(k)%F_sol = model%F_sun(tod%zodiband)/comp_LOS(k)%R**2 + if (trim(model%phasefunc_type) == 'Wright') then + allocate(b_nu(size(tod%bp(0)%p%nu))) + call get_blackbody_emission(tod%bp(0)%p%nu, 5772.d0, b_nu) + comp_LOS(k)%F_sol = tsum(tod%bp(0)%p%nu, tod%bp(0)%p%tau*b_nu)/comp_LOS(k)%R**2 + deallocate(b_nu) + else + comp_LOS(k)%F_sol = model%F_sun(tod%zodiband)/comp_LOS(k)%R**2 + end if call get_scattering_angle(comp_LOS(k)%X, comp_LOS(k)%X_unit, comp_LOS(k)%R, comp_LOS(k)%Theta) - call get_phase_function(comp_LOS(k)%Theta, C0, C1, C2, phase_normalization, comp_LOS(k)%Phi) + call model%get_phase_function(comp_LOS(k)%Theta, tod%zodiband, comp_LOS(k)%Phi) end if - call get_dust_grain_temperature(comp_LOS(k)%R, comp_LOS(k)%T, model%T_0, model%delta) + ! Get dust grain temperature along the line of sight, and compute splined blackbody emission + if (trim(model%phasefunc_type) == 'Wright' .and. k > 1) then + comp_LOS(k)%T = exp(5.5301d0) * comp_LOS(k)%R**(-0.5d0) + else + comp_LOS(k)%T = model%T_0 * comp_LOS(k)%R**(-model%delta) + end if call splint_simple_multi(tod%zodi_b_nu_spl_obj(det), comp_LOS(k)%T, comp_LOS(k)%B_nu) +!!$ ! Compute density along line of sight +!!$ call model%comps(k)%c%get_density(comp_LOS(k)%X, earth_lon, comp_LOS(k)%n) + + ! Compute predicted signal in MJy/sr; store computed signal in cache call model%comps(k)%c%get_density(comp_LOS(k)%X, earth_lon, comp_LOS(k)%n) - if (scattering) then - s_zodi_scat(i, k) = sum(comp_LOS(k)%n*comp_LOS(k)%F_sol*comp_LOS(k)%Phi*comp_LOS(k)%gauss_weights) * 0.5*(R_max - R_MIN) * 1d20 - if (use_lowres) then - tod%zodi_scat_cache_lowres(lookup_idx, k, det) = s_zodi_scat(i, k) - else - tod%zodi_scat_cache(lookup_idx, k, det) = s_zodi_scat(i, k) - end if - end if - s_zodi_therm(i, k) = sum(comp_LOS(k)%n*comp_LOS(k)%B_nu*comp_LOS(k)%gauss_weights) * 0.5 * (R_max - R_MIN) * 1d20 - if (use_lowres) then - tod%zodi_therm_cache_lowres(lookup_idx, k, det) = s_zodi_therm(i, k) + s_scat = 0.; s_therm = 0. + if (scattering) s_scat = sum(comp_LOS(k)%n*comp_LOS(k)%F_sol*comp_LOS(k)%Phi*comp_LOS(k)%gauss_weights) * 0.5d0*(R_max-R_MIN)*1d20 + if (thermal) s_therm = sum(comp_LOS(k)%n*comp_LOS(k)%B_nu*comp_LOS(k)%gauss_weights) * 0.5d0*(R_max-R_MIN)*1d20 + + al = zodi_model%comps(k)%c%albedo(tod%id) + em = zodi_model%comps(k)%c%emissivity(tod%id) + if (trim(zodi_model%phasefunc_type) == 'Wright') then + s_tot = s_tot + al*s_scat + em *s_therm else - tod%zodi_therm_cache(lookup_idx, k, det) = s_zodi_therm(i, k) + s_tot = s_tot + al*s_scat + em*(1.d0-al)*s_therm end if end do + + ! Return total zodi signal, and store final value in cache for later use + s_zodi(i) = s_tot + cache(lookup_idx, det) = s_tot + + !!$ call vec2ang(unit_vector, lat, lon) -!!$ write(58,*) i, lon*180.d0/pi, 90.d0-180.d0/pi*lat, 0.958*sum(s_zodi_therm(i,:))!, sum(s_zodi_scat(i,:)), sum(s_zodi_therm(i,:))+sum(s_zodi_scat(i,:)) +!!$ write(58,*) i, lon*180.d0/pi, 90.d0-180.d0/pi*lat, 0.958*sum(s_zodi_therm(i,:)), sum(s_zodi_scat(i,:)), sum(s_zodi_therm(i,:))+sum(s_zodi_scat(i,:)) !!$ !!$ write(*,*) "X", comp_LOS(1)%X(1,:) !!$ write(*,*) "Y", comp_LOS(1)%X(2,:) @@ -1291,109 +1443,208 @@ subroutine get_zodi_emission(tod, pix, scan, det, s_zodi_scat, s_zodi_therm, mod !!$ !write(*,*) "F", comp_LOS(1)%F_sol*1.d20 !!$ !write(*,*) "Phi", comp_LOS(1)%Phi !!$ !write(*,*) "s", comp_LOS(1)%F_sol*comp_LOS(1)%Phi*1d20 * 0.255d0 + (1.d0-0.255d0) * 1.d0 * comp_LOS(1)%B_nu* 1.d0 +!!$ write(*,*) "T_0, delta", model%T_0, model%delta +!!$ write(*,*) "T", comp_LOS(1)%T !!$ write(*,*) "s", comp_LOS(1)%B_nu*0.958 - end do -!!$ close(58) -!!$ call mpi_finalize(i) -!!$ stop - + deallocate(cache) + end subroutine get_zodi_emission - ! Functions for evaluating the zodiacal emission - ! ----------------------------------------------------------------------------------- - subroutine get_sphere_intersection(unit_vector, obs_pos, R_obs, R_cutoff, R_intersection) - ! Computes R_max (the length of the LOS such that it stops exactly at los_cutoff_radius). + subroutine get_s_tot_zodi(zodi_model, tod, det, scan, s_zodi_tot, pix_dynamic, exclude_static, comp) + implicit none + class(ZodiModel), intent(in) :: zodi_model + class(comm_tod), intent(inout) :: tod + integer(i4b), intent(in) :: det, scan + real(sp), dimension(:), intent(out) :: s_zodi_tot + integer(i4b), dimension(:,:), intent(in), optional :: pix_dynamic + character(len=*), intent(in), optional :: exclude_static + integer(i4b), intent(in), optional :: comp + + integer(i4b) :: i, j, h, ntod, nhorn, ncomp, band + real(sp) :: w + real(dp) :: t1, t2 + real(sp), allocatable, dimension(:) :: s_zodi + real(sp), allocatable, dimension(:,:) :: s_scat_, s_therm_ - real(dp), intent(in), dimension(:) :: unit_vector, obs_pos - real(dp), intent(in) :: R_obs, R_cutoff - real(dp), intent(out) :: R_intersection - real(dp) :: lon, lat, cos_lat, b, d, q + ntod = size(s_zodi_tot) + ncomp = zodi_model%n_comps + band = tod%id - if (R_obs > R_cutoff) then - R_intersection = EPS - return + ! Initialize + s_zodi_tot = 0. + + ! Compute non-stationary zodi TOD through line-of-sight integration for each horn, and add together + call wall_time(t1) + if (present(pix_dynamic)) then + allocate(s_zodi(ntod)) + do h = 1, size(pix_dynamic,2) + call get_zodi_emission(tod, pix_dynamic(:,h), scan, det, zodi_model, s_zodi, comp=comp) + w = 1.d0; if (h > 1) w = -1.d0 + s_zodi_tot = s_zodi_tot + w * s_zodi + end do + deallocate(s_zodi) + end if + call wall_time(t2) + + ! Add solar component by Healpix map lookup + if (trim(exclude_static) /= 'all' .and. associated(tod%map_solar) .and. trim(exclude_static) /= 'solar') then + do h = 1, tod%nhorn + do i = 1, ntod + j = tod%scans(scan)%d(det)%pix_sol(i,h) + if (tod%map_solar(j,1) > -1.d30) then + w = 1.d0; if (h > 1) w = -1.d0 + s_zodi_tot(i) = s_zodi_tot(i) + w * tod%map_solar(j,1) + end if + end do + end do end if + return - lon = atan(unit_vector(2), unit_vector(1)) - lat = asin(unit_vector(3)) - cos_lat = cos(lat) - b = 2.*(obs_pos(1)*cos_lat*cos(lon) + obs_pos(2)*cos_lat*sin(lon)) - d = R_obs**2 - R_cutoff**2 - q = -0.5*b*(1.+sqrt(b**2 - (4.*d))/abs(b)) - R_intersection = max(q, d/q) - end subroutine get_sphere_intersection + ! Add Moon component by Healpix map lookup + if (trim(exclude_static) /= 'all' .and. trim(exclude_static) /= 'moon') then + do h = 1, tod%nhorn + do i = 1, ntod + j = tod%scans(scan)%d(det)%pix_moon(i,h) + if (tod%map_moon(j,1) > -1.d30) then + w = 1.d0; if (h > 1) w = -1.d0 + s_zodi_tot(i) = s_zodi_tot(i) + w * tod%map_moon(j,1) + end if + end do + end do + end if - subroutine get_dust_grain_temperature(R, T_out, T_0, delta) - real(dp), dimension(:), intent(in) :: R - real(dp), dimension(:), intent(out) :: T_out - real(dp), intent(in) :: T_0, delta - T_out = T_0*R**(-delta) - end subroutine get_dust_grain_temperature + ! Add Earth component by Healpix map lookup + if (trim(exclude_static) /= 'all' .and. trim(exclude_static) /= 'earth') then + do h = 1, tod%nhorn + do i = 1, ntod + j = max(min(int(tod%scans(scan)%d(det)%earth_elon(i,h)/(pi/NBIN_EARTH_ELON)),NBIN_EARTH_ELON),1) + if (tod%map_earth(j) > -1.d30) then + w = 1.d0; if (h > 1) w = -1.d0 + s_zodi_tot(i) = s_zodi_tot(i) + w * tod%map_earth(j) + end if + end do + end do + end if + + end subroutine get_s_tot_zodi + + ! Functions for evaluating the zodiacal emission + ! ----------------------------------------------------------------------------------- + ! Computes R_max (the length of the LOS such that it stops exactly at los_cutoff_radius). + subroutine get_sphere_intersection(unit_vector, obs_pos, R_obs, R_cutoff, R_intersection) + implicit none + real(dp), intent(in), dimension(:) :: unit_vector, obs_pos + real(dp), intent(in) :: R_obs, R_cutoff + real(dp), intent(out) :: R_intersection + + real(dp) :: lon, lat, cos_lat, b, d, q + + if (R_obs > R_cutoff) then + R_intersection = EPS + return + end if + + lon = atan(unit_vector(2), unit_vector(1)) + lat = asin(unit_vector(3)) + cos_lat = cos(lat) + b = 2.d0*(obs_pos(1)*cos_lat*cos(lon) + obs_pos(2)*cos_lat*sin(lon)) + d = R_obs**2 - R_cutoff**2 + q = -0.5d0*b*(1.d0+sqrt(b**2 - (4.d0*d))/abs(b)) + R_intersection = max(q, d/q) + end subroutine get_sphere_intersection subroutine get_blackbody_emission(nus, T, b_nu) - real(dp), intent(in) :: nus(:), T - real(dp), dimension(:), intent(out) :: b_nu - integer(i4b) :: i - real(dp) :: x - do i = 1, size(nus) - x = h*nus(i)/(k_B*T) - if (x < 0.001d0) then - ! Use RJ approximation - b_nu(i) = 2.d0*nus(i)**2*k_B*T/c**2 - else if (x > 50.d0) then - ! Use Wien approximation - b_nu(i) = 2.d0*h*nus(i)**3/c**2 * exp(-x) - else - ! Use exact expression - b_nu(i) = 2.d0*h*nus(i)**3/c**2 / (exp(x) - 1.d0) - end if - end do - !b_nu = b_nu * 1d20 ! Convert from W/(m^2*sr*Hz) to MJy/sr + implicit none + real(dp), intent(in) :: nus(:), T + real(dp), dimension(:), intent(out) :: b_nu + + integer(i4b) :: i + real(dp) :: x + do i = 1, size(nus) + x = h*nus(i)/(k_B*T) + if (x < 0.001d0) then + ! Use RJ approximation + b_nu(i) = 2.d0*nus(i)**2*k_B*T/c**2 + else if (x > 50.d0) then + ! Use Wien approximation + b_nu(i) = 2.d0*h*nus(i)**3/c**2 * exp(-x) + else + ! Use exact expression + b_nu(i) = 2.d0*h*nus(i)**3/c**2 / (exp(x) - 1.d0) + end if + end do + !b_nu = b_nu * 1d20 ! Convert from W/(m^2*sr*Hz) to MJy/sr end subroutine get_blackbody_emission subroutine get_scattering_angle(X_helio_vec_LOS, X_vec_LOS, R_helio_LOS, scattering_angle) - real(dp), intent(in) :: X_helio_vec_LOS(:, :), X_vec_LOS(:, :), R_helio_LOS(:) - real(dp), dimension(:), intent(out) :: scattering_angle - real(dp), allocatable, dimension(:) :: cos_theta, R_LOS - - allocate(cos_theta(size(X_vec_LOS, dim=1))) - allocate(R_LOS(size(X_vec_LOS, dim=1))) - - R_LOS = norm2(X_vec_LOS, dim=1) - if (any(abs(R_LOS*R_helio_LOS) < 1e-6)) then - write(*,*) 'Error in get_scattering_angle' - write(*,*) 'X_vec_LOS = ', X_vec_LOS - write(*,*) 'R_LOS = ', R_LOS - write(*,*) 'helio = ', R_helio_LOS - end if - cos_theta = sum(X_helio_vec_LOS*X_vec_LOS, dim=1)/(R_LOS*R_helio_LOS) - ! clip cos(theta) to [-1, 1] - where (cos_theta > 1) - cos_theta = 1 - elsewhere(cos_theta < -1) - cos_theta = -1 - end where - scattering_angle = acos(-cos_theta) + implicit none + real(dp), intent(in) :: X_helio_vec_LOS(:, :), X_vec_LOS(:, :), R_helio_LOS(:) + real(dp), dimension(:), intent(out) :: scattering_angle + + real(dp), allocatable, dimension(:) :: cos_theta, R_LOS + + allocate(cos_theta(size(X_vec_LOS, dim=1))) + allocate(R_LOS(size(X_vec_LOS, dim=1))) + + R_LOS = norm2(X_vec_LOS, dim=1) + if (any(abs(R_LOS*R_helio_LOS) < 1e-6)) then + write(*,*) 'Error in get_scattering_angle' + write(*,*) 'X_vec_LOS = ', X_vec_LOS + write(*,*) 'R_LOS = ', R_LOS + write(*,*) 'helio = ', R_helio_LOS + end if + cos_theta = sum(X_helio_vec_LOS*X_vec_LOS, dim=1)/(R_LOS*R_helio_LOS) + ! clip cos(theta) to [-1, 1] + where (cos_theta > 1.d0) + scattering_angle = 0.d0 + elsewhere(cos_theta < -1.d0) + scattering_angle = pi + elsewhere + scattering_angle = acos(-cos_theta) + end where + deallocate(cos_theta, R_LOS) end subroutine get_scattering_angle - subroutine get_phase_function(Theta, C0 , C1 , C2, N, phase_function) - real(dp), intent(in) :: Theta(:), C0, C1, C2, N - real(dp), intent(out) :: phase_function(:) - phase_function = N * (C0 + (C1 * Theta) + exp(C2 * Theta)) - end subroutine + subroutine get_phase_function(self, Theta, band, Phi) + implicit none + class(ZodiModel), intent(in) :: self + real(dp), intent(in) :: Theta(:) + integer(i4b), intent(in) :: band + real(dp), intent(out) :: Phi(:) - function get_phase_normalization(C0, C1, C2) result(N) - real(dp), intent(in) :: C0, C1, C2 - real(dp) :: term1, term2, term3, term4, N + real(dp) :: C0, C1, C2, p20, p21, g1, g2, g3, w1, w2, w3, norm + integer(i4b) :: n + + if (trim(self%phasefunc_type) == 'K98') then + n = self%numband + C0 = self%par_phase(band+0*n) + C1 = self%par_phase(band+1*n) + C2 = self%par_phase(band+2*n) + norm = 1.d0 / (2.d0*pi * (2.d0*C0 + pi*C1 + (exp(C2 * pi) + 1.d0)/(C2**2 + 1.d0))) + Phi = norm * (C0 + (C1 * Theta) + exp(C2 * Theta)) + else if (trim(self%phasefunc_type) == 'Wright') then + p20 = self%par_phase(1) + p21 = self%par_phase(2) + Phi = exp(-p20*cos(Theta) + p21*cos(Theta)**2) + else if (trim(self%phasefunc_type) == 'Hong') then + g1 = self%par_phase(1) + g2 = self%par_phase(2) + g3 = self%par_phase(3) + w1 = 1.d0-sum(self%par_phase(4:5)) + w2 = self%par_phase(4) + w3 = self%par_phase(5) + Phi = w1 * (1d0-g1**2)/(1.d0+g1**2-2d0*g1*cos(Theta))**1.5d0 + Phi = Phi + w2 * (1d0-g2**2)/(1.d0+g2**2-2d0*g2*cos(Theta))**1.5d0 + Phi = Phi + w3 * (1d0-g3**2)/(1.d0+g3**2-2d0*g3*cos(Theta))**1.5d0 + Phi = Phi / (4.d0*pi) + else + write(*,*) 'Unsupported zodi phase function type:', trim(self%phasefunc_type) + stop + end if - term1 = 2.*pi - term2 = 2.*C0 - term3 = pi*C1 - term4 = (exp(C2 * pi) + 1.)/(C2**2 + 1.) - N = 1. / (term1 * (term2 + term3 + term4)) - end function + end subroutine get_phase_function subroutine initialize_earth_pos_spline(cpar) ! Returns the spline object which is used to evaluate the earth position @@ -1419,31 +1670,31 @@ subroutine initialize_earth_pos_spline(cpar) end subroutine initialize_earth_pos_spline subroutine update_zodi_splines(tod, bandpass, det, model) - ! Updates the spectral spline objects in the TOD object. - ! - ! In the K98 model, several spectral parameters are tabulated at individual frequencies, - ! which we need to evaluate over the bandpass. In a future version, we may want to fit - ! a modified blackbody which would allow us to drop using some of these spline objects. - ! - ! ----------------------------------------------------------------------------------------- - ! | The difficulty with this functino is that it needs the access to the bandpass, so is is | - ! | very limited in where it can be excecuted in commander. | - ! ----------------------------------------------------------------------------------------- - ! - ! Parameters - ! ---------- - ! tod : class(comm_tod) - ! The TOD object holding the spline objects to update. - ! bandpass : class(comm_bp_ptr) - ! The bandpass object holding the bandpass frequencies, and the SED2F function - ! (bandpass integration). - ! det : integer(i4b) - ! The detector to update the spline objects for. - - class(comm_tod), intent(inout) :: tod - class(comm_bp_ptr), intent(in) :: bandpass - integer(i4b), intent(in) :: det - type(ZodiModel), intent(inout) :: model + implicit none + ! Updates the spectral spline objects in the TOD object. + ! + ! In the K98 model, several spectral parameters are tabulated at individual frequencies, + ! which we need to evaluate over the bandpass. In a future version, we may want to fit + ! a modified blackbody which would allow us to drop using some of these spline objects. + ! + ! ----------------------------------------------------------------------------------------- + ! | The difficulty with this functino is that it needs the access to the bandpass, so is is | + ! | very limited in where it can be excecuted in commander. | + ! ----------------------------------------------------------------------------------------- + ! + ! Parameters + ! ---------- + ! tod : class(comm_tod) + ! The TOD object holding the spline objects to update. + ! bandpass : class(comm_bp_ptr) + ! The bandpass object holding the bandpass frequencies, and the SED2F function + ! (bandpass integration). + ! det : integer(i4b) + ! The detector to update the spline objects for. + class(comm_tod), intent(inout) :: tod + class(comm_bp_ptr), intent(in) :: bandpass + integer(i4b), intent(in) :: det + type(ZodiModel), intent(inout) :: model real(dp), allocatable :: b_nu(:) integer(i4b) :: i, j @@ -1451,11 +1702,19 @@ subroutine update_zodi_splines(tod, bandpass, det, model) allocate (b_nu(bandpass%p%n)) do i = 1, size(B_nu_integrals) - call get_blackbody_emission( bandpass%p%nu, T_grid(i), b_nu) - call get_blackbody_emission([bandpass%p%nu_c], T_grid(i), Inu0) ! Center frequency for color correction - K = tsum(bandpass%p%nu, bandpass%p%tau * b_nu/Inu0(1)) / tsum(bandpass%p%nu, bandpass%p%tau * bandpass%p%nu_c/bandpass%p%nu) ! Color correction - B_nu_integrals(i) = K * Inu0(1) - !B_nu_integrals(i) = tsum(bandpass%p%nu, bandpass%p%tau*b_nu) + call get_blackbody_emission( bandpass%p%nu, T_grid(i), b_nu) ! MJy/sr + if (trim(model%bandpass_type) == 'DIRBE') then + call get_blackbody_emission([bandpass%p%nu_c], T_grid(i), Inu0) ! Center frequency for color correction + K = tsum(bandpass%p%nu, bandpass%p%tau * b_nu/Inu0(1)) / tsum(bandpass%p%nu, bandpass%p%tau * bandpass%p%nu_c/bandpass%p%nu) ! Color correction + B_nu_integrals(i) = K * Inu0(1) + else if (trim(model%bandpass_type) == 'Wright') then + B_nu_integrals(i) = tsum(bandpass%p%nu, bandpass%p%tau*b_nu) + else if (trim(model%bandpass_type) == 'default') then + b_nu = 1.d0/(2.d0*bandpass%p%nu**2*k_b/c**2 * 1d14) * b_nu ! uK_RJ + B_nu_integrals(i) = tod%bp(det)%p%SED2F(b_nu) ! Converts to data units + else + write(*,*) 'Update_zodi_splines -- unknown bandpass type = ', trim(model%bandpass_type) + end if end do call spline_simple(tod%zodi_b_nu_spl_obj(det), T_grid, B_nu_integrals, regular=.true.) end subroutine update_zodi_splines @@ -1524,7 +1783,7 @@ subroutine read_tod_zodi_params(cpar, model, tod) type(hdf_file) :: file real(dp) :: lambda, lambda_min, lambda_max real(dp), allocatable :: emissivity(:), albedo(:) - character(len=512) :: chainfile, emissivity_path, albedo_path, band_path, comp_path, tod_path, group_name + character(len=2048) :: chainfile, emissivity_path, albedo_path, band_path, comp_path, tod_path, group_name !allocate(tod%zodi_emissivity(tod%zodi_n_comps)) !allocate(tod%zodi_albedo(tod%zodi_n_comps)) @@ -1579,78 +1838,9 @@ subroutine read_tod_zodi_params(cpar, model, tod) !call mpi_bcast(tod%zodi_albedo, size(tod%zodi_albedo), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) end subroutine read_tod_zodi_params + ! Get total zodi for a given TOD, including (optionally) both dynamic and static components, and accounting for horns - subroutine get_s_tot_zodi(zodi_model, tod, det, scan, s, pix_dynamic, pix_static, s_therm, s_scat) - implicit none - class(ZodiModel), intent(in) :: zodi_model - class(comm_tod), intent(inout) :: tod - integer(i4b), intent(in) :: det, scan - real(sp), dimension(:), intent(out) :: s - integer(i4b), dimension(:,:), intent(in), optional :: pix_dynamic, pix_static - real(sp), dimension(:,:), intent(out), optional :: s_therm, s_scat - - integer(i4b) :: i, j, h, ntod, nhorn, ncomp, band - real(sp) :: w - real(sp), allocatable, dimension(:) :: s_zodi - real(sp), allocatable, dimension(:,:) :: s_scat_, s_therm_ - - ntod = size(s,1) - ncomp = zodi_model%n_comps - band = tod%id - - s = 0. - if (present(pix_dynamic)) then - ! Get pointing - nhorn = size(pix_dynamic,2) - allocate(s_scat_(ntod,ncomp), s_therm_(ntod,ncomp), s_zodi(ntod)) - - ! Compute non-stationary zodi TOD through line-of-sight integration - do h = 1, nhorn - call get_zodi_emission(tod=tod, pix=pix_dynamic(:,h), scan=scan, & - & det=det, s_zodi_scat=s_scat_, s_zodi_therm=s_therm_, model=zodi_model) - call get_s_zodi(band, s_therm=s_therm_, s_scat=s_scat_, s_zodi=s_zodi) - w = 1.d0; if (h > 1) w = -1.d0 - s = s + w * s_zodi - if (present(s_scat)) s_scat = s_scat_ ! Only works for nhorn=1 - if (present(s_therm)) s_therm = s_therm_ - end do - - deallocate(s_scat_, s_therm_, s_zodi) - end if - - ! Add static zodi component by Healpix map lookup - if (present(pix_static) .and. associated(tod%map_solar)) then - nhorn = size(pix_static,2) - do h = 1, nhorn - do i = 1, ntod - j = pix_static(i,h) - if (tod%map_solar(j,1) > -1.d30) then - w = 1.d0; if (h > 1) w = -1.d0 - !s(i) = s(i) + w * zodi_model%amp_static(band) * zodi_model%map_static(j,1) - s(i) = s(i) + w * tod%map_solar(j,1) - end if - end do - end do - end if - - end subroutine get_s_tot_zodi - - subroutine get_zodi_emissivity_albedo(zodi, band, emissivity, albedo) - implicit none - class(ZodiModel), intent(in) :: zodi - integer(i4b), intent(in) :: band - real(dp), dimension(:), intent(out), optional :: emissivity, albedo - - integer(i4b) :: i - - do i = 1, zodi%n_comps - if (present(emissivity)) emissivity(i) = zodi%comps(i)%c%emissivity(band) - if (present(albedo)) albedo(i) = zodi%comps(i)%c%albedo(band) - end do - - end subroutine get_zodi_emissivity_albedo - - subroutine zodi_model_to_ascii(cpar, model, filename, overwrite) + subroutine zodi_model_to_ascii(cpar, model, filename, overwrite) ! Dumps the zodi model to an ascii file on the format {COMP}_{PARAM} = {VALUE}. class(ZodiModel), target, intent(in) :: model type(comm_params), intent(in) :: cpar @@ -1678,18 +1868,27 @@ subroutine zodi_model_to_ascii(cpar, model, filename, overwrite) end if open(newunit=io, file=trim(adjustl(filename)), action="write") - allocate(params(model%n_params)) - call model%model_to_params2(params, labels=labels) + allocate(params(model%npar_tot)) + call model%model_to_params(params, labels=labels) - allocate(comp_switch_indices(model%n_comps)) + allocate(comp_switch_indices(0:model%n_comps)) - running_idx = 0 + ! Newline after general parameters + if (trim(model%phasefunc_type) == 'Hong') then + comp_switch_indices(0) = model%n_general_params + else + comp_switch_indices(0) = 2 + end if + + ! Newline after each component + running_idx = model%n_general_params do i = 1, model%n_comps running_idx = running_idx + size(model%comps(i)%labels) comp_switch_indices(i) = running_idx end do - do i = 1, model%n_params + do i = 1, model%npar_tot + if (trim(labels(i)) == 'skip' .or. trim(labels(i)) == 'SKIP') cycle if (any(comp_switch_indices == i)) then write(io, fmt='(a, T25, a, ES12.5, a)') trim(adjustl(labels(i))), "= ", params(i), new_line('a') else @@ -1734,87 +1933,93 @@ subroutine zodi_model_to_ascii(cpar, model, filename, overwrite) end subroutine subroutine ascii_to_zodi_model(cpar, model, filename) - ! Reads in and updates the zodi model from an ascii file on the format {COMP}_{PARAM} = {VALUE}. - class(ZodiModel), target, intent(inout) :: model - type(comm_params), intent(in) :: cpar - character(len=*), intent(in) :: filename - type(hash_tbl_sll) :: htbl - - integer(i4b) :: i, j, io, io_status, ierr, n_comps - logical(lgt) :: exists - character(len=512) :: key, val, line - character(len=128), allocatable :: labels(:) - characteR(len=128) :: toks(100) - characteR(len=512) :: concatenated_string - real(dp), allocatable :: params(:) - - allocate(params(model%n_params)) - !if (cpar%myid_chain == cpar%root) then - inquire(file=trim(adjustl(filename)), exist=exists) - if (.not. exists) then - print *, "zodi asciifile: " // trim(adjustl(filename)) // " does not exist" - stop - end if - - call init_hash_tbl_sll(htbl, tbl_len=500) - - open(newunit=io, file=trim(adjustl(filename)), action="read") - io_status = 0 - do while (io_status == 0) - read(io, "(a)", iostat=io_status) line - if (io_status == 0 .and. line /= "") then - j = index(line, "=") - if (j == 0) then - print *, "Error: invalid line in ascii file: ", trim(adjustl(line)) - close(io) - stop - end if - - key = trim(adjustl(line(:j-1))) - val = trim(adjustl(line(j+1:))) - call tolower(key) - call put_hash_tbl_sll(htbl, trim(adjustl(key)), trim(adjustl(val))) - end if - end do - close(io) - - call model%model_to_params2(params, labels) - params = 0. - if (size(labels) /= size(params)) stop "Error: size of labels and params do not match" - do i = 1, size(labels) - call get_parameter_hashtable(htbl, labels(i), par_dp=params(i)) - end do - !end if - - !call mpi_bcast(params, size(params), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) - call model%params_to_model2(params) - - do i = 1, numband - if (trim(band_todtype(i)) == 'none') cycle - !if (.not. data(i)%tod%subtract_zodi) cycle - !if (cpar%myid == 0) then - call get_parameter_hashtable(htbl, trim(adjustl("EMISSIVITY_"//trim(adjustl(band_labels(i))))), par_string=concatenated_string) - call get_tokens(trim(adjustl(concatenated_string)), ',', toks, n_comps) - if (n_comps /= model%n_comps) stop "Error: number of components in ascii file does not match model emissivity" - do j = 1, n_comps - read(toks(j), *) model%comps(j)%c%emissivity(i) - end do - - call get_parameter_hashtable(htbl, trim(adjustl("ALBEDO_"//trim(adjustl(band_labels(i))))), par_string=concatenated_string) - call get_tokens(trim(adjustl(concatenated_string)), ',', toks, n_comps) - if (n_comps /= model%n_comps) stop "Error: number of components in ascii file does not match model albedo" - do j = 1, n_comps - read(toks(j), *) model%comps(j)%c%albedo(i) - end do - -! call get_parameter_hashtable(htbl, trim(adjustl("AMP_STATIC_"//trim(adjustl(band_labels(i))))), par_dp=zodi_model%amp_static(i)) - !end if - !call mpi_bcast(data(i)%tod%zodi_emissivity, size(data(i)%tod%zodi_emissivity), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) - !call mpi_bcast(data(i)%tod%zodi_albedo, size(data(i)%tod%zodi_albedo), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) - end do - end subroutine - + implicit none + ! Reads in and updates the zodi model from an ascii file on the format {COMP}_{PARAM} = {VALUE}. + class(ZodiModel), target, intent(inout) :: model + type(comm_params), intent(in) :: cpar + character(len=*), intent(in) :: filename + type(hash_tbl_sll) :: htbl + + integer(i4b) :: i, j, io, io_status, ierr, n_comps + logical(lgt) :: exists + character(len=512) :: key, val, line + character(len=128), allocatable :: labels(:) + characteR(len=128) :: toks(100) + characteR(len=512) :: concatenated_string + real(dp), allocatable :: params(:) + + allocate(params(model%npar_tot)) + !if (cpar%myid_chain == cpar%root) then + inquire(file=trim(adjustl(filename)), exist=exists) + if (.not. exists) then + print *, "zodi asciifile: " // trim(adjustl(filename)) // " does not exist" + stop + end if + + call init_hash_tbl_sll(htbl, tbl_len=500) + + open(newunit=io, file=trim(adjustl(filename)), action="read") + io_status = 0 + do while (io_status == 0) + read(io, "(a)", iostat=io_status) line + if (io_status == 0 .and. line /= "") then + j = index(line, "=") + if (j == 0) then + print *, "Error: invalid line in ascii file: ", trim(adjustl(line)) + close(io) + stop + end if + + key = trim(adjustl(line(:j-1))) + val = trim(adjustl(line(j+1:))) + call tolower(key) + call put_hash_tbl_sll(htbl, trim(adjustl(key)), trim(adjustl(val))) + end if + end do + close(io) + + call model%model_to_params(params, labels=labels) + params = 0. + if (size(labels) /= size(params)) then + write(*,*) labels + write(*,*) params + write(*,*) size(labels), size(params) + stop "Error: size of labels and params do not match" + end if + do i = 1, size(labels) + if (trim(labels(i)) == 'skip' .or. trim(labels(i)) == 'SKIP') cycle + call get_parameter_hashtable(htbl, labels(i), par_dp=params(i)) + end do + !end if + !call mpi_bcast(params, size(params), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) + call model%params_to_model(params) + + do i = 1, numband + if (trim(band_todtype(i)) == 'none') cycle + !if (.not. data(i)%tod%subtract_zodi) cycle + !if (cpar%myid == 0) then + call get_parameter_hashtable(htbl, trim(adjustl("EMISSIVITY_"//trim(adjustl(band_labels(i))))), par_string=concatenated_string) + call get_tokens(trim(adjustl(concatenated_string)), ',', toks, n_comps) + if (n_comps /= model%n_comps) stop "Error: number of components in ascii file does not match model emissivity" + do j = 1, n_comps + read(toks(j), *) model%comps(j)%c%emissivity(i) + end do + + call get_parameter_hashtable(htbl, trim(adjustl("ALBEDO_"//trim(adjustl(band_labels(i))))), par_string=concatenated_string) + call get_tokens(trim(adjustl(concatenated_string)), ',', toks, n_comps) + if (n_comps /= model%n_comps) stop "Error: number of components in ascii file does not match model albedo" + do j = 1, n_comps + read(toks(j), *) model%comps(j)%c%albedo(i) + end do + + ! call get_parameter_hashtable(htbl, trim(adjustl("AMP_STATIC_"//trim(adjustl(band_labels(i))))), par_dp=zodi_model%amp_static(i)) + !end if + !call mpi_bcast(data(i)%tod%zodi_emissivity, size(data(i)%tod%zodi_emissivity), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) + !call mpi_bcast(data(i)%tod%zodi_albedo, size(data(i)%tod%zodi_albedo), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) + end do + end subroutine ascii_to_zodi_model + subroutine print_zodi_model(theta, samp_group) implicit none real(dp), allocatable, intent(in) :: theta(:) diff --git a/commander3/src/comm_zodi_samp_mod.f90 b/commander3/src/comm_zodi_samp_mod.f90 index dfa3d2dab..9f8f5449b 100644 --- a/commander3/src/comm_zodi_samp_mod.f90 +++ b/commander3/src/comm_zodi_samp_mod.f90 @@ -5,9 +5,9 @@ module comm_zodi_samp_mod implicit none private - public initialize_zodi_samp_mod, downsamp_invariant_structs, project_and_downsamp_sky, compute_downsamp_zodi, sample_zodi_group, sample_linear_zodi - public minimize_zodi_with_powell, get_chisq_priors, precompute_lowres_zodi_lookups, create_zodi_glitch_mask - public apply_zodi_glitch_mask, sample_static_zodi_map!, sample_static_zodi_amps + public initialize_zodi_samp_mod, downsamp_invariant_structs, project_and_downsamp_sky + public minimize_zodi_with_powell, get_chisq_priors, precompute_lowres_zodi_lookups, create_zodi_sampgroup_mask + public apply_zodi_sampgroup_mask, sample_static_zodi_map!, sample_static_zodi_amps real(dp), allocatable :: chisq_previous, step_size, prior_vec(:, :), prior_vec_powell(:, :), step_sizes_emissivity(:, :), step_sizes_albedo(:, :), step_sizes_ipd(:), step_sizes_n0(:), theta_0(:) real(dp), allocatable :: powell_emissivity(:, :), powell_albedo(:, :) @@ -56,564 +56,9 @@ subroutine initialize_zodi_samp_mod(cpar) stop "Error: cannot sample zodi without the reference band being active." end if end if -!!$ if (trim(adjustl(cpar%zs_sample_method)) == "powell") then -!!$ allocate(powell_albedo(n_samp_bands, zodi_model%n_comps)) -!!$ allocate(powell_emissivity(n_samp_bands, zodi_model%n_comps)) -!!$ end if - - ! crappy way of picking initial stepsizes for the zodi parameters -!!$ allocate (step_sizes_albedo(n_samp_bands, zodi_model%n_comps)) -!!$ allocate (step_sizes_emissivity(n_samp_bands, zodi_model%n_comps)) -!!$ allocate (step_sizes_n0(zodi_model%n_comps)) -!!$ -!!$ do i = 1, zodi_model%n_comps -!!$ step_sizes_n0(i) = 0.01*zodi_model%comps(i)%c%n_0 -!!$ end do -!!$ do i = 1, numband -!!$ if (data(i)%tod_type == 'none') then -!!$ step_sizes_emissivity(i,:) = 0.d0 -!!$ step_sizes_albedo(i, :) = 0.d0 -!!$ else -!!$ step_sizes_emissivity(i,:) = 0.01d0 * data(i)%tod%zodi_emissivity -!!$ step_sizes_albedo(i, :) = 0.01d0 * data(i)%tod%zodi_albedo -!!$ end if -!!$ end do - -!!$ allocate(param_vec(zodi_model%n_params)) -!!$ call zodi_model%model_to_params2(param_vec, labels) - -!!$ allocate (step_sizes_ipd(zodi_model%n_params)) -!!$ step_sizes_ipd = 0.005*param_vec -!!$ -!!$ allocate (prior_vec(zodi_model%n_params, 3)) -!!$ idx_start = 1 -!!$ do i = 1, zodi_model%n_comps -!!$ idx_stop = idx_start + size(zodi_model%comps(i)%labels) - 1 -!!$ prior_vec(idx_start:idx_stop, :) = cpar%zs_comp_params(i, :size(zodi_model%comps(i)%labels), 2:) -!!$ idx_start = idx_stop + 1 -!!$ end do -!!$ do i = 1, zodi_model%n_general_params -!!$ prior_vec(idx_start, :) = cpar%zs_general_params(i, 2:) -!!$ idx_start = idx_start + 1 -!!$ end do -!!$ -!!$ emissivity_prior = [0., 5.] -!!$ albedo_prior = [0., 1.] - - ! validate sampling group parameters -!!$ do group_idx = 1, cpar%zs_num_samp_groups -!!$ ! Get indices of the parameters to sample in the current sampling group -!!$ call parse_samp_group_strings(cpar%zs_samp_groups(group_idx), labels, indices) -!!$ end do - ! do i = 1, size(labels) - ! if (index(trim(adjustl(labels(i))), "X_0") /= 0) then - ! step_sizes_ipd(i) = step_sizes_ipd(i) * 10. - ! else if (index(trim(adjustl(labels(i))), "Y_0") /= 0) then - ! step_sizes_ipd(i) = step_sizes_ipd(i) * 10. - ! else if (index(trim(adjustl(labels(i))), "Z_0") /= 0) then - ! step_sizes_ipd(i) = step_sizes_ipd(i) * 10. - ! end if - ! end do - - ! if (trim(adjustl(cpar%zs_covar_chain)) /= "none") then - ! call read_zodi_covariance(cpar) - ! end if - - ! Set up mapping between parameter vextor and band -!!$ allocate(param2band(zodi_model%n_params)) -!!$ param2band = 0 ! Assume for now that all parameters affect all bands end subroutine initialize_zodi_samp_mod - function get_boxwidth(samprate_lowres, samprate) result(box_width) - ! Returns the boxcar width for downsampling the zodi tods - real(dp), intent(in) :: samprate_lowres, samprate - real(dp) :: box_width - box_width = max(real(nint(samprate/samprate_lowres),dp),1.d0) - end function - - - subroutine sample_linear_zodi(cpar, handle, gibbs_iter, model, verbose) - type(comm_params), intent(in) :: cpar - type(planck_rng), intent(inout) :: handle - integer(i4b), intent(in) :: gibbs_iter - type(ZodiModel), intent(inout) :: model - logical(lgt), intent(in), optional :: verbose - - !call compute_downsamp_zodi(cpar, model) - !if (cpar%myid == cpar%root) print *, new_line('A'), "sampling and subtracting monopole" - !call sample_and_subtract_monopole(cpar, handle) - !if (cpar%myid == cpar%root) print *, new_line('A'), "sampling n0" - call sample_n0_emissivity_and_albedo(cpar, handle, gibbs_iter, model) - end subroutine - - subroutine sample_and_subtract_monopole(cpar, handle) - type(comm_params), intent(in) :: cpar - type(planck_rng), intent(inout) :: handle - - type(hdf_file) :: tod_file - integer(i4b) :: i, j, prop, nprop, ndet, scan, nscan, ierr, n_accepted - integer(i4b), allocatable, dimension(:) :: n_downsamp_tod - real(dp) :: box_width, chisq_scan, chisq_new, chisq_prev, chisq_diff, ln_accept_prob, accept_rate - real(dp), allocatable, dimension(:) :: monopole_prev, monopole_new, monopole_init, monopole_step, eta - logical(lgt) :: is_root, accepted, first_prop - character(len=3) :: itext - character(len=512) :: path - - nprop = 200 - is_root = cpar%myid == cpar%root - allocate(monopole_init(n_samp_bands), monopole_new(n_samp_bands), monopole_prev(n_samp_bands), eta(n_samp_bands), n_downsamp_tod(n_samp_bands)) - n_downsamp_tod = 0 - monopole_init = 0. - monopole_new = 0. - monopole_prev = monopole_new - - n_accepted = 0 - do prop = 0, nprop - first_prop = prop == 0 - if (.not. first_prop .and. is_root) then - eta = [(rand_gauss(handle), i = 1, n_samp_bands)] - monopole_new = monopole_prev + monopole_step * eta - else - monopole_new = monopole_prev - end if - call mpi_bcast(monopole_new, 1, MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) - - chisq_scan = 0. - chisq_new = 0. - - ! compute chisq for new model - do i = 1, numband - if ((data(i)%tod_type == "none") .or. (.not. data(i)%tod%sample_zodi)) cycle - ndet = data(i)%tod%ndet - nscan = data(i)%tod%nscan - box_width = get_boxwidth(data(i)%tod%samprate_lowres, data(i)%tod%samprate) - do scan = 1, nscan - do j = 1, ndet - if (.not. data(i)%tod%scans(scan)%d(j)%accept) cycle - - n_downsamp_tod(i) = n_downsamp_tod(i) + size(data(i)%tod%scans(scan)%d(j)%downsamp_pix) - ! rescale downsampled zodi comp-wise emission with newly proposed n0s - call get_s_zodi(i, & - & s_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & - & s_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & - & s_zodi=data(i)%tod%scans(scan)%d(j)%downsamp_zodi & - &) - ! compute monopole step size - if (first_prop) then - ! print *, "tod", maxval(data(i)%tod%scans(scan)%d(j)%downsamp_tod), minval(data(i)%tod%scans(scan)%d(j)%downsamp_tod) - ! print *, "sky", maxval(data(i)%tod%scans(scan)%d(j)%downsamp_sky), minval(data(i)%tod%scans(scan)%d(j)%downsamp_sky) - ! print *, "zodi", maxval(data(i)%tod%scans(scan)%d(j)%downsamp_zodi), minval(data(i)%tod%scans(scan)%d(j)%downsamp_zodi) - ! print *, "pix", maxval(data(i)%tod%scans(scan)%d(j)%downsamp_pix), minval(data(i)%tod%scans(scan)%d(j)%downsamp_pix) - ! stop - monopole_init(i) = monopole_init(i) + sum( & - & (data(i)%tod%scans(scan)%d(j)%downsamp_tod & - & - data(i)%tod%scans(scan)%d(j)%downsamp_sky & - & - data(i)%tod%scans(scan)%d(j)%downsamp_zodi) & - & ) - end if - - chisq_scan = chisq_scan + sum( & - & ((data(i)%tod%scans(scan)%d(j)%downsamp_tod & - & - data(i)%tod%scans(scan)%d(j)%downsamp_sky & - & - data(i)%tod%scans(scan)%d(j)%downsamp_zodi & - & - monopole_new(i) & - & )/(data(i)%tod%scans(scan)%d(j)%N_psd%sigma0/sqrt(box_width)))**2 & - &) - end do - end do - end do - call mpi_reduce(chisq_scan, chisq_new, 1, MPI_DOUBLE_PRECISION, MPI_SUM, cpar%root, MPI_COMM_WORLD, ierr) - - ! Use chisq from the first iteration where we dont draw new parameters as the base chisq - if (first_prop) then - call mpi_allreduce(MPI_IN_PLACE, monopole_init, size(monopole_init), MPI_DOUBLE_PRECISION, MPI_SUM, MPI_COMM_WORLD, ierr) - call mpi_allreduce(MPI_IN_PLACE, n_downsamp_tod, size(n_downsamp_tod), MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, ierr) - monopole_prev = monopole_init/n_downsamp_tod - monopole_step = 0.1*monopole_prev - chisq_prev = chisq_new - else - if (is_root) then - chisq_diff = max(chisq_new - chisq_prev, 0.) - ln_accept_prob = -0.5 * chisq_diff - select case (cpar%operation) - case ("sample") - accepted = ln_accept_prob > log(rand_uni(handle)) - case ("optimize") - accepted = chisq_diff < 0. - case default - stop "Error: invalid cpar%operation in comm_zodi_samp_mod sample_monopole routine" - end select - end if - call mpi_bcast(accepted, 1, MPI_LOGICAL, cpar%root, cpar%comm_chain, ierr) - - if (accepted) then - n_accepted = n_accepted + 1 - chisq_prev = chisq_new - monopole_prev = monopole_new - if (is_root) then - print *, "proposal:", prop - write(*, '(a, ES12.5)') "chisq: ", chisq_new - print *, "monopole: ", monopole_new - print *, " " - end if - else - monopole_new = monopole_prev - end if - accept_rate = real(n_accepted)/real(prop) - end if - end do - - if (is_root) print *, "monopole accept rate: ", (real(n_accepted)/real(nprop))*100. - - do i = 1, numband - if ((data(i)%tod_type == "none") .or. (.not. data(i)%tod%sample_zodi)) cycle - do scan = 1, nscan - do j = 1, ndet - if (.not. data(i)%tod%scans(scan)%d(j)%accept) cycle - data(i)%tod%scans(scan)%d(j)%downsamp_tod = data(i)%tod%scans(scan)%d(j)%downsamp_tod - monopole_prev(i) - end do - end do - end do - end subroutine - - subroutine sample_n0_emissivity_and_albedo(cpar, handle, gibbs_iter, model) - type(comm_params), intent(in) :: cpar - type(planck_rng), intent(inout) :: handle - integer(i4b), intent(in) :: gibbs_iter - type(ZodiModel), intent(inout) :: model - - integer(i4b) :: i, j, prop, nprop, ndet, scan, nscan, ierr, n_accepted, comp - real(dp) :: box_width, chisq_scan, chisq_new, chisq_prev, chisq_diff, ln_accept_prob, accept_rate, n0_ratio - real(dp), allocatable :: n0_new(:), n0_prev(:), eta_n0(:), eta_emissivity(:, :), eta_albedo(:, :), emissivity_new(:, :), emissivity_prev(:, :), albedo_new(:, :), albedo_prev(:, :) - logical(lgt) :: is_root, accepted, tuning, first_prop, scattering - - return - - nprop = 1000 - tuning = gibbs_iter <= 25 - is_root = cpar%myid == cpar%root - - n0_prev = [(model%comps(i)%c%n_0, i = 1, model%n_comps)] - n0_new = n0_prev - - allocate(emissivity_prev(n_samp_bands, model%n_comps)) - allocate(albedo_prev(n_samp_bands, model%n_comps)) - allocate(eta_emissivity(n_samp_bands, model%n_comps)) - allocate(eta_albedo(n_samp_bands, model%n_comps)) - do i = 1, numband - if (data(i)%tod_type == "none") cycle - do j = 1, model%n_comps - emissivity_prev(i,j) = model%comps(j)%c%emissivity(i) - albedo_prev(i,j) = model%comps(j)%c%albedo(i) - end do - end do - emissivity_new = emissivity_prev - albedo_new = albedo_prev - - n_accepted = 0 - do prop = 0, nprop - first_prop = prop == 0 - ! propose new n0s - if (.not. first_prop) then - if (is_root) then - eta_n0 = [(rand_gauss(handle), i = 1, model%n_comps)] - n0_new = n0_prev + (step_sizes_n0 * eta_n0) - do i = 1, numband - if ((data(i)%tod_type == "none") .or. (.not. data(i)%tod%sample_zodi)) cycle - if (cpar%ds_zodi_reference_band(data(i)%id_abs)) then - eta_emissivity(i, :) = 0. - else - eta_emissivity(i, :) = [(rand_gauss(handle), j = 1, model%n_comps)] - end if - eta_albedo(i, :) = [(rand_gauss(handle), j = 1, model%n_comps)] - end do - emissivity_new = emissivity_prev + (step_sizes_emissivity * eta_emissivity) - albedo_new = albedo_prev + (step_sizes_albedo * eta_albedo) - end if - call mpi_bcast(n0_new, size(n0_new), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) - call mpi_bcast(emissivity_new, size(emissivity_new), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) - call mpi_bcast(albedo_new, size(albedo_new), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) - end if - - chisq_scan = 0. - chisq_new = 0. - ! compute chisq for new model - do i = 1, numband - if ((data(i)%tod_type == "none") .or. (.not. data(i)%tod%sample_zodi)) cycle - ndet = data(i)%tod%ndet - nscan = data(i)%tod%nscan - box_width = get_boxwidth(data(i)%tod%samprate_lowres, data(i)%tod%samprate) - !scattering = any(data(i)%tod%zodi_albedo > EPS) - do scan = 1, nscan - do j = 1, ndet - if (.not. data(i)%tod%scans(scan)%d(j)%accept) cycle - ! rescale downsampled zodi comp-wise emission with newly proposed n0s - !call get_s_zodi(& - ! & s_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & - ! & s_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & - ! & s_zodi=data(i)%tod%scans(scan)%d(j)%downsamp_zodi, & - ! & emissivity=emissivity_new(i, :), & - ! & albedo=albedo_new(i, :) & - ! &) - write(*,*) i, "a0", n0_new, n0_prev - write(*,*) i, scan, j, data(i)%tod%scanid(scan), cpar%myid, "a", data(i)%tod%scans(scan)%d(j)%N_psd%sigma0, box_width - write(*,*) i, data(i)%tod%scanid(scan), "b", any(data(i)%tod%scans(scan)%d(j)%downsamp_tod /= data(i)%tod%scans(scan)%d(j)%downsamp_tod), minval(data(i)%tod%scans(scan)%d(j)%downsamp_tod), maxval(data(i)%tod%scans(scan)%d(j)%downsamp_tod) - write(*,*) i, data(i)%tod%scanid(scan), "c", any(data(i)%tod%scans(scan)%d(j)%downsamp_sky /= data(i)%tod%scans(scan)%d(j)%downsamp_sky), minval(data(i)%tod%scans(scan)%d(j)%downsamp_sky), maxval(data(i)%tod%scans(scan)%d(j)%downsamp_sky) - write(*,*) i, data(i)%tod%scanid(scan), "d0", allocated(data(i)%tod%scans(scan)%d(j)%downsamp_zodi), size(data(i)%tod%scans(scan)%d(j)%downsamp_zodi) - write(*,*) i, data(i)%tod%scanid(scan), "d1", any(data(i)%tod%scans(scan)%d(j)%downsamp_zodi /= data(i)%tod%scans(scan)%d(j)%downsamp_zodi) - write(*,*) i, data(i)%tod%scanid(scan), "d2", minval(data(i)%tod%scans(scan)%d(j)%downsamp_zodi) - write(*,*) i, data(i)%tod%scanid(scan), "d3", maxval(data(i)%tod%scans(scan)%d(j)%downsamp_zodi) - data(i)%tod%scans(scan)%d(j)%downsamp_zodi = data(i)%tod%scans(scan)%d(j)%downsamp_zodi * n0_new/n0_prev - - chisq_scan = chisq_scan + sum( & - & ((data(i)%tod%scans(scan)%d(j)%downsamp_tod & - & - data(i)%tod%scans(scan)%d(j)%downsamp_sky & - & - data(i)%tod%scans(scan)%d(j)%downsamp_zodi & - & )/(data(i)%tod%scans(scan)%d(j)%N_psd%sigma0/sqrt(box_width)))**2 & - &) - end do - end do - end do - call mpi_reduce(chisq_scan, chisq_new, 1, MPI_DOUBLE_PRECISION, MPI_SUM, cpar%root, MPI_COMM_WORLD, ierr) - - ! Use chisq from the first iteration where we dont draw new parameters as the base chisq - if (first_prop) then - chisq_prev = chisq_new - else - if (is_root) then - chisq_diff = max(chisq_new - chisq_prev, 0.) - ln_accept_prob = -0.5 * chisq_diff - select case (cpar%operation) - case ("sample") - accepted = ln_accept_prob > log(rand_uni(handle)) .and. & - & all (emissivity_new > 0.) .and. all (emissivity_new < 5.) .and. & - & all (albedo_new > 0.) .and. all (albedo_new < 1.) - case ("optimize") - accepted = chisq_diff < 0. .and. all (emissivity_new > 0.) .and. all (emissivity_new < 5.) .and. & - & all (albedo_new > 0.) .and. all (albedo_new < 1.) - case default - stop "Error: invalid cpar%operation in comm_zodi_samp_mod sample_n0 routine" - end select - end if - call mpi_bcast(accepted, 1, MPI_LOGICAL, cpar%root, cpar%comm_chain, ierr) - - if (accepted) then - n_accepted = n_accepted + 1 - chisq_prev = chisq_new - n0_prev = n0_new - emissivity_prev = emissivity_new - albedo_prev = albedo_new - if (is_root) then - print *, "proposal:", prop - write(*, '(a, ES12.5)') "chisq: ", chisq_new - print *, " " - end if - else - n0_new = n0_prev - emissivity_new = emissivity_prev - albedo_new = albedo_prev - end if - accept_rate = real(n_accepted)/real(prop) - end if - end do - if (tuning) then - if (accept_rate < 0.1) then - step_sizes_n0 = step_sizes_n0 / 2. - step_sizes_emissivity = step_sizes_emissivity / 2. - step_sizes_albedo = step_sizes_albedo / 2. - else if (accept_rate > 0.4) then - step_sizes_n0 = step_sizes_n0 * 2. - step_sizes_emissivity = step_sizes_emissivity * 2. - step_sizes_albedo = step_sizes_albedo * 2. - end if - end if - if (is_root) print *, "n0 accept rate: ", (real(n_accepted)/real(nprop))*100. - do i = 1, model%n_comps - model%comps(i)%c%n_0 = n0_prev(i) - end do - do i = 1, numband - if (data(i)%tod_type == "none") cycle - do j = 1, model%n_comps - model%comps(j)%c%emissivity(i) = emissivity_prev(i,j) - model%comps(j)%c%albedo(i) = albedo_prev(i,j) - end do - end do - end subroutine - - subroutine sample_zodi_group(cpar, handle, gibbs_iter, model, verbose) - type(comm_params), intent(in) :: cpar - type(planck_rng), intent(inout) :: handle - integer(i4b), intent(in) :: gibbs_iter - type(ZodiModel), intent(inout) :: model - logical(lgt), intent(in), optional :: verbose - - integer(i4b) :: i, j, k, prop, group_idx, flag, ndet, nscan, ntod, n_proposals, scan, ierr, n_accepted, param_idx - real(dp) :: chisq_tod, chisq_current, chisq_prior, chisq_diff, ln_acceptance_probability, accept_rate, chisq_lnL, box_width - real(dp), allocatable :: param_vec(:) - integer(i4b), allocatable :: group_indices(:) - type(ZodiModel) :: current_model, previous_model - logical(lgt) :: accepted, verbose_, tuning, skip - type(hdf_file) :: tod_file - character(len=128), allocatable :: param_labels(:) - - if (present(verbose)) then - verbose_ = verbose - else - verbose_ = .false. - end if - if (verbose_ .and. (cpar%myid == cpar%root)) print *, "sampling interplanetary dust parameters" - - current_model = model - previous_model = model - - tuning = .true. - n_proposals = 500 - - allocate(param_vec(current_model%n_params)) - call current_model%model_to_params2(param_vec, param_labels) - - ! sample all parameters in a group jointly - do group_idx = 1, cpar%zs_num_samp_groups - if (cpar%myid == cpar%root) print *, "sampling zodi group: ", group_idx, " of ", cpar%zs_num_samp_groups - - ! Get indices of the parameters to sample in the current sampling group - call parse_samp_group_strings(cpar%zs_samp_groups(group_idx), param_labels, group_indices) - - n_accepted = 0 - do prop = 0, n_proposals - ! if propsed parameter is outside of priors we dont want to immediately reject - skip = .false. - - ! Reset chisq for current proposal - chisq_tod = 0. - chisq_current = 0. - - ! If first iteration we dont want to draw, just compute the chisq with the base model - if (prop > 0) then - call current_model%model_to_params2(param_vec) - ! Root process draws new set of zodi parameters and broadcasts to all processes - if (cpar%myid == cpar%root) then - do i = 1, size(group_indices) - param_idx = group_indices(i) - param_vec(param_idx) = param_vec(param_idx) + (step_sizes_ipd(param_idx) * rand_gauss(handle)) - end do - ! HKE: NEED TO BE FIXED - !chisq_prior = get_chisq_priors(param_vec, samp_group=0) - !chisq_prior = get_chisq_priors(param_vec, prior_vec) - if (chisq_prior >= 1.d30) skip = .true. - end if - call mpi_bcast(chisq_prior, 1, MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) - call mpi_bcast(param_vec, size(param_vec), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) - call current_model%params_to_model2(param_vec) - end if - do i = 1, numband - if (skip) exit ! drop evaluation if prior is violated - if (data(i)%tod_type == "none") cycle - if (.not. data(i)%tod%sample_zodi) cycle - - ! If chisq is already too large, skip rest of the evaluation and go directly to rejection - if (chisq_tod >= 1.d30) exit - - ndet = data(i)%tod%ndet - nscan = data(i)%tod%nscan - - box_width = get_boxwidth(data(i)%tod%samprate_lowres, data(i)%tod%samprate) - - ! Make sure that the zodi cache is cleared before each new band - call data(i)%tod%clear_zodi_cache() - - ! Evaluate zodi model with newly proposed values for each band and calculate chisq - do scan = 1, nscan - ! Skip scan if no accepted data - do j = 1, ndet - if (.not. data(i)%tod%scans(scan)%d(j)%accept) cycle - - call get_zodi_emission(& - & tod=data(i)%tod, & - & pix=data(i)%tod%scans(scan)%d(j)%downsamp_pix, & - & scan=scan, & - & det=j, & - & s_zodi_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & - & s_zodi_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & - & model=current_model, & - & use_lowres_pointing=.true. & - &) - call get_s_zodi(i, & - & s_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & - & s_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & - & s_zodi=data(i)%tod%scans(scan)%d(j)%downsamp_zodi & - &) - - chisq_tod = chisq_tod + sum( & - & ((data(i)%tod%scans(scan)%d(j)%downsamp_tod & - & - data(i)%tod%scans(scan)%d(j)%downsamp_sky & - & - data(i)%tod%scans(scan)%d(j)%downsamp_zodi & - & )/(data(i)%tod%scans(scan)%d(j)%N_psd%sigma0/sqrt(box_width)))**2 & - &) - - if (chisq_tod >= 1.d30) exit - end do - end do - end do - - ! Reduce chisq to root process - call mpi_reduce(chisq_tod, chisq_current, 1, MPI_DOUBLE_PRECISION, MPI_SUM, cpar%root, MPI_COMM_WORLD, ierr) - - ! Add prior penalty to chisq - if (prop > 0 ) chisq_current = chisq_current + chisq_prior - - ! Use chisq from the first iteration where we dont draw new parameters as the base chisq - if (prop == 0) chisq_previous = chisq_current - - if (prop > 0) then - ! Root checks if the new proposal is accepted - if (cpar%myid == cpar%root) then - chisq_diff = max(chisq_current - chisq_previous, 0.) - ln_acceptance_probability = -0.5*chisq_diff - select case (cpar%operation) - case ("sample") - accepted = ln_acceptance_probability > log(rand_uni(handle)) - case ("optimize") - accepted = chisq_diff < 0. - case default - stop "Error: invalid operation" - end select - - if (verbose_ .and. accepted) then - print *, "proposal:", prop - write(*, '(a, ES12.5)') "chisq: ", chisq_current - print *, "accept rate:", (real(n_accepted)/real(prop))*100. - print *, " " - end if - end if - - call mpi_bcast(accepted, 1, MPI_LOGICAL, cpar%root, cpar%comm_chain, ierr) - ! Update model if proposal is accepted - if (accepted) then - n_accepted = n_accepted + 1 - chisq_previous = chisq_current - previous_model = current_model - else - current_model = previous_model - end if - accept_rate = real(n_accepted)/real(prop) - end if - end do - if (accept_rate < 0.05) then - do i = 1, size(group_indices) - param_idx = group_indices(i) - step_sizes_ipd(param_idx) = step_sizes_ipd(param_idx) / 2. - end do - else if (accept_rate > 0.95) then - do i = 1, size(group_indices) - param_idx = group_indices(i) - step_sizes_ipd(param_idx) = step_sizes_ipd(param_idx) * 2. - end do - end if - model = current_model - end do - end subroutine function get_chisq_priors(params, samp_group) result(chisq_prior) implicit none @@ -621,7 +66,7 @@ function get_chisq_priors(params, samp_group) result(chisq_prior) integer(i4b), intent(in) :: samp_group real(dp) :: chisq_prior - integer(i4b) :: i, j + integer(i4b) :: i, j, ind1, ind2 logical(lgt) :: prior_is_violated chisq_prior = 0.d0 @@ -643,25 +88,44 @@ function get_chisq_priors(params, samp_group) result(chisq_prior) j = j+1 end do + + ! Check that sum of phase function weights is smaller than 1 + if (trim(zodi_model%phasefunc_type) == 'Hong') then + ind1 = zodi_model%get_par_ind(param="w2") + if (zodi_model%theta_stat(ind1,samp_group) == 0) then + ! Find index of w2 in current sampgroup; assume both w2 and w3 are fitted + j = 1 + do i = 1, ind1-1 + if (zodi_model%theta_stat(i,samp_group) == 0) j = j+1 + end do + if (params(j)+params(j+1) > 1.d0) then + !write(*,*) 'Error in phase function prior', params(j), params(j+1) + chisq_prior = 1.d30 + return + end if + end if + end if end function get_chisq_priors - subroutine downsamp_invariant_structs(cpar) - ! Downsamples pointing, tod and caches the zodi mask (sky mask + flags) + ! Downsamples pointing, tod and caches the zodi mask (sky mask + flags) + subroutine downsamp_invariant_structs(cpar) + implicit none type(comm_params), intent(in) :: cpar - integer(i4b) :: i, j, k, l, g, scan, npix, nmaps, ndelta, ext(2), padding, ierr, ntod, ndet, nhorn, ndownsamp, box_halfwidth - real(dp) :: box_width, dt_tod, theta, phi, vec0(3), vec1(3), M_ecl2gal(3,3), day, lambda_solar, lat, lon - real(sp), allocatable :: tod(:), mask(:), downsamp_vec(:, :), s_static(:) + integer(i4b) :: i, j, k, kp, l, g, scan, nside, npix, nmaps, ext(2), padding, ierr, ntod, ndet, nhorn, ndownsamp, box_halfwidth, thin, ntod_lowres + real(dp) :: dt_tod, theta, phi, vec0(3), vec1(3), M_ecl2gal(3,3), day, lambda_solar, lat, lon + real(sp), allocatable :: tod(:), downsamp_vec(:, :), s_static(:) integer(i4b), allocatable :: pix(:, :), psi(:, :), flag(:) real(dp), allocatable, dimension(:, :) :: m_buf, vec integer(i4b), allocatable, dimension(:) :: downsamp_pix logical(lgt), allocatable, dimension(:) :: downsamp_mask_idx real(sp), allocatable, dimension(:) :: downsamp_mask, downsamp_tod, downsamp_obs_time, obs_time real(sp), allocatable, dimension(:) :: procmask_zodi + logical(sp), allocatable, dimension(:) :: mask type(hdf_file) :: tod_file character(len=4) :: scan_str + type(comm_detscan), pointer :: d - padding = 5 if (cpar%myid == cpar%root) print *, "downsampling tod and pointing" ! For each zodi band, create downsampled residual time stream @@ -672,113 +136,63 @@ subroutine downsamp_invariant_structs(cpar) if (trim(data(i)%tod_type) == 'none') cycle if (.not. data(i)%tod%subtract_zodi) cycle - ndelta = 1 - npix = 12*data(i)%map%info%nside**2 + nside = data(i)%map%info%nside + npix = 12*nside**2 nmaps = data(i)%map%info%nmaps - ndet = data(i)%tod%ndet + ndet = data(i)%tod%ndet nhorn = data(i)%tod%nhorn - ! Build zodi mask - allocate (m_buf(0:npix - 1, nmaps)) - allocate (procmask_zodi(0:npix - 1)) + ! Distribute zodi mask + allocate(m_buf(0:npix-1, nmaps)) + allocate(procmask_zodi(0:npix-1)) call data(i)%tod%procmask_zodi%bcast_fullsky_map(m_buf); procmask_zodi = m_buf(:, 1) - box_width = get_boxwidth(data(i)%tod%samprate_lowres, data(i)%tod%samprate) - box_halfwidth = anint(box_width / 2.) + + thin = max(nint(data(i)%tod%samprate/data(i)%tod%samprate_lowres), 1) + dt_tod = (thin/data(i)%tod%samprate)*SECOND_TO_DAY ! dt between two samples in units of days (assumes equispaced tods) do scan = 1, data(i)%tod%nscan if (.not. any(data(i)%tod%scans(scan)%d%accept)) cycle - ntod = data(i)%tod%scans(scan)%ntod - ! Allocate temporary variables to be downsampled - allocate (pix(ntod, nhorn)) - allocate (psi(ntod, nhorn)) - allocate (flag(ntod)) - allocate (tod(ntod)) - allocate (s_static(ntod)) - allocate (mask(ntod)) - allocate (vec(3, ntod)) - - ! Get shape of downsampled structs - call data(i)%tod%downsample_tod(tod, ext, width=box_width) - - ! Allocate downsampled strucs - allocate (downsamp_tod(ext(1):ext(2))) - allocate (downsamp_mask(ext(1):ext(2))) - allocate (downsamp_pix(ext(1):ext(2))) - allocate (downsamp_mask_idx(ext(1):ext(2))) - allocate (downsamp_vec(3, ext(1):ext(2))) - - ! downsample obs_time - allocate (obs_time(ntod)) - dt_tod = (1./data(i)%tod%samprate)*SECOND_TO_DAY ! dt between two samples in units of days (assumes equispaced tods) - do k = 1, ntod - obs_time(k) = data(i)%tod%scans(scan)%t0(1) + (k - 1)*dt_tod - end do - allocate (downsamp_obs_time(ext(1):ext(2))) - call data(i)%tod%downsample_tod(obs_time, ext, downsamp_obs_time, width=box_width) - + ntod = data(i)%tod%scans(scan)%ntod + ntod_lowres = ntod/thin + + ! Initialize detector specific downsampled quantities do j = 1, data(i)%tod%ndet - pix = 0. - psi = 0. - flag = 0 - tod = 0. - mask = 0. - - downsamp_tod = 0. - downsamp_mask = 0. - downsamp_pix = 0 - downsamp_mask_idx = .true. - downsamp_vec = 0. - + d => data(i)%tod%scans(scan)%d(j) + allocate(d%downsamp_pix_full(ntod_lowres)) + allocate(d%downsamp_tod_full(ntod_lowres)) + allocate(d%downsamp_obs_time_full(ntod_lowres)) + + ! Get downsampled pixel, mask and obstime + allocate(pix(ntod,nhorn), psi(ntod,nhorn), flag(ntod), mask(ntod)) call data(i)%tod%decompress_pointing_and_flags(scan, j, pix, psi, flag) + do k = 1, ntod_lowres + kp = (k-1)*thin + 1 + d%downsamp_pix_full(k) = pix(kp,1) + d%downsamp_obs_time_full(k) = data(i)%tod%scans(scan)%t0(1) + (kp-1)*dt_tod + mask(k) = procmask_zodi(pix(kp,1)) == 1 .and. iand(flag(kp), data(i)%tod%flag0) == 0 + end do + deallocate(pix, psi, flag) ! Get TOD after subtracting static zodi + allocate(tod(ntod), s_static(ntod)) if (data(i)%tod%compressed_tod) then call data(i)%tod%decompress_tod(scan, j, tod) else tod = data(i)%tod%scans(scan)%d(j)%tod end if - call get_s_tot_zodi(zodi_model, data(i)%tod, j, scan, s_static, pix_static=data(i)%tod%scans(scan)%d(j)%pix_sol) - tod = tod - s_static - - do k = 1, data(i)%tod%scans(scan)%ntod - mask(k) = procmask_zodi(pix(k, 1)) - if (iand(flag(k), data(i)%tod%flag0) .ne. 0) mask(k) = 0. - vec(:, k) = data(i)%tod%ind2vec(:, data(i)%tod%pix2ind(pix(k, 1))) - end do - - where (mask > 0.5) - mask = 1. - elsewhere - mask = 0. - end where - - do k = 1, 3 - call data(i)%tod%downsample_tod(real(vec(k, :), sp), ext, downsamp_vec(k, :), width=box_width) - end do - - do k = 0, ext(2)-padding - call vec2pix_ring(data(i)%tod%nside, real(downsamp_vec(:, k), dp), downsamp_pix(k)) + call get_s_tot_zodi(zodi_model, data(i)%tod, j, scan, s_static) + do k = 1, ntod_lowres + kp = (k-1)*thin + 1 + d%downsamp_tod_full(k) = tod(kp) - data(i)%tod%scans(scan)%d(j)%gain * s_static(kp) end do + deallocate(tod, s_static) - ! Downsample the mask - call data(i)%tod%downsample_tod(mask, ext, downsamp_mask, width=box_width) + ! Remove masked samples + ntod_lowres = count(mask) + d%downsamp_pix_full = pack(d%downsamp_pix_full, mask) + d%downsamp_tod_full = pack(d%downsamp_tod_full, mask) + d%downsamp_obs_time_full = pack(d%downsamp_obs_time_full, mask) + deallocate(mask) - ! Downsample the tods - call data(i)%tod%downsample_tod(tod, ext, downsamp_tod, width=box_width) - - ! Construct the downsampled pix array (pick central pixel in each box) - - ! do k = 1, int(size(tod)/box_width) + 1 - ! l = floor(min(((k-1)*box_width + box_halfwidth), real(ntod, dp))) - ! downsamp_pix(k) = pix(l, 1) - ! end do - - where (downsamp_mask < 1.) downsamp_mask_idx = .false. - - ! Find upper bound and truncate the downsampled arrays by where they were padded and - ! filter out the masked values. Store the result in the tod objects for use in sampling. - data(i)%tod%scans(scan)%d(j)%downsamp_pix = pack(downsamp_pix(0:ext(2)-padding), downsamp_mask_idx(0:ext(2)-padding)) - data(i)%tod%scans(scan)%d(j)%downsamp_tod = pack(downsamp_tod(0:ext(2)-padding), downsamp_mask_idx(0:ext(2)-padding)) - if (j == 1) data(i)%tod%scans(scan)%downsamp_obs_time = pack(downsamp_obs_time(0:ext(2)-padding), downsamp_mask_idx(0:ext(2)-padding)) ! write timestreams to files ! call int2string(data(i)%tod%scanid(scan), scan_str) ! call open_hdf_file(trim(adjustl("/mn/stornext/u3/metins/dirbe/chains/chains_downsamp/dtod_"//scan_str//".h5")), tod_file, 'w') @@ -790,64 +204,39 @@ subroutine downsamp_invariant_structs(cpar) ! call close_hdf_file(tod_file) ! Allocate other downsampled quantities with same shape - ndownsamp = size(data(i)%tod%scans(scan)%d(j)%downsamp_pix) - allocate (data(i)%tod%scans(scan)%d(j)%downsamp_zodi(ndownsamp)) - allocate (data(i)%tod%scans(scan)%d(j)%downsamp_scat(ndownsamp, zodi_model%n_comps)) - allocate (data(i)%tod%scans(scan)%d(j)%downsamp_therm(ndownsamp, zodi_model%n_comps)) - - ! Compute downsampled pointing in various coordinates - allocate(data(i)%tod%scans(scan)%d(j)%downsamp_point(ndownsamp,5)) - do k = 1, size(data(i)%tod%scans(scan)%d(j)%downsamp_pix) -!!$ call pix2ang_ring(data(i)%tod%nside, data(i)%tod%scans(scan)%d(j)%downsamp_pix(k), lat, lon) -!!$ phi = phi * 180.d0/pi -!!$ lon = 90.d0 - lon * 180.d0/pi -!!$ data(i)%tod%scans(scan)%d(j)%downsamp_point(k,1) = lon ! Ecliptic longitude -!!$ data(i)%tod%scans(scan)%d(j)%downsamp_point(k,2) = lat ! Ecliptic latitude -!!$ day = data(i)%tod%scanid(scan) -!!$ lambda_solar = (-80.598349 + 0.98564736 * day + 1.912 * cos(2.d0*pi/365.25 * (day-94.8))) * pi/180.d0 -!!$ data(i)%tod%scans(scan)%d(j)%downsamp_point(k,5) = acos(cos(lat*pi/180.d0) * cos(lon*pi/180.d0 - lambda_solar)) * 180.d0/pi ! Solar elongation -!!$ call pix2vec_ring(data(i)%tod%nside, data(i)%tod%scans(scan)%d(j)%downsamp_pix(k), vec1) -!!$ !vec0 = -0.5d0 * (data(i)%tod%scans(scan)%x0_obs + data(i)%tod%scans(scan)%x1_obs) -!!$ !vec0 = vec0/sqrt(sum(vec0**2)) -!!$ !theta = dot_product(vec0, vec1) -!!$ !data(i)%tod%scans(scan)%d(j)%downsamp_point(k,5) = acos(theta)*180.d0/pi ! Solar elongation -!!$ vec1 = matmul(M_ecl2gal, vec1) -!!$ call vec2ang(vec1, theta, phi) -!!$ data(i)%tod%scans(scan)%d(j)%downsamp_point(k,3) = phi*180.d0/pi ! Galactic longitude -!!$ data(i)%tod%scans(scan)%d(j)%downsamp_point(k,4) = (0.5d0*pi-theta)*180.d0/pi ! Galactic latitude - - call pix2ang_ring(data(i)%tod%nside, data(i)%tod%scans(scan)%d(j)%downsamp_pix(k), lat, lon) + allocate(d%downsamp_point_full(ntod_lowres,5)) + do k = 1, ntod_lowres + call pix2ang_ring(nside, d%downsamp_pix_full(k), lat, lon) lon = lon * 180.d0/pi if (lon > 180.d0) lon = lon - 360.d0 lat = 90.d0 - lat * 180.d0/pi - data(i)%tod%scans(scan)%d(j)%downsamp_point(k,3) = lon ! Galactic longitude - data(i)%tod%scans(scan)%d(j)%downsamp_point(k,4) = lat ! Galactic latitude - call pix2vec_ring(data(i)%tod%nside, data(i)%tod%scans(scan)%d(j)%downsamp_pix(k), vec1) + d%downsamp_point_full(k,3) = lon ! Galactic longitude + d%downsamp_point_full(k,4) = lat ! Galactic latitude + call pix2vec_ring(nside, d%downsamp_pix_full(k), vec1) vec1 = matmul(transpose(M_ecl2gal), vec1) call vec2ang(vec1, lat, lon) lon = lon * 180.d0/pi if (lon > 180.d0) lon = lon - 360.d0 lat = 90.d0 - lat * 180.d0/pi - data(i)%tod%scans(scan)%d(j)%downsamp_point(k,1) = lon ! Galactic longitude - data(i)%tod%scans(scan)%d(j)%downsamp_point(k,2) = lat ! Galactic latitude + d%downsamp_point_full(k,1) = lon ! Galactic longitude + d%downsamp_point_full(k,2) = lat ! Galactic latitude day = data(i)%tod%scanid(scan) lambda_solar = (-80.598349 + 0.98564736 * day + 1.912 * cos(2.d0*pi/365.25 * (day-94.8))) * pi/180.d0 - data(i)%tod%scans(scan)%d(j)%downsamp_point(k,5) = acos(cos(lat*pi/180.d0) * cos(lon*pi/180.d0 - lambda_solar)) * 180.d0/pi ! Solar elongation - end do - + d%downsamp_point_full(k,5) = acos(cos(lat*pi/180.d0) * cos(lon*pi/180.d0 - lambda_solar)) * 180.d0/pi ! Solar elongation + end do end do - deallocate (obs_time, downsamp_obs_time) - deallocate (pix, psi, vec, flag, tod, s_static, mask, downsamp_tod, downsamp_mask, downsamp_pix, downsamp_mask_idx, downsamp_vec) end do deallocate (m_buf, procmask_zodi) end do - end subroutine + end subroutine downsamp_invariant_structs - subroutine precompute_lowres_zodi_lookups(cpar) - ! Loop over each band with zodi and precompute lookup tables for lowres zodi caching + ! Loop over each band with zodi and precompute lookup tables for lowres zodi caching + subroutine precompute_lowres_zodi_lookups(cpar) + implicit none type(comm_params), intent(in) :: cpar + integer(i4b) :: i, j, k, l, scan, n_lowres_obs, nobs_downsamp, nobs_lowres, pix_high, pix_low, ierr integer(i4b), allocatable :: pix2ind_highres(:), ind2pix_highres(:) real(dp), allocatable :: ind2vec_zodi_temp(:, :) @@ -865,13 +254,14 @@ subroutine precompute_lowres_zodi_lookups(cpar) do scan = 1, data(i)%tod%nscan if (.not. any(data(i)%tod%scans(scan)%d%accept)) cycle do j = 1, data(i)%tod%ndet - do k = 1, size(data(i)%tod%scans(scan)%d(j)%downsamp_pix) - pix2ind_highres(data(i)%tod%scans(scan)%d(j)%downsamp_pix(k)) = 1 + do k = 1, size(data(i)%tod%scans(scan)%d(j)%downsamp_pix_full) + pix2ind_highres(data(i)%tod%scans(scan)%d(j)%downsamp_pix_full(k)) = 1 end do end do end do nobs_downsamp = count(pix2ind_highres == 1) + data(i)%tod%zodi_cache_nobs_lowres = nobs_downsamp allocate(ind2vec_zodi_temp(3, nobs_downsamp)) allocate(ind2pix_highres(nobs_downsamp)) @@ -899,15 +289,10 @@ subroutine precompute_lowres_zodi_lookups(cpar) j = j + 1 end do - nobs_lowres = j - 1 + nobs_lowres = j-1 allocate(data(i)%tod%ind2vec_ecl_lowres(3, nobs_lowres)) data(i)%tod%ind2vec_ecl_lowres = ind2vec_zodi_temp(:, 1:nobs_lowres) - allocate(data(i)%tod%zodi_scat_cache_lowres(nobs_lowres, data(i)%tod%zodi_n_comps, data(i)%tod%ndet)) - allocate(data(i)%tod%zodi_therm_cache_lowres(nobs_lowres, data(i)%tod%zodi_n_comps, data(i)%tod%ndet)) - data(i)%tod%zodi_scat_cache_lowres = -1.d0 - data(i)%tod%zodi_therm_cache_lowres = -1.d0 - do k = 1, nobs_lowres data(i)%tod%ind2vec_ecl_lowres(:, k) = matmul(data(i)%tod%ind2vec_ecl_lowres(:, k), rotation_matrix) end do @@ -916,183 +301,160 @@ subroutine precompute_lowres_zodi_lookups(cpar) end subroutine subroutine project_and_downsamp_sky(cpar) - type(comm_params), intent(in) :: cpar - integer(i4b) :: i, j, k, scan, ext(2), upper_bound, padding, ierr, ntod, nhorn, npix, ndet, nmaps, ndelta - real(dp) :: box_width + implicit none + type(comm_params), intent(in) :: cpar + + integer(i4b) :: i, j, k, scan, ext(2), upper_bound, padding, ierr, ntod, nhorn, npix, ndet, nmaps, thin, ntod_lowres, pix type(map_ptr), allocatable, dimension(:, :) :: sky_signal real(sp), allocatable, dimension(:) :: downsamp_sky, downsamp_mask logical(lgt), allocatable, dimension(:) :: downsamp_mask_idx real(sp), allocatable, dimension(:, :, :, :) :: map_sky real(dp), allocatable, dimension(:, :) :: m_buf type(hdf_file) :: tod_file - integer(i4b), allocatable :: pix(:, :), psi(:, :), flag(:) real(sp), allocatable :: mask(:), sky(:) real(sp), allocatable, dimension(:) :: procmask_zodi if (cpar%myid == cpar%root) print *, "projecting downsampled sky" - padding = 5 ! For each zodi band, create downsampled residual time stream do i = 1, numband - ! Only generate downsampled arrays for tod bands and bands where we have zodi if (trim(data(i)%tod_type) == 'none') cycle if (.not. data(i)%tod%subtract_zodi) cycle - npix = 12*data(i)%map%info%nside**2 - ndelta = 1 nmaps = data(i)%map%info%nmaps - ndet = data(i)%tod%ndet - nhorn = data(i)%tod%nhorn - box_width = get_boxwidth(data(i)%tod%samprate_lowres, data(i)%tod%samprate) + ndet = data(i)%tod%ndet + thin = max(nint(data(i)%tod%samprate/data(i)%tod%samprate_lowres), 1) - allocate (sky_signal(data(i)%tod%ndet, ndelta)) + ! Distribute sky signal + allocate(sky_signal(data(i)%tod%ndet,1)) do j = 1, data(i)%tod%ndet - call get_sky_signal(i, j, sky_signal(j, ndelta)%p, mono=.false.) + call get_sky_signal(i, j, sky_signal(j,1)%p, mono=.false.) end do - allocate (map_sky(nmaps, data(i)%tod%nobs, 0:data(i)%tod%ndet, 1)) call distribute_sky_maps(data(i)%tod, sky_signal, 1.e0, map_sky) - allocate (m_buf(0:npix - 1, nmaps)) - allocate (procmask_zodi(0:npix - 1)) - call data(i)%tod%procmask_zodi%bcast_fullsky_map(m_buf) - procmask_zodi = m_buf(:, 1) - + ! Project sky signal into already downsampled data structures do scan = 1, data(i)%tod%nscan if (.not. any(data(i)%tod%scans(scan)%d%accept)) cycle - ntod = data(i)%tod%scans(scan)%ntod - do j = 1, ndet - allocate (pix(ntod, nhorn)) - allocate (psi(ntod, nhorn)) - allocate (flag(ntod)) - allocate (mask(ntod)) - allocate (sky(ntod)) - pix = 0 - psi = 0 - flag = 0 - mask = 0. - sky = 0. - - ! Project sky map down to downsampled timestream and cache - call data(i)%tod%decompress_pointing_and_flags(scan, j, pix, psi, flag) - - do k = 1, ntod - mask(k) = procmask_zodi(pix(k, 1)) - if (iand(flag(k), data(i)%tod%flag0) .ne. 0) mask(k) = 0. - end do - where (mask > 0.) mask = 1. ! make sure mask is binary before downsampling - - do k = 1, ntod - sky(k) = map_sky(1, data(i)%tod%pix2ind(pix(k, 1)), j, 1) !zodi is only temperature (for now) + ntod_lowres = size(data(i)%tod%scans(scan)%d(j)%downsamp_pix_full) + if (.not. allocated(data(i)%tod%scans(scan)%d(j)%downsamp_sky_full)) then + allocate(data(i)%tod%scans(scan)%d(j)%downsamp_sky_full(ntod_lowres)) + end if + do k = 1, ntod_lowres + pix = data(i)%tod%scans(scan)%d(j)%downsamp_pix_full(k) + data(i)%tod%scans(scan)%d(j)%downsamp_sky_full(k) = map_sky(1, data(i)%tod%pix2ind(pix), j, 1) !zodi is only temperature (for now) end do - - ! Get downsample shape - call data(i)%tod%downsample_tod(sky, ext, width=box_width) - - allocate (downsamp_sky(ext(1):ext(2))) - allocate (downsamp_mask(ext(1):ext(2))) - allocate (downsamp_mask_idx(ext(1):ext(2))) - downsamp_mask_idx = .true. - - call data(i)%tod%downsample_tod(sky, ext, downsamp_sky, width=box_width) - - call data(i)%tod%downsample_tod(mask, ext, downsamp_mask, width=box_width) - where (downsamp_mask < 1.) downsamp_mask_idx = .false. - - data(i)%tod%scans(scan)%d(j)%downsamp_sky = pack(downsamp_sky(0:ext(2)-padding), downsamp_mask_idx(0:ext(2)-padding)) - deallocate(pix, psi, flag, mask, sky) - deallocate(downsamp_sky, downsamp_mask_idx, downsamp_mask) end do - end do - deallocate (map_sky, sky_signal, m_buf, procmask_zodi) + deallocate (map_sky, sky_signal) end do end subroutine - subroutine compute_downsamp_zodi(cpar, model) - type(comm_params), intent(in) :: cpar - type(ZodiModel), intent(inout) :: model - integer(i4b) :: i, j, scan, ierr, ndet - - if (cpar%myid == cpar%root) print *, "computing downsampled zodi" - - do i = 1, numband - if (trim(data(i)%tod_type) == 'none') cycle - if (.not. data(i)%tod%subtract_zodi) cycle - - do scan = 1, data(i)%tod%nscan - if (.not. any(data(i)%tod%scans(scan)%d%accept)) cycle - - ndet = data(i)%tod%ndet - do j = 1, ndet - call get_zodi_emission(& - & tod=data(i)%tod, & - & pix=data(i)%tod%scans(scan)%d(j)%downsamp_pix, & - & scan=scan, & - & det=j, & - & s_zodi_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & - & s_zodi_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & - & model=model, & - & use_lowres_pointing=.true. & - &) - call get_s_zodi(i, & - & s_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & - & s_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & - & s_zodi=data(i)%tod%scans(scan)%d(j)%downsamp_zodi & - &) - end do - end do - end do - end subroutine +!!$ subroutine compute_downsamp_zodi(cpar, model) +!!$ type(comm_params), intent(in) :: cpar +!!$ type(ZodiModel), intent(inout) :: model +!!$ integer(i4b) :: i, j, scan, ierr, ndet +!!$ +!!$ if (cpar%myid == cpar%root) print *, "computing downsampled zodi" +!!$ +!!$ do i = 1, numband +!!$ if (trim(data(i)%tod_type) == 'none') cycle +!!$ if (.not. data(i)%tod%subtract_zodi) cycle +!!$ +!!$ do scan = 1, data(i)%tod%nscan +!!$ if (.not. any(data(i)%tod%scans(scan)%d%accept)) cycle +!!$ +!!$ ndet = data(i)%tod%ndet +!!$ do j = 1, ndet +!!$ call get_zodi_emission(& +!!$ & tod=data(i)%tod, & +!!$ & pix=data(i)%tod%scans(scan)%d(j)%downsamp_pix, & +!!$ & scan=scan, & +!!$ & det=j, & +!!$ & s_zodi_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & +!!$ & s_zodi_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & +!!$ & model=model, & +!!$ & use_lowres_pointing=.true. & +!!$ &) +!!$ call get_s_zodi(i, & +!!$ & s_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & +!!$ & s_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & +!!$ & s_zodi=data(i)%tod%scans(scan)%d(j)%downsamp_zodi & +!!$ &) +!!$ end do +!!$ end do +!!$ end do +!!$ end subroutine - subroutine create_zodi_glitch_mask(cpar, handle) + subroutine create_zodi_sampgroup_mask(cpar, handle) type(comm_params), intent(in) :: cpar type(planck_rng), intent(inout) :: handle - integer(i4b) :: i, j, k, scan, ierr, non_glitch_size, thinstep, offset - real(dp) :: box_width, rms, frac + + integer(i4b) :: i, j, k, l, scan, ierr, non_glitch_size, thinstep, offset, ntod, ngood + real(dp) :: rms, frac, thin_frac real(sp), allocatable :: res(:) real(sp), allocatable :: downsamp_scat_comp(:, :), downsamp_therm_comp(:, :) - thinstep = nint(1.d0/cpar%zs_tod_thin_factor) do i = 1, numband if (trim(data(i)%tod_type) == 'none') cycle if (.not. data(i)%tod%subtract_zodi) cycle do scan = 1, data(i)%tod%nscan - offset = rand_uni(handle) * thinstep - box_width = get_boxwidth(data(i)%tod%samprate_lowres, data(i)%tod%samprate) do j = 1, data(i)%tod%ndet if (.not. data(i)%tod%scans(scan)%d(j)%accept) cycle + ! Initialize masks + ntod = size(data(i)%tod%scans(scan)%d(j)%downsamp_tod_full) + allocate(data(i)%tod%scans(scan)%d(j)%zodi_sampgroup_mask(ntod,cpar%zs_num_samp_groups)) + data(i)%tod%scans(scan)%d(j)%zodi_sampgroup_mask = .true. + + !allocate(basemask(ntod)) + ! Search for strong outliers - res = data(i)%tod%scans(scan)%d(j)%downsamp_tod - data(i)%tod%scans(scan)%d(j)%downsamp_sky - data(i)%tod%scans(scan)%d(j)%downsamp_zodi - rms = sqrt(mean(real(res**2, dp))) - data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask = abs(res) > 10. * real(rms, sp) - frac = count(data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask)/real(size(data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask),dp) - if (frac > 0.01d0) then - write(*,*) 'Warning: Removing high fraction of glitches = ', frac - end if - - ! Apply TOD thinning - !allocate(data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask(data(i)%tod%scans(scan)%ntod)) - do k = 1, size(data(i)%tod%scans(scan)%d(j)%downsamp_tod) - if (mod(k+offset,thinstep) /= 0) then - data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask(k) = .true. +!!$ res = data(i)%tod%scans(scan)%d(j)%downsamp_tod - data(i)%tod%scans(scan)%d(j)%gain * (data(i)%tod%scans(scan)%d(j)%downsamp_sky + data(i)%tod%scans(scan)%d(j)%downsamp_zodi) +!!$ rms = sqrt(mean(real(res**2, dp))) +!!$ basemask = abs(res) > 10. * real(rms, sp) +!!$ frac = count(basemask)/real(ntod,dp) +!!$ if (frac > 0.01d0) write(*,*) 'Warning: Removing high fraction of glitches = ', frac + + ! Apply TOD thinning; may be different for each sampling group + do l = 1, cpar%zs_num_samp_groups + + ! Remove samples at high latitudes, if requested by user + if (cpar%zs_samp_group_max_b_ecl(l) < 90.d0) then + do k = 1, ntod + if (abs(data(i)%tod%scans(scan)%d(j)%downsamp_point_full(k,3)) > cpar%zs_samp_group_max_b_ecl(l)) then + data(i)%tod%scans(scan)%d(j)%zodi_sampgroup_mask(k,l) = .false. + end if + end do end if + + ! Apply thinning factor, adjusted for already masked samples + ngood = count(data(i)%tod%scans(scan)%d(j)%zodi_sampgroup_mask(:,l)) + thinstep = max(nint(real(ngood,sp)/real(ntod,sp) / cpar%zs_tod_thin_factor),1) + k = 1 + ngood = 0 + do while (k <= ntod) + if (data(i)%tod%scans(scan)%d(j)%zodi_sampgroup_mask(k,l)) then + ngood = ngood + 1 + if (mod(ngood,thinstep) /= 0) data(i)%tod%scans(scan)%d(j)%zodi_sampgroup_mask(k,l) = .false. + end if + k = k+1 + end do end do end do end do end do - end subroutine - - subroutine apply_zodi_glitch_mask(cpar) - type(comm_params), intent(in) :: cpar - integer(i4b) :: i, j, k, scan, ierr, non_glitch_size - real(sp), allocatable :: res(:) - real(sp), allocatable :: downsamp_scat_comp(:, :), downsamp_therm_comp(:, :) - integer(i4b), allocatable :: downsamp_pix(:) + end subroutine create_zodi_sampgroup_mask + subroutine apply_zodi_sampgroup_mask(cpar, samp_group) + implicit none + type(comm_params), intent(in) :: cpar + integer(i4b), intent(in) :: samp_group + + integer(i4b) :: i, j, k, scan, ngood + do i = 1, numband if (trim(data(i)%tod_type) == 'none') cycle if (.not. data(i)%tod%subtract_zodi) cycle @@ -1100,33 +462,22 @@ subroutine apply_zodi_glitch_mask(cpar) do scan = 1, data(i)%tod%nscan do j = 1, data(i)%tod%ndet if (.not. data(i)%tod%scans(scan)%d(j)%accept) cycle - !if (size(data(i)%tod%scans(scan)%d(j)%downsamp_tod) < 10) cycle ! Remove flagged samples - non_glitch_size = count(.not. data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask) - if (size(data(i)%tod%scans(scan)%d(j)%downsamp_pix) /= non_glitch_size) data(i)%tod%scans(scan)%d(j)%downsamp_pix = pack(data(i)%tod%scans(scan)%d(j)%downsamp_pix, .not. data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask) - if (size(data(i)%tod%scans(scan)%d(j)%downsamp_tod) /= non_glitch_size) data(i)%tod%scans(scan)%d(j)%downsamp_tod = pack(data(i)%tod%scans(scan)%d(j)%downsamp_tod, .not. data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask) - if (size(data(i)%tod%scans(scan)%d(j)%downsamp_sky) /= non_glitch_size) data(i)%tod%scans(scan)%d(j)%downsamp_sky = pack(data(i)%tod%scans(scan)%d(j)%downsamp_sky, .not. data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask) - if (size(data(i)%tod%scans(scan)%d(j)%downsamp_zodi) /= non_glitch_size) data(i)%tod%scans(scan)%d(j)%downsamp_zodi = pack(data(i)%tod%scans(scan)%d(j)%downsamp_zodi, .not. data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask) - - ! pack doesnt work on multidimensional arrays so here we manually reallocate the zodi caches to the new sizes - if (size(data(i)%tod%scans(scan)%d(j)%downsamp_therm,1) /= non_glitch_size) then - allocate(downsamp_scat_comp(non_glitch_size, zodi_model%n_comps)) - allocate(downsamp_therm_comp(non_glitch_size, zodi_model%n_comps)) - do k = 1, zodi_model%n_comps - downsamp_scat_comp(:, k) = pack(data(i)%tod%scans(scan)%d(j)%downsamp_scat(:, k), .not. data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask) - downsamp_therm_comp(:, k) = pack(data(i)%tod%scans(scan)%d(j)%downsamp_therm(:, k), .not. data(i)%tod%scans(scan)%d(j)%zodi_glitch_mask) - end do - deallocate(data(i)%tod%scans(scan)%d(j)%downsamp_scat) - deallocate(data(i)%tod%scans(scan)%d(j)%downsamp_therm) - allocate(data(i)%tod%scans(scan)%d(j)%downsamp_scat(non_glitch_size, zodi_model%n_comps)) - allocate(data(i)%tod%scans(scan)%d(j)%downsamp_therm(non_glitch_size, zodi_model%n_comps)) - data(i)%tod%scans(scan)%d(j)%downsamp_therm = downsamp_therm_comp - data(i)%tod%scans(scan)%d(j)%downsamp_scat = downsamp_scat_comp - deallocate(downsamp_scat_comp, downsamp_therm_comp) - end if - - + ngood = count(data(i)%tod%scans(scan)%d(j)%zodi_sampgroup_mask(:,samp_group)) + data(i)%tod%scans(scan)%d(j)%downsamp_pix = pack(data(i)%tod%scans(scan)%d(j)%downsamp_pix_full, data(i)%tod%scans(scan)%d(j)%zodi_sampgroup_mask(:,samp_group)) + data(i)%tod%scans(scan)%d(j)%downsamp_tod = pack(data(i)%tod%scans(scan)%d(j)%downsamp_tod_full, data(i)%tod%scans(scan)%d(j)%zodi_sampgroup_mask(:,samp_group)) + data(i)%tod%scans(scan)%d(j)%downsamp_sky = pack(data(i)%tod%scans(scan)%d(j)%downsamp_sky_full, data(i)%tod%scans(scan)%d(j)%zodi_sampgroup_mask(:,samp_group)) + +!!$ ! Allocate arrays for zodi, but don't fill them +!!$ if (allocated(data(i)%tod%scans(scan)%d(j)%downsamp_zodi(ngood))) then +!!$ allocate(data(i)%tod%scans(scan)%d(j)%downsamp_zodi(ngood)) +!!$ allocate(data(i)%tod%scans(scan)%d(j)%downsamp_scat(ngood, zodi_model%n_comps)) +!!$ allocate(data(i)%tod%scans(scan)%d(j)%downsamp_therm(ngood, zodi_model%n_comps)) +!!$ allocate(data(i)%tod%scans(scan)%d(j)%downsamp_zodi(ngood)) +!!$ allocate(data(i)%tod%scans(scan)%d(j)%downsamp_scat(ngood, zodi_model%n_comps)) +!!$ allocate(data(i)%tod%scans(scan)%d(j)%downsamp_therm(ngood, zodi_model%n_comps)) +!!$ end if end do end do end do @@ -1158,7 +509,7 @@ subroutine minimize_zodi_with_powell(cpar, iter, handle, samp_group) ! Initialize active monopoles do i = 1, numband ind = zodi_model%get_par_ind(mono_band=i) - if (zodi_model%theta_stat(ind,samp_group) == 0) band_monopole(i) = get_monopole_amp(data(i)%label) + band_monopole(i) = get_monopole_amp(data(i)%label) end do if (cpar%myid_chain == 0) then @@ -1167,7 +518,7 @@ subroutine minimize_zodi_with_powell(cpar, iter, handle, samp_group) filename = trim(cpar%outdir)//'/zodi_powell_sg'//sgroup//'_k'//iter_string//'.dat' unit = getlun() open(unit, file=trim(filename), recl=10000) - write(unit, '(a)', advance="no") "# " + write(unit, '(a)', advance="no") "# chisq_red " do i = 1, zodi_model%npar_tot if (zodi_model%theta_stat(i,samp_group)==0) then write(unit, "(a,a)", advance="no") trim(adjustl(zodi_model%par_labels_full(i))), " " @@ -1177,19 +528,12 @@ subroutine minimize_zodi_with_powell(cpar, iter, handle, samp_group) end if ! Get chisq of old point - scale = pack(zodi_model%theta_scale, zodi_model%theta_stat(:,samp_group)==0) - call model_to_params(zodi_model, theta_old, samp_group) -!!$ if (cpar%myid == cpar%root) then -!!$ do i = 1, npar -!!$ write(*,*) i, theta_old(i) -!!$ end do -!!$ end if -!!$ call mpi_finalize(ierr) -!!$ stop + scale = pack(zodi_model%theta_scale(:,1), zodi_model%theta_stat(:,samp_group)==0) + call zodi_model%model_to_params(theta_old, samp_group) ! Enforce priors; rms = 0 call randomize_zodi_init(theta_old, samp_group, cpar, handle, rms=0.d0) - + theta_prev = 0.d0 chisq_prev = 0.d0 if (cpar%myid == cpar%root) then @@ -1213,7 +557,8 @@ subroutine minimize_zodi_with_powell(cpar, iter, handle, samp_group) if (cpar%myid == cpar%root) then ! Perform search - call powell(theta, lnL_zodi, ierr, tolerance=1d-5) + call powell(theta, lnL_zodi, ierr, tolerance=1d-4) + if (ierr /= 0) write(*,*) 'powell failed, ierr =', ierr chisq_new = lnL_zodi(theta) flag = 0 call mpi_bcast(flag, 1, MPI_INTEGER, cpar%root, cpar%comm_chain, ierr) @@ -1222,7 +567,7 @@ subroutine minimize_zodi_with_powell(cpar, iter, handle, samp_group) if (chisq_new < chisq_old) then accept = .true. else - accept = rand_uni(handle) < exp(-0.5d0*(chisq_new-chisq_old)/0.1d0) + accept = rand_uni(handle) < exp(-0.5d0*(chisq_new-chisq_old)/0.02d0) end if if (accept) then ! Accept new point; update @@ -1250,7 +595,7 @@ subroutine minimize_zodi_with_powell(cpar, iter, handle, samp_group) call mpi_bcast(theta_new, size(theta_new), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) ! update model with final parameters - call params_to_model(zodi_model, theta_new, samp_group) + call zodi_model%params_to_model(theta_new, samp_group) ! Update monopole for requested bands do i = 1, numband @@ -1268,12 +613,12 @@ function lnL_zodi(p) real(dp) :: lnL_zodi real(dp), allocatable :: theta(:) - real(dp) :: chisq, chisq_tot, box_width, t1, t2, t3, t4, mono + real(dp) :: chisq, chisq_tot, t1, t2, t3, t4, mono integer(i4b) :: i, j, k, scan, ntod, ndet, nscan, flag, ierr, ndof, ndof_tot logical(lgt) :: accept - logical(lgt), dimension(numband) :: update_band character(len=4) :: scan_str type(hdf_file) :: tod_file + real(sp), allocatable, dimension(:) :: s_zodi call wall_time(t1) @@ -1284,26 +629,7 @@ function lnL_zodi(p) theta = p*scale end if call mpi_bcast(theta, size(theta), MPI_DOUBLE_PRECISION, 0, data(1)%tod%comm, ierr) - - ! Check which parameters have changed - update_band = .true. -!!$ update_band = .false. -!!$ j = 0 -!!$ do i = 1, zodi_model%npar_tot -!!$ if (zodi_model%theta_stat(i,samp_group) /= 0) cycle -!!$ j = j+1 -!!$ if (theta(j) /= theta_prev(j)) then -!!$ !if (data(1)%tod%myid == 0) write(*,*) j, theta(j), theta_prev(j), zodi_model%theta2band(i) -!!$ if (zodi_model%theta2band(i) == 0) then -!!$ update_band = .true. -!!$ exit -!!$ else -!!$ update_band(zodi_model%theta2band(i)) = .true. -!!$ end if -!!$ end if -!!$ end do - !if (data(1)%tod%myid == 0) write(*,*) data(1)%tod%myid, ' -- update =', update_band, all(theta == theta_prev) - + ! Check priors if (cpar%myid_chain == 0) then chisq_tot = get_chisq_priors(theta, samp_group) @@ -1319,7 +645,7 @@ function lnL_zodi(p) return end if - call params_to_model(zodi_model, theta, samp_group) + call zodi_model%params_to_model(theta, samp_group) if (cpar%myid_chain == 0) call print_zodi_model(theta, samp_group) ndof = 0 @@ -1333,75 +659,36 @@ function lnL_zodi(p) ndet = data(i)%tod%ndet nscan = data(i)%tod%nscan - if (.not. update_band(i)) then - !write(*,*) 'skipping', i, chisq_prev(i) - if (cpar%myid_chain == 0) write(*,*) 'skipping band ', i, chisq_prev(i) - chisq_tot = chisq_tot + chisq_prev(i) - do scan = 1, nscan - do j = 1, ndet - if (.not. data(i)%tod%scans(scan)%d(j)%accept) cycle - ndof = ndof + size(data(i)%tod%scans(scan)%d(j)%downsamp_tod) - end do - end do - cycle - end if - ! Get monopole - mono = band_monopole(i) !get_monopole_amp(data(i)%label) -!!$ if (data(1)%tod%myid == 0) then -!!$ write(*,*) 'theta =', theta -!!$ write(*,*) 'mono =', mono -!!$ end if + mono = band_monopole(i) - box_width = get_boxwidth(data(i)%tod%samprate_lowres, data(i)%tod%samprate) - - ! Make sure that the zodi cache is cleared before each new band - call data(i)%tod%clear_zodi_cache() - ! Evaluate zodi model with newly proposed values for each band and calculate chisq - chisq_prev(i) = 0.d0 do scan = 1, nscan ! Skip scan if no accepted data do j = 1, ndet - if (.not. data(i)%tod%scans(scan)%d(j)%accept) then - !write(*,*) ' Scan rejected:', data(i)%tod%scanid(scan), data(1)%tod%myid - cycle - end if + if (.not. data(i)%tod%scans(scan)%d(j)%accept) cycle + allocate(s_zodi(size(data(i)%tod%scans(scan)%d(j)%downsamp_tod))) + call wall_time(t3) - call get_zodi_emission(& - & tod=data(i)%tod, & - & pix=data(i)%tod%scans(scan)%d(j)%downsamp_pix, & - & scan=scan, & - & det=j, & - & s_zodi_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & - & s_zodi_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & - & model=zodi_model, & - & use_lowres_pointing=.true. & - &) + call get_zodi_emission(data(i)%tod, data(i)%tod%scans(scan)%d(j)%downsamp_pix, & + & scan, j, zodi_model, s_zodi, use_lowres_pointing=.true.) call wall_time(t4) !if (data(1)%tod%myid == 10) write(*,*) ' CPU1 = ', t4-t3 - call get_s_zodi(i, & - & s_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & - & s_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & - & s_zodi=data(i)%tod%scans(scan)%d(j)%downsamp_zodi & - &) - call wall_time(t3) - !if (data(1)%tod%myid == 10) write(*,*) ' CPU2 = ', t3-t4 - + + !write(*,*) data(i)%tod%scanid(scan), data(1)%tod%myid, 'tod ', minval((data(i)%tod%scans(scan)%d(j)%downsamp_tod)), maxval((data(i)%tod%scans(scan)%d(j)%downsamp_tod)) + !write(*,*) data(i)%tod%scanid(scan), data(1)%tod%myid, 'sky ', minval((data(i)%tod%scans(scan)%d(j)%downsamp_tod)), maxval((data(i)%tod%scans(scan)%d(j)%downsamp_sky)) + !write(*,*) data(i)%tod%scanid(scan), data(1)%tod%myid, 'zodi ', minval((data(i)%tod%scans(scan)%d(j)%downsamp_tod)), maxval((data(i)%tod%scans(scan)%d(j)%downsamp_zodi)) + !write(*,*) data(i)%tod%scanid(scan), data(1)%tod%myid, 'mono ', mono + !write(*,*) data(i)%tod%scanid(scan), data(1)%tod%myid, 'noise', data(i)%tod%scans(scan)%d(j)%N_psd%sigma0 chisq = sum( & - & ((data(i)%tod%scans(scan)%d(j)%downsamp_tod & - & - data(i)%tod%scans(scan)%d(j)%downsamp_sky & - & - data(i)%tod%scans(scan)%d(j)%downsamp_zodi & - & - mono & - & )/(data(i)%tod%scans(scan)%d(j)%N_psd%sigma0/sqrt(box_width)))**2 & - &) + & ((data(i)%tod%scans(scan)%d(j)%downsamp_tod - data(i)%tod%scans(scan)%d(j)%gain * & + & (data(i)%tod%scans(scan)%d(j)%downsamp_sky + s_zodi + mono))/data(i)%tod%scans(scan)%d(j)%N_psd%sigma0)**2) chisq_tot = chisq_tot + chisq - chisq_prev(i) = chisq_prev(i) + chisq call wall_time(t4) !if (data(1)%tod%myid == 10) write(*,*) ' CPU3 = ', t4-t3 -!!$ write(*,*) 'a', i, scan!, allocated(data(i)%tod%scans(scan)%d(j)%downsamp_tod) +!!$ write(*,*) 'a', i, scan!, allocated(data(i)%tod%scans(scan)%d(j)%downsa1mp_tod) !!$ write(*,*) 'b', j!, allocated(data(i)%tod%scans(scan)%d(j)%downsamp_tod) !write(*,*) 'do not remove -- memory corruption bug "fix"', ndof!, allocated(data(i)%tod%scans(scan)%d(j)%downsamp_tod) ndof = ndof + size(data(i)%tod%scans(scan)%d(j)%downsamp_tod) @@ -1421,21 +708,21 @@ function lnL_zodi(p) open(58,file=trim(cpar%outdir)//'/todres_'//trim(data(i)%tod%freq)//'_'//scan_str//'.dat', recl=2048) do k = 1, size(data(i)%tod%scans(scan)%d(j)%downsamp_tod) write(58,*) data(i)%tod%scans(scan)%d(j)%downsamp_point(k,:), data(i)%tod%scans(scan)%d(j)%downsamp_tod(k) & - & - data(i)%tod%scans(scan)%d(j)%downsamp_sky(k) & - & - data(i)%tod%scans(scan)%d(j)%downsamp_zodi(k) & - & - mono + & - data(i)%tod%scans(scan)%d(j)%gain * & + & (data(i)%tod%scans(scan)%d(j)%downsamp_sky(k) & + & + s_zodi(k) & + & + mono) end do close(58) end if call wall_time(t3) !if (data(1)%tod%myid == 10) write(*,*) ' CPU4 = ', t3-t4 + deallocate(s_zodi) end do end do end do - !write(*,*) data(1)%tod%myid, ' -- recomputed =', chisq_prev - ! Reduce chisq to root process call mpi_reduce(chisq_tot, chisq, 1, MPI_DOUBLE_PRECISION, MPI_SUM, 0, data(1)%tod%comm, ierr) call mpi_reduce(ndof, ndof_tot, 1, MPI_INTEGER, MPI_SUM, 0, data(1)%tod%comm, ierr) @@ -1451,431 +738,12 @@ function lnL_zodi(p) write(unit,*) chisq/ndof_tot, real(theta,sp) end if - theta_prev = theta end function end subroutine minimize_zodi_with_powell - -!!$ subroutine minimize_zodi_with_powell2(cpar, handle) -!!$ type(comm_params), intent(in) :: cpar -!!$ type(planck_rng), intent(inout) :: handle -!!$ logical(lgt), save :: first_call = .true. -!!$ logical(lgt) :: accept -!!$ real(dp), allocatable :: theta(:), theta_phys(:), theta_new(:), theta_final(:) -!!$ character(len=128), allocatable :: labels(:) -!!$ integer(i4b) :: i, j, k, ierr, flag, group_idx, end_idx, n_bands -!!$ real(dp) :: chisq_lnL, chisq_red -!!$ real(dp), allocatable, dimension(:) :: prior_vec_powell_min, prior_vec_powell_max, prior_vec_powell_type -!!$ integer(i4b), allocatable :: indices(:) -!!$ -!!$ if (allocated(param_vec_current)) then -!!$ ! Start at a new random point -!!$ call randomize_zodi_init(cpar, handle) -!!$ else -!!$ allocate(param_vec_current(zodi_model%n_params)) -!!$ chisq_red_current = 1.d30 -!!$ end if -!!$ -!!$ allocate(theta(zodi_model%n_params)) -!!$ call zodi_model%model_to_params2(theta, labels) -!!$ if (cpar%myid == 0) print *, "minimizing zodi parameters with powell" -!!$ -!!$ ! filter out parameters for powell search -!!$ allocate(powell_included_params(zodi_model%n_params)) -!!$ powell_included_params = .false. -!!$ -!!$ ! Get parameters to sample from sampling groups -!!$ do group_idx = 1, cpar%zs_num_samp_groups -!!$ call parse_samp_group_strings(cpar%zs_samp_groups(group_idx), labels, indices) -!!$ do i = 1, size(indices) -!!$ powell_included_params(indices(i)) = .true. -!!$ end do -!!$ end do -!!$ prior_vec_powell_min = prior_vec(:, 1) -!!$ prior_vec_powell_max = prior_vec(:, 2) -!!$ prior_vec_powell_type = prior_vec(:, 3) -!!$ -!!$ ! ! append emissivities and albedoes to the vector given to powell. -!!$ do i = 1, numband -!!$ if (trim(data(i)%tod_type) == 'none') cycle -!!$ if (.not. data(i)%tod%subtract_zodi) cycle -!!$ if (cpar%ds_zodi_reference_band(data(i)%id_abs)) cycle -!!$ theta = [theta, data(i)%tod%zodi_emissivity] -!!$ powell_included_params = [powell_included_params, [(.true. , j=1, size(data(i)%tod%zodi_emissivity))]] -!!$ prior_vec_powell_min = [prior_vec_powell_min, [(emissivity_prior(1) , j=1, size(data(i)%tod%zodi_emissivity))]] -!!$ prior_vec_powell_max = [prior_vec_powell_max, [(emissivity_prior(2) , j=1, size(data(i)%tod%zodi_emissivity))]] -!!$ prior_vec_powell_type = [prior_vec_powell_type, [(real(0, dp), j=1, size(data(i)%tod%zodi_emissivity))]] -!!$ end do -!!$ -!!$ do i = 1, numband -!!$ if (trim(data(i)%tod_type) == 'none') cycle -!!$ if (.not. data(i)%tod%subtract_zodi) cycle -!!$ if (.not. any(data(i)%tod%zodi_albedo > EPS)) cycle -!!$ theta = [theta, data(i)%tod%zodi_albedo] -!!$ powell_included_params = [powell_included_params, [(.true. , j=1, size(data(i)%tod%zodi_albedo))]] -!!$ prior_vec_powell_min = [prior_vec_powell_min, [(albedo_prior(1) , j=1, size(data(i)%tod%zodi_albedo))]] -!!$ prior_vec_powell_max = [prior_vec_powell_max, [(albedo_prior(2) , j=1, size(data(i)%tod%zodi_albedo))]] -!!$ prior_vec_powell_type = [prior_vec_powell_type, [(real(0, dp), j=1, size(data(i)%tod%zodi_albedo))]] -!!$ end do -!!$ -!!$ allocate(prior_vec_powell(size(prior_vec_powell_min), 3)) -!!$ prior_vec_powell(:, 1) = prior_vec_powell_min -!!$ prior_vec_powell(:, 2) = prior_vec_powell_max -!!$ prior_vec_powell(:, 3) = prior_vec_powell_type -!!$ -!!$ if (any(pack(theta, powell_included_params) == 0.)) then -!!$ do i = 1, size(theta) -!!$ write(*,*) i, theta(i) -!!$ end do -!!$ stop "theta_0 contains zeros in zodi powell sampling. Cant compute physical units due to theta/theta_0" -!!$ end if -!!$ -!!$ allocate(theta_0(size(theta))) -!!$ theta_0 = theta -!!$ -!!$ allocate(theta_phys(count(powell_included_params))) -!!$ -!!$ if (cpar%myid == cpar%root) then -!!$ !filter out N_0 parameters and scale to physical units -!!$ theta_phys = pack(theta / theta_0, powell_included_params) -!!$ !call powell(theta_phys, lnL_zodi, ierr) -!!$ do k = 1, 2 -!!$ call powell(theta_phys, lnL_zodi2, ierr, tolerance=1d-3) -!!$ end do -!!$ flag = 0 -!!$ call mpi_bcast(flag, 1, MPI_INTEGER, cpar%root, cpar%comm_chain, ierr) -!!$ chisq_red = lnL_zodi2(theta_phys) -!!$ else -!!$ do while (.true.) -!!$ call mpi_bcast(flag, 1, MPI_INTEGER, cpar%root, cpar%comm_chain, ierr) -!!$ if (flag == 1) then -!!$ chisq_lnL = lnL_zodi2() -!!$ else -!!$ exit -!!$ end if -!!$ end do -!!$ call mpi_bcast(flag, 1, MPI_INTEGER, cpar%root, cpar%comm_chain, ierr) -!!$ chisq_red = lnL_zodi2() -!!$ end if -!!$ -!!$ call mpi_barrier(MPI_COMM_WORLD, ierr) -!!$ call mpi_bcast(theta_phys, size(theta_phys), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) -!!$ call mpi_bcast(chisq_red, 1, MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) -!!$ -!!$ allocate(theta_final(zodi_model%n_params)) -!!$ theta_final = theta(1:zodi_model%n_params) -!!$ -!!$ j = 1 -!!$ do i = 1, size(theta) -!!$ if (powell_included_params(i)) then -!!$ theta(i) = theta_phys(j) * theta_0(i) -!!$ j = j + 1 -!!$ end if -!!$ end do -!!$ -!!$ !call min_max_param_vec_with_priors(theta, prior_vec_powell) -!!$ -!!$ -!!$ j = 1 -!!$ do i = 1, size(theta) -!!$ if (powell_included_params(i)) then -!!$ if (i <= zodi_model%n_params) then -!!$ theta_final(i) = theta_phys(j) * theta_0(i) -!!$ end if -!!$ j = j + 1 -!!$ end if -!!$ end do -!!$ -!!$ ! Apply approximate Metropolis rule, using reduced chisq instead of chisq -!!$ if (cpar%myid == cpar%root) then -!!$ if (chisq_red_current == 1.d30) then -!!$ accept = .true. -!!$ else -!!$ accept = rand_uni(handle) < exp(-0.5d0*(chisq_red-chisq_red_current)/0.1d0) -!!$ end if -!!$ end if -!!$ call mpi_bcast(accept, 1, MPI_LOGICAL, cpar%root, cpar%comm_chain, ierr) -!!$ -!!$ if (accept) then -!!$ ! Accept new point; update -!!$ if (cpar%myid == cpar%root) write(*,fmt='(a,f8.2,a,f8.2)') 'Zodi sample accepted, chisq_new =', chisq_red, ', chisq_old = ', chisq_red_current -!!$ param_vec_current = theta_final -!!$ chisq_red_current = chisq_red -!!$ else -!!$ ! Reject new solution, reset to previous solution -!!$ if (cpar%myid == cpar%root) write(*,fmt='(a,f8.2,a,f8.2)') 'Zodi sample rejected, chisq_new =', chisq_red, ', chisq_old = ', chisq_red_current -!!$ call zodi_model%params_to_model2(param_vec_current) -!!$ deallocate(prior_vec_powell, theta_0, powell_included_params) -!!$ return -!!$ end if -!!$ -!!$ ! update model with final parameters -!!$ call zodi_model%params_to_model2(theta_final) -!!$ -!!$ ! update emissivities and albedos with final parameters -!!$ j = 0 -!!$ do i = numband, 1, -1 -!!$ if (data(i)%tod_type == "none") cycle -!!$ if (.not. data(i)%tod%sample_zodi) cycle -!!$ if (any(data(i)%tod%zodi_albedo > EPS)) then -!!$ j = j + 1 -!!$ data(i)%tod%zodi_albedo = theta(size(theta)-(j*zodi_model%n_comps)+1:size(theta)-(j-1)*zodi_model%n_comps) -!!$ else -!!$ data(i)%tod%zodi_albedo = data(i)%tod%zodi_albedo -!!$ end if -!!$ end do -!!$ do i = numband, 1, -1 -!!$ if (data(i)%tod_type == "none") cycle -!!$ if (.not. data(i)%tod%sample_zodi) cycle -!!$ if (.not. ref_band(data(i)%id_abs)) then -!!$ j = j + 1 -!!$ data(i)%tod%zodi_emissivity = theta(size(theta)-(j*zodi_model%n_comps)+1:size(theta)-(j-1)*zodi_model%n_comps) -!!$ else -!!$ data(i)%tod%zodi_emissivity = 1. -!!$ end if -!!$ end do -!!$ deallocate(prior_vec_powell, theta_0, powell_included_params) -!!$ end subroutine -!!$ -!!$ function lnL_zodi2(p) -!!$ use healpix_types -!!$ implicit none -!!$ real(dp), dimension(:), intent(in), optional :: p -!!$ real(dp) :: lnL_zodi2 -!!$ type(ZodiModel) :: model -!!$ -!!$ real(dp), allocatable :: theta(:), theta_phys(:), theta_full(:) -!!$ character(len=128), allocatable :: labels(:) -!!$ real(dp) :: chisq, chisq_tod, chisq_prior, box_width, t1, t2, t3, t4, prior -!!$ real(dp), allocatable, dimension(:), save :: theta_prev, chisq_prev -!!$ integer(i4b) :: i, j, k, scan, ntod, ndet, nscan, flag, ierr, n_bands, ndof, ndof_tot -!!$ logical(lgt), dimension(numband) :: update_band -!!$ character(len=4) :: scan_str -!!$ type(hdf_file) :: tod_file -!!$ -!!$ call wall_time(t1) -!!$ model = zodi_model -!!$ allocate(theta_phys(count(powell_included_params))) -!!$ -!!$ if (data(1)%tod%myid == 0) then -!!$ flag = 1 -!!$ call mpi_bcast(flag, 1, MPI_INTEGER, 0, data(1)%tod%comm, ierr) -!!$ theta_phys = p -!!$ end if -!!$ call mpi_bcast(theta_phys, size(theta_phys), MPI_DOUBLE_PRECISION, 0, data(1)%tod%comm, ierr) -!!$ -!!$ -!!$ allocate(theta(model%n_params)) -!!$ call model%model_to_params2(theta, labels) -!!$ -!!$ allocate(theta_full(size(powell_included_params))) -!!$ theta_full(1:model%n_params) = theta -!!$ -!!$ j = 1 -!!$ do i = 1, size(theta_full) -!!$ if (powell_included_params(i)) then -!!$ if (i <= model%n_params) then -!!$ theta(i) = theta_phys(j) * theta_0(i) -!!$ end if -!!$ theta_full(i) = theta_phys(j) * theta_0(i) -!!$ j = j + 1 -!!$ end if -!!$ end do -!!$ -!!$ call model%params_to_model2(theta) -!!$ -!!$ ! if (data(1)%tod%myid == 0) call print_zodi_model(theta, labels) -!!$ -!!$ -!!$ j = 0 -!!$ do i = numband, 1, -1 -!!$ if (data(i)%tod_type == "none") cycle -!!$ if (.not. data(i)%tod%sample_zodi) cycle -!!$ if (any(data(i)%tod%zodi_albedo > EPS)) then -!!$ j = j + 1 -!!$ powell_albedo(i, :) = theta_full(size(theta_full)-(j*zodi_model%n_comps)+1:size(theta_full)-(j-1)*zodi_model%n_comps) -!!$ else -!!$ powell_albedo(i, :) = data(i)%tod%zodi_albedo -!!$ end if -!!$ end do -!!$ do i = numband, 1, -1 -!!$ if (data(i)%tod_type == "none") cycle -!!$ if (.not. data(i)%tod%sample_zodi) cycle -!!$ if (.not. ref_band(data(i)%id_abs)) then -!!$ j = j + 1 -!!$ powell_emissivity(i, :) = theta_full(size(theta_full)-(j*zodi_model%n_comps)+1:size(theta_full)-(j-1)*zodi_model%n_comps) -!!$ else -!!$ powell_emissivity(i, :) = 1. -!!$ end if -!!$ end do -!!$ -!!$ ! rescale parameters -!!$ call model%model_to_params2(theta) -!!$ theta_full(1:model%n_params) = theta -!!$ -!!$ ! Check which parameters have changed -!!$ update_band = .false. -!!$ if (.not. allocated(theta_prev)) then -!!$ allocate(theta_prev(model%n_params), chisq_prev(numband)) -!!$ theta_prev = theta_full -!!$ chisq_prev = 0.d0 -!!$ update_band = .true. -!!$ else -!!$ do i = 1, model%n_params -!!$ if (theta_full(i) /= theta_prev(i)) then -!!$ if (param2band(i) == 0) then -!!$ update_band = .true. -!!$ exit -!!$ else -!!$ update_band(param2band(i)) = .true. -!!$ end if -!!$ end if -!!$ end do -!!$ end if -!!$ -!!$ ! Check priors -!!$ if (data(1)%tod%myid == 0) then -!!$ call print_zodi_model(theta, labels, chisq) -!!$ chisq_tod = get_chisq_priors(theta_full, prior_vec_powell) -!!$ prior = chisq_tod -!!$ else -!!$ chisq_tod = 0.d0 -!!$ end if -!!$ call mpi_bcast(prior, 1, MPI_DOUBLE_PRECISION, 0, data(1)%tod%comm, ierr) -!!$ -!!$ if (prior >= 1.d30) then -!!$ lnL_zodi2 = 1.d30 -!!$ return -!!$ end if -!!$ -!!$ ndof = 0 -!!$ do i = 1, numband -!!$ if (data(i)%tod_type == "none") cycle -!!$ if (.not. data(i)%tod%sample_zodi) cycle -!!$ ! If chisq is already too large, skip rest of the evaluation and go directly to rejection -!!$ if (chisq_tod >= 1.d30) exit -!!$ -!!$ ndet = data(i)%tod%ndet -!!$ nscan = data(i)%tod%nscan -!!$ -!!$ if (.not. update_band(i)) then -!!$ chisq_tod = chisq_tod + chisq_prev(i) -!!$ do scan = 1, nscan -!!$ do j = 1, ndet -!!$ if (.not. data(i)%tod%scans(scan)%d(j)%accept) cycle -!!$ ndof = ndof + size(data(i)%tod%scans(scan)%d(j)%downsamp_tod) -!!$ end do -!!$ end do -!!$ cycle -!!$ end if -!!$ -!!$ box_width = get_boxwidth(data(i)%tod%samprate_lowres, data(i)%tod%samprate) -!!$ -!!$ ! Make sure that the zodi cache is cleared before each new band -!!$ call data(i)%tod%clear_zodi_cache() -!!$ -!!$ ! Evaluate zodi model with newly proposed values for each band and calculate chisq -!!$ do scan = 1, nscan -!!$ ! Skip scan if no accepted data -!!$ do j = 1, ndet -!!$ if (.not. data(i)%tod%scans(scan)%d(j)%accept) cycle -!!$ -!!$ call wall_time(t3) -!!$ call get_zodi_emission(& -!!$ & tod=data(i)%tod, & -!!$ & pix=data(i)%tod%scans(scan)%d(j)%downsamp_pix, & -!!$ & scan=scan, & -!!$ & det=j, & -!!$ & s_zodi_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & -!!$ & s_zodi_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & -!!$ & model=model, & -!!$ & use_lowres_pointing=.true. & -!!$ &) -!!$ call wall_time(t4) -!!$ !if (data(1)%tod%myid == 0) write(*,*) ' CPU1 = ', t4-t3 -!!$ call get_s_zodi(& -!!$ & s_therm=data(i)%tod%scans(scan)%d(j)%downsamp_therm, & -!!$ & s_scat=data(i)%tod%scans(scan)%d(j)%downsamp_scat, & -!!$ & s_zodi=data(i)%tod%scans(scan)%d(j)%downsamp_zodi, & -!!$ & emissivity=powell_emissivity(i, :), & -!!$ & albedo=powell_albedo(i, :) & -!!$ &) -!!$ call wall_time(t3) -!!$ !if (data(1)%tod%myid == 0) write(*,*) ' CPU2 = ', t3-t4 -!!$ -!!$ chisq = sum( & -!!$ & ((data(i)%tod%scans(scan)%d(j)%downsamp_tod & -!!$ & - data(i)%tod%scans(scan)%d(j)%downsamp_sky & -!!$ & - data(i)%tod%scans(scan)%d(j)%downsamp_zodi & -!!$ & )/(data(i)%tod%scans(scan)%d(j)%N_psd%sigma0/sqrt(box_width)))**2 & -!!$ &) -!!$ chisq_tod = chisq_tod + chisq -!!$ chisq_prev(i) = chisq -!!$ call wall_time(t4) -!!$ !if (data(1)%tod%myid == 0) write(*,*) ' CPU3 = ', t4-t3 -!!$ -!!$ -!!$ -!!$ ndof = ndof + size(data(i)%tod%scans(scan)%d(j)%downsamp_tod) -!!$ if (chisq_tod >= 1.d30) exit -!!$ ! call int2string(data(i)%tod%scanid(scan), scan_str) -!!$ ! call open_hdf_file(trim(adjustl("/mn/stornext/u3/metins/dirbe/chains/chains_downsamp/dtodlnl_"//scan_str//".h5")), tod_file, 'w') -!!$ ! call write_hdf(tod_file, '/dtod', data(i)%tod%scans(scan)%d(j)%downsamp_tod) -!!$ ! call write_hdf(tod_file, '/dzodi', data(i)%tod%scans(scan)%d(j)%downsamp_zodi) -!!$ ! call write_hdf(tod_file, '/dsky', data(i)%tod%scans(scan)%d(j)%downsamp_sky) -!!$ ! call write_hdf(tod_file, '/dpix', data(i)%tod%scans(scan)%d(j)%downsamp_pix) -!!$ ! call close_hdf_file(tod_file) -!!$ -!!$ if (data(1)%tod%myid == 0 .and. scan == 1) then -!!$ !write(*,*) "scan = ", data(i)%tod%scanid(scan), sum(abs(data(i)%tod%scans(scan)%d(j)%downsamp_tod)), sum(abs(data(i)%tod%scans(scan)%d(j)%downsamp_sky)), sum(abs(data(i)%tod%scans(scan)%d(j)%downsamp_zodi)), data(i)%tod%scans(scan)%d(j)%N_psd%sigma0 -!!$ open(58,file='res'//trim(data(i)%tod%freq)//'.dat') -!!$ do k = 1, size(data(i)%tod%scans(scan)%d(j)%downsamp_tod) -!!$ write(58,*) data(i)%tod%scans(scan)%d(j)%downsamp_tod(k) & -!!$ & - data(i)%tod%scans(scan)%d(j)%downsamp_sky(k) & -!!$ & - data(i)%tod%scans(scan)%d(j)%downsamp_zodi(k) -!!$ end do -!!$ close(58) -!!$ end if -!!$ call wall_time(t3) -!!$ !if (data(1)%tod%myid == 0) write(*,*) ' CPU4 = ', t3-t4 -!!$ -!!$ end do -!!$ end do -!!$ end do -!!$ ! call mpi_barrier(MPI_COMM_WORLD, ierr) -!!$ ! stop -!!$ -!!$ ! Reduce chisq to root process -!!$ call mpi_reduce(chisq_tod, chisq, 1, MPI_DOUBLE_PRECISION, MPI_SUM, 0, data(1)%tod%comm, ierr) -!!$ call mpi_reduce(ndof, ndof_tot, 1, MPI_INTEGER, MPI_SUM, 0, data(1)%tod%comm, ierr) -!!$ -!!$ call wall_time(t4) -!!$ !if (data(1)%tod%myid == 0) write(*,*) ' CPU5 = ', t4-t3 -!!$ -!!$ if (data(1)%tod%myid == 0) then -!!$ lnL_zodi2 = chisq/ndof_tot -!!$ call wall_time(t2) -!!$ if (ndof_tot > 0) write(*,fmt='(a,e16.8,a,f10.4,a,f8.3)') "chisq_zodi = ", chisq, ", chisq_red = ", chisq/ndof_tot, ", time = ", t2-t1 -!!$ write(*,*) -!!$ ! call print_zodi_model(theta, labels, chisq) -!!$ end if -!!$ end function - - subroutine get_s_zodi_with_n0(s_therm, s_scat, s_zodi, emissivity, albedo, n_0_comp_ratio, comp) - real(sp), dimension(:, :), intent(in) :: s_scat, s_therm - real(sp), dimension(:), intent(inout) :: s_zodi - real(dp), dimension(:), intent(in) :: emissivity, albedo, n_0_comp_ratio - integer(i4b) :: comp - integer(i4b) :: i - - s_zodi = 0. - do i = 1, size(s_therm, dim= 2) - s_zodi = s_zodi + (s_scat(:, i) * albedo(i) + (1. - albedo(i)) * emissivity(i) * s_therm(:, i)) * n_0_comp_ratio(i) - end do - end subroutine get_s_zodi_with_n0 - - subroutine parse_samp_group_strings(samp_group_str, param_labels, param_indices) + subroutine parse_samp_group_strings(samp_group_str, param_labels, param_indices) + implicit none character(len=*), intent(in) :: samp_group_str character(len=*), intent(in) :: param_labels(:) integer(i4b), allocatable, intent(inout) :: param_indices(:) @@ -1924,250 +792,7 @@ subroutine parse_samp_group_strings(samp_group_str, param_labels, param_indices) end do param_indices = pack(param_indices, param_indices > 0) end subroutine - - -!!$ subroutine zodi_model_to_ascii(cpar, model, filename, overwrite) -!!$ ! Dumps the zodi model to an ascii file on the format {COMP}_{PARAM} = {VALUE}. -!!$ class(ZodiModel), target, intent(in) :: model -!!$ type(comm_params), intent(in) :: cpar -!!$ character(len=*), intent(in) :: filename -!!$ logical(lgt), intent(in), optional :: overwrite -!!$ -!!$ integer(i4b) :: io, i, j, running_idx -!!$ logical(lgt) :: exists, overwrite_ -!!$ real(dp), allocatable :: params(:) -!!$ integer(i4b), allocatable :: comp_switch_indices(:) -!!$ character(len=128), allocatable :: labels(:) -!!$ character(len=512) :: concatenated_string, val -!!$ -!!$ if (present(overwrite)) then -!!$ overwrite_ = overwrite -!!$ else -!!$ overwrite_ = .false. -!!$ end if -!!$ -!!$ if (cpar%myid_chain /= cpar%root) return -!!$ inquire(file=trim(adjustl(filename)), exist=exists) -!!$ if (exists .and. (.not. overwrite_)) then -!!$ print *, "zodi asciifile: " // trim(adjustl(filename)) // " exists and overwrite = .false." -!!$ stop -!!$ end if -!!$ -!!$ open(newunit=io, file=trim(adjustl(filename)), action="write") -!!$ allocate(params(model%n_params)) -!!$ call model%model_to_params2(params, labels=labels) -!!$ -!!$ allocate(comp_switch_indices(model%n_comps)) -!!$ -!!$ running_idx = 0 -!!$ do i = 1, model%n_comps -!!$ running_idx = running_idx + size(model%comps(i)%labels) -!!$ comp_switch_indices(i) = running_idx -!!$ end do -!!$ -!!$ do i = 1, model%n_params -!!$ if (any(comp_switch_indices == i)) then -!!$ write(io, fmt='(a, T25, a, ES12.5, a)') trim(adjustl(labels(i))), "= ", params(i), new_line('a') -!!$ else -!!$ write(io, fmt='(a, T25, a, ES12.5)') trim(adjustl(labels(i))), "= ", params(i) -!!$ end if -!!$ end do -!!$ -!!$ write(io, fmt='(a)') '' -!!$ do i = 1, numband -!!$ if (trim(data(i)%tod_type) == 'none') cycle -!!$ if (.not. data(i)%tod%subtract_zodi) cycle -!!$ concatenated_string = "" -!!$ do j = 1, model%n_comps -!!$ write(val, fmt='(ES12.5)') model%comps(j)%c%emissivity(i) -!!$ concatenated_string = trim(adjustl(concatenated_string)) // "," // trim(adjustl(val)) -!!$ end do -!!$ write(io, fmt='(a, T25, a, a)') trim(adjustl("EMISSIVITY_"//trim(adjustl(data(i)%tod%freq)))), "= ", trim(adjustl(concatenated_string(2:))) -!!$ end do -!!$ -!!$ write(io, fmt='(a)') '' -!!$ do i = 1, numband -!!$ if (trim(data(i)%tod_type) == 'none') cycle -!!$ if (.not. data(i)%tod%subtract_zodi) cycle -!!$ concatenated_string = "" -!!$ do j = 1, model%n_comps -!!$ write(val, fmt='(ES12.5)') model%comps(j)%c%albedo(i) -!!$ concatenated_string = trim(adjustl(concatenated_string)) // "," // trim(adjustl(val)) -!!$ end do -!!$ write(io, fmt='(a, T25, a, a)') trim(adjustl("ALBEDO_"//trim(adjustl(data(i)%tod%freq)))), "= ", trim(adjustl(concatenated_string(2:))) -!!$ end do -!!$ -!!$ close(io) -!!$ end subroutine -!!$ -!!$ subroutine ascii_to_zodi_model(cpar, model, filename) -!!$ ! Reads in and updates the zodi model from an ascii file on the format {COMP}_{PARAM} = {VALUE}. -!!$ class(ZodiModel), target, intent(inout) :: model -!!$ type(comm_params), intent(in) :: cpar -!!$ character(len=*), intent(in) :: filename -!!$ type(hash_tbl_sll) :: htbl -!!$ -!!$ integer(i4b) :: i, j, io, io_status, ierr, n_comps -!!$ logical(lgt) :: exists -!!$ character(len=512) :: key, val, line -!!$ character(len=128), allocatable :: labels(:) -!!$ characteR(len=128) :: toks(100) -!!$ characteR(len=512) :: concatenated_string -!!$ real(dp), allocatable :: params(:) -!!$ -!!$ allocate(params(model%n_params)) -!!$ !if (cpar%myid_chain == cpar%root) then -!!$ inquire(file=trim(adjustl(filename)), exist=exists) -!!$ if (.not. exists) then -!!$ print *, "zodi asciifile: " // trim(adjustl(filename)) // " does not exist" -!!$ stop -!!$ end if -!!$ -!!$ call init_hash_tbl_sll(htbl, tbl_len=500) -!!$ -!!$ open(newunit=io, file=trim(adjustl(filename)), action="read") -!!$ io_status = 0 -!!$ do while (io_status == 0) -!!$ read(io, "(a)", iostat=io_status) line -!!$ if (io_status == 0 .and. line /= "") then -!!$ j = index(line, "=") -!!$ if (j == 0) then -!!$ print *, "Error: invalid line in ascii file: ", trim(adjustl(line)) -!!$ close(io) -!!$ stop -!!$ end if -!!$ -!!$ key = trim(adjustl(line(:j-1))) -!!$ val = trim(adjustl(line(j+1:))) -!!$ call tolower(key) -!!$ call put_hash_tbl_sll(htbl, trim(adjustl(key)), trim(adjustl(val))) -!!$ end if -!!$ end do -!!$ close(io) -!!$ -!!$ call model%model_to_params2(params, labels) -!!$ params = 0. -!!$ if (size(labels) /= size(params)) stop "Error: size of labels and params do not match" -!!$ do i = 1, size(labels) -!!$ call get_parameter_hashtable(htbl, labels(i), par_dp=params(i)) -!!$ end do -!!$ !end if -!!$ -!!$ !call mpi_bcast(params, size(params), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) -!!$ call model%params_to_model2(params) -!!$ -!!$ do i = 1, numband -!!$ if (trim(data(i)%tod_type) == 'none') cycle -!!$ if (.not. data(i)%tod%subtract_zodi) cycle -!!$ !if (cpar%myid == 0) then -!!$ call get_parameter_hashtable(htbl, trim(adjustl("EMISSIVITY_"//trim(adjustl(data(i)%tod%freq)))), par_string=concatenated_string) -!!$ call get_tokens(trim(adjustl(concatenated_string)), ',', toks, n_comps) -!!$ if (n_comps /= model%n_comps) stop "Error: number of components in ascii file does not match model emissivity" -!!$ do j = 1, n_comps -!!$ read(toks(j), *) model%comps(j)%c%emissivity(i) -!!$ end do -!!$ -!!$ call get_parameter_hashtable(htbl, trim(adjustl("ALBEDO_"//trim(adjustl(data(i)%tod%freq)))), par_string=concatenated_string) -!!$ call get_tokens(trim(adjustl(concatenated_string)), ',', toks, n_comps) -!!$ if (n_comps /= model%n_comps) stop "Error: number of components in ascii file does not match model albedo" -!!$ do j = 1, n_comps -!!$ read(toks(j), *) model%comps(j)%c%albedo(i) -!!$ end do -!!$ !end if -!!$ !call mpi_bcast(data(i)%tod%zodi_emissivity, size(data(i)%tod%zodi_emissivity), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) -!!$ !call mpi_bcast(data(i)%tod%zodi_albedo, size(data(i)%tod%zodi_albedo), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) -!!$ end do -!!$ end subroutine -!!$ -!!$ -!!$ subroutine print_zodi_model(theta, samp_group) -!!$ implicit none -!!$ real(dp), allocatable, intent(in) :: theta(:) -!!$ integer(i4b), intent(in) :: samp_group -!!$ -!!$ integer(i4b) :: i, j, k, l, n, idx, n_cols, col, comp, n_params -!!$ logical(lgt) :: newline -!!$ -!!$ n_cols = 5 -!!$ n_params = size(theta) -!!$ -!!$ ! General parameters -!!$ k = 1 -!!$ if (any(zodi_model%theta_stat(1:zodi_model%n_general_params,samp_group)==0)) then -!!$ write(*, "(a)", advance="no") 'General: ' -!!$ col = 1 -!!$ do i = 1, zodi_model%n_general_params -!!$ if (zodi_model%theta_stat(i,samp_group)==0) then -!!$ if (col > n_cols .or. i == zodi_model%n_general_params) then -!!$ write(*, "(a,a,g0.4,a)") trim(adjustl(zodi_model%par_labels(i))), "=", theta(k), ", " -!!$ col = 1 -!!$ else -!!$ write(*, "(a,a,g0.4,a)", advance="no") trim(adjustl(zodi_model%par_labels(i))), "=", theta(k), ", " -!!$ col = col+1 -!!$ end if -!!$ k = k+1 -!!$ end if -!!$ end do -!!$ end if -!!$ -!!$ ! Component parameters -!!$ do j = 1, zodi_model%n_comps -!!$ idx = zodi_model%comps(j)%start_ind -!!$ n = zodi_model%comps(j)%npar + 2*numband -!!$ if (all(zodi_model%theta_stat(idx:idx+n-1,samp_group)/=0)) cycle -!!$ write(*, "(a,a)", advance="no") trim(adjustl(zodi_model%comp_labels(j))),': ' -!!$ col = 1 -!!$ do i = idx, idx+n-1 -!!$ newline = (i==idx+n-1) .or. col == n_cols-1 -!!$ if (zodi_model%theta_stat(i,samp_group)==0) then -!!$ write(*, "(a,a,a,g0.4,a)", advance="no") " ", trim(adjustl(zodi_model%par_labels(i))), "=", theta(k), ", " -!!$ k = k+1 -!!$ col = col+1 -!!$ end if -!!$ if (newline .and. col>1) then -!!$ write(*,*) -!!$ col = 1 -!!$ end if -!!$ end do -!!$ end do -!!$ -!!$ ! Monopoles -!!$ col = 1 -!!$ write(*, "(a)", advance="no") 'Mono : ' -!!$ do j = 1, numband -!!$ idx = zodi_model%npar_tot - numband + j -!!$ if (zodi_model%theta_stat(idx,samp_group)==0) then -!!$ write(*, "(a,a,a,g0.4,a)", advance="no") " ", trim(adjustl(data(j)%label)), "=", theta(k), ", " -!!$ k = k+1 -!!$ col = col+1 -!!$ end if -!!$ if ((col == n_cols-1 .and. col>1) .or. j == numband) then -!!$ write(*,*) -!!$ col = 1 -!!$ end if -!!$ end do -!!$ -!!$ end subroutine - subroutine min_max_param_vec_with_priors(params, priors) - real(dp), intent(inout) :: params(:) - real(dp), intent(in) :: priors(:, :) - integer(i4b) :: i - - if (size(params) /= size(priors,1)) then - write(*,*) "Error: params and priors must have the same size", size(params), size(priors,1) - stop - end if - do i = 1, size(params) - if (priors(i, 3) == 1) cycle ! (0 is uniform, 1 is gaussian) - if (params(i) < priors(i, 1)) then - params(i) = priors(i, 1) - else if (params(i) > priors(i, 2)) then - params(i) = priors(i, 2) - end if - end do - - end subroutine subroutine randomize_zodi_init(x, samp_group, cpar, handle, rms) implicit none @@ -2188,7 +813,8 @@ subroutine randomize_zodi_init(x, samp_group, cpar, handle, rms) do i = 1, zodi_model%npar_tot if (zodi_model%theta_stat(i,samp_group) == 0) then j = j+1 - x(j) = x(j) * (1.d0 + eps*rand_gauss(handle)) + x(j) = x(j) + eps*zodi_model%theta_scale(i,2)*rand_gauss(handle) + !x(j) = x(j) * (1.d0 + eps*rand_gauss(handle)) x(j) = max(x(j), zodi_model%theta_prior(1,i)) x(j) = min(x(j), zodi_model%theta_prior(2,i)) end if @@ -2197,141 +823,12 @@ subroutine randomize_zodi_init(x, samp_group, cpar, handle, rms) call mpi_bcast(x, size(x), MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) end subroutine randomize_zodi_init - - - subroutine model_to_params(zodi, x, samp_group) - implicit none - class(ZodiModel), intent(in) :: zodi - real(dp), dimension(:), intent(out) :: x - integer(i4b), intent(in), optional :: samp_group - - integer(i4b) :: i, j, idx - real(dp), allocatable, dimension(:) :: z - - allocate(z(zodi%npar_tot)) - - ! General parameters - z(1) = zodi%T_0 - z(2) = zodi%delta - idx = zodi%n_general_params - - ! Component parameters - do i = 1, zodi%n_comps - ! Shape parameters - call zodi%comps(i)%c%model2param(z(idx+1:idx+zodi%comps(i)%npar)) - idx = idx + zodi%comps(i)%npar - - ! Emissivity and albedo - do j = 1, numband - if (data(j)%tod_type == "none") then - z(idx +j) = 0.d0 - z(idx+numband+j) = 0.d0 - else - z(idx +j) = zodi%comps(i)%c%emissivity(j) - z(idx+numband+j) = zodi%comps(i)%c%albedo(j) - end if - end do - idx = idx + 2*numband - end do - - ! Monopoles - do i = 1, numband - idx = idx+1 - if (data(i)%tod_type /= "none") then - z(idx) = band_monopole(i) !get_monopole_amp(data(i)%label) - !write(*,*) 'get', i, trim(data(i)%label), z(idx) - else - z(idx) = 0.d0 - end if - end do - - if (present(samp_group)) then - x = pack(z, zodi%theta_stat(:,samp_group)==0) - else - x = z - end if - deallocate(z) - - end subroutine model_to_params - - subroutine params_to_model(zodi, x, samp_group) - implicit none - class(ZodiModel), intent(inout) :: zodi - real(dp), dimension(:), intent(in) :: x - integer(i4b), intent(in), optional :: samp_group - - integer(i4b) :: i, j, idx - real(dp), allocatable, dimension(:) :: z, z_prev - - allocate(z(zodi%npar_tot)) - - ! Initialize full parameter vector - if (present(samp_group)) then - allocate(z_prev(zodi%npar_tot)) - call model_to_params(zodi, z_prev) - idx = 1 - do i = 1, zodi%npar_tot - if (zodi%theta_stat(i,samp_group) == 0) then - z(i) = x(idx) - idx = idx+1 - else if (zodi%theta_stat(i,samp_group) == -1) then - z(i) = z_prev(i) - else if (zodi%theta_stat(i,samp_group) == -2) then - z(i) = 0.d0 - else if (zodi%theta_stat(i,samp_group) == -3) then - z(i) = 1.d0 - end if - end do - do i = 1, zodi%npar_tot - if (zodi%theta_stat(i,samp_group) > 0) then - z(i) = z(zodi%theta_stat(i,samp_group)) - end if - end do - deallocate(z_prev) - else - z = x - end if - - ! General parameters - zodi%T_0 = z(1) - zodi%delta = z(2) - - ! Component parameters - idx = zodi%n_general_params - do i = 1, zodi%n_comps - ! Shape parameters - call zodi%comps(i)%c%param2model(z(idx+1:idx+zodi%comps(i)%npar)) - call zodi%comps(i)%c%init() - - ! Emissivity and albedo - idx = idx + zodi%comps(i)%npar - do j = 1, numband - if (data(j)%tod_type /= "none") then - zodi%comps(i)%c%emissivity(j) = z(idx+j) - zodi%comps(i)%c%albedo(j) = z(idx+numband+j) - end if - end do - idx = idx + 2*numband - end do - - ! Monopoles - do i = 1, numband - idx = idx+1 - if (data(i)%tod_type /= "none") then - !write(*,*) 'set', i, trim(data(i)%label), z(idx) - !call set_monopole_amp(data(i)%label, z(idx)) - band_monopole(i) = z(idx) - end if - end do - - deallocate(z) - - end subroutine params_to_model - subroutine sample_static_zodi_map(cpar, handle) + subroutine sample_static_zodi_map(cpar, handle, map_id) implicit none type(comm_params), intent(inout) :: cpar - type(planck_rng), intent(inout) :: handle + type(planck_rng), intent(inout) :: handle + character(len=*), intent(in) :: map_id integer(i4b) :: band, i, j, k, ndet, scan, nscan, npix, nmaps, p, ierr, ntod, nhorn, npix_band, ncomp, nactive real(dp) :: res, w, vec(3), elon, amp @@ -2351,7 +848,16 @@ subroutine sample_static_zodi_map(cpar, handle) logical(lgt), allocatable, dimension(:) :: active if (cpar%myid == 0) then - write(*,*) ' Sampling solar centric model maps' + if (trim(map_id) == 'solar') then + write(*,*) ' Sampling solar centric model maps' + else if (trim(map_id) == 'moon') then + write(*,*) ' Sampling Moon centric model maps' + else if (trim(map_id) == 'earth') then + write(*,*) ' Sampling Earth centric model maps' + else + write(*,*) ' Unknown static map type = ', trim(map_id) + stop + end if end if ncomp = zodi_model%n_comps @@ -2359,19 +865,35 @@ subroutine sample_static_zodi_map(cpar, handle) do band = 1, numband if (trim(data(band)%tod_type) == 'none') cycle - model = cpar%ds_tod_solar_model(data(band)%tod%band) + if (trim(map_id) == 'solar') then + model = cpar%ds_tod_solar_model(data(band)%tod%band) + else if (trim(map_id) == 'moon') then + model = cpar%ds_tod_moon_model(data(band)%tod%band) + else if (trim(map_id) == 'earth') then + model = cpar%ds_tod_earth_model(data(band)%tod%band) + end if if (trim(model) == 'none') cycle if (model(1:1) == '>') then do i = 1, numband if (trim(data(i)%label) == trim(model(2:))) then - data(band)%tod%map_solar => data(i)%tod%map_solar + if (trim(map_id) == 'solar') then + data(band)%tod%map_solar => data(i)%tod%map_solar + else if (trim(map_id) == 'moon') then + data(band)%tod%map_moon => data(i)%tod%map_moon + else if (trim(map_id) == 'earth') then + data(band)%tod%map_earth => data(i)%tod%map_earth + end if exit end if end do cycle end if - - npix = 12*data(band)%info%nside**2 + + if (trim(map_id) == 'earth') then + npix = NBIN_EARTH_ELON + else + npix = 12*data(band)%info%nside**2 + end if ! Allocate temporary map structures allocate(A(0:npix-1), b(0:npix-1)) @@ -2423,8 +945,6 @@ subroutine sample_static_zodi_map(cpar, handle) ! Get data and pointing allocate(pix(ntod, nhorn), psi(ntod, nhorn), flag(ntod), tod(ntod), mask(ntod)) - !allocate(flag(ntod), tod(ntod), mask(ntod)) - !call data(i)%tod%decompress_pointing_and_flags(scan, j, flag=flag) if (data(i)%tod%compressed_tod) then call data(i)%tod%decompress_tod(scan, j, tod) else @@ -2436,7 +956,6 @@ subroutine sample_static_zodi_map(cpar, handle) do k = 1, data(i)%tod%scans(scan)%ntod mask(k) = procmask(pix(k, 1)) if (iand(flag(k), data(i)%tod%flag0) .ne. 0) mask(k) = 0. - !vec(:, k) = data(i)%tod%ind2vec(:, data(i)%tod%pix2ind(pix(k, 1))) end do where (mask > 0.5) mask = 1. @@ -2444,25 +963,27 @@ subroutine sample_static_zodi_map(cpar, handle) mask = 0. end where - ! Compute non-stationary zodi TOD - call get_s_tot_zodi(zodi_model, data(i)%tod, j, scan, s_zodi, pix_dynamic=pix) - - !call get_zodi_emission(tod=data(i)%tod, pix=pix(:,1), scan=scan, & - ! & det=j, s_zodi_scat=s_scat, s_zodi_therm=s_therm, model=zodi_model) - !call get_s_zodi(s_therm=s_therm, s_scat=s_scat, s_zodi=s_zodi, emissivity=em, albedo=al) + ! Compute non-stationary zodi TOD; exclude current static component + call get_s_tot_zodi(zodi_model, data(i)%tod, j, scan, s_zodi, pix_dynamic=pix, exclude_static=map_id) ! Add residual to mapmaking equation in solar centric coordinates w = 1.d0/data(i)%tod%scans(scan)%d(j)%N_psd%sigma0**2 amp = 1.d0 !zodi_model%amp_static(i) do k = 1, ntod if (mask(k) == 0) cycle - p = data(i)%tod%scans(scan)%d(j)%pix_sol(k,1) - - call pix2vec_ring(data(i)%tod%nside, p, vec) - elon = acos(min(max(vec(1),-1.d0),1.d0)) * 180.d0/pi + if (trim(map_id) == 'solar') then + p = data(i)%tod%scans(scan)%d(j)%pix_sol(k,1) + else if (trim(map_id) == 'moon') then + p = data(i)%tod%scans(scan)%d(j)%pix_moon(k,1) + else if (trim(map_id) == 'earth') then + p = max(min(int(data(i)%tod%scans(scan)%d(j)%earth_elon(k,1) / (pi/NBIN_EARTH_ELON)), NBIN_EARTH_ELON),1) + end if + + !call pix2vec_ring(data(i)%tod%nside, p, vec) + !elon = acos(min(max(vec(1),-1.d0),1.d0)) * 180.d0/pi s_sky(k) = map_sky(1, data(i)%tod%pix2ind(pix(k, 1)), j, 1) ! zodi is only temperature (for now) - res = tod(k) - (s_zodi(k)+s_sky(k)) + res = tod(k) / data(i)%tod%scans(scan)%d(j)%gain - (s_zodi(k)+s_sky(k)) A(p) = A(p) + w * amp * amp b(p) = b(p) + w * amp * res end do @@ -2478,20 +999,37 @@ subroutine sample_static_zodi_map(cpar, handle) call mpi_allreduce(MPI_IN_PLACE, b, size(b), MPI_DOUBLE_PRECISION, MPI_SUM, cpar%comm_chain, ierr) ! Solve for best-fit map - if (.not. associated(data(band)%tod%map_solar)) then - allocate(data(band)%tod%map_solar(0:12*data(band)%info%nside**2-1,1)) + if (trim(map_id) == 'solar' .and. .not. associated(data(band)%tod%map_solar)) allocate(data(band)%tod%map_solar(0:12*data(band)%info%nside**2-1,1)) + if (trim(map_id) == 'moon' .and. .not. associated(data(band)%tod%map_moon)) allocate(data(band)%tod%map_moon(0:12*data(band)%info%nside**2-1,1)) + if (trim(map_id) == 'earth' .and. .not. associated(data(band)%tod%map_earth)) allocate(data(band)%tod%map_earth(NBIN_EARTH_ELON)) + + if (trim(map_id) == 'solar') then + where (A > 0.d0) + data(band)%tod%map_solar(:,1) = b/A + elsewhere + data(band)%tod%map_solar(:,1) = -1.6375d30 + end where + end if + + if (trim(map_id) == 'moon') then + where (A > 0.d0) + data(band)%tod%map_moon(:,1) = b/A + elsewhere + data(band)%tod%map_moon(:,1) = -1.6375d30 + end where end if - where (A > 0.d0) - !zodi_model%map_static(:,1) = b/A - data(band)%tod%map_solar(:,1) = b/A - elsewhere - !zodi_model%map_static(:,1) = -1.6375d30 - data(band)%tod%map_solar(:,1) = -1.6375d30 - end where - - if (cpar%myid_chain == 0) then - call write_map2('static_'//trim(data(band)%label)//'.fits', real(data(band)%tod%map_solar,dp)) + + if (trim(map_id) == 'earth') then + where (A > 0.d0) + data(band)%tod%map_earth = b/A + elsewhere + data(band)%tod%map_earth = -1.6375d30 + end where end if + +!!$ if (cpar%myid_chain == 0) then +!!$ call write_map2('static_'//trim(data(band)%label)//'.fits', real(data(band)%tod%map_solar,dp)) +!!$ end if ! Clean up deallocate(A, b, active) @@ -2502,188 +1040,4 @@ subroutine sample_static_zodi_map(cpar, handle) end subroutine sample_static_zodi_map - -!!$ subroutine sample_static_zodi_amps(cpar, handle) -!!$ implicit none -!!$ type(comm_params), intent(inout) :: cpar -!!$ type(planck_rng), intent(inout) :: handle -!!$ -!!$ integer(i4b) :: band, i, j, k, ndet, scan, nscan, npix, nmaps, p, ierr, ntod, nhorn, npix_band, ncomp, refband -!!$ real(dp) :: res, w, vec(3), elon -!!$ character(len=128) :: reflabel -!!$ real(dp), allocatable, dimension(:) :: A, b -!!$ real(sp), allocatable, dimension(:) :: s_sky -!!$ real(sp), allocatable, dimension(:,:) :: s_scat, s_therm -!!$ real(sp), allocatable, dimension(:) :: s_zodi, s_static -!!$ real(sp), allocatable, dimension(:,:,:,:) :: map_sky -!!$ type(map_ptr), allocatable, dimension(:,:) :: sky_signal -!!$ real(sp), allocatable, dimension(:) :: tod, mask, procmask_zodi -!!$ real(dp), allocatable, dimension(:,:) :: m_buf -!!$ integer(i4b), allocatable, dimension(:,:) :: pix, psi -!!$ integer(i4b), allocatable, dimension(:) :: flag -!!$ -!!$ if (cpar%myid == 0) then -!!$ write(*,*) ' Sampling static zodi amplitudes' -!!$ end if -!!$ -!!$ npix = 12*cpar%zodi_solar_nside**2 -!!$ nmaps = 1 -!!$ ncomp = zodi_model%n_comps -!!$ -!!$ ! Find reference band -!!$ refband = 0 -!!$ reflabel = 'none' -!!$ do i = 1, numband -!!$ if (trim(data(i)%label) == trim(cpar%zs_refband)) then -!!$ refband = i -!!$ reflabel = data(refband)%instlabel -!!$ exit -!!$ end if -!!$ end do -!!$ -!!$ ! Allocate temporary map structures -!!$ allocate(A(numband), b(numband), amp_old(numband)) -!!$ A = 0.d0; b = 0.d0 -!!$ amp_old = zodi_model%amp_static -!!$ -!!$ ! Add up contributions from all bands -!!$ do i = 1, numband -!!$ if (data(i)%tod_type == "none") cycle -!!$ if (.not. data(i)%tod%sample_zodi) cycle -!!$ if (trim(data(i)%label) == trim(cpar%zs_refband)) cycle -!!$ if (trim(data(i)%instlabel) == trim(reflabel)) cycle -!!$ -!!$ ndet = data(i)%tod%ndet -!!$ nscan = data(i)%tod%nscan -!!$ nhorn = data(i)%tod%nhorn -!!$ npix_band = 12*data(i)%map%info%nside**2 -!!$ -!!$ ! Set amplitude to 1 during these calculations -!!$ zodi_model%amp_static(i) = 1.d0 -!!$ -!!$ ! Get and distribute sky signal -!!$ allocate(sky_signal(data(i)%tod%ndet,1)) -!!$ do j = 1, data(i)%tod%ndet -!!$ call get_sky_signal(i, j, sky_signal(j,1)%p, mono=.true.) -!!$ end do -!!$ allocate (map_sky(nmaps, data(i)%tod%nobs, 0:data(i)%tod%ndet, 1)) -!!$ call distribute_sky_maps(data(i)%tod, sky_signal, 1.e0, map_sky) -!!$ -!!$ ! Initialize frequency-specific mask -!!$ allocate(m_buf(0:npix_band-1, nmaps), procmask_zodi(0:npix_band-1)) -!!$ call data(i)%tod%procmask_zodi%bcast_fullsky_map(m_buf); procmask_zodi = m_buf(:, 1) -!!$ deallocate(m_buf) -!!$ -!!$ ! Sum up contributions -!!$ do scan = 1, nscan -!!$ ntod = data(i)%tod%scans(scan)%ntod -!!$ allocate(s_scat(ntod,ncomp), s_therm(ntod,ncomp), s_zodi(ntod), s_sky(ntod), s_static(ntod)) -!!$ -!!$ do j = 1, ndet -!!$ if (.not. data(i)%tod%scans(scan)%d(j)%accept) cycle -!!$ -!!$ ! Get data and pointing -!!$ allocate(pix(ntod, nhorn), psi(ntod, nhorn), flag(ntod), tod(ntod), mask(ntod)) -!!$ if (data(i)%tod%compressed_tod) then -!!$ call data(i)%tod%decompress_tod(scan, j, tod) -!!$ else -!!$ tod = data(i)%tod%scans(scan)%d(j)%tod -!!$ end if -!!$ -!!$ ! Set up mask; remove flagged samples and foreground contaminated regions -!!$ call data(i)%tod%decompress_pointing_and_flags(scan, j, pix, psi, flag) -!!$ do k = 1, data(i)%tod%scans(scan)%ntod -!!$ mask(k) = procmask_zodi(pix(k, 1)) -!!$ if (iand(flag(k), data(i)%tod%flag0) .ne. 0) mask(k) = 0. -!!$ end do -!!$ where (mask > 0.5) -!!$ mask = 1. -!!$ elsewhere -!!$ mask = 0. -!!$ end where -!!$ -!!$ ! Compute zodi TODs -!!$ call get_s_tot_zodi(zodi_model, data(i)%tod, j, scan, s_zodi, pix_dynamic=pix) -!!$ call get_s_tot_zodi(zodi_model, data(i)%tod, j, scan, s_static, pix_static=data(i)%tod%scans(scan)%d(j)%pix_sol) -!!$ -!!$ ! Add residual to normal equations -!!$ w = 1.d0/data(i)%tod%scans(scan)%d(j)%N_psd%sigma0**2 -!!$ do k = 1, ntod -!!$ if (mask(k) == 0) cycle -!!$ s_sky(k) = map_sky(1, data(i)%tod%pix2ind(pix(k, 1)), j, 1) ! zodi is only temperature (for now) -!!$ A(i) = A(i) + w * s_static(k) * s_static(k) -!!$ b(i) = b(i) + w * s_static(k) * (tod(k) - (s_zodi(k)+s_sky(k))) -!!$ end do -!!$ deallocate(pix, psi, flag, tod, mask) -!!$ end do -!!$ deallocate(s_scat, s_therm, s_zodi, s_sky, s_static) -!!$ end do -!!$ deallocate(procmask_zodi,map_sky, sky_signal) -!!$ end do -!!$ -!!$ ! Gather information across cores -!!$ call mpi_allreduce(MPI_IN_PLACE, A, size(A), MPI_DOUBLE_PRECISION, MPI_SUM, cpar%comm_chain, ierr) -!!$ call mpi_allreduce(MPI_IN_PLACE, b, size(b), MPI_DOUBLE_PRECISION, MPI_SUM, cpar%comm_chain, ierr) -!!$ -!!$ ! Solve for best-fit amplitudes -!!$ if (cpar%myid_chain == 0) then -!!$ ! Collect data from bands with same instrument -!!$ -!!$ do i = 1, numband -!!$ do j = i+1, numband -!!$ if (trim(data(j)%instlabel) == trim(data(i)%instlabel)) then -!!$ A(i) = A(i) + A(j) -!!$ b(i) = b(i) + b(j) -!!$ end if -!!$ end do -!!$ end do -!!$ -!!$ ! Solve for new amplitudes -!!$ do i = 1, numband -!!$ if (trim(data(i)%instlabel) == trim(reflabel)) cycle -!!$ if (A(i) > 0.d0) then -!!$ if (trim(cpar%operation) == 'optimize') then -!!$ zodi_model%amp_static(i) = b(i)/A(i) -!!$ else if (trim(cpar%operation) == 'sample') then -!!$ zodi_model%amp_static(i) = b(i)/A(i) + rand_gauss(handle) / sqrt(A(i)) -!!$ else -!!$ write(*,*) 'Unknown operation in sample_static_zodi_amps = ', trim(cpar%operation) -!!$ end if -!!$ else -!!$ zodi_model%amp_static(i) = 0.d0 -!!$ end if -!!$ zodi_model%amp_static(i) = max(zodi_model%amp_static(i), 0.d0) -!!$ end do -!!$ -!!$ ! Synchronize amplitudes for bands with same instrument -!!$ do i = 1, numband -!!$ do j = i+1, numband -!!$ if (trim(data(j)%instlabel) == trim(data(i)%instlabel)) then -!!$ zodi_model%amp_static(j) = zodi_model%amp_static(i) -!!$ end if -!!$ end do -!!$ end do -!!$ -!!$ -!!$ end if -!!$ -!!$ call mpi_bcast(zodi_model%amp_static, numband, MPI_DOUBLE_PRECISION, cpar%root, cpar%comm_chain, ierr) -!!$ -!!$ ! Output to screen -!!$ if (cpar%myid == 0) then -!!$ do i = 1, numband -!!$ if (zodi_model%amp_static(i) /= amp_old(i) .and. zodi_model%amp_static(i) /= 0.d0) then -!!$ write(*,fmt='(a,a,a,f8.3,a,f8.3)') ' Static amp: Band = ', trim(data(i)%label), ', old = ', amp_old(i), ', new = ', zodi_model%amp_static(i) -!!$ end if -!!$ end do -!!$ end if -!!$ -!!$ ! Clean up -!!$ deallocate(A, b, amp_old) -!!$ -!!$ call mpi_finalize(ierr) -!!$ stop -!!$ -!!$ end subroutine sample_static_zodi_amps - -end module + end module comm_zodi_samp_mod diff --git a/commander3/src/commander.f90 b/commander3/src/commander.f90 index f9a18b0ac..20f926440 100644 --- a/commander3/src/commander.f90 +++ b/commander3/src/commander.f90 @@ -22,6 +22,8 @@ program commander use comm_nonlin_mod use comm_mh_specind_mod use comm_zodi_samp_mod + use comm_sparse_mod + use comm_dust_extinction_mod implicit none integer(i4b) :: i, j, l, iargc, ierr, iter, stat, first_sample, samp_group, curr_samp, tod_freq, modfact @@ -31,10 +33,6 @@ program commander type(planck_rng) :: handle, handle_noise character(len=6) :: samptext - ! param_vec for zodi (REMOVE THIS AFTER ATLAS) - ! type(zodi_model) :: current_model, previous_model - ! real(dp), allocatable :: param_vec(:) - type(comm_mapinfo), pointer :: info => null() type(comm_map), pointer :: m => null() class(comm_comp), pointer :: c1 => null() @@ -46,15 +44,25 @@ program commander integer :: arg_indx real(dp), allocatable :: param_test(:) - real(dp) :: time_step + real(dp) :: time_step, lambda, A_ext(1) integer(i4b), dimension(2) :: bands_to_sample, bands_to_calibrate_against + real(dp), allocatable :: theta(:), theta_new(:), theta_old(:), scale(:) + integer(i4b) :: ntot, npar + bands_to_sample = (/1,2/) bands_to_calibrate_against= (/1,2/) ! Giving the simple command line arguments for user to chose from. comm3_args: do arg_indx = 1, command_argument_count() - call get_command_argument(arg_indx, arg) + call get_command_argument(arg_indx, arg, j, stat) + if (stat .ne. 0) then + if (stat == -1) then + write(*,*) 'Command line argument was truncated: ', arg + else + write(*,*) 'Command line argument retrieval failed: ', arg + end if + end if select case (arg) case ('-v', '--version') @@ -67,10 +75,7 @@ program commander call print_help() call exit(0) case default - !print '(2a, /)', 'Unrecognised command-line option: ', arg - !call print_help() - !call exit(0) - exit comm3_args + exit comm3_args end select end do comm3_args !---------------------------------------------------------------------------------- @@ -95,6 +100,14 @@ program commander status%active = cpar%myid_chain == 0 !.false. call timer%start(TOT_RUNTIME); call timer%start(TOT_INIT) +!!$ call initialize_dust_extinction_mod(cpar) +!!$ do i = 1, 1000 +!!$ lambda = 0.09 + (i-1)/(1000-1.d0)*33.d0 +!!$ call get_dust_attenuation_pos([0.d0,1.d0,0.d0], [c/(lambda*1d-6)], A_ext) +!!$ end do +!!$ call mpi_finalize(ierr) +!!$ stop + !!! if (cpar%myid == cpar%root) then !!! allocate(param_test(200)) !!! param_test = 0.5d0 @@ -105,30 +118,6 @@ program commander !!! write(*,*) "last", param_test(1) !!! end if -!!$ n = 100000 -!!$ q = 100000 -!!$ allocate(arr(n)) -!!$ do i = 1, n -!!$ allocate(arr(i)%p(q)) -!!$ arr(i)%p = i -!!$ if (mod(i,1000) == 0) then -!!$ write(*,*) 'up', arr(i)%p(6) -!!$ call update_status(status, "debug") -!!$ end if -!!$ end do -!!$ -!!$ do i = 1, n -!!$ deallocate(arr(i)%p) -!!$ if (mod(i,1000) == 0) then -!!$ write(*,*) 'down', i -!!$ call update_status(status, "debug2") -!!$ end if -!!$ end do -!!$ deallocate(arr) -!!$ stop - - - if (iargc() == 0) then if (cpar%myid == cpar%root) write(*,*) 'Usage: commander [parfile] {sample restart}' call MPI_Finalize(ierr) @@ -149,8 +138,6 @@ program commander write(*,fmt='(a,i12,t70,a)') ' | Number of chains = ', cpar%numchain, '|' write(*,fmt='(a,i12,t70,a)') ' | Number of processors in first chain = ', cpar%numprocs_chain, '|' write(*,fmt='(a,t70,a)') ' |', '|' -! write(*,fmt='(a,f12.3,a,t70,a)') ' | Time to initialize run = ', t2-t0, ' sec', '|' -! write(*,fmt='(a,f12.3,a,t70,a)') ' | Time to read in parameters = ', t3-t1, ' sec', '|' write(*,fmt='(a)') ' ---------------------------------------------------------------------' end if @@ -169,8 +156,9 @@ program commander end if call define_cg_samp_groups(cpar) - call initialize_bp_mod(cpar); call update_status(status, "init_bp") - call initialize_data_mod(cpar, handle); call update_status(status, "init_data") + call initialize_bp_mod(cpar); call update_status(status, "init_bp") + call initialize_dust_extinction_mod(cpar); call update_status(status, "init_ext") + call initialize_data_mod(cpar, handle); call update_status(status, "init_data") call initialize_inter_tod_params(cpar) @@ -200,9 +188,6 @@ program commander if (trim(adjustl(cpar%zs_init_ascii)) /= 'none') call ascii_to_zodi_model(cpar, zodi_model, cpar%zs_init_ascii) end if -!write(*,*) 'Setting gain to 1' -!data(6)%gain = 1.d0 - ! Make sure TOD and BP modules agree on initial bandpass parameters ok = trim(cpar%cs_init_inst_hdf) /= 'none' if (ok) ok = trim(cpar%init_chain_prefix) /= 'none' @@ -230,7 +215,6 @@ program commander ! ************************************************************** if (cpar%myid == cpar%root .and. cpar%verbosity > 0) then - !write(*,*) '|' write(*,fmt='(a)') ' ---------------------------------------------------------------------' write(*,fmt='(a,f12.3,a)') ' | Time to read data = ', t2-t1, ' sec' write(*,*) '| Starting Gibbs sampling' @@ -238,35 +222,23 @@ program commander ! Prepare chains call init_chain_file(cpar, first_sample) - !first_sample = 1 if (first_sample == -1) then call output_FITS_sample(cpar, 0, .true.) ! Output initial point to sample 0 first_sample = 1 else ! Re-initialise seeds and reinitialize call initialize_mpi_struct(cpar, handle, handle_noise, reinit_rng=first_sample) - !first_sample = 10 - !first_sample=first_sample-1 ! Reject last sample, which may be corrupt call initialize_from_chain(cpar, handle, init_samp=first_sample, init_from_output=.true., first_call=.true.) first_sample = first_sample+1 end if call timer%stop(TOT_INIT) - !data(1)%bp(0)%p%delta(1) = data(1)%bp(0)%p%delta(1) + 0.2 - !data(2)%bp(0)%p%delta(1) = data(1)%bp(0)%p%delta(1) + 0.2 ! Run Gibbs loop iter = first_sample first = .true. first_zodi = .true. - modfact = 1; if (cpar%enable_TOD_analysis .and. cpar%sample_zodi .and. (cpar%sample_signal_amplitudes .or. cpar%sample_specind)) modfact = 2 - !---------------------------------------------------------------------------------- - ! Part of Simulation routine - !---------------------------------------------------------------------------------- - ! Will make only one full gibbs loop to produce simulations - !if (cpar%enable_tod_simulations) cpar%num_gibbs_iter = 2 - !---------------------------------------------------------------------------------- - + modfact = 1; if (cpar%enable_TOD_analysis .and. cpar%sample_zodi .and. (cpar%sample_signal_amplitudes .or. cpar%sample_specind .or. cpar%mcmc_num_samp_groups > 0)) modfact = 2 do while (iter <= cpar%num_gibbs_iter) ok = .true. @@ -291,6 +263,7 @@ program commander call update_mixing_matrices(update_F_int=.true.) end if end if + !---------------------------------------------------------------------------------- ! Part of Simulation routine !---------------------------------------------------------------------------------- @@ -300,131 +273,97 @@ program commander call copy_tod(cpar, ierr) call write_filelists_to_disk(cpar, ierr) end if + !---------------------------------------------------------------------------------- ! Process TOD structures if (iter > 0 .and. cpar%enable_TOD_analysis .and. (iter <= 2 .or. mod(iter,cpar%tod_freq) == 0)) then - - ! Create zodi atlas - ! if (.false.) then - ! allocate(param_vec(base_zodi_model%N_PARAMETERS)) - ! do i = 1, base_zodi_model%N_PARAMETERS - ! if (cpar%myid == cpar%root) print *, "Creating zodi atlas for parameter: ", i - ! do j = 1, 3 - ! base_zodi_model = sampled_zodi_model - ! base_zodi_model%param_i = i - ! base_zodi_model%up_down_j = j - - ! param_vec = base_zodi_model%model_to_param_vec() - ! if (j == 1) then - ! param_vec(i) = param_vec(i) - 0.1*param_vec(i) - ! else if (j == 3) then - ! param_vec(i) = param_vec(i) + 0.1*param_vec(i) - ! end if - ! call base_zodi_model%param_vec_to_model(param_vec) - ! call process_all_TODs(cpar, cpar%mychain, iter, handle) - ! end do - ! end do - ! end if - - ! if (iter == 1) then ! For faster component separation since we dont sample the cios - - ! First iteration should just be component separation, in case sky model - ! is off + !if (mod(iter,10) == 1 .and. cpar%enable_TOD_analysis .and. (iter <= 2 .or. mod(iter,cpar%tod_freq) == 0)) then call timer%start(TOT_TODPROC) call process_all_TODs(cpar, cpar%mychain, iter, handle) call timer%stop(TOT_TODPROC) end if - if (cpar%enable_tod_simulations) then - ! Skip other steps if TOD simulations - exit - end if - - if (mod(iter,modfact) == 0 .and. iter > 1 .and. cpar%enable_TOD_analysis .and. cpar%sample_zodi) then -! if (.true. .and. cpar%include_tod_zodi) then - call timer%start(TOT_ZODI_SAMP) - call project_and_downsamp_sky(cpar) - if (first_zodi) then - ! in the first tod gibbs iter we precompute timeinvariant downsampled quantities - call downsamp_invariant_structs(cpar) - call precompute_lowres_zodi_lookups(cpar) - end if - -!!$ do i = 1, zodi_model%n_comps -!!$ write(*,*) 'n0', zodi_model%comps(i)%c%n_0 -!!$ end do -!!$ do i = 1, numband -!!$ write(*,*) 'emissivity', data(i)%tod%zodi_emissivity, data(i)%tod%zodi_albedo -!!$ end do - - call compute_downsamp_zodi(cpar, zodi_model) - if (first_zodi) then - call sample_linear_zodi(cpar, handle, iter, zodi_model, verbose=.true.) - call compute_downsamp_zodi(cpar, zodi_model) - call create_zodi_glitch_mask(cpar, handle) - first_zodi = .false. - end if - call apply_zodi_glitch_mask(cpar) - !write(*,*) 'disabling glitch mask' - - ! Sample non-stationary zodi components with geometric 3D model - select case (trim(adjustl(cpar%zs_sample_method))) - case ("mh") - call sample_zodi_group(cpar, handle, iter, zodi_model, verbose=.true.) - case ("powell") - do i = 1, cpar%zs_num_samp_groups - if (iter > 1) call minimize_zodi_with_powell(cpar, iter, handle, i) - end do - end select - - ! Sample stationary zodi components with 2D model - call sample_static_zodi_map(cpar, handle) - !call sample_static_zodi_amps(cpar, handle) + ! Skip other steps if TOD simulations + if (cpar%enable_tod_simulations) exit + + ! Sample zodi parameters + if (mod(iter,modfact) == 0 .and. iter > 0 .and. cpar%enable_TOD_analysis .and. cpar%sample_zodi) then + call timer%start(TOT_ZODI_SAMP) + if (first_zodi) then + ! in the first tod gibbs iter we precompute timeinvariant downsampled quantities + call downsamp_invariant_structs(cpar) + call precompute_lowres_zodi_lookups(cpar) + !call compute_downsamp_zodi(cpar, zodi_model) + call create_zodi_sampgroup_mask(cpar, handle) + first_zodi = .false. + end if + call project_and_downsamp_sky(cpar) + + ! Sample non-stationary zodi components with geometric 3D model + do i = 1, cpar%zs_num_samp_groups + call apply_zodi_sampgroup_mask(cpar, i) + select case (trim(adjustl(cpar%zs_sample_method))) + case ("powell") + call minimize_zodi_with_powell(cpar, iter, handle, i) + end select + end do + + ! Sample stationary components + !if (first_zodi) then + if (cpar%sample_earth_maps) call sample_static_zodi_map(cpar, handle, 'earth') + if (cpar%sample_solar_maps) call sample_static_zodi_map(cpar, handle, 'solar') + if (cpar%sample_moon_maps) call sample_static_zodi_map(cpar, handle, 'moon') + !end if -!!$ if (mod(iter-2,10) == 0) then -!!$ call zodi_model%params_to_model([& -!!$ & 1.198d-7 + 0d-9*rand_gauss(handle), & -!!$ & 2.10d0 + 0.0d0*rand_gauss(handle), & -!!$ & 78.01d0 + 0.d0* rand_gauss(handle), & -!!$ & 3.72d-2 + 0.000d0 * rand_gauss(handle), & -!!$ & 8.71d-3 + 0.000d0 * rand_gauss(handle), & -!!$ & -2.14d-3 + 0.000d0 * rand_gauss(handle), & -!!$ & 0.951d0 + 0.00d0*rand_gauss(handle), & -!!$ & 3.50d0 + 0.00d0*rand_gauss(handle), & -!!$ & 0.822d0 + 0.00d0*rand_gauss(handle), & -!!$ & 0.183d0 + 0.00d0*rand_gauss(handle), & -!!$ & 1d-9 + 3d-10*rand_gauss(handle), & -!!$ & 0.d0, & -!!$ & 0.d0, & -!!$ & 0.d0, & -!!$ & 0.d0, & -!!$ & 0.d0, & -!!$ & 1.d0 + 0.3d0*rand_gauss(handle), & -!!$ & 3.d0 + 0.3*rand_gauss(handle), & -!!$ & 286d0, 0.466863d0]) -!!$ end if -!!$ if (mod(iter-1,2) == 0) then -!!$ call sample_zodi_group(cpar, handle, iter, zodi_model, verbose=.true.) -!!$ else -!!$ call minimize_zodi_with_powell(cpar) -!!$ end if - call timer%stop(TOT_ZODI_SAMP) end if + + if (mod(iter+1,modfact) == 0 .and. iter > 1) then - if (mod(iter+1,modfact) == 0) then + ! Sample linear parameters with CG search; loop over CG sample groups + !call output_FITS_sample(cpar, 1000+iter, .true.) + if (cpar%sample_signal_amplitudes .and. iter > 0) then + ! Do CG group sampling + call sample_all_amps_by_CG(cpar, handle, handle_noise) + ! Perform joint alm-Cl Metropolis move + call timer%start(TOT_CLS) + do i = 1, 3 + if (cpar%resamp_CMB .and. cpar%sample_powspec) call sample_joint_alm_Cl(handle) + end do + call timer%stop(TOT_CLS) + end if + + ! Sample power spectra + call timer%start(TOT_CLS) + if (cpar%sample_powspec) call sample_powspec(handle, ok) + call timer%stop(TOT_CLS) + + + if (iter > 1) then + !if (iter > 3) then + do i = 1, cpar%mcmc_num_samp_groups + if (index(cpar%mcmc_samp_groups(i), ':scale%') .ne. 0) then + if (cpar%myid == 0) write(*,*) '| MH sampling scaling amplitudes' + call sample_template_mh(cpar%outdir, cpar, handle, handle_noise, i) + end if + end do + end if ! Sample non-linear parameters if (iter > 1 .and. cpar%sample_specind) then call timer%start(TOT_SPECIND) call sample_nonlin_params(cpar, iter, handle, handle_noise) call timer%stop(TOT_SPECIND) + + ! Do CG group sampling + call sample_all_amps_by_CG(cpar, handle, handle_noise) end if !if (mod(iter,cpar%thinning) == 0) call output_FITS_sample(cpar, 100+iter, .true.) - + if (iter > 1) then + !if (iter > 3) then do i = 1, cpar%mcmc_num_samp_groups if (index(cpar%mcmc_samp_groups(i), 'gain:') .ne. 0) then if (cpar%myid == 0) write(*,*) '| MH sampling map-based gains' @@ -432,9 +371,6 @@ program commander else if (index(cpar%mcmc_samp_groups(i), ':tab@') .ne. 0) then if (cpar%myid == 0) write(*,*) '| MH sampling tabulated SEDs' call sample_mbbtab_mh(cpar%outdir, cpar, handle, handle_noise, i) - else if (index(cpar%mcmc_samp_groups(i), ':scale%') .ne. 0) then - if (cpar%myid == 0) write(*,*) '| MH sampling scaling amplitudes' - call sample_template_mh(cpar%outdir, cpar, handle, handle_noise, i) else if (cpar%myid == 0) write(*,*) '| MH sampling spectral indices' call sample_specind_mh(cpar%outdir, cpar, handle, handle_noise, i) @@ -442,26 +378,6 @@ program commander end do end if - ! Sample linear parameters with CG search; loop over CG sample groups - !call output_FITS_sample(cpar, 1000+iter, .true.) - if (cpar%sample_signal_amplitudes) then - - ! Do CG group sampling - call sample_all_amps_by_CG(cpar, handle, handle_noise) - - ! Perform joint alm-Cl Metropolis move - call timer%start(TOT_CLS) - do i = 1, 3 - if (cpar%resamp_CMB .and. cpar%sample_powspec) call sample_joint_alm_Cl(handle) - end do - call timer%stop(TOT_CLS) - end if - - ! Sample power spectra - call timer%start(TOT_CLS) - if (cpar%sample_powspec) call sample_powspec(handle, ok) - call timer%stop(TOT_CLS) - end if ! Output sample to disk @@ -469,14 +385,6 @@ program commander if (mod(iter,cpar%thinning) == 0) call output_FITS_sample(cpar, iter, .true.) call timer%stop(TOT_OUTPUT) - ! Sample partial-sky templates - !call sample_partialsky_tempamps(cpar, handle) - - !call output_FITS_sample(cpar, 1000, .true.) - - - - call wall_time(t2) if (ok) then if (cpar%myid_chain == 0) then @@ -661,9 +569,6 @@ subroutine process_all_TODs(cpar, chain, iter, handle) rms => comm_map(data(i)%rmsinfo) call data(i)%tod%process_tod(cpar%outdir, chain, iter, handle, s_sky, delta, data(i)%map, rms, s_gain) - ! Clear zodi cache for next band - if (data(i)%subtract_zodi) call data(i)%tod%clear_zodi_cache() - call timer%incr_numsamp(data(i)%id_abs) if (cpar%myid_chain == 0) then diff --git a/commander3/src/get_deps b/commander3/src/get_deps.sh similarity index 91% rename from commander3/src/get_deps rename to commander3/src/get_deps.sh index cfde50276..579299dce 100755 --- a/commander3/src/get_deps +++ b/commander3/src/get_deps.sh @@ -1,4 +1,7 @@ #!/bin/bash +# Produces makefiles that ocntain the actual dependancies of each file +# usage: bash get_deps.sh *.f90 + declare -A blacklist declare -A srcs_lower diff --git a/commander3/src/math_tools.f90 b/commander3/src/math_tools.f90 index d3ea49023..eb3d54f20 100644 --- a/commander3/src/math_tools.f90 +++ b/commander3/src/math_tools.f90 @@ -33,7 +33,7 @@ module math_tools interface convert_fract2sigma module procedure convert_fract2sigma_sp, convert_fract2sigma_dp - end interface + end interface convert_fract2sigma contains @@ -662,6 +662,65 @@ subroutine compute_hermitian_root(A, pow, trunc) end subroutine compute_hermitian_root + subroutine compute_hermitian_root_sp(A, pow, trunc) + implicit none + + real(sp), intent(in) :: pow + real(sp), dimension(1:,1:), intent(inout) :: A + logical(lgt), intent(in), optional :: trunc + + integer(i8b) :: i, n, liwork, lwork, lda, ldb, info + character(len=1) :: job, uplo + real(sp), allocatable, dimension(:,:) :: V + real(dp), allocatable, dimension(:) :: W, work + integer(i4b), allocatable, dimension(:) :: iwork + + job = 'v' + uplo = 'l' + n = size(A(1,:)) + lda = n + ldb = n + liwork = 5*n + 3 + lwork = 2*n**2 + 6*n + 1 + + ! Perform eigenvalue decomposition + allocate(work(lwork)) + allocate(iwork(liwork)) + allocate(V(n,n)) + allocate(W(n)) + V = A + call dsyevd(job, uplo, n, V, lda, W, work, lwork, iwork, liwork, info) + + if (present(trunc)) then + where (W < 0.d0) + W = 0.d0 + end where + else + if (any(W <= 0.d0)) then +! write(*,*) 'W = ', W + A(1,1) = -1.30 + deallocate(V) + deallocate(W) + deallocate(work) + deallocate(iwork) + return + end if + end if + + ! Re-compose matrix + do i = 1, n + A(i,:) = W(i)**pow * V(:,i) + end do + A = matmul(V, A) + + deallocate(V) + deallocate(W) + deallocate(work) + deallocate(iwork) + + end subroutine compute_hermitian_root_sp + + subroutine compute_hermitian_root_with_mask(A, pow, A2, pow2) implicit none @@ -807,7 +866,7 @@ subroutine invert_singular_matrix(matrix, threshold) integer(i4b) :: myid, i, n real(dp) :: maxeigenval - myid = 1000 + myid = 1000 ! ??? n = size(matrix(1,:)) allocate(matrix2(n,n)) allocate(eigenvals(n)) @@ -1696,4 +1755,5 @@ function calc_linear_regression(x_arr, y_arr, n_lim) end function calc_linear_regression + end module math_tools diff --git a/commander3/src/powell_mod.f90 b/commander3/src/powell_mod.f90 index 85f1bc2d3..d5ed0516e 100644 --- a/commander3/src/powell_mod.f90 +++ b/commander3/src/powell_mod.f90 @@ -141,7 +141,8 @@ end function func end do ! The second test here, fret < 1, is *only* for Anderson-Darling fitting - if (2.d0*(fp-fret) <= epsilon*(abs(fp)+abs(fret))) then + if (2.d0*(fp-fret) <= epsilon*(abs(fp)+abs(fret)) .and. fret /= 1d30) then + !write(*,*) 'powell -- fp = ', fp, ', fret = ', fret, ', epsilon = ', epsilon, ', lhs = ', 2.d0*(fp-fret), ', rhs = ', epsilon*(abs(fp)+abs(fret)) ierr = 0 return end if diff --git a/commander3/src/sharp.f90 b/commander3/src/sharp.f90 index 7f56e9be6..6c01ee374 100644 --- a/commander3/src/sharp.f90 +++ b/commander3/src/sharp.f90 @@ -211,8 +211,8 @@ subroutine sharp_execute_d(type, spin, nmaps, alm, alm_info, map, geom_info, & type(c_ptr), target :: map_ptr(nmaps) mod_flags = SHARP_DP - if (present(add) .and. add) then - mod_flags = or(mod_flags, SHARP_ADD) + if (present(add)) then + if (add) mod_flags = or(mod_flags, SHARP_ADD) end if if (spin == 0) then @@ -220,7 +220,7 @@ subroutine sharp_execute_d(type, spin, nmaps, alm, alm_info, map, geom_info, & else ntrans = nmaps / 2 end if - if (ntrans/=1) print *, "ERROR: ntrans /= 1" + !if (ntrans/=1) print *, "ERROR: ntrans /= 1" ! Set up pointer table to access maps alm_ptr(:) = c_null_ptr diff --git a/commander3/src/sharp_test.f90 b/commander3/src/sharp_test.f90 index 99cadfde9..3e528c445 100644 --- a/commander3/src/sharp_test.f90 +++ b/commander3/src/sharp_test.f90 @@ -1,6 +1,5 @@ program sharp_test use comm_map_mod - use comm_param_mod use ARS_mod implicit none diff --git a/commander3/todscripts/dirbe/metin/__init__.py b/commander3/todscripts/dirbe/archive/__init__.py similarity index 100% rename from commander3/todscripts/dirbe/metin/__init__.py rename to commander3/todscripts/dirbe/archive/__init__.py diff --git a/commander3/todscripts/dirbe/_write_dirbe_instrumentfile_old.py b/commander3/todscripts/dirbe/archive/_write_dirbe_instrumentfile_old.py similarity index 100% rename from commander3/todscripts/dirbe/_write_dirbe_instrumentfile_old.py rename to commander3/todscripts/dirbe/archive/_write_dirbe_instrumentfile_old.py diff --git a/commander3/todscripts/dirbe/_write_filelists_old.py b/commander3/todscripts/dirbe/archive/_write_filelists_old.py similarity index 100% rename from commander3/todscripts/dirbe/_write_filelists_old.py rename to commander3/todscripts/dirbe/archive/_write_filelists_old.py diff --git a/commander3/todscripts/dirbe/bin_dirbe_tods.py b/commander3/todscripts/dirbe/archive/bin_dirbe_tods.py similarity index 100% rename from commander3/todscripts/dirbe/bin_dirbe_tods.py rename to commander3/todscripts/dirbe/archive/bin_dirbe_tods.py diff --git a/commander3/todscripts/dirbe/detect_planets.py b/commander3/todscripts/dirbe/archive/detect_planets.py similarity index 100% rename from commander3/todscripts/dirbe/detect_planets.py rename to commander3/todscripts/dirbe/archive/detect_planets.py diff --git a/commander3/todscripts/dirbe/archive/dirbe_utils.py b/commander3/todscripts/dirbe/archive/dirbe_utils.py new file mode 100644 index 000000000..ebab5ee29 --- /dev/null +++ b/commander3/todscripts/dirbe/archive/dirbe_utils.py @@ -0,0 +1,319 @@ +from __future__ import annotations +from typing import Sequence + +from functools import cache + +from astropy.io import fits +import astropy.units as u +from astropy.time import Time, TimeDelta +from datetime import datetime +import numpy as np +from numpy.typing import NDArray +import re + +import healpy as hp +from astropy.coordinates import get_body, HeliocentricMeanEcliptic +from scipy import interpolate + + +DIRBE_SKYMAP_INFO = "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/DIRBE_SKYMAP_INFO.FITS" +DIRBE_BANDPASSES = "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/bandpass/DIRBE_SYSTEM_SPECTRAL_RESPONSE_TABLE.ASC" +DIRBE_BEAM = "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/beams/DIRBE_BEAM_CHARACTERISTICS_P3B.ASC" +DIRBE_POS_PATH = "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/position/" +DIRBE_POS_FILES = [ + "dmr_anc_spcl_89328_89356.txt", + "dmr_anc_89356_90021.txt", + "dmr_anc_90021_90051.txt", + "dmr_anc_90081_90111.txt", + "dmr_anc_90111_90141.txt", + "dmr_anc_90171_90206.txt", + "dmr_anc_90206_90236.txt", + "dmr_anc_90266_90296.txt", + "dmr_anc_90296_90326.txt", + "dmr_anc_90356_91021.txt", + "dmr_anc_90051_90081.txt", + "dmr_anc_90141_90171.txt", + "dmr_anc_90236_90266.txt", + "dmr_anc_90326_90356.txt", + ] + +BANDS = range(1,11) +DIRBE_START_DATE = Time(datetime(1989, 12, 11)) +DETECTOR_LABELS = ("A", "B", "C") +WAVELENGHTS = (1.25, 2.2, 3.5, 4.9, 12, 25, 60, 100, 140, 240) +DETECTORS = [ + "1A", + "1B", + "1C", + "2A", + "2B", + "2C", + "3A", + "3B", + "3C", + "4", + "5", + "6", + "7", + "8", + "9", + "10", +] + +BAND_TO_WAVELENGTH: dict[int, float] = { + 1: 1.25, + 2: 2.2, + 3: 3.5, + 4: 4.9, + 5: 12, + 6: 25, + 7: 60, + 8: 100, + 9: 140, + 10: 240, +} + +BODIES = { + "moon": 10, + "mercury": 1, + "venus": 2, + "mars": 2, + "jupiter": 2, + "saturn": 1, + "uranus": 1, + "neptune": 1, +} + + +def get_flag_sum(*flag_bits: int) -> int: + return sum([2**bit for bit in flag_bits]) + + +def pix_to_lonlat( + pixels: int | Sequence[int] | NDArray[np.integer], +) -> tuple[float, float] | NDArray[np.integer]: + """Returns the lon lat pairs for DIRBE QUADCUBE pixels indices.""" + + with fits.open(DIRBE_SKYMAP_INFO) as file: + latitudes = file[1].data["ELAT-CSC"][pixels] + longitudes = file[1].data["ELON-CSC"][pixels] + + if np.isscalar(pixels): + return latitudes, longitudes + + return np.column_stack((latitudes, longitudes)) + +def normalize_dirbe_bandpasses( + bandpasses: NDArray[np.floating], +) -> NDArray[np.floating]: + """Normalizes the dirbe_bandpasses so that the sum of the weights is 1.""" + + return bandpasses / np.expand_dims(bandpasses.sum(axis=1), axis=1) + +@cache +def get_dirbe_bandpass(normalized: bool = True) -> tuple[NDArray[np.floating], NDArray[np.floating]]: + """Returns the DIRBE bandpasses.""" + + wavelengths, *bandpasses = np.loadtxt(DIRBE_BANDPASSES, skiprows=15, unpack=True) + + wavelengths = np.asarray(wavelengths) + bandpasses = np.asarray(bandpasses) + + if normalized: + return wavelengths, normalize_dirbe_bandpasses(bandpasses) + + return wavelengths, bandpasses + +@cache +def get_dirbe_fwhm() -> dict[str, float]: + """Returns a dictionary mapping the DIRBE bands to FWHM in radians.""" + + ROWS_TO_SKIP = 19 + FWHM_COL = 4 + + fwhms: dict[str, float] = {} + with open(DIRBE_BEAM, "r") as file: + for line in file.readlines()[ROWS_TO_SKIP:]: + cols = line.split() + detector, band = re.match(r"(\d+)([A-C]?)", cols[0], re.I).groups() + band_label = f"{int(detector):02}_{band}" if band else f"{int(detector):02}_A" + if len(cols) > FWHM_COL: + fwhm = np.sqrt(float(cols[FWHM_COL])) * u.rad + fwhm_arcmin = fwhm.to(u.arcmin).value + fwhms[band_label] = np.round(fwhm_arcmin, 2) + + return fwhms + +@cache +def get_dirbe_beams() -> dict[str, NDArray[np.floating]]: + """ + Returns a dictionary mapping the DIRBE bands to beams. + NOTE: Currently only returns a sequence of 0's. + """ + NSIDE = 128 + LMAX = 3 * NSIDE + N_ALMS = LMAX**2 + 2*LMAX +1 + DEFAULT_BEAM = np.zeros((3, N_ALMS)) # Update this with actual beams + + beams: dict[str, NDArray[np.floating]] = {} + for detector in range(1,11): + if detector <= 3: + for band in DETECTOR_LABELS: + beams[f"{detector:02}_{band}"] = DEFAULT_BEAM + else: + beams[f"{detector:02}_A"] = DEFAULT_BEAM + + return beams + +@cache +def get_dirbe_sidelobes() -> dict[str, NDArray[np.floating]]: + """ + Returns a dictionary mapping the DIRBE bands to sidelobes. + NOTE: We dont have dirbe sidelobes so we just returns a sequence of 0's. + """ + NSIDE = 128 + LMAX = 3 * NSIDE + N_ALMS = LMAX**2 + 2*LMAX +1 + DEFAULT_SIDELOBES = np.zeros((3,N_ALMS)) # Update this with actual sidelobes + + sidelobes: dict[str, NDArray[np.floating]] = {} + for detector in range(1,11): + if detector <= 3: + for band in DETECTOR_LABELS: + sidelobes[f"{detector:02}_{band}"] = DEFAULT_SIDELOBES + else: + sidelobes[f"{detector:02}_A"] = DEFAULT_SIDELOBES + + return sidelobes + +@cache +def get_dmrfile_mjd_times(filename: str) -> NDArray[np.floating]: + """Duncans script dont really know what goes on here.""" + + data = np.loadtxt(DIRBE_POS_PATH + filename) + adt = data[:,:2] + i4max = 4.294967296e9 + t_adt = np.zeros_like(adt[:,0]) + ind = adt[:,0] >= 0 + t_adt[ind] = adt[ind,0] + i4max*adt[ind,1] + ind = adt[:,0] < 0 + t_adt[ind] = i4max + adt[ind,0] + i4max*adt[ind,1] + t_adt = t_adt*(100*u.ns) + t_adt_d = t_adt.to('day').value # in MJD + + return t_adt_d + +@cache +def get_dmrfile_positions(filename: str) -> NDArray[np.floating]: + return np.loadtxt(DIRBE_POS_PATH + filename, usecols=[5,6,7]) + +@cache +def dirbe_day_to_dmr_day(days: int) -> datetime: + """Returns the dmr_day from dirbe_day""" + + dirbe_date = DIRBE_START_DATE + TimeDelta(days - 1, format="jd") + + # datetime doesnt support leap seconds so we need to do some tricks + dirbe_date_iso = dirbe_date.to_value(format="iso",subfmt="date_hm") + + return datetime.strptime(dirbe_date_iso, "%Y-%m-%d %H:%M") + +@cache +def get_dmrfile_datetimes(filename: str) -> tuple[datetime, datetime]: + """Returns datetime objects for the start and stop days in the dmr files.""" + + regex_groups = re.search(r"(\d{2})(\d+)_(\d{2})(\d+)", filename).groups() + year_one, yday_one, year_two, yday_two = regex_groups + + start_date = datetime.strptime(f'19{year_one} {yday_one}', '%Y %j') + stop_date = datetime.strptime(f'19{year_two} {yday_two}', '%Y %j') + + return start_date, stop_date + +def get_sat_and_earth_pos( + day: int, dirbe_time: float +) -> tuple[NDArray[np.floating], NDArray[np.floating]]: + """dmr_cio_91206-91236.fits contains data from day 206 of 1991 to day 236 of 1991).""" + + dmr_day = dirbe_day_to_dmr_day(day) + + for file in DIRBE_POS_FILES: + start_date, stop_date = get_dmrfile_datetimes(file) + if start_date <= dmr_day <= stop_date: + dmr_file = file + break + else: + raise FileNotFoundError( + f"could not find file containing sat pos for {dmr_day=}" + ) + + dmr_times = get_dmrfile_mjd_times(dmr_file) + dmr_positions = get_dmrfile_positions(dmr_file) + + interpolator_sat_x = interpolate.interp1d( + dmr_times, dmr_positions[:, 0], fill_value="extrapolate" + ) + interpolator_sat_y = interpolate.interp1d( + dmr_times, dmr_positions[:, 1], fill_value="extrapolate" + ) + interpolator_sat_z = interpolate.interp1d( + dmr_times, dmr_positions[:, 2], fill_value="extrapolate" + ) + + pos_x = interpolator_sat_x(dirbe_time) + pos_y = interpolator_sat_y(dirbe_time) + pos_z = interpolator_sat_z(dirbe_time) + + celestial_sat_pos = u.Quantity([pos_x, pos_y, pos_z], u.m).to(u.AU).value + + rotator = hp.Rotator(coord=["C", "E"]) + geocentric_ecl_sat_pos = u.Quantity(rotator(celestial_sat_pos), u.AU).transpose() + + earth_pos = get_body("earth", Time(dirbe_time, format="mjd")).transform_to( + HeliocentricMeanEcliptic + ) + earth_pos = earth_pos.cartesian.xyz.to(u.AU).transpose() + + ecl_sat_pos = earth_pos + geocentric_ecl_sat_pos + + return ecl_sat_pos.value, earth_pos.value + +@cache +def get_bandpass(band: int) -> tuple[u.Quantity[u.micron], NDArray[np.float64]]: + bandpass_file = BANDPASS_PATH / f"DIRBE_{band:02}_bandpass.dat" + bandpass = np.loadtxt(bandpass_file, unpack=True) + + non_zero = np.nonzero(bandpass[1]) + bandpass = bandpass[:, non_zero[0]] + freqs, weights = bandpass + freqs *= u.micron + + return freqs, weights + + +@cache +def get_iras_factor(band: int) -> float: + freqs, weights = get_bandpass(band) + freq_ref = BAND_TO_WAVELENGTH[band] + freqs = freqs.to(u.Hz, u.spectral()) + freqs = np.flip(freqs) + weights = np.flip(weights) + weights /= np.trapz(weights, freqs.value) + return np.trapz( + weights * ((freq_ref * u.micron).to(u.Hz, u.spectral()).value / freqs.value), + freqs.value, + ) + + +def test_naming() -> None: + import h5py + with h5py.File("test.h5", "w") as file: + for detector in BANDS: + file.create_group(f"{detector:02}_{WAVELENGHTS[detector - 1]}um") + for band in DETECTOR_LABELS: + file.create_group(f"{detector:02}_{band}") + if detector > 3: + break + +if __name__ == "__main__": + ... \ No newline at end of file diff --git a/commander3/todscripts/dirbe/gustav/DIRBE_Calls.py b/commander3/todscripts/dirbe/archive/gustav/DIRBE_Calls.py similarity index 100% rename from commander3/todscripts/dirbe/gustav/DIRBE_Calls.py rename to commander3/todscripts/dirbe/archive/gustav/DIRBE_Calls.py diff --git a/commander3/todscripts/dirbe/gustav/DIRBE_FITS2HDF5.py b/commander3/todscripts/dirbe/archive/gustav/DIRBE_FITS2HDF5.py similarity index 100% rename from commander3/todscripts/dirbe/gustav/DIRBE_FITS2HDF5.py rename to commander3/todscripts/dirbe/archive/gustav/DIRBE_FITS2HDF5.py diff --git a/commander3/todscripts/dirbe/gustav/DIRBE_Functions.py b/commander3/todscripts/dirbe/archive/gustav/DIRBE_Functions.py similarity index 100% rename from commander3/todscripts/dirbe/gustav/DIRBE_Functions.py rename to commander3/todscripts/dirbe/archive/gustav/DIRBE_Functions.py diff --git a/commander3/todscripts/dirbe/gustav/DIRBE_Plotting_and_Figures.py b/commander3/todscripts/dirbe/archive/gustav/DIRBE_Plotting_and_Figures.py similarity index 100% rename from commander3/todscripts/dirbe/gustav/DIRBE_Plotting_and_Figures.py rename to commander3/todscripts/dirbe/archive/gustav/DIRBE_Plotting_and_Figures.py diff --git a/commander3/todscripts/dirbe/gustav/DIRBE_Unused_and_Unfinished_Functions.py b/commander3/todscripts/dirbe/archive/gustav/DIRBE_Unused_and_Unfinished_Functions.py similarity index 100% rename from commander3/todscripts/dirbe/gustav/DIRBE_Unused_and_Unfinished_Functions.py rename to commander3/todscripts/dirbe/archive/gustav/DIRBE_Unused_and_Unfinished_Functions.py diff --git a/commander3/todscripts/dirbe/gustav/run_dirbe.py b/commander3/todscripts/dirbe/archive/gustav/run_dirbe.py similarity index 100% rename from commander3/todscripts/dirbe/gustav/run_dirbe.py rename to commander3/todscripts/dirbe/archive/gustav/run_dirbe.py diff --git a/commander3/todscripts/dirbe/make_dirbe_rimo.py b/commander3/todscripts/dirbe/archive/make_dirbe_rimo.py similarity index 100% rename from commander3/todscripts/dirbe/make_dirbe_rimo.py rename to commander3/todscripts/dirbe/archive/make_dirbe_rimo.py diff --git a/commander3/todscripts/dirbe/res15_to_hpx.py b/commander3/todscripts/dirbe/archive/res15_to_hpx.py similarity index 100% rename from commander3/todscripts/dirbe/res15_to_hpx.py rename to commander3/todscripts/dirbe/archive/res15_to_hpx.py diff --git a/commander3/todscripts/dirbe/tods.fits b/commander3/todscripts/dirbe/archive/tods.fits similarity index 100% rename from commander3/todscripts/dirbe/tods.fits rename to commander3/todscripts/dirbe/archive/tods.fits diff --git a/commander3/todscripts/dirbe/write_instrumentfile.py b/commander3/todscripts/dirbe/archive/write_instrumentfile.py similarity index 100% rename from commander3/todscripts/dirbe/write_instrumentfile.py rename to commander3/todscripts/dirbe/archive/write_instrumentfile.py diff --git a/commander3/todscripts/dirbe/write_instrumentfile_delta.py b/commander3/todscripts/dirbe/archive/write_instrumentfile_delta.py similarity index 100% rename from commander3/todscripts/dirbe/write_instrumentfile_delta.py rename to commander3/todscripts/dirbe/archive/write_instrumentfile_delta.py diff --git a/commander3/todscripts/dirbe/write_tods.py b/commander3/todscripts/dirbe/archive/write_tods.py similarity index 100% rename from commander3/todscripts/dirbe/write_tods.py rename to commander3/todscripts/dirbe/archive/write_tods.py diff --git a/commander3/todscripts/dirbe/write_tods_new.py b/commander3/todscripts/dirbe/archive/write_tods_new.py similarity index 100% rename from commander3/todscripts/dirbe/write_tods_new.py rename to commander3/todscripts/dirbe/archive/write_tods_new.py diff --git a/commander3/todscripts/dirbe/zodi.fits b/commander3/todscripts/dirbe/archive/zodi.fits similarity index 100% rename from commander3/todscripts/dirbe/zodi.fits rename to commander3/todscripts/dirbe/archive/zodi.fits diff --git a/commander3/todscripts/dirbe/zodi2.fits b/commander3/todscripts/dirbe/archive/zodi2.fits similarity index 100% rename from commander3/todscripts/dirbe/zodi2.fits rename to commander3/todscripts/dirbe/archive/zodi2.fits diff --git a/commander3/todscripts/dirbe/dirbe_utils.py b/commander3/todscripts/dirbe/dirbe_utils.py index ebab5ee29..cfaeef915 100644 --- a/commander3/todscripts/dirbe/dirbe_utils.py +++ b/commander3/todscripts/dirbe/dirbe_utils.py @@ -1,4 +1,5 @@ from __future__ import annotations +from dataclasses import dataclass from typing import Sequence from functools import cache @@ -10,34 +11,42 @@ import numpy as np from numpy.typing import NDArray import re - +from scipy.interpolate import interp1d import healpy as hp -from astropy.coordinates import get_body, HeliocentricMeanEcliptic -from scipy import interpolate - +from astropy.coordinates import ( + solar_system_ephemeris, + get_body, + HeliocentricMeanEcliptic, +) +from astroquery.mpc import MPC DIRBE_SKYMAP_INFO = "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/DIRBE_SKYMAP_INFO.FITS" DIRBE_BANDPASSES = "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/bandpass/DIRBE_SYSTEM_SPECTRAL_RESPONSE_TABLE.ASC" -DIRBE_BEAM = "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/beams/DIRBE_BEAM_CHARACTERISTICS_P3B.ASC" +DIRBE_BEAM = ( + "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/beams/DIRBE_BEAM_CHARACTERISTICS_P3B.ASC" +) DIRBE_POS_PATH = "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/position/" +BEAM_FILE = "/mn/stornext/d16/cmbco/ola/dirbe/DIRBE_BEAM_CHARACTERISTICS_P3B.ASC" +BANDPASS_PATH = "/mn/stornext/d23/cmbco/cg/dirbe/data/" + DIRBE_POS_FILES = [ - "dmr_anc_spcl_89328_89356.txt", - "dmr_anc_89356_90021.txt", - "dmr_anc_90021_90051.txt", - "dmr_anc_90081_90111.txt", - "dmr_anc_90111_90141.txt", - "dmr_anc_90171_90206.txt", - "dmr_anc_90206_90236.txt", - "dmr_anc_90266_90296.txt", - "dmr_anc_90296_90326.txt", - "dmr_anc_90356_91021.txt", - "dmr_anc_90051_90081.txt", - "dmr_anc_90141_90171.txt", - "dmr_anc_90236_90266.txt", - "dmr_anc_90326_90356.txt", - ] - -BANDS = range(1,11) + "dmr_anc_spcl_89328_89356.txt", + "dmr_anc_89356_90021.txt", + "dmr_anc_90021_90051.txt", + "dmr_anc_90081_90111.txt", + "dmr_anc_90111_90141.txt", + "dmr_anc_90171_90206.txt", + "dmr_anc_90206_90236.txt", + "dmr_anc_90266_90296.txt", + "dmr_anc_90296_90326.txt", + "dmr_anc_90356_91021.txt", + "dmr_anc_90051_90081.txt", + "dmr_anc_90141_90171.txt", + "dmr_anc_90236_90266.txt", + "dmr_anc_90326_90356.txt", +] + +BANDS = range(1, 11) DIRBE_START_DATE = Time(datetime(1989, 12, 11)) DETECTOR_LABELS = ("A", "B", "C") WAVELENGHTS = (1.25, 2.2, 3.5, 4.9, 12, 25, 60, 100, 140, 240) @@ -73,20 +82,153 @@ 10: 240, } -BODIES = { +ROWS_IN_BEAM_FILE_TO_SKIP = 19 + +PLANET_RADII = { "moon": 10, "mercury": 1, - "venus": 2, - "mars": 2, - "jupiter": 2, + "venus": 1, + "mars": 1, + "jupiter": 1.5, "saturn": 1, "uranus": 1, "neptune": 1, } +# Note that Ceres, Pallas, and Vesta were flagged in the original analysis, all +# other asteroids were discovered later on. All comets except C/1989 T1 were +# discovered by Lisse +COMET_RADII = { + '73P/Schwassmann–Wachmann 3':2, + 'C/1989 Q1':2, + 'C/1989 T1':2, + 'C/1989 X1':15, + 'C/1990 K1':5 + } +ASTEROID_RADII = { + '1 Ceres':1, + '2 Pallas':1, + '4 Vesta':1, + '15 Eunomia':1, + '31 Euphrosyne':1, + '41 Daphne':1, + '42 Isis':1, + '85 Io':1, + '185 Eunike':1, + '194 Prokne':1, + '372 Palma':1, + '405 Thia':1, + '511 Davida':1, + '704 Interamnia':1, + '747 Winchester':1, + '1021 Flammario':1, + } + +SIGMA_0 = { + 1: 0.1820848274487808, + 2: 0.1785923183102134, + 3: 0.12869298902093768, + 4: 0.09362580480386565, + 5: 0.14110078941487805, + 6: 0.19622963644711278, + 7: 0.358702745030365, + 8: 0.4273920139329039, + 9: 1.9890065503932703, + 10: 2.012305834012275, +} + -def get_flag_sum(*flag_bits: int) -> int: - return sum([2**bit for bit in flag_bits]) +def get_planet_interps(time_delta: TimeDelta) -> dict[str, dict[str, interp1d]]: + times = np.arange(datetime(1989, 6, 1), datetime(1991, 1, 1), time_delta).astype( + datetime + ) + astropy_times = Time(times, format="datetime", scale="utc") + interpolaters = {} + rotator = hp.Rotator(coord=["E", "G"]) + with solar_system_ephemeris.set("de432s"): + for body_name in PLANET_RADII: + interpolaters[body_name] = {} + body = get_body(body_name, astropy_times).transform_to( + "geocentricmeanecliptic" + ) + lon, lat = rotator(body.lon.value, body.lat.value, lonlat=True) + interpolaters[body_name]["lon"] = interp1d(astropy_times.mjd, lon) + interpolaters[body_name]["lat"] = interp1d(astropy_times.mjd, lat) + + return interpolaters + +def get_smallbody_interps(time_delta: TimeDelta) -> dict[str, dict[str, interp1d]]: + times = np.arange(datetime(1989, 6, 1), datetime(1991, 1, 1), time_delta).astype( + datetime + ) + + astropy_times = Time(times, format="datetime", scale="utc") + interpolaters_comet = {} + interpolaters_asteroids = {} + rotator = hp.Rotator(coord=["C", "G"]) + with solar_system_ephemeris.set('de432s'): + for ci, c in enumerate(COMET_RADII): + interpolaters_comet[c] = {} + lons = [] + lats = [] + dists = [] + for i in range(len(astropy_times)//1441+1): + astropy_times_i = astropy_times[i*1441:(i+1)*1441] + eph = MPC.get_ephemeris(c, start=astropy_times_i[0], + number=len(astropy_times_i), step='1h') + lon, lat = rotator(eph['RA'].value, eph['Dec'].value, lonlat=True) + dist = eph['r'] + lons += lon.tolist() + lats += lat.tolist() + dists += dist.tolist() + lons = np.array(lons) + lats = np.array(lats) + dists = np.array(dists) + x, y, z = hp.dir2vec(lons, lats, lonlat=True) + + interpolaters_comet[c]['lon'] = interp1d(astropy_times.mjd, lons) + interpolaters_comet[c]['lat'] = interp1d(astropy_times.mjd, lats) + interpolaters_comet[c]['dist'] = interp1d(astropy_times.mjd, dists) + interpolaters_comet[c]['x'] = interp1d(astropy_times.mjd, x) + interpolaters_comet[c]['y'] = interp1d(astropy_times.mjd, y) + interpolaters_comet[c]['z'] = interp1d(astropy_times.mjd, z) + + for a in ASTEROID_RADII: + interpolaters_asteroids[a] = {} + lons = [] + lats = [] + for i in range(len(astropy_times)//1441+1): + astropy_times_i = astropy_times[i*1441:(i+1)*1441] + eph = MPC.get_ephemeris(a, start=astropy_times_i[0], + number=len(astropy_times_i), step='1h') + lon, lat = rotator(eph['RA'].value, eph['Dec'].value, lonlat=True) + lons += lon.tolist() + lats += lat.tolist() + lons = np.array(lons) + lats = np.array(lats) + x, y, z = hp.dir2vec(lons, lats, lonlat=True) + interpolaters_asteroids[a]['lon'] = interp1d(astropy_times.mjd, lons) + interpolaters_asteroids[a]['lat'] = interp1d(astropy_times.mjd, lats) + interpolaters_asteroids[a]['x'] = interp1d(astropy_times.mjd, x) + interpolaters_asteroids[a]['y'] = interp1d(astropy_times.mjd, y) + interpolaters_asteroids[a]['z'] = interp1d(astropy_times.mjd, z) + return interpolaters_comet, interpolaters_asteroids + +@cache +def band_to_bit(band: int) -> int: + """Returns the bit corresponding to the band.""" + return { + 1: 0, + 2: 3, + 3: 6, + 4: 9, + 5: 10, + 6: 11, + 7: 12, + 8: 13, + 9: 14, + 10: 15, + }[band] def pix_to_lonlat( @@ -103,26 +245,6 @@ def pix_to_lonlat( return np.column_stack((latitudes, longitudes)) -def normalize_dirbe_bandpasses( - bandpasses: NDArray[np.floating], -) -> NDArray[np.floating]: - """Normalizes the dirbe_bandpasses so that the sum of the weights is 1.""" - - return bandpasses / np.expand_dims(bandpasses.sum(axis=1), axis=1) - -@cache -def get_dirbe_bandpass(normalized: bool = True) -> tuple[NDArray[np.floating], NDArray[np.floating]]: - """Returns the DIRBE bandpasses.""" - - wavelengths, *bandpasses = np.loadtxt(DIRBE_BANDPASSES, skiprows=15, unpack=True) - - wavelengths = np.asarray(wavelengths) - bandpasses = np.asarray(bandpasses) - - if normalized: - return wavelengths, normalize_dirbe_bandpasses(bandpasses) - - return wavelengths, bandpasses @cache def get_dirbe_fwhm() -> dict[str, float]: @@ -136,14 +258,17 @@ def get_dirbe_fwhm() -> dict[str, float]: for line in file.readlines()[ROWS_TO_SKIP:]: cols = line.split() detector, band = re.match(r"(\d+)([A-C]?)", cols[0], re.I).groups() - band_label = f"{int(detector):02}_{band}" if band else f"{int(detector):02}_A" - if len(cols) > FWHM_COL: + band_label = ( + f"{int(detector):02}_{band}" if band else f"{int(detector):02}_A" + ) + if len(cols) > FWHM_COL: fwhm = np.sqrt(float(cols[FWHM_COL])) * u.rad fwhm_arcmin = fwhm.to(u.arcmin).value fwhms[band_label] = np.round(fwhm_arcmin, 2) return fwhms + @cache def get_dirbe_beams() -> dict[str, NDArray[np.floating]]: """ @@ -152,11 +277,11 @@ def get_dirbe_beams() -> dict[str, NDArray[np.floating]]: """ NSIDE = 128 LMAX = 3 * NSIDE - N_ALMS = LMAX**2 + 2*LMAX +1 - DEFAULT_BEAM = np.zeros((3, N_ALMS)) # Update this with actual beams + N_ALMS = LMAX**2 + 2 * LMAX + 1 + DEFAULT_BEAM = np.zeros((3, N_ALMS)) # Update this with actual beams beams: dict[str, NDArray[np.floating]] = {} - for detector in range(1,11): + for detector in range(1, 11): if detector <= 3: for band in DETECTOR_LABELS: beams[f"{detector:02}_{band}"] = DEFAULT_BEAM @@ -165,6 +290,7 @@ def get_dirbe_beams() -> dict[str, NDArray[np.floating]]: return beams + @cache def get_dirbe_sidelobes() -> dict[str, NDArray[np.floating]]: """ @@ -173,11 +299,11 @@ def get_dirbe_sidelobes() -> dict[str, NDArray[np.floating]]: """ NSIDE = 128 LMAX = 3 * NSIDE - N_ALMS = LMAX**2 + 2*LMAX +1 - DEFAULT_SIDELOBES = np.zeros((3,N_ALMS)) # Update this with actual sidelobes + N_ALMS = LMAX**2 + 2 * LMAX + 1 + DEFAULT_SIDELOBES = np.zeros((3, N_ALMS)) # Update this with actual sidelobes sidelobes: dict[str, NDArray[np.floating]] = {} - for detector in range(1,11): + for detector in range(1, 11): if detector <= 3: for band in DETECTOR_LABELS: sidelobes[f"{detector:02}_{band}"] = DEFAULT_SIDELOBES @@ -186,26 +312,29 @@ def get_dirbe_sidelobes() -> dict[str, NDArray[np.floating]]: return sidelobes + @cache def get_dmrfile_mjd_times(filename: str) -> NDArray[np.floating]: """Duncans script dont really know what goes on here.""" data = np.loadtxt(DIRBE_POS_PATH + filename) - adt = data[:,:2] + adt = data[:, :2] i4max = 4.294967296e9 - t_adt = np.zeros_like(adt[:,0]) - ind = adt[:,0] >= 0 - t_adt[ind] = adt[ind,0] + i4max*adt[ind,1] - ind = adt[:,0] < 0 - t_adt[ind] = i4max + adt[ind,0] + i4max*adt[ind,1] - t_adt = t_adt*(100*u.ns) - t_adt_d = t_adt.to('day').value # in MJD + t_adt = np.zeros_like(adt[:, 0]) + ind = adt[:, 0] >= 0 + t_adt[ind] = adt[ind, 0] + i4max * adt[ind, 1] + ind = adt[:, 0] < 0 + t_adt[ind] = i4max + adt[ind, 0] + i4max * adt[ind, 1] + t_adt = t_adt * (100 * u.ns) + t_adt_d = t_adt.to("day").value # in MJD return t_adt_d + @cache def get_dmrfile_positions(filename: str) -> NDArray[np.floating]: - return np.loadtxt(DIRBE_POS_PATH + filename, usecols=[5,6,7]) + return np.loadtxt(DIRBE_POS_PATH + filename, usecols=[5, 6, 7]) + @cache def dirbe_day_to_dmr_day(days: int) -> datetime: @@ -214,10 +343,11 @@ def dirbe_day_to_dmr_day(days: int) -> datetime: dirbe_date = DIRBE_START_DATE + TimeDelta(days - 1, format="jd") # datetime doesnt support leap seconds so we need to do some tricks - dirbe_date_iso = dirbe_date.to_value(format="iso",subfmt="date_hm") + dirbe_date_iso = dirbe_date.to_value(format="iso", subfmt="date_hm") return datetime.strptime(dirbe_date_iso, "%Y-%m-%d %H:%M") + @cache def get_dmrfile_datetimes(filename: str) -> tuple[datetime, datetime]: """Returns datetime objects for the start and stop days in the dmr files.""" @@ -225,51 +355,114 @@ def get_dmrfile_datetimes(filename: str) -> tuple[datetime, datetime]: regex_groups = re.search(r"(\d{2})(\d+)_(\d{2})(\d+)", filename).groups() year_one, yday_one, year_two, yday_two = regex_groups - start_date = datetime.strptime(f'19{year_one} {yday_one}', '%Y %j') - stop_date = datetime.strptime(f'19{year_two} {yday_two}', '%Y %j') - + start_date = datetime.strptime(f"19{year_one} {yday_one}", "%Y %j") + stop_date = datetime.strptime(f"19{year_two} {yday_two}", "%Y %j") + return start_date, stop_date -def get_sat_and_earth_pos( - day: int, dirbe_time: float -) -> tuple[NDArray[np.floating], NDArray[np.floating]]: - """dmr_cio_91206-91236.fits contains data from day 206 of 1991 to day 236 of 1991).""" - dmr_day = dirbe_day_to_dmr_day(day) +def test_naming() -> None: + import h5py - for file in DIRBE_POS_FILES: - start_date, stop_date = get_dmrfile_datetimes(file) - if start_date <= dmr_day <= stop_date: - dmr_file = file + with h5py.File("test.h5", "w") as file: + for detector in BANDS: + file.create_group(f"{detector:02}_{WAVELENGHTS[detector - 1]}um") + for band in DETECTOR_LABELS: + file.create_group(f"{detector:02}_{band}") + if detector > 3: + break + + +@dataclass +class DetectorBeamData: + solid_angle: float + solid_angle_error: float + beam: dict[range, tuple[float, float]] + + +@cache +def get_beam_data() -> dict[str, DetectorBeamData]: + data: dict[str, DetectorBeamData] = {} + visited = set() + current_det_data = {} + with open(BEAM_FILE, "r") as f: + lines = iter(f.readlines()[ROWS_IN_BEAM_FILE_TO_SKIP:]) + while True: + try: + line = next(lines) + except StopIteration: + data[split[0]] = DetectorBeamData(**current_det_data) + break + split = line.split() + current_det = split[0] + if current_det not in visited: + visited.add(current_det) + current_det_data = { + "solid_angle": float(split[4]), + "solid_angle_error": float(split[5]), + "beam": {}, + } + if visited != set(): + data[split[0]] = DetectorBeamData(**current_det_data) + if current_det in visited: + start, stop = split[1].split("-") + if current_det in {"9", "10"}: + start, stop = "89345", "90260" + # Hack to invlude final 5 days fo data... + if stop == "90260": + stop = "90266" + current_det_data["beam"][range(int(start), int(stop))] = ( + u.Quantity(float(split[2]), u.arcmin).to_value(u.rad), + u.Quantity(float(split[3]), u.arcmin).to_value(u.rad), + ) + + return data + + +BEAM_DATA = get_beam_data() + + +def get_sat_and_earth_pos(yday: int, time: float) -> tuple[np.ndarray, np.ndarray]: + """dmr_cio_91206-91236.fits contains data from day 206 of 1991 to day 236 of 1991).""" + + ranges_times = [re.findall(r"\d+", file) for file in DIRBE_POS_FILES] + ranges = [range(*[int(time) for time in times]) for times in ranges_times] + for idx, r in enumerate(ranges): + if yday in r: + dmr_file = DIRBE_POS_FILES[idx] break else: - raise FileNotFoundError( - f"could not find file containing sat pos for {dmr_day=}" - ) + raise FileNotFoundError(f"could not find file containing sat pos for {yday=}") dmr_times = get_dmrfile_mjd_times(dmr_file) dmr_positions = get_dmrfile_positions(dmr_file) - interpolator_sat_x = interpolate.interp1d( - dmr_times, dmr_positions[:, 0], fill_value="extrapolate" + interpolator_sat_x = interp1d( + dmr_times, + dmr_positions[:, 0], + fill_value="extrapolate", ) - interpolator_sat_y = interpolate.interp1d( - dmr_times, dmr_positions[:, 1], fill_value="extrapolate" + interpolator_sat_y = interp1d( + dmr_times, + dmr_positions[:, 1], + fill_value="extrapolate", ) - interpolator_sat_z = interpolate.interp1d( - dmr_times, dmr_positions[:, 2], fill_value="extrapolate" + interpolator_sat_z = interp1d( + dmr_times, + dmr_positions[:, 2], + fill_value="extrapolate", ) - pos_x = interpolator_sat_x(dirbe_time) - pos_y = interpolator_sat_y(dirbe_time) - pos_z = interpolator_sat_z(dirbe_time) + pos_x = interpolator_sat_x(time) + pos_y = interpolator_sat_y(time) + pos_z = interpolator_sat_z(time) celestial_sat_pos = u.Quantity([pos_x, pos_y, pos_z], u.m).to(u.AU).value rotator = hp.Rotator(coord=["C", "E"]) geocentric_ecl_sat_pos = u.Quantity(rotator(celestial_sat_pos), u.AU).transpose() - earth_pos = get_body("earth", Time(dirbe_time, format="mjd")).transform_to( + earth_pos = get_body("earth", Time(time, format="mjd")).transform_to( HeliocentricMeanEcliptic ) earth_pos = earth_pos.cartesian.xyz.to(u.AU).transpose() @@ -278,9 +471,37 @@ def get_sat_and_earth_pos( return ecl_sat_pos.value, earth_pos.value +def get_moon_pos(yday: int, time: float) -> tuple[np.ndarray, np.ndarray]: + """dmr_cio_91206-91236.fits contains data from day 206 of 1991 to day 236 of 1991).""" + + moon_pos = get_body("moon", Time(time, format="mjd")).transform_to( + HeliocentricMeanEcliptic + ) + moon_pos = moon_pos.cartesian.xyz.to(u.AU).transpose() + + return moon_pos.value + +@cache +def get_const_scalars(band: int) -> NDArray[np.floating]: + """Used in V14 -> and out""" + # SIGMA0 = u.Quantity( + # [2.4, 1.6, 0.9, 0.8, 0.9, 0.9, 0.9, 0.5, 32.8, 10.7], "nW/(m^2 sr)" + # ) + # SIGMA0 *= 20 + # SIGMA0 /= u.Quantity( + # [59.5, 22.4, 22.0, 8.19, 13.3, 4.13, 2.32, 0.974, 0.605, 0.495], "THz" + # ) + # SIGMA0 = SIGMA0.to_value("MJy/sr") + + TEMP_GAIN = 1 + TEMP_ALPHA = -1 + fknee = 1 / (10 * 60) + + return np.array([TEMP_GAIN, SIGMA_0[band], fknee, TEMP_ALPHA]).flatten() + @cache def get_bandpass(band: int) -> tuple[u.Quantity[u.micron], NDArray[np.float64]]: - bandpass_file = BANDPASS_PATH / f"DIRBE_{band:02}_bandpass.dat" + bandpass_file = BANDPASS_PATH + f"/DIRBE_{band:02}_bandpass.dat" bandpass = np.loadtxt(bandpass_file, unpack=True) non_zero = np.nonzero(bandpass[1]) @@ -305,15 +526,6 @@ def get_iras_factor(band: int) -> float: ) -def test_naming() -> None: - import h5py - with h5py.File("test.h5", "w") as file: - for detector in BANDS: - file.create_group(f"{detector:02}_{WAVELENGHTS[detector - 1]}um") - for band in DETECTOR_LABELS: - file.create_group(f"{detector:02}_{band}") - if detector > 3: - break - if __name__ == "__main__": - ... \ No newline at end of file + print([get_iras_factor(i) for i in range(1,11)]) + diff --git a/commander3/todscripts/dirbe/metin/dirbe_utils.py b/commander3/todscripts/dirbe/metin/dirbe_utils.py deleted file mode 100644 index 1423ae2c8..000000000 --- a/commander3/todscripts/dirbe/metin/dirbe_utils.py +++ /dev/null @@ -1,436 +0,0 @@ -from __future__ import annotations -from dataclasses import dataclass -from typing import Sequence - -from functools import cache - -from astropy.io import fits -import astropy.units as u -from astropy.time import Time, TimeDelta -from datetime import datetime -import numpy as np -from numpy.typing import NDArray -import re -from scipy.interpolate import interp1d -import healpy as hp -from astropy.coordinates import ( - solar_system_ephemeris, - get_body, - HeliocentricMeanEcliptic, -) - -DIRBE_SKYMAP_INFO = "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/DIRBE_SKYMAP_INFO.FITS" -DIRBE_BANDPASSES = "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/bandpass/DIRBE_SYSTEM_SPECTRAL_RESPONSE_TABLE.ASC" -DIRBE_BEAM = ( - "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/beams/DIRBE_BEAM_CHARACTERISTICS_P3B.ASC" -) -DIRBE_POS_PATH = "/mn/stornext/d16/cmbco/ola/dirbe/auxdata/position/" -BEAM_FILE = "/mn/stornext/d16/cmbco/ola/dirbe/DIRBE_BEAM_CHARACTERISTICS_P3B.ASC" -BANDPASS_PATH = "/mn/stornext/d5/data/metins/dirbe/data/" - -DIRBE_POS_FILES = [ - "dmr_anc_spcl_89328_89356.txt", - "dmr_anc_89356_90021.txt", - "dmr_anc_90021_90051.txt", - "dmr_anc_90081_90111.txt", - "dmr_anc_90111_90141.txt", - "dmr_anc_90171_90206.txt", - "dmr_anc_90206_90236.txt", - "dmr_anc_90266_90296.txt", - "dmr_anc_90296_90326.txt", - "dmr_anc_90356_91021.txt", - "dmr_anc_90051_90081.txt", - "dmr_anc_90141_90171.txt", - "dmr_anc_90236_90266.txt", - "dmr_anc_90326_90356.txt", -] - -BANDS = range(1, 11) -DIRBE_START_DATE = Time(datetime(1989, 12, 11)) -DETECTOR_LABELS = ("A", "B", "C") -WAVELENGHTS = (1.25, 2.2, 3.5, 4.9, 12, 25, 60, 100, 140, 240) -DETECTORS = [ - "1A", - "1B", - "1C", - "2A", - "2B", - "2C", - "3A", - "3B", - "3C", - "4", - "5", - "6", - "7", - "8", - "9", - "10", -] - -BAND_TO_WAVELENGTH: dict[int, float] = { - 1: 1.25, - 2: 2.2, - 3: 3.5, - 4: 4.9, - 5: 12, - 6: 25, - 7: 60, - 8: 100, - 9: 140, - 10: 240, -} - -ROWS_IN_BEAM_FILE_TO_SKIP = 19 - -PLANET_RADII = { - "moon": 10, - "mercury": 1, - "venus": 1, - "mars": 1, - "jupiter": 1.5, - "saturn": 1, - "uranus": 1, - "neptune": 1, -} - -SIGMA_0 = { - 1: 0.1820848274487808, - 2: 0.1785923183102134, - 3: 0.12869298902093768, - 4: 0.09362580480386565, - 5: 0.14110078941487805, - 6: 0.19622963644711278, - 7: 0.358702745030365, - 8: 0.4273920139329039, - 9: 1.9890065503932703, - 10: 2.012305834012275, -} - - -def get_planet_interps(time_delta: TimeDelta) -> dict[str, dict[str, interp1d]]: - times = np.arange(datetime(1989, 6, 1), datetime(1991, 1, 1), time_delta).astype( - datetime - ) - astropy_times = Time(times, format="datetime", scale="utc") - interpolaters = {} - rotator = hp.Rotator(coord=["E", "G"]) - with solar_system_ephemeris.set("de432s"): - for body_name in PLANET_RADII: - interpolaters[body_name] = {} - body = get_body(body_name, astropy_times).transform_to( - "geocentricmeanecliptic" - ) - lon, lat = rotator(body.lon.value, body.lat.value, lonlat=True) - interpolaters[body_name]["lon"] = interp1d(astropy_times.mjd, lon) - interpolaters[body_name]["lat"] = interp1d(astropy_times.mjd, lat) - - return interpolaters - - -@cache -def band_to_bit(band: int) -> int: - """Returns the bit corresponding to the band.""" - return { - 1: 0, - 2: 3, - 3: 6, - 4: 9, - 5: 10, - 6: 11, - 7: 12, - 8: 13, - 9: 14, - 10: 15, - }[band] - - -def pix_to_lonlat( - pixels: int | Sequence[int] | NDArray[np.integer], -) -> tuple[float, float] | NDArray[np.integer]: - """Returns the lon lat pairs for DIRBE QUADCUBE pixels indices.""" - - with fits.open(DIRBE_SKYMAP_INFO) as file: - latitudes = file[1].data["ELAT-CSC"][pixels] - longitudes = file[1].data["ELON-CSC"][pixels] - - if np.isscalar(pixels): - return latitudes, longitudes - - return np.column_stack((latitudes, longitudes)) - - -@cache -def get_dirbe_fwhm() -> dict[str, float]: - """Returns a dictionary mapping the DIRBE bands to FWHM in radians.""" - - ROWS_TO_SKIP = 19 - FWHM_COL = 4 - - fwhms: dict[str, float] = {} - with open(DIRBE_BEAM, "r") as file: - for line in file.readlines()[ROWS_TO_SKIP:]: - cols = line.split() - detector, band = re.match(r"(\d+)([A-C]?)", cols[0], re.I).groups() - band_label = ( - f"{int(detector):02}_{band}" if band else f"{int(detector):02}_A" - ) - if len(cols) > FWHM_COL: - fwhm = np.sqrt(float(cols[FWHM_COL])) * u.rad - fwhm_arcmin = fwhm.to(u.arcmin).value - fwhms[band_label] = np.round(fwhm_arcmin, 2) - - return fwhms - - -@cache -def get_dirbe_beams() -> dict[str, NDArray[np.floating]]: - """ - Returns a dictionary mapping the DIRBE bands to beams. - NOTE: Currently only returns a sequence of 0's. - """ - NSIDE = 128 - LMAX = 3 * NSIDE - N_ALMS = LMAX**2 + 2 * LMAX + 1 - DEFAULT_BEAM = np.zeros((3, N_ALMS)) # Update this with actual beams - - beams: dict[str, NDArray[np.floating]] = {} - for detector in range(1, 11): - if detector <= 3: - for band in DETECTOR_LABELS: - beams[f"{detector:02}_{band}"] = DEFAULT_BEAM - else: - beams[f"{detector:02}_A"] = DEFAULT_BEAM - - return beams - - -@cache -def get_dirbe_sidelobes() -> dict[str, NDArray[np.floating]]: - """ - Returns a dictionary mapping the DIRBE bands to sidelobes. - NOTE: We dont have dirbe sidelobes so we just returns a sequence of 0's. - """ - NSIDE = 128 - LMAX = 3 * NSIDE - N_ALMS = LMAX**2 + 2 * LMAX + 1 - DEFAULT_SIDELOBES = np.zeros((3, N_ALMS)) # Update this with actual sidelobes - - sidelobes: dict[str, NDArray[np.floating]] = {} - for detector in range(1, 11): - if detector <= 3: - for band in DETECTOR_LABELS: - sidelobes[f"{detector:02}_{band}"] = DEFAULT_SIDELOBES - else: - sidelobes[f"{detector:02}_A"] = DEFAULT_SIDELOBES - - return sidelobes - - -@cache -def get_dmrfile_mjd_times(filename: str) -> NDArray[np.floating]: - """Duncans script dont really know what goes on here.""" - - data = np.loadtxt(DIRBE_POS_PATH + filename) - adt = data[:, :2] - i4max = 4.294967296e9 - t_adt = np.zeros_like(adt[:, 0]) - ind = adt[:, 0] >= 0 - t_adt[ind] = adt[ind, 0] + i4max * adt[ind, 1] - ind = adt[:, 0] < 0 - t_adt[ind] = i4max + adt[ind, 0] + i4max * adt[ind, 1] - t_adt = t_adt * (100 * u.ns) - t_adt_d = t_adt.to("day").value # in MJD - - return t_adt_d - - -@cache -def get_dmrfile_positions(filename: str) -> NDArray[np.floating]: - return np.loadtxt(DIRBE_POS_PATH + filename, usecols=[5, 6, 7]) - - -@cache -def dirbe_day_to_dmr_day(days: int) -> datetime: - """Returns the dmr_day from dirbe_day""" - - dirbe_date = DIRBE_START_DATE + TimeDelta(days - 1, format="jd") - - # datetime doesnt support leap seconds so we need to do some tricks - dirbe_date_iso = dirbe_date.to_value(format="iso", subfmt="date_hm") - - return datetime.strptime(dirbe_date_iso, "%Y-%m-%d %H:%M") - - -@cache -def get_dmrfile_datetimes(filename: str) -> tuple[datetime, datetime]: - """Returns datetime objects for the start and stop days in the dmr files.""" - - regex_groups = re.search(r"(\d{2})(\d+)_(\d{2})(\d+)", filename).groups() - year_one, yday_one, year_two, yday_two = regex_groups - - start_date = datetime.strptime(f"19{year_one} {yday_one}", "%Y %j") - stop_date = datetime.strptime(f"19{year_two} {yday_two}", "%Y %j") - - return start_date, stop_date - - -def test_naming() -> None: - import h5py - - with h5py.File("test.h5", "w") as file: - for detector in BANDS: - file.create_group(f"{detector:02}_{WAVELENGHTS[detector - 1]}um") - for band in DETECTOR_LABELS: - file.create_group(f"{detector:02}_{band}") - if detector > 3: - break - - -@dataclass -class DetectorBeamData: - solid_angle: float - solid_angle_error: float - beam: dict[range, tuple[float, float]] - - -@cache -def get_beam_data() -> dict[str, DetectorBeamData]: - data: dict[str, DetectorBeamData] = {} - visited = set() - current_det_data = {} - with open(BEAM_FILE, "r") as f: - lines = iter(f.readlines()[ROWS_IN_BEAM_FILE_TO_SKIP:]) - while True: - try: - line = next(lines) - except StopIteration: - data[split[0]] = DetectorBeamData(**current_det_data) - break - split = line.split() - current_det = split[0] - if current_det not in visited: - visited.add(current_det) - current_det_data = { - "solid_angle": float(split[4]), - "solid_angle_error": float(split[5]), - "beam": {}, - } - if visited != set(): - data[split[0]] = DetectorBeamData(**current_det_data) - if current_det in visited: - start, stop = split[1].split("-") - if current_det in {"9", "10"}: - start, stop = "89345", "90260" - # Hack to invlude final 5 days fo data... - if stop == "90260": - stop = "90266" - current_det_data["beam"][range(int(start), int(stop))] = ( - u.Quantity(float(split[2]), u.arcmin).to_value(u.rad), - u.Quantity(float(split[3]), u.arcmin).to_value(u.rad), - ) - - return data - - -BEAM_DATA = get_beam_data() - - -def get_sat_and_earth_pos(yday: int, time: float) -> tuple[np.ndarray, np.ndarray]: - """dmr_cio_91206-91236.fits contains data from day 206 of 1991 to day 236 of 1991).""" - - ranges_times = [re.findall(r"\d+", file) for file in DIRBE_POS_FILES] - ranges = [range(*[int(time) for time in times]) for times in ranges_times] - for idx, r in enumerate(ranges): - if yday in r: - dmr_file = DIRBE_POS_FILES[idx] - break - else: - raise FileNotFoundError(f"could not find file containing sat pos for {yday=}") - - dmr_times = get_dmrfile_mjd_times(dmr_file) - dmr_positions = get_dmrfile_positions(dmr_file) - - interpolator_sat_x = interp1d( - dmr_times, - dmr_positions[:, 0], - fill_value="extrapolate", - ) - interpolator_sat_y = interp1d( - dmr_times, - dmr_positions[:, 1], - fill_value="extrapolate", - ) - interpolator_sat_z = interp1d( - dmr_times, - dmr_positions[:, 2], - fill_value="extrapolate", - ) - - pos_x = interpolator_sat_x(time) - pos_y = interpolator_sat_y(time) - pos_z = interpolator_sat_z(time) - - celestial_sat_pos = u.Quantity([pos_x, pos_y, pos_z], u.m).to(u.AU).value - - rotator = hp.Rotator(coord=["C", "E"]) - geocentric_ecl_sat_pos = u.Quantity(rotator(celestial_sat_pos), u.AU).transpose() - - earth_pos = get_body("earth", Time(time, format="mjd")).transform_to( - HeliocentricMeanEcliptic - ) - earth_pos = earth_pos.cartesian.xyz.to(u.AU).transpose() - - ecl_sat_pos = earth_pos + geocentric_ecl_sat_pos - - return ecl_sat_pos.value, earth_pos.value - - -@cache -def get_const_scalars(band: int) -> NDArray[np.floating]: - """Used in V14 -> and out""" - # SIGMA0 = u.Quantity( - # [2.4, 1.6, 0.9, 0.8, 0.9, 0.9, 0.9, 0.5, 32.8, 10.7], "nW/(m^2 sr)" - # ) - # SIGMA0 *= 20 - # SIGMA0 /= u.Quantity( - # [59.5, 22.4, 22.0, 8.19, 13.3, 4.13, 2.32, 0.974, 0.605, 0.495], "THz" - # ) - # SIGMA0 = SIGMA0.to_value("MJy/sr") - - TEMP_GAIN = 1 - TEMP_ALPHA = -1 - fknee = 1 / (10 * 60) - - return np.array([TEMP_GAIN, SIGMA_0[band], fknee, TEMP_ALPHA]).flatten() - -@cache -def get_bandpass(band: int) -> tuple[u.Quantity[u.micron], NDArray[np.float64]]: - bandpass_file = BANDPASS_PATH + f"/DIRBE_{band:02}_bandpass.dat" - bandpass = np.loadtxt(bandpass_file, unpack=True) - - non_zero = np.nonzero(bandpass[1]) - bandpass = bandpass[:, non_zero[0]] - freqs, weights = bandpass - freqs *= u.micron - - return freqs, weights - - -@cache -def get_iras_factor(band: int) -> float: - freqs, weights = get_bandpass(band) - freq_ref = BAND_TO_WAVELENGTH[band] - freqs = freqs.to(u.Hz, u.spectral()) - freqs = np.flip(freqs) - weights = np.flip(weights) - weights /= np.trapz(weights, freqs.value) - return np.trapz( - weights * ((freq_ref * u.micron).to(u.Hz, u.spectral()).value / freqs.value), - freqs.value, - ) - - -if __name__ == "__main__": - print([get_iras_factor(i) for i in range(1,11)]) - diff --git a/commander3/todscripts/dirbe/metin/pointing.py b/commander3/todscripts/dirbe/pointing.py similarity index 100% rename from commander3/todscripts/dirbe/metin/pointing.py rename to commander3/todscripts/dirbe/pointing.py diff --git a/commander3/todscripts/dirbe/metin/read_data.py b/commander3/todscripts/dirbe/read_data.py similarity index 100% rename from commander3/todscripts/dirbe/metin/read_data.py rename to commander3/todscripts/dirbe/read_data.py diff --git a/commander3/todscripts/dirbe/metin/write_instrument_final.py b/commander3/todscripts/dirbe/write_instrument_final.py similarity index 95% rename from commander3/todscripts/dirbe/metin/write_instrument_final.py rename to commander3/todscripts/dirbe/write_instrument_final.py index 02115cd07..d0ee47904 100644 --- a/commander3/todscripts/dirbe/metin/write_instrument_final.py +++ b/commander3/todscripts/dirbe/write_instrument_final.py @@ -6,13 +6,13 @@ if TYPE_CHECKING: from ....python.commander_tools.tod_tools.commander_instrument import commander_instrument -sys.path.insert(0, "/mn/stornext/d16/cmbco/bp/metins/Commander/commander3/python") +sys.path.insert(0, "../../python") from commander_tools.tod_tools.commander_instrument import commander_instrument from numpy.typing import NDArray import astropy.units as u import dirbe_utils -TEMP_OUTPUT_PATH = "/mn/stornext/d5/data/metins/dirbe/data" +TEMP_OUTPUT_PATH = "/mn/stornext/d5/data/duncanwa/DIRBE/data" NSIDE = 128 # temporary values that needs to be updated diff --git a/commander3/todscripts/dirbe/metin/write_tods_final.py b/commander3/todscripts/dirbe/write_tods_final.py similarity index 68% rename from commander3/todscripts/dirbe/metin/write_tods_final.py rename to commander3/todscripts/dirbe/write_tods_final.py index d61d2fadc..bfff30b10 100644 --- a/commander3/todscripts/dirbe/metin/write_tods_final.py +++ b/commander3/todscripts/dirbe/write_tods_final.py @@ -21,7 +21,7 @@ from dataclasses import dataclass import itertools from pathlib import Path -from datetime import timedelta +from datetime import timedelta, datetime import multiprocessing import time @@ -35,22 +35,21 @@ from scipy.interpolate import interp1d from astropy.time import Time, TimeDelta from cosmoglobe.tod_tools import TODLoader -import zodipy -# zodi_model = zodipy.Zodipy(extrapolate=True) # Path objects -DIRBE_DATA_PATH = Path("/mn/stornext/d5/data/metins/dirbe/data/") -HDF5_PATH = Path("/mn/stornext/d16/cmbco/bp/gustavbe/master/dirbe_hdf5_files/") +DIRBE_DATA_PATH = Path("/mn/stornext/d5/data/duncanwa/DIRBE/hdf_files/") BANDPASS_PATH = Path("/mn/stornext/d5/data/metins/dirbe/data/") CIO_PATH = Path("/mn/stornext/d16/cmbco/ola/dirbe/cio") # system constants -N_PROC = multiprocessing.cpu_count() +N_PROC = multiprocessing.cpu_count() // 2 +N_PROC = 2 ROTATOR = hp.Rotator(coord=["E", "G"]) YDAYS = np.concatenate([np.arange(89345, 89366), np.arange(90001, 90265)]) START_TIME = Time("1981-01-01", format="isot", scale="utc") +# For debugging purposes, reduce N_CIO_FILES # CIO constants N_CIO_FILES = 285 BAD_DATA_SENTINEL = -16375 @@ -58,6 +57,8 @@ SAMP_RATE = 1 / 8 SAMP_RATE_DAYS = SAMP_RATE / (24 * 3600) +N_MOON_INTERP = 8640 + BEAM_DATA = dirbe_utils.get_beam_data() FLAG_BITS: dict[str, int] = { @@ -78,28 +79,37 @@ "saturn": 10, "uranus": 11, "neptune": 12, + "comets": 13, + "asteroids": 14, # Orbit and attitude flag (each observation has either of each pair turned on) - "non_definitive_attitude": 13, - "definite_attitude": 14, - "course_attitude": 15, - "fine_attitude": 16, - "merged_attitude": 17, - "external_uax_attitude": 18, - "space_craft_slewing": 19, - "space_craft_not_slewing": 20, - "special_pointing": 21, - "normal_pointing": 22, - "space_craft_ascending": 23, - "space_craft_descending": 24, - "leading_los": 25, - "trailing_los": 26, + "non_definitive_attitude": 15, + "coarse_attitude": 16, + "glitch": 17, } +''' +The default DIRBE flags used for Commander analysis are in the defaults directory. For example, +for band 1 the default value is BAND_TOD_FLAG&&& = 2047, which includes all the radiation zone flags, +the excess noise flag, the bad data flag, and the planet flags. Currently it seems that the attitude flags +are not necessary, but they are included now for completeness. + +Only a few bands are sensitive to the infrared radiation from comets and asteroids, specifically bands 4 and 5. For these, +the flags should include the comet and asteroid flags. When summed together, these flags should be 32767 = 2**15 - 1. + +Comet flags and asteroid flags currently are set by hand, since their FWHM are not documented anywhere specifically, although +Arendt 2014 does specify that the comet tails are up to 15 degrees long when they are within 2 AU of the sun. + +Flag glitch, bit 17 or 131072, should only apply to bands 7 and 8, since these +bands are especially sensitivie to cosmic ray hits, and it affects the gain +and/or baseline over very short timescales. +''' + @dataclass class YdayData: tods: dict[str, np.ndarray] pixels: dict[str, np.ndarray] + psis: dict[str, np.ndarray] flags: dict[str, np.ndarray] time_start: float time_stop: float @@ -107,12 +117,17 @@ class YdayData: sat_pos_stop: np.ndarray earth_pos_start: np.ndarray earth_pos_stop: np.ndarray + moon_positions: np.ndarray + earth_positions: np.ndarray + sat_positions: np.ndarray + time_arr: np.ndarray @dataclass class CIO: tods: list[np.ndarray] pixels: list[np.ndarray] + psis: list[np.ndarray] flags: list[np.ndarray] time_start: list[float] time_stop: list[float] @@ -120,6 +135,10 @@ class CIO: sat_pos_stop: list[np.ndarray] earth_pos_start: list[np.ndarray] earth_pos_stop: list[np.ndarray] + moon_positions: list[np.ndarray] + earth_positions: list[np.ndarray] + sat_positions: list[np.ndarray] + time_arr: list[np.ndarray] def get_cios(yday_data: list[YdayData]) -> dict[str, CIO]: @@ -127,6 +146,7 @@ def get_cios(yday_data: list[YdayData]) -> dict[str, CIO]: f"{band:02}": CIO( tods=[yday.tods[f"{band:02}"] for yday in yday_data], pixels=[yday.pixels[f"{band:02}"] for yday in yday_data], + psis=[yday.psis[f"{band:02}"] for yday in yday_data], flags=[yday.flags[f"{band:02}"] for yday in yday_data], time_start=[yday.time_start for yday in yday_data], time_stop=[yday.time_stop for yday in yday_data], @@ -134,6 +154,10 @@ def get_cios(yday_data: list[YdayData]) -> dict[str, CIO]: sat_pos_stop=[yday.sat_pos_stop for yday in yday_data], earth_pos_start=[yday.earth_pos_start for yday in yday_data], earth_pos_stop=[yday.earth_pos_stop for yday in yday_data], + moon_positions=[yday.moon_positions for yday in yday_data], + earth_positions=[yday.earth_positions for yday in yday_data], + sat_positions=[yday.sat_positions for yday in yday_data], + time_arr=[yday.time_arr for yday in yday_data], ) for band in dirbe_utils.BANDS } @@ -142,13 +166,15 @@ def get_cios(yday_data: list[YdayData]) -> dict[str, CIO]: def get_yday_data( files: range, nside_out: int, planet_time_delta: timedelta, color_corr: bool ) -> list[YdayData]: + comet_interps, asteroid_interps = dirbe_utils.get_smallbody_interps(planet_time_delta) planet_interps = dirbe_utils.get_planet_interps(planet_time_delta) with multiprocessing.Pool(processes=N_PROC) as pool: proc_chunks = [ pool.apply_async( get_yday_cio_data, - args=(file_number, nside_out, planet_interps, color_corr), + args=(file_number, nside_out, planet_interps, comet_interps, + asteroid_interps, color_corr), ) for file_number in files ] @@ -159,6 +185,8 @@ def get_yday_cio_data( file_number: int, nside_out: int, planet_interps: dict[str, dict[str, interp1d]], + comet_interps: dict[str, dict[str, interp1d]], + asteroid_interps: dict[str, dict[str, interp1d]], color_corr: bool, ) -> YdayData: """Function which extracts and reorders the CIO data from one day CIO file.""" @@ -181,8 +209,11 @@ def get_yday_cio_data( # Convert time to MJD time = (START_TIME + TimeDelta(time, format="sec", scale="tai")).mjd + time_arr = np.linspace(time[0], time[-1], N_MOON_INTERP) sat_pos_start, earth_pos_start= dirbe_utils.get_sat_and_earth_pos(yday, time[0]) sat_pos_stop, earth_pos_stop = dirbe_utils.get_sat_and_earth_pos(yday, time[-1]) + sat_positions, earth_positions = dirbe_utils.get_sat_and_earth_pos(yday, time_arr) + moon_positions = dirbe_utils.get_moon_pos(yday, time_arr) # Gap filling # Get indexes where time difference is larger than 2 sampling rates and split time array @@ -201,14 +232,15 @@ def get_yday_cio_data( bad_data_padding = padd_vals(base_padding, BAD_DATA_SENTINEL) pix_padding = padd_vals(base_padding, 0, dtype=np.int64) - flag_padding = padd_vals(base_padding, 2 ** FLAG_BITS["bad_data"], dtype=np.int16) + flag_padding = padd_vals(base_padding, 2 ** FLAG_BITS["bad_data"], dtype=np.int32) + psi_padding = padd_vals(base_padding, 0, dtype=np.int64) # Get cio flags - rad_zone_flags = data["RadZone"].astype(np.int8)[time_sorted_inds] - xs_noise_flags = data["XSNoise"].astype(np.int16)[time_sorted_inds] - oa_flags = data["OA_Flags"].astype(np.int16)[time_sorted_inds] + rad_zone_flags = data["RadZone"].astype(np.int32)[time_sorted_inds] + xs_noise_flags = data["XSNoise"].astype(np.int32)[time_sorted_inds] + oa_flags = data["OA_Flags"].astype(np.int32)[time_sorted_inds] - common_flags = np.zeros_like(rad_zone_flags, dtype=np.int16) + common_flags = np.zeros_like(rad_zone_flags, dtype=np.int32) non_zero_rad_zone_inds = rad_zone_flags > 0 common_flags[non_zero_rad_zone_inds > 0] += ( 2 ** rad_zone_flags[non_zero_rad_zone_inds] @@ -233,6 +265,7 @@ def get_yday_cio_data( # Extract tods, and modify pointing vectors per detector according to beam data tods: dict[str, np.ndarray] = {} pixels: dict[str, np.ndarray] = {} + psis: dict[str, np.ndarray] = {} flags: dict[str, np.ndarray] = {} for band in dirbe_utils.BANDS: band_label = f"{band:02}" @@ -269,15 +302,29 @@ def get_yday_cio_data( ) # Rotate ecliptic vectors to galactic (commander convention) and apply time ordered sorting - unit_vectors = los[:, time_sorted_inds] + unit_vectors = new_los[:, time_sorted_inds] unit_vectors_gal = ROTATOR(unit_vectors) # Convert unit vectors to requested nside resolution healpix pixels pix = hp.vec2pix(nside_out, *unit_vectors_gal) lon, lat = hp.pix2ang(nside_out, pix, lonlat=True) + v_x, v_y, v_z = unit_vectors_gal tod = data[f"Phot{cio_band_label}"].astype(np.float64)[time_sorted_inds] + # Compute polarization angle + lonrad = np.deg2rad(lon) + latrad = np.deg2rad(lat) + colat = np.pi/2 - latrad + att_x = natv[:,0]*np.cos(lonrad) + natv[:,1]*np.sin(lonrad) + att_y = natv[:,1]*np.cos(lonrad) - natv[:,0]*np.sin(lonrad) + + xp = att_x*np.cos(colat) - natv[:,2]*np.sin(colat) + psi = np.arctan2(att_y, xp) + psi[psi < 0] += 2*np.pi + psi = psi % (2*np.pi) + + # Remove the iras convention color correction iras_color_corr_factor = dirbe_utils.get_iras_factor(band) flag = common_flags.copy() @@ -292,9 +339,51 @@ def get_yday_cio_data( lonlat=True, ) - planet_indices = ang_dist <= np.deg2rad(radius) + if (body == 'moon') & ((band == 4) | (band == 5)): + r = 15 + else: + r = radius + planet_indices = ang_dist <= np.deg2rad(r) flag[planet_indices] += 2 ** FLAG_BITS[body] + + # Get comet flags + for body, radius in dirbe_utils.COMET_RADII.items(): + #if (band < 4) | (band < 7): + # continue + comet_x = comet_interps[body]["x"](time) + comet_y = comet_interps[body]["y"](time) + comet_z = comet_interps[body]["z"](time) + comet_dist = comet_interps[body]["dist"](time) + if comet_dist.min() < 2: + r = radius + else: + r = 1 + + ang_dist = hp.rotator.angdist( + np.array([v_x, v_y, v_z]), + np.array([comet_x, comet_y, comet_z]) + ) + + + comet_indices = ang_dist <= np.deg2rad(r) + flag[comet_indices] += 2 ** FLAG_BITS["comets"] + + for body, radius in dirbe_utils.ASTEROID_RADII.items(): + #if (band < 4) | (band < 7): + # continue + aster_x = asteroid_interps[body]["x"](time) + aster_y = asteroid_interps[body]["y"](time) + aster_z = asteroid_interps[body]["z"](time) + + ang_dist = hp.rotator.angdist( + np.array([v_x, v_y, v_z]), + np.array([aster_x, aster_y, aster_z]) + ) + + aster_indices = ang_dist <= np.deg2rad(radius) + flag[aster_indices] += 2 ** FLAG_BITS["asteroids"] + # Find which flags correspond to the detector and get the inds of those flags xs_noise_inds = (xs_noise_flags & band_bit) > 0 flag[xs_noise_inds] += 2 ** FLAG_BITS["excess_noise"] @@ -303,34 +392,58 @@ def get_yday_cio_data( bad_data_inds = tod <= BAD_DATA_SENTINEL flag[bad_data_inds] += 2 ** FLAG_BITS["bad_data"] + # Large glitch-rate related excitations + # Applied for both 7 and 8, since they have the same detector material, + # Ge:Ga. These were determined by hand by looking at residual maps per + # day, and should be automated in the future. + if (band == 7) | (band == 8): + t = np.arange(len(flag)) + scan_no = file_number + 1 + if (scan_no == 90): + glitch_inds = ((t > 270_000) & (t < 275_000)) + flag[glitch_inds] += 2**FLAG_BITS["glitch"] + if (scan_no == 91): + glitch_inds = ((t > 273_500) & (t < 273_750)) + flag[glitch_inds] += 2**FLAG_BITS["glitch"] + if (scan_no == 93): + glitch_inds = ((t > 272_000) & (t < 273_000)) + flag[glitch_inds] += 2**FLAG_BITS["glitch"] + if (scan_no == 118): + glitch_inds = ((t > 211_900) & (t < 212_100)) + flag[glitch_inds] += 2**FLAG_BITS["glitch"] + if (scan_no == 131): + glitch_inds = ((t > 553_500) & (t < 554_125)) + flag[glitch_inds] += 2**FLAG_BITS["glitch"] + if (scan_no == 181): + glitch_inds = ((t > 270_000) & (t < 275_000)) + flag[glitch_inds] += 2**FLAG_BITS["glitch"] + + + # padd tods, pix and flags to remove gaps in data pixels[band_label] = padd_array_gaps( np.split(pix, split_inds), padding=pix_padding ) - # nus, weights = dirbe_utils.get_bandpass(band) - # zodi_tods = zodi_model.get_emission_pix( - # freq=nus, - # weights=weights, - # pixels=pixels[band_label], - # obs_time=Time(time[0], format="mjd"), - # obs_pos=sat_pos * u.au, - # nside=nside_out, - # coord_in="G", - # ) - - # tods[band_label] = zodi_tods.value + tods[band_label] = padd_array_gaps( np.split(tod * iras_color_corr_factor if color_corr else tod, split_inds), padding=bad_data_padding, ) + psis[band_label] = padd_array_gaps( + np.split(psi, split_inds), padding=psi_padding + ) + flags[band_label] = padd_array_gaps( np.split(flag, split_inds), padding=flag_padding ) + print(yday, datetime.now()) + return YdayData( tods, pixels, + psis, flags, time_start=time[0], time_stop=time[-1], @@ -338,6 +451,10 @@ def get_yday_cio_data( sat_pos_stop=sat_pos_stop, earth_pos_start=earth_pos_start, earth_pos_stop=earth_pos_stop, + sat_positions=sat_positions, + earth_positions=earth_positions, + moon_positions=moon_positions, + time_arr=time_arr ) @@ -352,6 +469,27 @@ def padd_vals( def get_oa_flags(oa_flags: np.ndarray, yday: int) -> np.ndarray: + """ + Function which converts the OA flags to the new flag system. The new flag system is as follows: + - The OA flags are split into 7 bits, each bit corresponding to a different flag. + From the DIRBE Explanatory supplement, these are + - Bit 0: 1 if non-definitive attitude, 0 if definitive attitude + - Bit 1: 1 if coarse attitude, 0 if fine attitude + - Bit 2: 1 if merged attitude, 0 if external UAX attitude + - Bit 3: 1 if spacecraft slewing, 0 if spacecraft not slewing + - Bit 4: 1 if special pointing, 0 if normal pointing + - Bit 5: 1 when spacecraft in ascending portion of COBE orbit, + i.e., moving up toward North Ecliptic Pole, + 0 when spacecraft in descending portion of COBE orbit, + i.e., moving down toward South Ecliptic Pole + - Bit 6: 1 if leading LOS, 0 if trailing LOS + - Bit 7: Not used + + Currently, only the non-definitive attitude is considered a gamechanger, so flags with value of 15 (2**15 = 32768) + need to be removed. All others are set to 2**16 = 65536 + + Default assumptions si taht the attitude solutions are the highest values. + """ new_bits = iter( [ bit @@ -361,15 +499,13 @@ def get_oa_flags(oa_flags: np.ndarray, yday: int) -> np.ndarray: ) flags = np.zeros_like(oa_flags) for cio_bit, bit1 in zip(range(7), new_bits): - bit2 = next(new_bits) inds = (oa_flags & 2**cio_bit) > 0 flags[inds] += 2**bit1 - flags[~inds] += 2**bit2 - return flags def get_flag_sum(flags: list[str]) -> int: + if flags: return sum(2 ** FLAG_BITS[flag] for flag in flags) return 0 @@ -413,6 +549,12 @@ def write_band( comm_tod.add_field(pid_common_group + "/earthpos", cio.earth_pos_start[pid]) comm_tod.add_field(pid_common_group + "/earthpos_end", cio.earth_pos_stop[pid]) + comm_tod.add_field(pid_common_group + "/moonpos_arr", cio.moon_positions[pid]) + comm_tod.add_field(pid_common_group + "/satpos_arr", cio.sat_positions[pid]) + comm_tod.add_field(pid_common_group + "/earthpos_arr", cio.earth_positions[pid]) + comm_tod.add_field(pid_common_group + "/time_arr", cio.time_arr[pid]) + comm_tod.add_field(pid_common_group + "/time_len", len(cio.time_arr[pid])) + comm_tod.add_attribute(pid_common_group + "/satpos", "index", "X, Y, Z") comm_tod.add_attribute( pid_common_group + "/satpos", "coords", "heliocentric-ecliptic" @@ -430,7 +572,7 @@ def write_band( ] comm_tod.add_field( pid_det_group + "/psi", - np.zeros_like(cio.tods[pid]), + cio.psis[pid], [psi_digitize_compression, HUFFMAN_COMPRESSION], ) @@ -506,13 +648,14 @@ def write_to_commander_tods( def main() -> None: + print(datetime.now()) time_delta = timedelta(hours=1) files = range(N_CIO_FILES) - nside_out = 256 + nside_out = 512 start_time = time.perf_counter() - color_corr = True - version = 18 + color_corr = False + version = 22 print(f"{'Writing DIRBE h5 files':=^50}") print(f"{version=}, {nside_out=}") @@ -571,19 +714,8 @@ def main() -> None: "uranus", "neptune", "non_definitive_attitude", - # "definite_attitude", - "course_attitude", - # "fine_attitude", - # "merged_attitude", - # "external_uax_attitude", - # "space_craft_slewing", - # "space_craft_not_slewing", + "coarse_attitude", "special_pointing", - # "normal_pointing", - # "space_craft_ascending", - # "space_craft_descending", - # "leading_los", - # "trailing_los", ] ) print(f"flag bit sum: {flag_bit_sum}") diff --git a/commander3/todscripts/hfi/hfiinstrument.py b/commander3/todscripts/hfi/hfiinstrument.py index 59e3fce77..890160e63 100644 --- a/commander3/todscripts/hfi/hfiinstrument.py +++ b/commander3/todscripts/hfi/hfiinstrument.py @@ -25,7 +25,9 @@ import numpy as np import math import argparse +import sys from astropy.io import fits +#sys.path.insert(0, "/mn/stornext/u3/hke/git/Commander_hfi/commander3/python") from commander_tools.tod_tools.hfi import hfi from commander_tools.tod_tools.lfi import lfi from commander_tools.tod_tools import commander_instrument as inst @@ -44,7 +46,7 @@ def main(): args = parser.parse_args() outDir = args.out_dir - version = 1 + version = 3 rimo = fits.open(args.rimo) @@ -52,12 +54,12 @@ def main(): for freq in hfi.freqs: bandNo = rimo.index_of('BANDPASS_F' + str(freq)) - inst_file.add_bandpass(freq, rimo[bandNo].data.field('WAVENUMBER'), rimo[bandNo].data.field('TRANSMISSION')) + inst_file.add_hfi_bandpass(freq, rimo[bandNo].data.field('WAVENUMBER'), rimo[bandNo].data.field('TRANSMISSION')) for det in hfi.dets[freq]: prefix = str(freq) + '-' + det bandNo = rimo.index_of('bandpass_' + str(freq) + '-' + det) - inst_file.add_bandpass(prefix, rimo[bandNo].data.field('wavenumber'), rimo[bandNo].data.field('transmission')) + inst_file.add_hfi_bandpass(prefix, rimo[bandNo].data.field('wavenumber'), rimo[bandNo].data.field('transmission')) beamData, mmax_b = hp.read_alm(os.path.join(args.beam_dir, 'blm_' + str(freq) + '-' + det + '.fits'), return_mmax=True) @@ -74,7 +76,9 @@ def main(): slData_B, mmax_s = hp.read_alm(os.path.join(args.beam_dir, 'fsl_alms_' + str(freq) + '-' + det + '.fits'), return_mmax=True, hdu=2) inst_file.add_alms(prefix, 'sl', lfi.getLmax(len(slData), mmax_s), mmax_s, lfi.complex2realAlms(slData, mmax_s), lfi.complex2realAlms(slData_E, mmax_s), lfi.complex2realAlms(slData_B, mmax_s)) - + else: + #we need sidelobe models for 545 and 857 + inst_file.add_alms(prefix, 'sl', 0, 0, [0], [0], [0]) inst_file.add_alms(prefix, 'beam', lfi.getLmax(len(beamData), mmax_b), mmax_b, lfi.complex2realAlms(beamData, mmax_b), None, None) diff --git a/commander3/todscripts/hfi/hfitohdf5.py b/commander3/todscripts/hfi/hfitohdf5.py index eb61859ae..3fb11b095 100644 --- a/commander3/todscripts/hfi/hfitohdf5.py +++ b/commander3/todscripts/hfi/hfitohdf5.py @@ -36,6 +36,10 @@ import cProfile import glob from scipy.spatial.transform import Rotation as rot +import pickle +import codecs + +import matplotlib.pyplot as plt def main(): @@ -51,6 +55,9 @@ def main(): parser.add_argument('--extra-flags', type=str, action='store', help='path to extra flagging in txt file', default='/mn/stornext/d16/cmbco/bp/HFI/aux/hfi_bad_intervals_15s_elephants.txt') + #https://github.com/planck-npipe/toast-npipe/blob/master/toast_planck/preproc_modules/transf1_nodemod.py + parser.add_argument('--calib-params', type=str, action='store', help='hash dump of HFI housekeeping imo from npipe', default='/mn/stornext/d16/cmbco/bp/HFI/aux/hficalibparams.dat') + parser.add_argument('--out-dir', type=str, action='store', default=os.getcwd(), help='path to output data structure you want to generate') parser.add_argument('--num-procs', type=int, action='store', default=1, help='number of processes to use') @@ -101,7 +108,14 @@ def main(): def make_od(comm_tod, freq, od, args): try: - + + #load housekeeping imo from file + calibfile = open(args.calib_params, mode='r') + calibparams = calibfile.read() + calibfile.close() + calibparams = bytes(calibparams, encoding='utf-8') + hsk = pickle.loads(codecs.decode(bytes(calibparams), 'base64'), fix_imports=True, encoding='bytes') + nside = hfi.nsides[freq] comm_tod.init_file(freq, od, mode='w') @@ -178,14 +192,39 @@ def make_od(comm_tod, freq, od, args): starttime = pointingFile[1].data['obt'][0]/1e9 endtime = pointingFile[1].data['obt'][-1]/1e9 - #per pid - for dbentry in c.execute("SELECT * FROM ring_times_hfi WHERE stop_time >= '{0}' AND start_time < '{1}'".format(starttime, endtime)): + dbs = c.execute("SELECT * FROM ring_times_hfi WHERE stop_time >= '{0}' AND start_time < '{1}'".format(starttime, endtime)) + + #Make a new list where the each short chunk is prepended to a long chunk + chunks = [] + + start = True + for dbentry in dbs: pid = dbentry[0] start_time = dbentry[2] - end_time = dbentry[3] + end_time = dbentry[3] + + if(start): + curr_chunk = [] + curr_chunk.append(pid) + curr_chunk.append(start_time) + curr_chunk.append(end_time) + start = False + else: + curr_chunk.append(start_time) + curr_chunk.append(end_time) + chunks.append(curr_chunk) + start = True + + #per pid + for chunk in chunks: + pid = chunk[0] + + start_time = chunk[1] + end_time = chunk[4] startIndex = np.where(exFile[1].data['obt']/1e9 > start_time) endIndex = np.where(exFile[1].data['obt']/1e9 > end_time) + if len(startIndex[0]) > 0: pid_start = startIndex[0][0] else:#catch days with no pids @@ -197,6 +236,11 @@ def make_od(comm_tod, freq, od, args): if pid_start == pid_end:#catch chunks with no data like od 1007 continue + #There are some samples that are not included in either chunk... + garbageStart = np.where(exFile[1].data['obt']/1e9 > chunk[2])[0][0] + garbageEnd = np.where(exFile[1].data['obt']/1e9 > chunk[3])[0][0] + ngarbage = garbageEnd - garbageStart + #common fields per pid prefix = str(pid).zfill(6) + '/common' @@ -234,8 +278,9 @@ def make_od(comm_tod, freq, od, args): r_boresight = rot.from_quat(quat_arr) - extra_flags = extraFlagsFile[str(pid).zfill(6) + '/flag_extra'] - + extra_flags = extraFlagsFile[str(pid).zfill(6) + '/flag_extra'][()] + extra_flags = np.append(extra_flags, np.ones(ngarbage, dtype='uint16')) + extra_flags = np.append(extra_flags, extraFlagsFile[str(pid+1).zfill(6) + '/flag_extra'][()]) #per detector fields for det in hfi.dets[freq]: @@ -248,14 +293,23 @@ def make_od(comm_tod, freq, od, args): data_i = exFile.index_of(str(freq) + '-' + det) #make flag data - flagArray = exFile[data_i].data.field('flag')[pid_start:pid_end] + flagArray = np.array(exFile[data_i].data.field('flag')[pid_start:pid_end], dtype='uint16') #add extra flagging from txt files ex_flags = extra_flags if(det == '353-1'): - ex_flags = extraFlagsFile[str(pid).zfill(6) + '/flags_extra_353-1'] + #add extra flags and a bit for the repointing period + ex_flags = extraFlagsFile[str(pid).zfill(6) + '/flags_extra_353-1'] + 256 + #add flags for garbage data + ex_flags = np.append(ex_flags, np.zeros(ngarbage, dtype=uint16)) + + #add flags from scanning chunk + ex_flags = np.append(extraFlagsFile[str(pid+1).zfill(6) + '/flags_extra_353-1']) flagArray += ex_flags - + + #with np.printoptions(threshold=np.inf): + # print(flagArray) + if (len(flagArray) > 0): comm_tod.add_field(prefix + '/flag', flagArray, compArr) @@ -265,32 +319,58 @@ def make_od(comm_tod, freq, od, args): # Follows this npipe function: # https://github.com/planck-npipe/toast-npipe/blob/master/toast_planck/utilities.py#L1503-L1575 - phi = math.radians(rimo[1].data.field('phi_uv')[rimo_i]) - theta = math.radians(rimo[1].data.field('theta_uv')[rimo_i]) - psi = math.radians(rimo[1].data.field('psi_uv')[rimo_i] + rimo[1].data.field('psi_pol')[rimo_i]) - phi + phi = float(math.radians(rimo[1].data.field('phi_uv').ravel()[rimo_i])) + theta = float(math.radians(rimo[1].data.field('theta_uv').ravel()[rimo_i])) + psi = float(math.radians(rimo[1].data.field('psi_uv').ravel()[rimo_i])) + float(rimo[1].data.field('psi_pol').ravel()[rimo_i]) - phi + #print(phi) + #print(theta) + #print(psi, float(math.radians(rimo[1].data.field('psi_uv').ravel()[rimo_i])), float(rimo[1].data.field('psi_pol').ravel()[rimo_i])) - det_s = np.cos(0.5 * theta) * np.cos(0.5 * (phi + psi)) - # vector part - det_x = -np.sin(0.5 * theta) * np.sin(0.5 * (phi - psi)) - det_y = np.sin(0.5 * theta) * np.cos(0.5 * (phi - psi)) - det_z = np.cos(0.5 * theta) * np.sin(0.5 * (phi + psi)) + #ZYZ + r_det = rot.from_euler('ZYZ', [phi, theta, psi]) - #convert from boresight pointing to per detector pointing - r_det = rot.from_quat([det_x, det_y, det_z, det_s]) + #rotation due to spin angle + r_spin = rot.from_euler('Y', np.pi/2 - math.radians(85)) - r_total = r_boresight * r_det + r_total = r_boresight *r_spin * r_det #convert to theta, phi, psi - angs = r_total.as_euler('zxz') # could also be 'ZXZ' if we are supposed to be using intrinsic rotations instead of extrinsic - # idk what the difference is + angs = r_total.as_euler('ZYZ') - theta_array = angs[:,0] - phi_array = angs[:,1] + phi_array = angs[:,0] + theta_array = angs[:,1] psi_array = angs[:,2] + + # additional psi rotation due to ecliptic/galactic rotation + r = hp.rotator.Rotator(coord=['E', 'G'], deg=False) + angle = r.angle_ref([theta_array, phi_array]) galTheta, galPhi = r(theta_array, phi_array) + pixels = hp.pixelfunc.ang2pix(nside, galTheta, galPhi) + ''' + if(pid == 25083): + + plt.figure() + x = np.arange(0, 20000) + + theta_, phi_ = hp.pix2ang(nside, pixels) + + print('theta, phi, psi=', np.rad2deg(theta), np.rad2deg(phi), np.rad2deg(psi)) + #print('x, y, z, x=', det_x, det_y, det_z, det_s) + plt.plot(x, theta_[-20000:], label='theta') + plt.plot(x, phi_[-20000:], label='phi') + plt.plot(x, quat_x[-20000:], label='x') + plt.plot(x, quat_y[-20000:], label='y') + plt.plot(x, quat_z[-20000:], label='z') + plt.plot(x, quat_s[-20000:], label='s') + plt.legend(loc='best') + + plt.savefig('quat_test.pdf') + #sys.exit() + ''' + if len(pixels > 0): #compute average outer product outAng = hfi.ring_outer_product(galTheta, galPhi) @@ -303,6 +383,7 @@ def make_od(comm_tod, freq, od, args): #make pol angle if(len(psi_array) > 0): + psi_array += angle psi_array = np.where(psi_array < 0, 2*np.pi + psi_array, psi_array) psi_array = np.where(psi_array >= 2*np.pi, psi_array - 2*np.pi, psi_array) compArray = None @@ -327,17 +408,23 @@ def make_od(comm_tod, freq, od, args): gainFile = fits.open(os.path.join(args.gains_dir, 'npipe5_gains_' + str(freq) + '.fits')) gain = gainFile[gainFile.index_of(str(freq) +'-' + det)].data[0][0] - + gain1, offset = hfi.compute_l1_gain(str(freq) + '-' + det, exFile[1].data['obt'][pid_start:pid_end], hsk) + + + #print(gain, gain1, offset, gain/gain1) + + gain = gain/gain1[0] + #make white noise sigma0 = rimo[1].data.field('net')[rimo_i][0] * math.sqrt(fsamp) #make f_knee #fknee = rimo[1].data.field('f_knee')[rimo_i][0] - fknee = 0.5 + fknee = 0.5 #make 1/f noise exponent #alpha = rimo[1].data.field('alpha')[rimo_i][0] - alpha = -1 + alpha = -1 #print(gain, sigma0, fknee, alpha) comm_tod.add_field(prefix + '/scalars', np.array([gain, sigma0, fknee, alpha]).flatten()) @@ -346,7 +433,17 @@ def make_od(comm_tod, freq, od, args): #make psd noise #make tod data - tod = exFile[exFile.index_of(str(freq)+'-' + det)].data.field('signal')[pid_start:pid_end] + tod = exFile[exFile.index_of(str(freq)+'-' + det)].data.field('signal')[pid_start:pid_end] #- offset + + #fout1 = open("output.dat","w") + #for i in range(len(tod)): + # fout1.write(str(tod[i])+"\n") + #fout1.close() + + #print(tod) + #print(offset) + #ghj + #compArray = [hfi.todDtype, hfi.rice] compArray = [hfi.todDtype, hfi.huffTod] if(args.no_compress): diff --git a/commander3/todscripts/hfi/hfitohdf5_pointing.py b/commander3/todscripts/hfi/hfitohdf5_pointing.py new file mode 100644 index 000000000..e30f079cd --- /dev/null +++ b/commander3/todscripts/hfi/hfitohdf5_pointing.py @@ -0,0 +1,487 @@ +#================================================================================ +# +# Copyright (C) 2020 Institute of Theoretical Astrophysics, University of Oslo. +# +# This file is part of Commander3. +# +# Commander3 is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Commander3 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Commander3. If not, see . +# +#================================================================================ + +from commander_tools.tod_tools.hfi import hfi +from commander_tools.tod_tools import commander_tod as tod +import argparse +import multiprocessing as mp +import os +import numpy as np +import math +from astropy.io import fits +import healpy as hp +import sys +import random +import h5py +import sqlite3 +import traceback +import cProfile +import glob +from scipy.spatial.transform import Rotation as rot +import pickle +import codecs + +import matplotlib.pyplot as plt + +def main(): + + parser = argparse.ArgumentParser() + + parser.add_argument('--planck_dir', type=str, action='store', help='path to the legacy planck data in hdf format', default='/mn/stornext/d16/cmbco/bp/HFI/hfi_miss03_adc') + + parser.add_argument('--gains-dir', type=str, action='store', help='path to a directory with the initial gain estimates', default='/mn/stornext/d16/cmbco/bp/HFI/aux/gains') + + parser.add_argument('--rimo', type=str, action='store', help='path to on disk rimo file', default='/mn/stornext/d16/cmbco/bp/HFI/aux/RIMO_npipe2.fits') + + parser.add_argument('--pid-database', type=str, action='store', help='path to the sql database storing the PID info', default='/mn/stornext/d16/cmbco/bp/HFI/aux/hfi_raw_rings_v3.db') + + parser.add_argument('--extra-flags', type=str, action='store', help='path to extra flagging in txt file', default='/mn/stornext/d16/cmbco/bp/HFI/aux/hfi_bad_intervals_15s_elephants.txt') + + #https://github.com/planck-npipe/toast-npipe/blob/master/toast_planck/preproc_modules/transf1_nodemod.py + parser.add_argument('--calib-params', type=str, action='store', help='hash dump of HFI housekeeping imo from npipe', default='/mn/stornext/d16/cmbco/bp/HFI/aux/hficalibparams.dat') + + parser.add_argument('--out-dir', type=str, action='store', default='/mn/stornext/d5/data/artemba/HFI_data_pointing_DPC/143', help='path to output data structure you want to generate') + + parser.add_argument('--num-procs', type=int, action='store', default=1, help='number of processes to use') + + parser.add_argument('--freqs', type=int, nargs='+', default=[545], help='which hfi frequencies to operate on') + + parser.add_argument('--ods', type=int, nargs=2, default=[91, 975], help='the operational days to operate on') # [92,93] - test ODs; [91, 975] - full + + parser.add_argument('--no-compress', action='store_true', default=False, help='Produce uncompressed data output') + + parser.add_argument('--restart', action='store_true', default=False, help="restart from a previous run that didn't finish") + + parser.add_argument('--produce-filelist', action='store_true', default=True, help='force the production of a filelist even if only some files are present') + + parser.add_argument('--pointing_dir', type=str, action='store', default='/mn/stornext/d5/data/artemba/HFI_pointing/143') + # 545: '/mn/stornext/u3/hke/data_d5/HFI/pointing/545' + # 143: '/mn/stornext/d5/data/artemba/HFI_pointing/143' + + in_args = parser.parse_args() + + in_args.version = 1 + + random.seed() + + os.environ['OMP_NUM_THREADS'] = '1' + + pool = mp.Pool(processes=in_args.num_procs) + manager = mp.Manager() + + ods = range(in_args.ods[0], in_args.ods[1], 1) + + manager = mp.Manager() + dicts = {} + for freq in hfi.freqs: + dicts[freq] = manager.dict() + + comm_tod = tod.commander_tod(in_args.out_dir, 'HFI', in_args.version, dicts, not in_args.restart) + + x = [[pool.apply_async(make_od, args=[comm_tod, freq, od, in_args]) for freq in in_args.freqs] for od in ods] + + for res1 in np.array(x): + for res in res1: + res.get() + + pool.close() + pool.join() + + if ((in_args.ods[0] == 91 and in_args.ods[1] == 975) or in_args.produce_filelist) : + comm_tod.make_filelists() + #write file lists + +def make_od(comm_tod, freq, od, args): + + try: + + #load housekeeping imo from file + calibfile = open(args.calib_params, mode='r') + calibparams = calibfile.read() + calibfile.close() + calibparams = bytes(calibparams, encoding='utf-8') + hsk = pickle.loads(codecs.decode(bytes(calibparams), 'base64'), fix_imports=True, encoding='bytes') + + nside = hfi.nsides[freq] + + comm_tod.init_file(freq, od, mode='w') + + if(args.restart and comm_tod.exists): + comm_tod.finalize_file() + print('Skipping existing file ' + comm_tod.outName) + return + + rimo = fits.open(args.rimo) + + #make common group for things we only read once + #polang, mbeamang, nside, fsamp + prefix = '/common' + rimo_i = np.where(rimo[1].data.field('detector').flatten() == str(freq) + '-' + hfi.dets[freq][0])[0] + + #sampling frequency + fsamp = rimo[1].data.field('f_samp')[rimo_i] + comm_tod.add_field(prefix + '/fsamp', fsamp) + + #nside + comm_tod.add_field(prefix + '/nside', [nside]) + + detNames = '' + polangs = [] + mainbeamangs = [] + for det in hfi.dets[freq]: + rimo_i = np.where(rimo[1].data.field('detector').flatten() == str(freq) + '-' + det)[0] + detNames += str(freq) + '-' + det + ', ' + if len(rimo_i) == 1: rimo_i = rimo_i[0] + polangs.append(math.radians(rimo[1].data.field('psi_pol')[rimo_i])) + mainbeamangs.append(math.radians(rimo[1].data.field('psi_uv')[rimo_i])) + + compArr=[hfi.huffman] + if args.no_compress: + compArr = None + + #make detector names lookup + comm_tod.add_field(prefix + '/det', np.string_(detNames[0:-2])) + + #make polarization angle + comm_tod.add_field(prefix + '/polang', polangs) + comm_tod.add_attribute(prefix + '/polang', 'index', detNames[0:-2]) + + #make main beam angle + comm_tod.add_field(prefix + '/mbang', mainbeamangs) + comm_tod.add_attribute(prefix + '/mbang', 'index', detNames[0:-2]) + + dataFileName = glob.glob(os.path.join(args.planck_dir, str(od).zfill(4), 'H' + str(freq) + '_' + str(od).zfill(4) + '_R_201505??.fits'))[0] + + try: + exFile = fits.open(dataFileName) + except (OSError): + print("Failed to open file " + dataFileName) + return + + try: + pointingFile = fits.open(os.path.join(args.planck_dir, str(od).zfill(4), 'pointing-' + str(od).zfill(4) + '.fits')) + except (OSError): + print("Failed to open file " + os.path.join(args.planck_dir, str(od).zfill(4), 'pointing-' + str(od).zfill(4) + '.fits')) + return + + try: + extraFlagsFile = h5py.File(os.path.join(args.planck_dir, str(od).zfill(4), 'extra_flags_' + str(od).zfill(4) + '.h5'), 'r') + except (OSError): + print("Failed to open file " + os.path.join(args.planck_dir, str(od).zfill(4), 'extra_flags_' + str(od).zfill(4) + '.h5')) + return + + + dpc_times = np.array([]) + angle_dict = dict() + for ods in range(od-1, od+2): + + if ods == 90 or ods == 976: + continue + + try: + DPC_pointing_file = fits.open(os.path.join(args.pointing_dir, 'HFI_TOI_' + str(freq) + '-PTG_R2.01_OD'+ str(ods).zfill(4) + '.fits')) + except (OSError): + print("Failed to open file " + os.path.join(args.pointing_dir, 'HFI_TOI_' + str(freq) + '-PTG_R2.01_OD'+ str(ods).zfill(4) + '.fits')) + return + + dpc_times = np.concatenate([dpc_times, DPC_pointing_file[1].data['OBT']/2.**16]) + + try: + for i, det in enumerate(hfi.dets[freq]): + if det in angle_dict.keys(): + angle_dict[det]['phi'] = np.concatenate([angle_dict[det]['phi'], DPC_pointing_file[i+2].data['PHI']]) + angle_dict[det]['theta'] = np.concatenate([angle_dict[det]['theta'], DPC_pointing_file[i+2].data['THETA']]) + angle_dict[det]['psi'] = np.concatenate([angle_dict[det]['psi'], DPC_pointing_file[i+2].data['PSI']]) + else: + angle_dict[det] = dict() + angle_dict[det]['phi'] = DPC_pointing_file[i+2].data['PHI'] + angle_dict[det]['theta'] = DPC_pointing_file[i+2].data['THETA'] + angle_dict[det]['psi'] = DPC_pointing_file[i+2].data['PSI'] + except: + print("failed to allocate array at od", od) + print("od:", od) + return + + + DPC_pointing_file.close() + + + def closest_argmin(A, B): + # fucntion to find the closest time value between the two arrays + L = B.size + sidx_B = B.argsort() + sorted_B = B[sidx_B] + sorted_idx = np.searchsorted(sorted_B, A) + sorted_idx[sorted_idx==L] = L-1 + mask = (sorted_idx > 0) & \ + ((np.abs(A - sorted_B[sorted_idx-1]) < np.abs(A - sorted_B[sorted_idx])) ) + return sidx_B[sorted_idx-mask] + + + + #open database with pid info in it + conn = sqlite3.connect(args.pid_database) + c = conn.cursor() + + starttime = pointingFile[1].data['obt'][0]/1e9 + endtime = pointingFile[1].data['obt'][-1]/1e9 + + #per pid + for dbentry in c.execute("SELECT * FROM ring_times_hfi WHERE stop_time >= '{0}' AND start_time < '{1}'".format(starttime, endtime)): + pid = dbentry[0] + + #if pid != 10666: continue + + start_time = dbentry[2] + end_time = dbentry[3] + + startIndex = np.where(exFile[1].data['obt']/1e9 > start_time) + endIndex = np.where(exFile[1].data['obt']/1e9 > end_time) + if len(startIndex[0]) > 0: + pid_start = startIndex[0][0] + else:#catch days with no pids + continue + if len(endIndex[0]) != 0: + pid_end = endIndex[0][0] + else:#catch final pid per od + pid_end = len(exFile[1].data['obt']) + if pid_start == pid_end:#catch chunks with no data like od 1007 + continue + + pid_times = exFile[1].data['obt'][pid_start:pid_end]/1e9 + + # find inicies corresponding to the same time staps in DPC files + indices_dpc = closest_argmin(pid_times, dpc_times) + + # fix shift by 3 samples + indices_dpc -= 3 + + + #if pid == 10666: + # print(max(pid_times - dpc_times[indices_dpc])) + # print(pid_times - dpc_times[indices_dpc]) + + prefix = str(pid).zfill(6) + '/common' + + #time field + comm_tod.add_field(prefix + '/time', [exFile[1].data['obt'][pid_start]/1.e+9]) + comm_tod.add_attribute(prefix + '/time','index','OBT in s') + + #length of the tod + comm_tod.add_field(prefix + '/ntod', [pid_end - pid_start]) + + #velocity field + #rotate from ecliptic to galactic + #might be required, I'm not sure what coordinate system these are in + r = hp.Rotator(coord=['E', 'G']) + comm_tod.add_field(prefix + '/vsun', r([pointingFile[4].data['x_vel'][pid_start], pointingFile[4].data['y_vel'][pid_start], pointingFile[4].data['z_vel'][pid_start]])) + + #add some metadata so someone might be able to figure out what is going on + comm_tod.add_attribute(prefix + '/vsun','index', '[x, y, z]') + comm_tod.add_attribute(prefix + '/vsun','coords','galactic') + + #satelite position + comm_tod.add_field(prefix + '/satpos', [pointingFile[5].data['x_pos'][pid_start], pointingFile[5].data['y_pos'][pid_start], pointingFile[5].data['z_pos'][pid_start]]) + #add metadata + comm_tod.add_attribute(prefix + '/satpos','index','X, Y, Z') + comm_tod.add_attribute(prefix + '/satpos','coords','heliocentric') + comm_tod.add_attribute(prefix + '/satpos', 'units', 'AU') + ''' + #read boresight pointing for this chunk + quat_x = pointingFile[3].data['quaternion_x'][pid_start:pid_end] + quat_y = pointingFile[3].data['quaternion_y'][pid_start:pid_end] + quat_z = pointingFile[3].data['quaternion_z'][pid_start:pid_end] + quat_s = pointingFile[3].data['quaternion_s'][pid_start:pid_end] + + quat_arr = np.array([quat_x, quat_y, quat_z, quat_s]).transpose() + + r_boresight = rot.from_quat(quat_arr) + ''' + extra_flags = extraFlagsFile[str(pid).zfill(6) + '/flag_extra'][()] + + + #per detector fields + for det in hfi.dets[freq]: + prefix = str(pid).zfill(6) + '/' + str(freq) + '-' + det + + #get RIMO index + #print(rimo[1].data.field('detector').flatten().shape, rimo[1].data.field('detector').flatten(), 'LFI' +str(horn) + hornType) + rimo_i = np.where(rimo[1].data.field('detector').flatten() == str(freq) + '-' + det)[0] + data_i = exFile.index_of(str(freq) + '-' + det) + + #make flag data + flagArray = exFile[data_i].data.field('flag')[pid_start:pid_end] + + # naughty od list (all pointing is 0) + if od in [157, 266, 267, 366, 367, 368]: + flagArray = np.ones(len(flagArray)) + + #add extra flagging from txt files + ex_flags = extra_flags + if(det == '353-1'): + ex_flags = extraFlagsFile[str(pid).zfill(6) + '/flags_extra_353-1'] + flagArray += ex_flags + + + #with np.printoptions(threshold=np.inf): + # print(flagArray) + + if (len(flagArray) > 0): + comm_tod.add_field(prefix + '/flag', flagArray, compArr) + + + #make pixel number + + #create detector pointing offset quaternion + # Follows this npipe function: + # https://github.com/planck-npipe/toast-npipe/blob/master/toast_planck/utilities.py#L1503-L1575 + ''' + phi = math.radians(rimo[1].data.field('phi_uv')[rimo_i]) + theta = math.radians(rimo[1].data.field('theta_uv')[rimo_i]) + psi = math.radians(rimo[1].data.field('psi_uv')[rimo_i] + rimo[1].data.field('psi_pol')[rimo_i]) - phi + + det_s = np.cos(0.5 * theta) * np.cos(0.5 * (phi + psi)) + # vector part + det_x = -np.sin(0.5 * theta) * np.sin(0.5 * (phi - psi)) + det_y = np.sin(0.5 * theta) * np.cos(0.5 * (phi - psi)) + det_z = np.cos(0.5 * theta) * np.sin(0.5 * (phi + psi)) + + #convert from boresight pointing to per detector pointing + r_det = rot.from_quat([det_x, det_y, det_z, det_s]) + + r_total = r_boresight * r_det + + #convert to theta, phi, psi + angs = r_total.as_euler('ZYZ') # could also be 'ZXZ' if we are supposed to be using intrinsic rotations instead of extrinsic + # idk what the difference is + + phi_array = angs[:,0] + theta_array = angs[:,1] + psi_array = angs[:,2] + + r = hp.rotator.Rotator(coord=['E', 'G'], deg=False) + + galTheta, galPhi = r(theta_array, phi_array) + pixels = hp.pixelfunc.ang2pix(nside, galTheta, galPhi) + + print('Old pointing:') + print(galPhi) + print(galTheta) + print(pixels) + print() + ''' + + galPhi = angle_dict[det]['phi'][indices_dpc] + galTheta = angle_dict[det]['theta'][indices_dpc] + psi_array = angle_dict[det]['psi'][indices_dpc] + try: + pixels = hp.pixelfunc.ang2pix(nside, galTheta, galPhi) + except: + print('Theta:', galTheta, min(galTheta), max(galTheta)) + print('Phi:', galPhi, min(galPhi), max(galPhi)) + + #print(galPhi) + #print(galTheta) + + + if len(pixels > 0): + #compute average outer product + try: + outAng = hfi.ring_outer_product(galTheta, galPhi) + except: + print('Outer product error:', galTheta, min(galTheta), max(galTheta)) + print('od, pid', od, pid) + comm_tod.add_field(prefix + '/outP', data=outAng) + if(args.no_compress): + comm_tod.add_field(prefix+'/theta', data=galTheta) + comm_tod.add_field(prefix+'/phi', data=galPhi) + comm_tod.add_field(prefix + '/pix', pixels, compArr) + + + #make pol angle + if(len(psi_array) > 0): + psi_array = np.where(psi_array < 0, 2*np.pi + psi_array, psi_array) + psi_array = np.where(psi_array >= 2*np.pi, psi_array - 2*np.pi, psi_array) + compArray = None + if not args.no_compress: + compArray = [hfi.psiDigitize, hfi.huffman] + comm_tod.add_field(prefix + '/psi', psi_array, compArray) + + #scalars + + #make gain + + #TODO: figure this shit out + # yikes the gain is complicated as hell + # There is more information needed here from the housekeeping data + # From Reijo: + # To convert DSP-valued HFI data into K_CMB, you also need to calibrate twice. First from DSP into pseudo-Volts. Then from Volts to K_CMB. + + # The first step is performed in this operator: https://github.com/planck-npipe/toast-npipe/blob/master/toast_planck/preproc_modules/transf1_nodemod.py The second step involves multiplying the data with the factors in the gain files you mention. After these, there will be small time-dependent fluctuations coming from residual ADC nonlinearity and (possibly) from real gain fluctuations. + + # Aside from calibration, you will need to demodulate out the square wave modulation between the two calibration steps and correct for bolometric nonlinearity. Please see this part of the preprocessing operator: https://github.com/planck-npipe/toast-npipe/blob/master/toast_planck/preproc.py#L921-L939. + + gainFile = fits.open(os.path.join(args.gains_dir, 'npipe5_gains_' + str(freq) + '.fits')) + gain = gainFile[gainFile.index_of(str(freq) +'-' + det)].data[0][0] + + gain1, offset = hfi.compute_l1_gain(str(freq) + '-' + det, exFile[1].data['obt'][pid_start:pid_end], hsk) + + + #print(gain, gain1, offset, gain/gain1) + + gain = gain/gain1[0] + + #make white noise + sigma0 = rimo[1].data.field('net')[rimo_i][0] * math.sqrt(fsamp[0]) + + #make f_knee + #fknee = rimo[1].data.field('f_knee')[rimo_i][0] + fknee = 0.5 + + #make 1/f noise exponent + #alpha = rimo[1].data.field('alpha')[rimo_i][0] + alpha = -1 + + #print(gain, sigma0, fknee, alpha) + comm_tod.add_field(prefix + '/scalars', np.array([gain, sigma0, fknee, alpha]).flatten()) + comm_tod.add_attribute(prefix + '/scalars','index','gain, sigma0, fknee, alpha') + + #make psd noise + + #make tod data + tod = exFile[exFile.index_of(str(freq)+'-' + det)].data.field('signal')[pid_start:pid_end] #- offset + + #compArray = [hfi.todDtype, hfi.rice] + compArray = [hfi.todDtype, hfi.huffTod] + if(args.no_compress): + compArray = [hfi.todDtype] + comm_tod.add_field(prefix + '/tod', tod, compArray) + + print(freq, od, pid) + comm_tod.finalize_chunk(pid, loadBalance=outAng) + comm_tod.finalize_file() + except: + exc_type, exc_val, exc_tb = sys.exc_info() + raise Exception("".join(traceback.format_exception(exc_type, exc_val, exc_tb))) + + +if __name__ == '__main__': + main() diff --git a/install_ita.sh b/install_ita.sh index 61b98bfca..bbdafb468 100755 --- a/install_ita.sh +++ b/install_ita.sh @@ -20,6 +20,8 @@ owl2528="$prefix+(2[5-8])+$suffix" owl2930="$prefix+(29|30)+$suffix" owl3135="$prefix+(3[1-5])+$suffix" owl3637="$prefix+(3[6-7])+$suffix" +owl38="$prefix+(38)+$suffix" +owl4246="$prefix+(4[2-6])+$suffix" # Using regex to figure out which beehive I am on. prefix="beehive" bee0123="$prefix+(\d{0}|[1-9](?!\d)|1[0-9]|2[0-3])+$suffix" @@ -94,6 +96,10 @@ then build_dir="build_owl3135_${toolchain}_${buildtype}" elif [[ "${HOSTNAME}" =~ $owl3637 ]]; then build_dir="build_owl3637_${toolchain}_${buildtype}" + elif [[ "${HOSTNAME}" =~ $owl4246 ]]; then + build_dir="build_owl4246_${toolchain}_${buildtype}" + elif [[ "${HOSTNAME}" =~ $owl38 ]]; then + build_dir="build_owl38_${toolchain}_${buildtype}" elif [[ "${HOSTNAME}" =~ $bee0123 ]]; then build_dir="build_bee0123_${toolchain}_${buildtype}" elif [[ "${HOSTNAME}" =~ $bee2631 ]]; then @@ -152,15 +158,16 @@ then elif [[ "$toolchain" =~ "oneapi" ]] then # Compilers - fc="ifort" - cc="icc" - cxx="icpc" + fc="ifx" + cc="icx" + cxx="icpx" # MPI compilers - mpifc="mpiifort" - mpicc="mpiicc" - mpicxx="mpiicpc" + mpifc="mpiifx" + mpicc="mpiicx" + mpicxx="mpiicpx" printf "Using Intel:\nFC=$fc\nCC=$cc\nCXX=$cxx\nMPIF90=$mpifc\nMPICC=$mpicc\nMPICXX=$mpicxx" - module load intel/oneapi mpi/2021.11 compiler-rt/2023.2.1 mkl/2023.2.0 icc/2023.2.1 + #module load intel/oneapi mpi/2021.11 compiler-rt/2023.2.1 mkl/2023.2.0 icc/2023.2.1 + module load intel/oneapi compiler/latest mpi/latest mkl/latest elif [[ "$toolchain" =~ "gnu" ]] then # Compilers @@ -172,8 +179,8 @@ then mpicc="mpicc" mpicxx="mpicxx" printf "Using GNU:\nFC=$fc\nCC=$cc\nCXX=$cxx\nMPIF90=$mpifc\nMPICC=$mpicc\nMPICXX=$mpicxx" - module load gcc/13.1 - module load openmpi/gcc13/5.0.2 + module load gcc/13.3.1 + module load openmpi/gcc13/5.0.5 printf "\n" $mpifc --version elif [[ "$toolchain" =~ "flang" ]]