Module cswt_swav_mod

module cswt_swav_mod

        ! Uses
    use cswt_error_mod
    use s2_types_mod
    use s2_sky_mod

        ! Types
    public type cswt_swav

        ! Variables
    integer, public, parameter :: CSWT_SWAV_DEFAULT_PIX_SCHEME = S2_SKY_RING
    character (len=*), public, parameter :: CSWT_SWAV_DEFAULT_NAME = 'Not specified'
    integer, public, parameter :: CSWT_SWAV_DILATION_DIM = 2

        ! Interfaces
    public interface cswt_swav_init

        ! Subroutines and functions
    private function cswt_swav_init_fun (fun, nside, pix_scheme_in, lmax, mmax, param, name, dilation, alpha, beta, gamma, fun_type, norm_preserve) result (swav)
    private function cswt_swav_init_sky (sky, name, dilation, alpha, beta, gamma, norm_preserve) result (swav)
    private function cswt_swav_init_file (filename, name, dilation, alpha, beta, gamma, norm_preserve) result (swav)
    private function cswt_swav_init_copy (orig) result (copy)
    public subroutine cswt_swav_free (swav)
    public subroutine cswt_swav_dilate (swav, dilation, norm_preserve_in)
    public subroutine cswt_swav_rotate (swav, alpha, beta, gamma)
    public function cswt_swav_azimuthal_bl (swav, cutoff_prop) result (mmax_min)
    public subroutine cswt_swav_compute_alm (swav, lmax, mmax, message)
    public subroutine cswt_swav_write_map_file (swav, filename, comment)
    public function cswt_swav_get_init (swav) result (init)
    public function cswt_swav_get_sky (swav) result (sky)
    public subroutine cswt_swav_get_sky_alm (swav, alm)
    public function cswt_swav_get_map_status (swav) result (map_status)
    public function cswt_swav_get_alm_status (swav) result (alm_status)
    public function cswt_swav_get_nside (swav) result (nside)
    public function cswt_swav_get_pix_scheme (swav) result (pix_scheme)
    public function cswt_swav_get_name (swav) result (name)
    public function cswt_swav_get_admiss (swav) result (admiss)
    public function cswt_swav_get_admiss_perc (swav) result (admiss_perc)
    public function cswt_swav_get_dilation (swav) result (dilation)
    public function cswt_swav_get_alpha (swav) result (alpha)
    public function cswt_swav_get_beta (swav) result (beta)
    public function cswt_swav_get_gamma (swav) result (gamma)

end module cswt_swav_mod
Provides functionality to support and manipulate a spherical wavelet. The spherical wavelet data structure includes the wavelet sky plus its parameters.

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

Version: 0.1 - November 2004


Description of Types

cswt_swav

public type cswt_swav
    private
    logical :: init = .false.
    type (s2_sky) :: sky
    character (len=S2_STRING_LEN) :: name = trim (CSWT_SWAV_DEFAULT_NAME)
    real (kind=s2_sp) :: admiss = 0.0e0
    real (kind=s2_sp), dimension (CSWT_SWAV_DILATION_DIM) :: dilation = (/ 1.0e0, 1.0e0 /)
    real (kind=s2_sp) :: alpha = 0.0e0
    real (kind=s2_sp) :: beta = 0.0e0
    real (kind=s2_sp) :: gamma = 0.0e0
end type cswt_swav

Description of Variables

CSWT_SWAV_DEFAULT_PIX_SCHEME

integer, public, parameter :: CSWT_SWAV_DEFAULT_PIX_SCHEME = S2_SKY_RING
Default healpix pixelisation scheme.

CSWT_SWAV_DEFAULT_NAME

character (len=*), public, parameter :: CSWT_SWAV_DEFAULT_NAME = 'Not specified'
Default wavelet name if not specified.

CSWT_SWAV_DILATION_DIM

integer, public, parameter :: CSWT_SWAV_DILATION_DIM = 2
Dimension of dilation.

Description of Interfaces

cswt_swav_init

public interface cswt_swav_init
    module procedure cswt_swav_init_fun
    module procedure cswt_swav_init_sky
    module procedure cswt_swav_init_file
    module procedure cswt_swav_init_copy
end interface cswt_swav_init

Description of Subroutines and Functions

cswt_swav_init_fun

private function cswt_swav_init_fun (fun, nside, pix_scheme_in, lmax, mmax, param, name, dilation, alpha, beta, gamma, fun_type, norm_preserve) result (swav)
    interface fun
        function fun (x, phi, param) result (val)
            real (kind=s2_sp), intent(in) :: x
            real (kind=s2_sp), intent(in) :: phi
            real (kind=s2_sp), optional, intent(in), dimension (:) :: param
            real (kind=s2_sp) :: val
        end function fun
    end interface fun
    integer, intent(in) :: nside
    integer, optional, intent(in) :: pix_scheme_in
    integer, optional, intent(in) :: lmax
    integer, optional, intent(in) :: mmax
    real (kind=s2_sp), optional, intent(in), dimension (:) :: param
    character (len=*), optional, intent(in) :: name
    real (kind=s2_sp), optional, intent(in), dimension (CSWT_SWAV_DILATION_DIM) :: dilation
    real (kind=s2_sp), optional, intent(in) :: alpha
    real (kind=s2_sp), optional, intent(in) :: beta
    real (kind=s2_sp), optional, intent(in) :: gamma
    integer, optional, intent(in) :: fun_type
    logical, optional, intent(in) :: norm_preserve
    type (cswt_swav) :: swav
    ! Calls: cswt_error, cswt_swav_dilate, cswt_swav_rotate
