Module comb_csky_mod

module comb_csky_mod

        ! 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
    use comb_error_mod
    use comb_obj_mod

        ! Types
    public type comb_csky

        ! Interfaces
    public interface comb_csky_init

        ! Subroutines and functions
    private function comb_csky_init_mother (obj, nobj, amplitude, dilation, alpha, beta, gamma, cmb, wnoise, beam, lmax, mmax) result (csky)
    private function comb_csky_init_array (obj, cmb, wnoise) result (csky)
    public subroutine comb_csky_free (csky)
    private subroutine comb_csky_compute_sky_obj (csky)
    private subroutine comb_csky_compute_sky_full (csky)
    public subroutine comb_csky_write_param (csky, filename)
    public subroutine comb_csky_write_sky_obj (csky, filename, comment)
    public subroutine comb_csky_write_sky_full (csky, filename, comment)
    public subroutine comb_csky_write_sky_cmb (csky, filename, comment)
    public subroutine comb_csky_write_sky_wnoise (csky, filename, comment)
    public subroutine comb_csky_set_cmb (csky, cmb)
    public subroutine comb_csky_set_wnoise (csky, wnoise)
    public function comb_csky_get_init (csky) result (init)
    public function comb_csky_get_nobj (csky) result (nobj)
    public function comb_csky_get_nside (csky) result (nside)
    public function comb_csky_get_obj (csky, iobj) result (obj)
    public function comb_csky_get_sky_obj (csky) result (sky_obj)
    public function comb_csky_get_sky_full (csky) result (sky_full)
    public function comb_csky_get_cmb (csky) result (cmb)
    public function comb_csky_get_wnoise (csky) result (wnoise)
    public function comb_csky_get_cmb_status (csky) result (cmb_status)
    public function comb_csky_get_wnoise_status (csky) result (wnoise_status)

end module comb_csky_mod
Provides funcitonality to support a COMB csky object. The csky object defines a full sky map consisting of embedded compact objects (COMB obj objects) and optional primodial cmb and noise realisations. Output maps may be produced contained the sum of all these components or each component map may also be written individually. An output parameter file may also be written to specify the compact object positions and other parameters, in addition to the cmb, beam and noise properties.

Author: J. D. McEwen (mcewen[AT]mrao.cam.ac.uk)

Version: 0.1 August 2004


Description of Types

comb_csky

public type comb_csky
    private
    logical :: init = .false.
    integer :: nobj = 0
    integer :: nside = 0
    type (comb_obj), allocatable, dimension (:) :: obj
    type (s2_sky) :: sky_obj
    type (s2_sky) :: sky_full
    type (s2_cmb) :: cmb
    type (s2_wnoise) :: wnoise
    logical :: cmb_status = .false.
    logical :: wnoise_status = .false.
end type comb_csky

Description of Interfaces

comb_csky_init

public interface comb_csky_init
    module procedure comb_csky_init_mother
    module procedure comb_csky_init_array
end interface comb_csky_init

Description of Subroutines and Functions

comb_csky_init_mother

private function comb_csky_init_mother (obj, nobj, amplitude, dilation, alpha, beta, gamma, cmb, wnoise, beam, lmax, mmax) result (csky)
    type (comb_obj), intent(in) :: obj
    integer, intent(in) :: nobj
    real (kind=s2_sp), intent(in), dimension (:) :: amplitude
    real (kind=s2_sp), intent(in), dimension (:) :: dilation
    real (kind=s2_sp), intent(in), dimension (:) :: alpha
    real (kind=s2_sp), intent(in), dimension (:) :: beta
    real (kind=s2_sp), intent(in), dimension (:) :: gamma
    type (s2_cmb), optional, intent(in) :: cmb
    type (s2_wnoise), optional, intent(in) :: wnoise
    type (s2_pl), optional, intent(in) :: beam
    integer, optional, intent(in) :: lmax
    integer, optional, intent(in) :: mmax
    type (comb_csky) :: csky
    ! Calls: comb_csky_compute_sky_full, comb_csky_compute_sky_obj, comb_csky_set_cmb, comb_csky_set_wnoise, comb_error, comb_obj_compute_alm, comb_obj_conv, s2_error, s2_sky_free
