Program s2_gcmbcoad

program s2_gcmbcoad

        ! Uses
    use s2_types_mod
    use s2_error_mod
    use s2_sky_mod
    use s2_pl_mod
    use s2_cmb_mod
    use s2_wnoise_mod

        ! Calls
    call parse_options
    call s2_cmb_free
    call s2_error
    call s2_pl_free
    call s2_sky_compute_map
    call s2_sky_conv
    call s2_sky_downsample
    call s2_sky_free
    call s2_sky_get_map
    call s2_sky_map_convert
    call s2_sky_write_map_file
    call s2_wnoise_free

        ! Variables
    integer, parameter :: NUM_BANDS = 8
    integer, parameter :: NOBS_EXT = 2
    integer, parameter :: LMAX_LIMIT = 1000
    integer, parameter :: NSIDE_FINAL = 256
    character (len=*), parameter :: msgpfx = 's2_gcmbcoad> '
    real (kind=s2_sp), parameter, dimension (NUM_BANDS) :: SIGMA0 = (/ 2.26677, 2.15567, 3.28789, 2.93683, 5.85196, 6.53276, 6.88032, 6.72537 /)
    character (len=S2_STRING_LEN), parameter, dimension (NUM_BANDS) :: filename_nobs = (/ 'wmap_q1_cleanimap_yr1_v1.fits', 'wmap_q2_cleanimap_yr1_v1.fits', 'wmap_v1_cleanimap_yr1_v1.fits', 'wmap_v2_cleanimap_yr1_v1.fits', 'wmap_w1_cleanimap_yr1_v1.fits', 'wmap_w2_cleanimap_yr1_v1.fits', 'wmap_w3_cleanimap_yr1_v1.fits', 'wmap_w4_cleanimap_yr1_v1.fits' /)
    character (len=S2_STRING_LEN), parameter, dimension (NUM_BANDS) :: filename_beam = (/ 'map_q1_ampl_bl_yr1_v1.txt', 'map_q2_ampl_bl_yr1_v1.txt', 'map_v1_ampl_bl_yr1_v1.txt', 'map_v2_ampl_bl_yr1_v1.txt', 'map_w1_ampl_bl_yr1_v1.txt', 'map_w2_ampl_bl_yr1_v1.txt', 'map_w3_ampl_bl_yr1_v1.txt', 'map_w4_ampl_bl_yr1_v1.txt' /)
    character (len=S2_STRING_LEN) :: filename_mask
    character (len=S2_STRING_LEN) :: filename_cl = 'wmap_lcdm_pl_model_yr1_v1.txt'
    character (len=S2_STRING_LEN) :: filename_out
    character (len=S2_STRING_LEN) :: filename_out_cmb_prefix = 'gcmb_coadded_'
    character (len=S2_STRING_LEN) :: filename_out_noise_prefix = 'wnoise_coadded_'
    character (len=S2_STRING_LEN) :: comment_out = 'seed not specified'
    character (len=S2_STRING_LEN) :: filename_current
    character (len=S2_STRING_LEN) :: dir_cl = 'data_input'
    character (len=S2_STRING_LEN) :: dir_nobs = 'data_input'
    character (len=S2_STRING_LEN) :: dir_beam = 'data_input'
    integer :: isim_start = 1
    integer :: isim_end = 1
    integer :: lmax
    integer :: lmin_cl
    integer :: lmin_beam
    integer :: iband
    integer :: isim
    integer :: fail
    integer :: ncomment_cl
    integer :: ncomment_beam
    integer :: seed_cmb = 1
    integer :: seed_noise = 1
    logical :: scale_in_cl = .true.
    logical :: scale_in_beam = .false.
    logical :: line_nos_in_cl = .true.
    logical :: line_nos_in_beam = .true.
    logical :: apply_mask = .false.
    type (s2_pl) :: cl
    type (s2_pl), dimension (NUM_BANDS) :: beam
    type (s2_sky), dimension (NUM_BANDS) :: weights
    type (s2_sky) :: weights_sum
    type (s2_sky) :: weights_temp
    type (s2_sky) :: mask
    type (s2_sky), dimension (NUM_BANDS) :: nobs
    type (s2_cmb) :: cmb
    type (s2_sky) :: cmb_sky
    type (s2_sky), dimension (NUM_BANDS) :: cmb_sky_beam
    type (s2_sky) :: sky_temp
    type (s2_sky) :: cmb_coadded
    type (s2_sky) :: cmb_coadded_unscaled
    type (s2_wnoise) :: wnoise
    type (s2_sky), dimension (NUM_BANDS) :: wnoise_sky
    type (s2_sky) :: wnoise_coadded
    type (s2_sky) :: wnoise_coadded_unscaled
    real (kind=s2_sp), allocatable, dimension (:) :: nobs_map
    real (kind=s2_sp), allocatable, dimension (:) :: weights_map

        ! Interfaces
    interface s2_gcmbcoad_weightedsum

        ! Subroutines and functions
    subroutine parse_options ()

end program s2_gcmbcoad
Generate co-added Gaussian CMB and noise realisations. Realisations are simulated for each WMAP channel by convolving with the approriate beam function and adding appropriate noise for the specific receiver. The signals from each receiver are combined to give a coadded map, using the processing pipeline specified by Komatsu et al. (2003).

Usage: s2_gcmbcoad

Author: J. D. McEwen (mcewen@mrao.cam.ac.uk)

Version: 0.1 - October 2005


Description of Variables

NUM_BANDS

integer, parameter :: NUM_BANDS = 8

NOBS_EXT

integer, parameter :: NOBS_EXT = 2