end function cswt_swav_init_fun
Initialise a swav (spherical wavelet) from a template function defined either on the sphere or plane.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_init_sky

private function cswt_swav_init_sky (sky, name, dilation, alpha, beta, gamma, norm_preserve) result (swav)
    type (s2_sky), intent(in) :: sky
    character (len=*), optional, intent(in) :: name
    real (kind=s2_sp), optional, intent(in), dimension (CSWT_SWAV_DILATION_DIM) :: dilation
    real (kind=s2_sp), optional, intent(in) :: alpha
    real (kind=s2_sp), optional, intent(in) :: beta
    real (kind=s2_sp), optional, intent(in) :: gamma
    logical, optional, intent(in) :: norm_preserve
    type (cswt_swav) :: swav
    ! Calls: cswt_error, cswt_swav_dilate, cswt_swav_rotate
end function cswt_swav_init_sky
Initialise a swav (spherical wavelet) from a predefined sky.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_init_file

private function cswt_swav_init_file (filename, name, dilation, alpha, beta, gamma, norm_preserve) result (swav)
    character (len=*), intent(in) :: filename
    character (len=*), optional, intent(in) :: name
    real (kind=s2_sp), optional, intent(in), dimension (CSWT_SWAV_DILATION_DIM) :: dilation
    real (kind=s2_sp), optional, intent(in) :: alpha
    real (kind=s2_sp), optional, intent(in) :: beta
    real (kind=s2_sp), optional, intent(in) :: gamma
    logical, optional, intent(in) :: norm_preserve
    type (cswt_swav) :: swav
    ! Calls: cswt_error, s2_sky_free
end function cswt_swav_init_file
Initialise a swav (spherical wavelet) from a sky read from an input file.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_init_copy

private function cswt_swav_init_copy (orig) result (copy)
    type (cswt_swav), intent(in) :: orig
    type (cswt_swav) :: copy
    ! Calls: cswt_error
end function cswt_swav_init_copy
Initialise a new swav (spherical wavelet) as a copy of another swav.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_free

public subroutine cswt_swav_free (swav)
    type (cswt_swav), intent(inout) :: swav
    ! Calls: cswt_error, s2_sky_free
end subroutine cswt_swav_free
Free all data associated with an initialised swav and reset all other attributes.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_dilate

public subroutine cswt_swav_dilate (swav, dilation, norm_preserve_in)
    type (cswt_swav), intent(inout) :: swav
    real (kind=s2_sp), intent(in), dimension (CSWT_SWAV_DILATION_DIM) :: dilation
    logical, optional, intent(in) :: norm_preserve_in
    ! Calls: cswt_error, s2_sky_dilate
end subroutine cswt_swav_dilate
Dilate the spherical wavelet and update the dilation parameter. Only a mother wavelet with dilation of one may be dilated (otherwise a different dilation would have to be performed to give the correct final dilation).

Notes:

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_rotate

public subroutine cswt_swav_rotate (swav, alpha, beta, gamma)
    type (cswt_swav), intent(inout) :: swav
    real (kind=s2_sp), intent(in) :: alpha
    real (kind=s2_sp), intent(in) :: beta
    real (kind=s2_sp), intent(in) :: gamma
    ! Calls: cswt_error, s2_sky_rotate
end subroutine cswt_swav_rotate
Rotate a spherical wavelet. Only an originally non-rotated wavelet may be rotated (otherwise a different rotation would have to be performed to give the correct final rotation).

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_azimuthal_bl

public function cswt_swav_azimuthal_bl (swav, cutoff_prop) result (mmax_min)
    type (cswt_swav), intent(inout) :: swav
    real (kind=s2_sp), optional, intent(in) :: cutoff_prop
    integer :: mmax_min
    ! Calls: cswt_error
end function cswt_swav_azimuthal_bl
Find azimuthal band limit of wavelet. Finds lowest m' value such that cutoff_prop*100 percent of the cm power is contained in the alms with m index below m'.

Notes:

Variables

Author: J. D. McEwen

Version: 0.1 May 2005

cswt_swav_compute_alm

public subroutine cswt_swav_compute_alm (swav, lmax, mmax, message)
    type (cswt_swav), intent(inout) :: swav
    integer, intent(in) :: lmax
    integer, intent(in) :: mmax
    logical, optional, intent(in) :: message
    ! Calls: cswt_error, s2_sky_compute_alm
end subroutine cswt_swav_compute_alm
Compute the spherical wavelet sky alms.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_write_map_file