end function comb_csky_init_mother
Initialise a csky from a mother obj and arrays of parameters specifying properties of each object to add to the obj array. Cmb and wnoise objects may also be optionally added.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_init_array

private function comb_csky_init_array (obj, cmb, wnoise) result (csky)
    type (comb_obj), intent(in), dimension (:) :: obj
    type (s2_cmb), optional, intent(in) :: cmb
    type (s2_wnoise), optional, intent(in) :: wnoise
    type (comb_csky) :: csky
    ! Calls: comb_csky_compute_sky_full, comb_csky_compute_sky_obj, comb_csky_set_cmb, comb_csky_set_wnoise, comb_error, s2_error, s2_sky_free
end function comb_csky_init_array
Initialise csky from an array of already defined objs. Cmb and wnoise objects may also be optionally added.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_free

public subroutine comb_csky_free (csky)
    type (comb_csky), intent(inout) :: csky
    ! Calls: comb_error, comb_obj_free, s2_cmb_free, s2_sky_free, s2_wnoise_free
end subroutine comb_csky_free
Free all data associated with an initialised csky and reset all other attributes.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_compute_sky_obj

private subroutine comb_csky_compute_sky_obj (csky)
    type (comb_csky), intent(inout) :: csky
    ! Calls: comb_error, s2_sky_free
end subroutine comb_csky_compute_sky_obj
Compute the full sky obj representation consisting of the sum of all individual objs contained in the csky obj array.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_compute_sky_full

private subroutine comb_csky_compute_sky_full (csky)
    type (comb_csky), intent(inout) :: csky
    ! Calls: comb_error, s2_sky_free
end subroutine comb_csky_compute_sky_full
Compute full sky map consisting of the full sky obj representation and the cmb and noise realisation (if present).

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_write_param

public subroutine comb_csky_write_param (csky, filename)
    type (comb_csky), intent(in) :: csky
    character (len=*), intent(in) :: filename
    ! Calls: date_and_time
end subroutine comb_csky_write_param
Write text parameter file describing csky attributes. All compact object parameters are written (eg. alplitude, dilation and Euler angles), plus limited cmb and noise parameters).

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_write_sky_obj

public subroutine comb_csky_write_sky_obj (csky, filename, comment)
    type (comb_csky), intent(in) :: csky
    character (len=*), intent(in) :: filename
    character (len=*), optional, intent(in) :: comment
    ! Calls: comb_error, s2_sky_write_map_file
end subroutine comb_csky_write_sky_obj
Write csky compact object full sky representation to fits file.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_write_sky_full

public subroutine comb_csky_write_sky_full (csky, filename, comment)
    type (comb_csky), intent(in) :: csky
    character (len=*), intent(in) :: filename
    character (len=*), optional, intent(in) :: comment
    ! Calls: comb_error, s2_sky_write_map_file
end subroutine comb_csky_write_sky_full
Write csky full sky representation consisting of all present components to fits file.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_write_sky_cmb

public subroutine comb_csky_write_sky_cmb (csky, filename, comment)
    type (comb_csky), intent(in) :: csky
    character (len=*), intent(in) :: filename
    character (len=*), optional, intent(in) :: comment
    ! Calls: comb_error, s2_cmb_write_sky
end subroutine comb_csky_write_sky_cmb
Write cmb sky map (if present) to fits file.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_write_sky_wnoise

public subroutine comb_csky_write_sky_wnoise (csky, filename, comment)
    type (comb_csky), intent(in) :: csky
    character (len=*), intent(in) :: filename
    character (len=*), optional, intent(in) :: comment
    ! Calls: comb_error, s2_wnoise_write_sky_file
