module s2_cmb_mod
! Uses
use s2_types_mod
use s2_error_mod
use s2_distn_mod
use s2_pl_mod
use s2_sky_mod
use s2_wnoise_mod
! Types
public type s2_cmb
! Interfaces
public interface s2_cmb_init
! Subroutines and functions
private function s2_cmb_init_pl (clt, nside, seed, beam, compute_map) result (cmb)
private function s2_cmb_init_array (clt_spec, nside, seed, beam, compute_map) result (cmb)
private function s2_cmb_init_file (filename_clt, nside, lmin, lmax, ncomment, seed, beam, scale_cl, compute_map) result (cmb)
private function s2_cmb_init_copy (orig) result (copy)
public subroutine s2_cmb_free (cmb)
public subroutine s2_cmb_gen_sky (cmb, seed, beam, compute_map)
private subroutine s2_cmb_apply_beam (cmb, beam)
private subroutine s2_cmb_create_alm (cmb, seed_in)
private subroutine s2_cmb_compute_map (cmb)
public subroutine s2_cmb_map_convert (cmb, pix_scheme)
public subroutine s2_cmb_add_noise (cmb, wnoise)
public subroutine s2_cmb_write_sky (cmb, filename, comment)
public function s2_cmb_get_init (cmb) result (init)
public function s2_cmb_get_nside (cmb) result (nside)
public function s2_cmb_get_npix (cmb) result (npix)
public function s2_cmb_get_lmax (cmb) result (lmax)
public function s2_cmb_get_sky (cmb) result (sky)
public function s2_cmb_get_clt (cmb) result (clt)
public function s2_cmb_get_noise_added (cmb) result (noise_added)
public function s2_cmb_get_beam_applied (cmb) result (beam_applied)
end module s2_cmb_mod
Provides functionality to create a Gaussian simuated CMB map. The map
is realised from Gaussain alms that satisfy the specified CMB power
spectrum.
Author: J. D. McEwen (mcewen@mrao.cam.ac.uk)
Version: 0.1 August 2004
public type s2_cmb
private
logical :: init = .false.
integer :: seed
integer :: nside = 0
type (s2_sky) :: sky
type (s2_pl) :: clt
logical :: noise_added = .false.
logical :: beam_applied = .false.
end type s2_cmb
public interface s2_cmb_init
module procedure s2_cmb_init_pl
module procedure s2_cmb_init_array
module procedure s2_cmb_init_file
module procedure s2_cmb_init_copy
end interface s2_cmb_init
private function s2_cmb_init_pl (clt, nside, seed, beam, compute_map) result (cmb)
type (s2_pl), intent(in) :: clt
integer, intent(in) :: nside
integer, intent(in) :: seed
type (s2_pl), optional, intent(in) :: beam
logical, optional, intent(in) :: compute_map
type (s2_cmb) :: cmb
! Calls: s2_cmb_gen_sky, s2_error
end function s2_cmb_init_pl
Initialise a Gaussian cmb form a clt spectrum pl object.
If beam is present then the realised cmb alms are convolved with the
beam before the cmb map is generated.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_init_array
private function s2_cmb_init_array (clt_spec, nside, seed, beam, compute_map) result (cmb)
real (kind=s2_sp), intent(in), dimension (:) :: clt_spec
integer, intent(in) :: nside
integer, intent(in) :: seed
type (s2_pl), optional, intent(in) :: beam
logical, optional, intent(in) :: compute_map
type (s2_cmb) :: cmb
! Calls: s2_cmb_gen_sky, s2_error
end function s2_cmb_init_array
Initialise a Gaussian cmb form a clt spectrum array.
If beam is present then the realised cmb alms are convolved with the
beam before the cmb map is generated.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_init_file
private function s2_cmb_init_file (filename_clt, nside, lmin, lmax, ncomment, seed, beam, scale_cl, compute_map) result (cmb)
character (len=*), intent(in) :: filename_clt
integer, intent(in) :: nside
integer, intent(in) :: lmin
integer, intent(in) :: lmax
integer, intent(in) :: ncomment
integer, intent(in) :: seed
type (s2_pl), optional, intent(in) :: beam
logical, optional, intent(in) :: scale_cl
logical, optional, intent(in) :: compute_map
type (s2_cmb) :: cmb
! Calls: s2_cmb_gen_sky, s2_error
end function s2_cmb_init_file
Initialise a Gaussian cmb from a file containing a clt spectrum.
If beam is present then the realised cmb alms are convolved with the
beam before the cmb map is generated.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_init_copy
private function s2_cmb_init_copy (orig) result (copy)
type (s2_cmb), intent(in) :: orig
type (s2_cmb) :: copy
! Calls: s2_error
end function s2_cmb_init_copy
Initialise a cmb from a copy of an original cmb.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_free
public subroutine s2_cmb_free (cmb)
type (s2_cmb), intent(inout) :: cmb
! Calls: s2_error, s2_pl_free, s2_sky_free
end subroutine s2_cmb_free
Free all data associated with an initialised cmb and reset all other
attributes.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_gen_sky
public subroutine s2_cmb_gen_sky (cmb, seed, beam, compute_map)
type (s2_cmb), intent(inout) :: cmb
integer, optional, intent(in) :: seed
type (s2_pl), optional, intent(in) :: beam
logical, optional, intent(in) :: compute_map
! Calls: s2_cmb_apply_beam, s2_cmb_compute_map, s2_cmb_create_alm, s2_error
end subroutine s2_cmb_gen_sky
Generate a sky realisation of the cmb from the clt spectrum.
First Gaussian alm values that satisfy the clt spectrum are generated,
these are convolved with a beam (if present), before the map realisation
is computed from an inverse spherical harmonic transform.
Notes:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_apply_beam
private subroutine s2_cmb_apply_beam (cmb, beam)
type (s2_cmb), intent(inout) :: cmb
type (s2_pl), intent(in) :: beam
! Calls: s2_error, s2_pl_conv, s2_sky_free, s2_sky_get_alm
end subroutine s2_cmb_apply_beam
Convolve beam with cmb alms. The cmb alms are overwritten with the
convolved alms.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_create_alm
private subroutine s2_cmb_create_alm (cmb, seed_in)
type (s2_cmb), intent(inout) :: cmb
integer, optional, intent(in) :: seed_in
! Calls: s2_error, s2_sky_free
end subroutine s2_cmb_create_alm
Create Gaussian cmb alms that satify the clt spectrum.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_compute_map
private subroutine s2_cmb_compute_map (cmb)
type (s2_cmb), intent(inout) :: cmb
! Calls: s2_error, s2_sky_compute_map
end subroutine s2_cmb_compute_map
Compute the cmb sky map from alms.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_map_convert
public subroutine s2_cmb_map_convert (cmb, pix_scheme)
type (s2_cmb), intent(inout) :: cmb
integer, intent(in) :: pix_scheme
! Calls: s2_error, s2_sky_map_convert
end subroutine s2_cmb_map_convert
Convert sky map pixelisation scheme between nested and ring.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_add_noise
public subroutine s2_cmb_add_noise (cmb, wnoise)
type (s2_cmb), intent(inout) :: cmb
type (s2_wnoise), intent(in) :: wnoise
! Calls: s2_error, s2_sky_free
end subroutine s2_cmb_add_noise
Add noise to the cmb sky map. The cmb noise_added attribute flag is
also set.
Notes:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_write_sky
public subroutine s2_cmb_write_sky (cmb, filename, comment)
type (s2_cmb), intent(in) :: cmb
character (len=*), intent(in) :: filename
character (len=*), optional, intent(in) :: comment
! Calls: s2_error, s2_sky_write_map_file
end subroutine s2_cmb_write_sky
Write the cmb sky to an output fits file.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_get_init
public function s2_cmb_get_init (cmb) result (init)
type (s2_cmb), intent(in) :: cmb
logical :: init
end function s2_cmb_get_init
Get init variable from the passed cmb.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_get_nside
public function s2_cmb_get_nside (cmb) result (nside)
type (s2_cmb), intent(in) :: cmb
integer :: nside
! Calls: s2_error
end function s2_cmb_get_nside
Get nside variable from the passed cmb.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_get_npix
public function s2_cmb_get_npix (cmb) result (npix)
type (s2_cmb), intent(in) :: cmb
integer :: npix
! Calls: s2_error
end function s2_cmb_get_npix
Get npix variable from the passed cmb.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_get_lmax
public function s2_cmb_get_lmax (cmb) result (lmax)
type (s2_cmb), intent(in) :: cmb
integer :: lmax
! Calls: s2_error
end function s2_cmb_get_lmax
Get lmax variable from the passed cmb.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_get_sky
public function s2_cmb_get_sky (cmb) result (sky)
type (s2_cmb), intent(in) :: cmb
type (s2_sky) :: sky
! Calls: s2_error
end function s2_cmb_get_sky
Get sky variable from the passed cmb.
Notes:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_get_clt
public function s2_cmb_get_clt (cmb) result (clt)
type (s2_cmb), intent(in) :: cmb
type (s2_pl) :: clt
! Calls: s2_error
end function s2_cmb_get_clt
Get clt variable from the passed cmb.
Notes:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_get_noise_added
public function s2_cmb_get_noise_added (cmb) result (noise_added)
type (s2_cmb), intent(in) :: cmb
logical :: noise_added
! Calls: s2_error
end function s2_cmb_get_noise_added
Get noise_added variable from the passed cmb.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_cmb_get_beam_applied
public function s2_cmb_get_beam_applied (cmb) result (beam_applied)
type (s2_cmb), intent(in) :: cmb
logical :: beam_applied
! Calls: s2_error
end function s2_cmb_get_beam_applied
Get beam_applied variable from the passed cmb.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004