public subroutine cswt_swav_write_map_file (swav, filename, comment)
    type (cswt_swav), intent(in) :: swav
    character (len=*), intent(in) :: filename
    character (len=*), optional, intent(in) :: comment
    ! Calls: cswt_error, s2_sky_write_map_file
end subroutine cswt_swav_write_map_file
Write the spherical wavelet sky to an output file.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_get_init

public function cswt_swav_get_init (swav) result (init)
    type (cswt_swav), intent(in) :: swav
    logical :: init
end function cswt_swav_get_init
Get init variable from the passed swav.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_get_sky

public function cswt_swav_get_sky (swav) result (sky)
    type (cswt_swav), intent(in) :: swav
    type (s2_sky) :: sky
    ! Calls: cswt_error
end function cswt_swav_get_sky
Get sky variable from the passed swav.

Notes:

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_get_sky_alm

public subroutine cswt_swav_get_sky_alm (swav, alm)
    type (cswt_swav), intent(in) :: swav
    complex (kind=s2_spc), intent(out), dimension (:,:) :: alm
    ! Calls: cswt_error, s2_sky_get_alm
end subroutine cswt_swav_get_sky_alm
Get alm of the swav sky.

Variables:

Author: J. D. McEwen

Version: 0.1 July 2005

cswt_swav_get_map_status

public function cswt_swav_get_map_status (swav) result (map_status)
    type (cswt_swav), intent(in) :: swav
    logical :: map_status
    ! Calls: cswt_error
end function cswt_swav_get_map_status
Get map_status of the sky of the passed swav. Note that the map status is stored within the wavelet sky object.

Variables:

Author: J. D. McEwen

Version: 0.1 - April 2005

cswt_swav_get_alm_status

public function cswt_swav_get_alm_status (swav) result (alm_status)
    type (cswt_swav), intent(in) :: swav
    logical :: alm_status
    ! Calls: cswt_error
end function cswt_swav_get_alm_status
Get alm_status of the sky of the passed swav. Note that the alm status is stored within the wavelet sky object.

Variables:

Author: J. D. McEwen

Version: 0.1 - April 2005

cswt_swav_get_nside

public function cswt_swav_get_nside (swav) result (nside)
    type (cswt_swav), intent(in) :: swav
    integer :: nside
    ! Calls: cswt_error
end function cswt_swav_get_nside
Get nside of the sky of the passed swav. Note that the alm status is stored within the wavelet sky object.

Variables:

Author: J. D. McEwen

Version: 0.1 - April 2005

cswt_swav_get_pix_scheme

public function cswt_swav_get_pix_scheme (swav) result (pix_scheme)
    type (cswt_swav), intent(in) :: swav
    integer :: pix_scheme
    ! Calls: cswt_error
end function cswt_swav_get_pix_scheme
Get pix_scheme of the sky of the passed swav. Note that the alm status is stored within the wavelet sky object.

Variables:

Author: J. D. McEwen

Version: 0.1 - April 2005

cswt_swav_get_name

public function cswt_swav_get_name (swav) result (name)
    type (cswt_swav), intent(in) :: swav
    character (len=S2_STRING_LEN) :: name
    ! Calls: cswt_error
end function cswt_swav_get_name
Get name variable from the passed swav.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_get_admiss

public function cswt_swav_get_admiss (swav) result (admiss)
    type (cswt_swav), intent(in) :: swav
    real (kind=s2_sp) :: admiss
    ! Calls: cswt_error
end function cswt_swav_get_admiss
Get normalised numerical admissibility of the passed swav.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_get_admiss_perc

public function cswt_swav_get_admiss_perc (swav) result (admiss_perc)
    type (cswt_swav), intent(in) :: swav
    real (kind=s2_sp) :: admiss_perc
    ! Calls: cswt_error
end function cswt_swav_get_admiss_perc
Get admissibility percentage of the passed swav.

Notes:

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_get_dilation

public function cswt_swav_get_dilation (swav) result (dilation)
    type (cswt_swav), intent(in) :: swav
    real (kind=s2_sp), dimension (CSWT_SWAV_DILATION_DIM) :: dilation
    ! Calls: cswt_error
end function cswt_swav_get_dilation
Get dilation variable from the passed swav.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_get_alpha

public function cswt_swav_get_alpha (swav) result (alpha)
    type (cswt_swav), intent(in) :: swav
    real (kind=s2_sp) :: alpha
    ! Calls: cswt_error
end function cswt_swav_get_alpha
Get alpha Euler angle from the passed swav.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_get_beta

public function cswt_swav_get_beta (swav) result (beta)
    type (cswt_swav), intent(in) :: swav
    real (kind=s2_sp) :: beta
    ! Calls: cswt_error
end function cswt_swav_get_beta
Get beta Euler angle from the passed swav.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004

cswt_swav_get_gamma

public function cswt_swav_get_gamma (swav) result (gamma)
    type (cswt_swav), intent(in) :: swav
    real (kind=s2_sp) :: gamma
    ! Calls: cswt_error
end function cswt_swav_get_gamma
Get gamma Euler angle from the passed swav.

Variables:

Author: J. D. McEwen

Version: 0.1 - November 2004