LMAX_LIMIT

integer, parameter :: LMAX_LIMIT = 1000

NSIDE_FINAL

integer, parameter :: NSIDE_FINAL = 256

msgpfx

character (len=*), parameter :: msgpfx = 's2_gcmbcoad> '

SIGMA0

real (kind=s2_sp), parameter, dimension (NUM_BANDS) :: SIGMA0 = (/ 2.26677, 2.15567, 3.28789, 2.93683, 5.85196, 6.53276, 6.88032, 6.72537 /)

filename_nobs

character (len=S2_STRING_LEN), parameter, dimension (NUM_BANDS) :: filename_nobs = (/ 'wmap_q1_cleanimap_yr1_v1.fits', 'wmap_q2_cleanimap_yr1_v1.fits', 'wmap_v1_cleanimap_yr1_v1.fits', 'wmap_v2_cleanimap_yr1_v1.fits', 'wmap_w1_cleanimap_yr1_v1.fits', 'wmap_w2_cleanimap_yr1_v1.fits', 'wmap_w3_cleanimap_yr1_v1.fits', 'wmap_w4_cleanimap_yr1_v1.fits' /)

filename_beam

character (len=S2_STRING_LEN), parameter, dimension (NUM_BANDS) :: filename_beam = (/ 'map_q1_ampl_bl_yr1_v1.txt', 'map_q2_ampl_bl_yr1_v1.txt', 'map_v1_ampl_bl_yr1_v1.txt', 'map_v2_ampl_bl_yr1_v1.txt', 'map_w1_ampl_bl_yr1_v1.txt', 'map_w2_ampl_bl_yr1_v1.txt', 'map_w3_ampl_bl_yr1_v1.txt', 'map_w4_ampl_bl_yr1_v1.txt' /)

filename_mask

character (len=S2_STRING_LEN) :: filename_mask

filename_cl

character (len=S2_STRING_LEN) :: filename_cl = 'wmap_lcdm_pl_model_yr1_v1.txt'

filename_out

character (len=S2_STRING_LEN) :: filename_out

filename_out_cmb_prefix

character (len=S2_STRING_LEN) :: filename_out_cmb_prefix = 'gcmb_coadded_'

filename_out_noise_prefix

character (len=S2_STRING_LEN) :: filename_out_noise_prefix = 'wnoise_coadded_'

comment_out

character (len=S2_STRING_LEN) :: comment_out = 'seed not specified'

filename_current

character (len=S2_STRING_LEN) :: filename_current

dir_cl

character (len=S2_STRING_LEN) :: dir_cl = 'data_input'

dir_nobs

character (len=S2_STRING_LEN) :: dir_nobs = 'data_input'

dir_beam

character (len=S2_STRING_LEN) :: dir_beam = 'data_input'

isim_start

integer :: isim_start = 1

isim_end

integer :: isim_end = 1

lmax

integer :: lmax

lmin_cl

integer :: lmin_cl

lmin_beam

integer :: lmin_beam

iband

integer :: iband

isim

integer :: isim

fail

integer :: fail

ncomment_cl

integer :: ncomment_cl

ncomment_beam

integer :: ncomment_beam

seed_cmb

integer :: seed_cmb = 1

seed_noise

integer :: seed_noise = 1

scale_in_cl

logical :: scale_in_cl = .true.

scale_in_beam

logical :: scale_in_beam = .false.

line_nos_in_cl

logical :: line_nos_in_cl = .true.

line_nos_in_beam

logical :: line_nos_in_beam = .true.

apply_mask

logical :: apply_mask = .false.

cl

type (s2_pl) :: cl

beam

type (s2_pl), dimension (NUM_BANDS) :: beam

weights

type (s2_sky), dimension (NUM_BANDS) :: weights

weights_sum

type (s2_sky) :: weights_sum

weights_temp

type (s2_sky) :: weights_temp

mask

type (s2_sky) :: mask

nobs

type (s2_sky), dimension (NUM_BANDS) :: nobs

cmb

type (s2_cmb) :: cmb

cmb_sky

type (s2_sky) :: cmb_sky

cmb_sky_beam

type (s2_sky), dimension (NUM_BANDS) :: cmb_sky_beam

sky_temp

type (s2_sky) :: sky_temp

cmb_coadded

type (s2_sky) :: cmb_coadded

cmb_coadded_unscaled

type (s2_sky) :: cmb_coadded_unscaled

wnoise

type (s2_wnoise) :: wnoise

wnoise_sky

type (s2_sky), dimension (NUM_BANDS) :: wnoise_sky

wnoise_coadded

type (s2_sky) :: wnoise_coadded

wnoise_coadded_unscaled

type (s2_sky) :: wnoise_coadded_unscaled

nobs_map

real (kind=s2_sp), allocatable, dimension (:) :: nobs_map

weights_map

real (kind=s2_sp), allocatable, dimension (:) :: weights_map

Description of Interfaces

s2_gcmbcoad_weightedsum

interface s2_gcmbcoad_weightedsum
    function s2_gcmbcoad_weightedsum (skies, weights) result (sky_coadded)
        type (s2_sky), intent(inout), dimension (1:) :: skies
        type (s2_sky), intent(inout), dimension (1:) :: weights
        type (s2_sky) :: sky_coadded
    end function s2_gcmbcoad_weightedsum
end interface s2_gcmbcoad_weightedsum

Description of Subroutines and Functions

parse_options

subroutine parse_options ()
    ! Calls: getArgument
end subroutine parse_options
Parse the options passed when program called.

Author: J. D. McEwen (mcewen@mrao.cam.ac.uk)

Version: 0.1 - October 2005