end subroutine comb_csky_write_sky_wnoise
Write wnoise sky map (if present) to fits file.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_set_cmb

public subroutine comb_csky_set_cmb (csky, cmb)
    type (comb_csky), intent(inout) :: csky
    type (s2_cmb), intent(in) :: cmb
    ! Calls: comb_csky_compute_sky_full, comb_error, s2_cmb_free
end subroutine comb_csky_set_cmb
Set the csky cmb object to that passed as an argument (actually create a copy of this cmb). The full sky csky map is then recomputed with the new cmb included.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_set_wnoise

public subroutine comb_csky_set_wnoise (csky, wnoise)
    type (comb_csky), intent(inout) :: csky
    type (s2_wnoise) :: wnoise
    ! Calls: comb_csky_compute_sky_full, comb_error, s2_wnoise_free
end subroutine comb_csky_set_wnoise
Set the csky wnoise object to that passed as an argument (actually create a copy of this wnoise). The full sky csky map is then recomputed with the new wnoise included.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_get_init

public function comb_csky_get_init (csky) result (init)
    type (comb_csky), intent(in) :: csky
    logical :: init
end function comb_csky_get_init
Get init variable from the passed csky object.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_get_nobj

public function comb_csky_get_nobj (csky) result (nobj)
    type (comb_csky), intent(in) :: csky
    integer :: nobj
    ! Calls: s2_error
end function comb_csky_get_nobj
Get nobj variable from the passed csky object.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_get_nside

public function comb_csky_get_nside (csky) result (nside)
    type (comb_csky), intent(in) :: csky
    integer :: nside
    ! Calls: s2_error
end function comb_csky_get_nside
Get nside variable from the passed csky object.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_get_obj

public function comb_csky_get_obj (csky, iobj) result (obj)
    type (comb_csky), intent(in) :: csky
    integer, intent(in) :: iobj
    type (comb_obj) :: obj
    ! Calls: s2_error
end function comb_csky_get_obj
Get compact object variable at specified index from the passed csky object.

Notes:

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_get_sky_obj

public function comb_csky_get_sky_obj (csky) result (sky_obj)
    type (comb_csky), intent(in) :: csky
    type (s2_sky) :: sky_obj
    ! Calls: s2_error
end function comb_csky_get_sky_obj
Get sky_obj variable from the passed csky object.

Notes:

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_get_sky_full

public function comb_csky_get_sky_full (csky) result (sky_full)
    type (comb_csky), intent(in) :: csky
    type (s2_sky) :: sky_full
    ! Calls: s2_error
end function comb_csky_get_sky_full
Get sky_full variable from the passed csky object.

Notes:

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_get_cmb

public function comb_csky_get_cmb (csky) result (cmb)
    type (comb_csky), intent(in) :: csky
    type (s2_cmb) :: cmb
    ! Calls: s2_error
end function comb_csky_get_cmb
Get cmb variable from the passed csky object.

Notes:

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_get_wnoise

public function comb_csky_get_wnoise (csky) result (wnoise)
    type (comb_csky), intent(in) :: csky
    type (s2_wnoise) :: wnoise
    ! Calls: s2_error
end function comb_csky_get_wnoise
Get wnoise variable from the passed csky object.

Notes:

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_get_cmb_status

public function comb_csky_get_cmb_status (csky) result (cmb_status)
    type (comb_csky), intent(in) :: csky
    logical :: cmb_status
    ! Calls: s2_error
end function comb_csky_get_cmb_status
Get cmb_status variable from the passed csky object.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004

comb_csky_get_wnoise_status

public function comb_csky_get_wnoise_status (csky) result (wnoise_status)
    type (comb_csky), intent(in) :: csky
    logical :: wnoise_status
    ! Calls: s2_error
end function comb_csky_get_wnoise_status
Get wnoise_status variable from the passed csky object.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004