module cswt_tr_mod ! Uses use s2_types_mod use s2_sky_mod use s2_vect_mod use cswt_error_mod use cswt_swav_mod ! Types public type cswt_tr ! Variables integer, public, parameter :: CSWT_TR_DIL_UNIT_RAD = 1 integer, public, parameter :: CSWT_TR_DIL_UNIT_ARCMIN = 2 character (len=*), private, parameter :: CSWT_TR_DIL_UNIT_STR_RAD = 'radian' character (len=*), private, parameter :: CSWT_TR_DIL_UNIT_STR_ARCMIN = 'arcmin' integer, public, parameter :: CSWT_TR_METHOD_FAST_FFT_REAL = 1 integer, public, parameter :: CSWT_TR_METHOD_FAST_FFT = 2 integer, public, parameter :: CSWT_TR_METHOD_FAST_DFT = 3 integer, public, parameter :: CSWT_TR_METHOD_FAST_ISOTROPIC = 4 integer, public, parameter :: CSWT_TR_METHOD_DIRECT = 5 integer, public, parameter :: CSWT_TR_KERNEL_TYPE_SQR = 1 integer, public, parameter :: CSWT_TR_KERNEL_TYPE_CIRC = 2 integer, public, parameter :: CSWT_TR_MASK_GEN_CSWT = 1 integer, public, parameter :: CSWT_TR_MASK_GEN_MORPH = 2 integer, public, parameter :: CSWT_TR_THRES_NSIGMA_MODE_ABS = 1 integer, public, parameter :: CSWT_TR_THRES_NSIGMA_MODE_ABOVE = 2 integer, public, parameter :: CSWT_TR_THRES_NSIGMA_MODE_BELOW = 3 ! Interfaces public interface cswt_tr_init public interface cswt_tr_const_multiply public interface cswt_tr_const_subtract public interface cswt_tr_wcoeff_sigma ! Subroutines and functions private function cswt_tr_init_data (swav_mother, dilation, lmax, mmax, n_gamma) result (tr) private function cswt_tr_init_file_dil (swav_mother, filename_dil, lmax, mmax, n_gamma) result (tr) private function cswt_tr_init_file (filename_swav, filename_dil, lmax, mmax, n_gamma, wav_name) result (tr) private function cswt_tr_init_read (filename) result (tr) private function cswt_tr_init_computed (dilation, wcoeff, lmax, mmax) result (tr) private function cswt_tr_init_copy (orig) result (copy) private function cswt_tr_init_merg (tr) result (tr_merg) public subroutine cswt_tr_free (tr) public subroutine cswt_tr_analysis (tr, data, method, message_status, time_it, filename_isotropic) private subroutine cswt_tr_anadirect (tr, data, message) private subroutine cswt_tr_anafast (tr, data, method, message, filename_isotropic) private subroutine cswt_tr_anafast_isotropic (tr, i_dil, sky, swav, message, filename) private subroutine cswt_tr_anafast_spcv (tr, i_dil, sky1, sky2, method_in, message) private subroutine cswt_tr_anafast_fft3d (x, backward) private function cswt_tr_anafast_imdft (tmmm, alpha, beta, gamma) result (t) public subroutine cswt_tr_norm (tr, norm, weight_in) public subroutine cswt_tr_multiply (tr1, tr2, weight_in) private subroutine cswt_tr_const_multiply_array (tr, mfactor) private subroutine cswt_tr_const_multiply_val (tr, mfactor) private subroutine cswt_tr_const_subtract_array (tr, val) private subroutine cswt_tr_const_subtract_val (tr, val) private subroutine cswt_tr_wcoeff_sigma_each (tr, n_effective_samples, mean, sigma) private subroutine cswt_tr_wcoeff_sigma_all (tr, n_effective_samples, mean, sigma) public subroutine cswt_tr_wcoeff_thres_nsigma (tr, nsigma, mode, n_effective_samples_in) public subroutine cswt_tr_localmax_ab (tr, i_dil, n_regions, max_val, max_loc, max_siz, filename_connected) private subroutine cswt_tr_connected_ab (tr, i_dil, i_gamma) private subroutine cswt_tr_equivclass (tab, n_equiv_pair, equiv) private subroutine cswt_tr_reallocate_mat (mat, x_axis) private function cswt_tr_present_vect_int (vect, val) result (pres) private function cswt_tr_present_mat_int (mat, val) result (pres) public subroutine cswt_tr_mask_nonzero (tr_mask, ncoeff_eff, ncoeff_tot) public subroutine cswt_tr_mask_nonzero_weight (tr_mask, prop) public subroutine cswt_tr_mask_invert (tr_mask) public subroutine cswt_tr_mask_apply (tr, tr_mask, display_in) public subroutine cswt_tr_mask_thres_nsigma (tr, nsigma, n_effective_samples, mode) public subroutine cswt_tr_mask_copy (tr_mask, sky_mask) public subroutine cswt_tr_mask_gen (tr_mask, sky_mask, mode, run_stage1_in, run_stage2_in, orig_mask_only_in, thres1_proportion_in, thres2_proportion_in, thres1_min_in, std_in) private subroutine cswt_tr_morph_erode_ab (tr, i_dil, i_gamma, kernel_size, kernel_type) private subroutine cswt_tr_morph_dilate_ab (tr, i_dil, i_gamma, kernel_size, kernel_type) public subroutine cswt_tr_smooth_gaussian (tr, kernel_size1, kernel_size2, std) private subroutine cswt_tr_smooth_gaussian_ab (tr, kernel_size1, kernel_size2, std, i_dil, i_gamma) public function cswt_tr_extract_wcoeff_sky (tr, i_dil, i_gamma, nside, interp, pix_scheme_in) result (sky) public subroutine cswt_tr_io_fits_write_wcoeff_sky (filename, tr, i_dil, i_gamma, nside, interp, pix_scheme_in, comment) public subroutine cswt_tr_io_fits_write_wcoeff (filename, tr, comment) private subroutine cswt_tr_io_fits_read_wcoeff (filename, tr) private subroutine cswt_tr_io_fits_error_check (status, halt) private subroutine cswt_tr_io_fits_exists (filename, status, exists) private subroutine cswt_tr_io_fits_del (filename, status) public subroutine cswt_tr_io_txt_dilation_write (filename, tr, unit) public subroutine cswt_tr_io_txt_dilation_read (filename, dilation) public function cswt_tr_get_init (tr) result (init) public function cswt_tr_get_swav_mother (tr) result (swav_mother) public subroutine cswt_tr_get_wcoeff (tr, wcoeff) public subroutine cswt_tr_get_dilation (tr, dilation) public function cswt_tr_get_lmax (tr) result (lmax) public function cswt_tr_get_mmax (tr) result (mmax) public function cswt_tr_get_n_alpha (tr) result (n_alpha) public function cswt_tr_get_n_beta (tr) result (n_beta) public function cswt_tr_get_n_gamma (tr) result (n_gamma) public function cswt_tr_get_n_dilation (tr) result (n_dilation) public function cswt_tr_get_wcoeff_status (tr) result (wcoeff_status) public function cswt_tr_get_swav_mother_status (tr) result (swav_mother_status) end module cswt_tr_modProvides functionality to support and compute the directional spherical wavelet transform. In addition the mother wavelet, the dilation values and all wavelet parameters are stored herein. The resulting wavelet coefficients for each dilation are sampled on an ecp (equi-sampled) alpha-beta-gamma Euler angle grid. Functionality is also provided to convert the alpha-beta dimensions to Healpix sky representations and vice versa.
Author: J. D. McEwen (mcewen@mrao.cam.ac.uk)
Version: 0.1 - November 2004
public type cswt_tr private logical :: init = .false. type (cswt_swav) :: swav_mother real (kind=s2_sp), allocatable, dimension (:,:,:,:) :: wcoeff real (kind=s2_sp), allocatable, dimension (:,:) :: dilation integer :: lmax = 0 integer :: mmax = 0 integer :: n_alpha = 0 integer :: n_beta = 0 integer :: n_gamma = 0 integer :: n_dilation = 0 logical :: wcoeff_status = .false. logical :: swav_mother_status = .false. end type cswt_tr
integer, public, parameter :: CSWT_TR_DIL_UNIT_RAD = 1Radian dilation unit specifier.
integer, public, parameter :: CSWT_TR_DIL_UNIT_ARCMIN = 2Arcminute dilation unit specifier.
character (len=*), private, parameter :: CSWT_TR_DIL_UNIT_STR_RAD = 'radian'
character (len=*), private, parameter :: CSWT_TR_DIL_UNIT_STR_ARCMIN = 'arcmin'
integer, public, parameter :: CSWT_TR_METHOD_FAST_FFT_REAL = 1Fast FFT analysis method specifier.
integer, public, parameter :: CSWT_TR_METHOD_FAST_FFT = 2Fast FFT analysis method specifier.
integer, public, parameter :: CSWT_TR_METHOD_FAST_DFT = 3Fast DFT analysis method specifier.
integer, public, parameter :: CSWT_TR_METHOD_FAST_ISOTROPIC = 4Fast isotropic analysis method specifier.
integer, public, parameter :: CSWT_TR_METHOD_DIRECT = 5Direct analysis method specifier.
integer, public, parameter :: CSWT_TR_KERNEL_TYPE_SQR = 1Square kernel type specifier.
integer, public, parameter :: CSWT_TR_KERNEL_TYPE_CIRC = 2Circular kernel type specifier.
integer, public, parameter :: CSWT_TR_MASK_GEN_CSWT = 1Generate mask from wavelet coefficients specifier.
integer, public, parameter :: CSWT_TR_MASK_GEN_MORPH = 2Generate mask by morphological operations specifier.
integer, public, parameter :: CSWT_TR_THRES_NSIGMA_MODE_ABS = 1Generate thresholded nsigma mask by considering absolte value.
integer, public, parameter :: CSWT_TR_THRES_NSIGMA_MODE_ABOVE = 2Generate thresholded nsigma mask by leaving values above threshold.
integer, public, parameter :: CSWT_TR_THRES_NSIGMA_MODE_BELOW = 3Generate thresholded nsigma mask by leaving values below threshold.
public interface cswt_tr_init module procedure cswt_tr_init_data module procedure cswt_tr_init_file_dil module procedure cswt_tr_init_file module procedure cswt_tr_init_read module procedure cswt_tr_init_copy module procedure cswt_tr_init_merg end interface cswt_tr_init
public interface cswt_tr_const_multiply module procedure cswt_tr_const_multiply_array module procedure cswt_tr_const_multiply_val end interface cswt_tr_const_multiply
public interface cswt_tr_const_subtract module procedure cswt_tr_const_subtract_array module procedure cswt_tr_const_subtract_val end interface cswt_tr_const_subtract
public interface cswt_tr_wcoeff_sigma module procedure cswt_tr_wcoeff_sigma_each module procedure cswt_tr_wcoeff_sigma_all end interface cswt_tr_wcoeff_sigma
private function cswt_tr_init_data (swav_mother, dilation, lmax, mmax, n_gamma) result (tr) type (cswt_swav), intent(in) :: swav_mother real (kind=s2_sp), intent(in), dimension (:,:) :: dilation integer, intent(in) :: lmax integer, intent(in) :: mmax integer, intent(in) :: n_gamma type (cswt_tr) :: tr ! Calls: cswt_error end function cswt_tr_init_dataInitialise a tr structure from a mother wavelet, dilations and resolution parameters.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_init_file_dil
private function cswt_tr_init_file_dil (swav_mother, filename_dil, lmax, mmax, n_gamma) result (tr) type (cswt_swav), intent(in) :: swav_mother character (len=*), intent(in) :: filename_dil integer, intent(in) :: lmax integer, intent(in) :: mmax integer, intent(in) :: n_gamma type (cswt_tr) :: tr ! Calls: cswt_error, cswt_tr_io_txt_dilation_read end function cswt_tr_init_file_dilInitialise a tr strucutre from a mother wavelet, dilations read from an input dilation text file and resolution parameters.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_init_file
private function cswt_tr_init_file (filename_swav, filename_dil, lmax, mmax, n_gamma, wav_name) result (tr) character (len=*), intent(in) :: filename_swav character (len=*), intent(in) :: filename_dil integer, intent(in) :: lmax integer, intent(in) :: mmax integer, intent(in) :: n_gamma character (len=*), optional, intent(in) :: wav_name type (cswt_tr) :: tr ! Calls: cswt_error, cswt_swav_free end function cswt_tr_init_fileInitialise a tr strucutre from a mother wavelet read from an input fits file, dilations read from an input dilation text file and resolution parameters.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_init_read
private function cswt_tr_init_read (filename) result (tr) character (len=*), intent(in) :: filename type (cswt_tr) :: tr ! Calls: cswt_error, cswt_tr_io_fits_read_wcoeff end function cswt_tr_init_readWrapper to initalise a tr data structure from a file. The tr structure is read and initialised by the routine cswt_tr_io_fits_read_wcoeff.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_init_computed
private function cswt_tr_init_computed (dilation, wcoeff, lmax, mmax) result (tr) real (kind=s2_sp), intent(in), dimension (:,:) :: dilation real (kind=s2_sp), intent(in), dimension (:,:,:,:) :: wcoeff integer, intent(in) :: lmax integer, intent(in) :: mmax type (cswt_tr) :: tr ! Calls: cswt_error end function cswt_tr_init_computedInitialise a tr structure from precomputed wavelet coefficients (if, say, read from file).
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_init_copy
private function cswt_tr_init_copy (orig) result (copy) type (cswt_tr), intent(in) :: orig type (cswt_tr) :: copy ! Calls: cswt_error end function cswt_tr_init_copyInitialise a tr structure as a copy of another tr.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_init_merg
private function cswt_tr_init_merg (tr) result (tr_merg) type (cswt_tr), intent(in), dimension (:) :: tr type (cswt_tr) :: tr_merg ! Calls: cswt_error end function cswt_tr_init_mergInitialise a tr structure by merging a number of tr structures that have only a single dilation.
Variables:
Author: J. D. McEwen
Version: 0.1 - April 2005
cswt_tr_free
public subroutine cswt_tr_free (tr) type (cswt_tr), intent(inout) :: tr ! Calls: cswt_error, cswt_swav_free end subroutine cswt_tr_freeFree all data associated with an initialised tr structure and reset all other attributes.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_analysis
public subroutine cswt_tr_analysis (tr, data, method, message_status, time_it, filename_isotropic) type (cswt_tr), intent(inout) :: tr type (s2_sky), intent(inout) :: data integer, optional, intent(in) :: method logical, optional, intent(in) :: message_status logical, optional, intent(in) :: time_it character (len=*), optional, intent(in) :: filename_isotropic ! Calls: cswt_error, cswt_tr_anadirect, cswt_tr_anafast, s2_sky_free, system_clock end subroutine cswt_tr_analysisPerform directional continuous spherical wavelet transform to compute wavelet coefficients. The actual method employed to compute wavelet coefficients depends on the method specifier.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_anadirect
private subroutine cswt_tr_anadirect (tr, data, message) type (cswt_tr), intent(inout) :: tr type (s2_sky), intent(inout) :: data logical, optional, intent(in) :: message ! Calls: cswt_error, cswt_swav_dilate, cswt_swav_free, s2_sky_free, s2_sky_get_map, s2_sky_rotate end subroutine cswt_tr_anadirectPerform the direct directional spherical wavelet transform.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_anafast
private subroutine cswt_tr_anafast (tr, data, method, message, filename_isotropic) type (cswt_tr), intent(inout) :: tr type (s2_sky), intent(inout) :: data integer, optional, intent(in) :: method logical, optional, intent(in) :: message character (len=*), optional, intent(in) :: filename_isotropic ! Calls: cswt_error, cswt_swav_compute_alm, cswt_swav_dilate, cswt_swav_free, cswt_tr_anafast_isotropic, cswt_tr_anafast_spcv, s2_sky_compute_alm, s2_sky_free end subroutine cswt_tr_anafastPerform the fast directional spherical wavelet transform.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_anafast_isotropic
private subroutine cswt_tr_anafast_isotropic (tr, i_dil, sky, swav, message, filename) type (cswt_tr), intent(inout) :: tr integer, intent(in) :: i_dil type (s2_sky), intent(in) :: sky type (s2_sky), intent(in) :: swav logical, optional, intent(in) :: message character (len=*), optional, intent(in) :: filename ! Calls: cswt_error, s2_sky_compute_map, s2_sky_extract_ab, s2_sky_free, s2_sky_get_alm, s2_sky_write_map_file end subroutine cswt_tr_anafast_isotropicPerform the fast isotropic spherical convolution for a particular dilation (noting the the convolution is simply given by a product of spherical harmonic coefficients).
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_anafast_spcv
private subroutine cswt_tr_anafast_spcv (tr, i_dil, sky1, sky2, method_in, message) type (cswt_tr), intent(inout) :: tr integer, intent(in) :: i_dil type (s2_sky), intent(in) :: sky1 type (s2_sky), intent(in) :: sky2 integer, optional, intent(in) :: method_in logical, optional, intent(in) :: message ! Calls: cswt_error, cswt_tr_anafast_fft3d, rfftw3d_f77_create_plan, rfftwnd_f77_destroy_plan, rfftwnd_f77_one_complex_to_real, s2_dl_beta_operator, s2_sky_get_alm end subroutine cswt_tr_anafast_spcvPerform the fast spherical convolution for a particular dilation using the fast algorithm of Wandlet and Gorski.
Notes:
Author: D. J. Mortlock and J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_anafast_fft3d
private subroutine cswt_tr_anafast_fft3d (x, backward) complex (kind=s2_dpc), intent(inout), dimension (:,:,:) :: x logical, intent(in) :: backward ! Calls: complex_fft end subroutine cswt_tr_anafast_fft3dPerform 3D FFT using healpix fft routines (fftw if linked).
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_anafast_imdft
private function cswt_tr_anafast_imdft (tmmm, alpha, beta, gamma) result (t) complex (kind=s2_dpc), intent(in), dimension (:, :, :) :: tmmm real (kind=s2_dp), intent(in) :: alpha real (kind=s2_dp), intent(in) :: beta real (kind=s2_dp), intent(in) :: gamma real (kind=s2_sp) :: t end function cswt_tr_anafast_imdftPerform the modified inverse Fourier transform required to convert T_mmm to T_abg directly.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_norm
public subroutine cswt_tr_norm (tr, norm, weight_in) type (cswt_tr), intent(in) :: tr real (kind=s2_sp), intent(out), dimension (:) :: norm logical, optional, intent(in) :: weight_in ! Calls: cswt_error, cswt_tr_free end subroutine cswt_tr_normCompute the norm of the wavelet coefficients stored in the tr strucutre for each dilation. The norm is defined as the sum, over all Euler angles, of the squared coefficient values, i.e. norm(a) = 1/N_s * \sum_i ( k_i (W_i)^2 ) where W_i are the wavelet coefficients, k_i the weights (if applied) and N_s is the number of samples per dilation, i.e. N_s = N_alpha * N_beta * N_gamma. The weights may be optionally applied. Note that N_s=1 now
Notes:
Author: J. D. McEwen
Version: 0.1 - December 2004
cswt_tr_multiply
public subroutine cswt_tr_multiply (tr1, tr2, weight_in) type (cswt_tr), intent(inout) :: tr1 type (cswt_tr), intent(in) :: tr2 logical, optional, intent(in) :: weight_in ! Calls: cswt_error end subroutine cswt_tr_multiplyMultiply two wavelet coefficients contained in tr structure arrays. Weight the multiplication for each pixel by the size of the pixel on the sky if desired. The product coefficients are written to the tr1 structure wavelet coefficient array on exit.
Variables:
Author: J. D. McEwen
Version: 0.1 - December 2004
cswt_tr_const_multiply_array
private subroutine cswt_tr_const_multiply_array (tr, mfactor) type (cswt_tr), intent(inout) :: tr real (kind=s2_sp), intent(in), dimension (:) :: mfactor ! Calls: cswt_error end subroutine cswt_tr_const_multiply_arrayMultiply the wavelet coefficients of the tr structure for a given dilation by the value of mfactor for the corresponding dilation.
Variables:
Author: J. D. McEwen
Version: 0.1 - December 2004
cswt_tr_const_multiply_val
private subroutine cswt_tr_const_multiply_val (tr, mfactor) type (cswt_tr), intent(inout) :: tr real (kind=s2_sp), intent(in) :: mfactor ! Calls: cswt_error end subroutine cswt_tr_const_multiply_valMultiply the wavelet coefficients of the tr structure by a constant value (for all dilations).
Variables:
Author: J. D. McEwen
Version: 0.1 - December 2004
cswt_tr_const_subtract_array
private subroutine cswt_tr_const_subtract_array (tr, val) type (cswt_tr), intent(inout) :: tr real (kind=s2_sp), intent(in), dimension (:) :: val ! Calls: cswt_error end subroutine cswt_tr_const_subtract_arraySubtract the wavelet coefficients of the tr structure for a given dilation by the value of val for the corresponding dilation.
Variables:
Author: J. D. McEwen
Version: 0.1 - December 2004
cswt_tr_const_subtract_val
private subroutine cswt_tr_const_subtract_val (tr, val) type (cswt_tr), intent(inout) :: tr real (kind=s2_sp), intent(in) :: val ! Calls: cswt_error end subroutine cswt_tr_const_subtract_valSubtract the wavelet coefficients of the tr structure by a constant value (for all dilations).
Variables:
Author: J. D. McEwen
Version: 0.1 - December 2004
cswt_tr_wcoeff_sigma_each
private subroutine cswt_tr_wcoeff_sigma_each (tr, n_effective_samples, mean, sigma) type (cswt_tr), intent(in) :: tr integer, intent(in), dimension (:) :: n_effective_samples real (kind=s2_sp), intent(out), dimension (:) :: mean real (kind=s2_sp), intent(out), dimension (:) :: sigma ! Calls: cswt_error end subroutine cswt_tr_wcoeff_sigma_eachCompute the mean and standard deviation of the wavelet coefficients of the tr strucutre for each dilation.
Notes:
Author: J. D. McEwen
Version: 0.1 - December 2004
cswt_tr_wcoeff_sigma_all
private subroutine cswt_tr_wcoeff_sigma_all (tr, n_effective_samples, mean, sigma) type (cswt_tr), intent(in) :: tr integer, intent(in) :: n_effective_samples real (kind=s2_sp), intent(out) :: mean real (kind=s2_sp), intent(out) :: sigma ! Calls: cswt_error end subroutine cswt_tr_wcoeff_sigma_allCompute the mean and standard deviation of the wavelet coefficients of the tr strucutre over all dilations.
Notes:
Author: J. D. McEwen
Version: 0.1 - April 2005
cswt_tr_wcoeff_thres_nsigma
public subroutine cswt_tr_wcoeff_thres_nsigma (tr, nsigma, mode, n_effective_samples_in) type (cswt_tr), intent(inout) :: tr real (kind=s2_sp) :: nsigma integer, intent(in) :: mode integer, optional, intent(in) :: n_effective_samples_in ! Calls: cswt_error, cswt_tr_wcoeff_sigma_all end subroutine cswt_tr_wcoeff_thres_nsigmaThreshold wavelet coefficients. Coefficients that remain keep their original value and are not set to 1.0. Differs to cswt_tr_mask_thres_nsigma routine since the same nsigma is used over all dilations.
Notes:
Author: J. D. McEwen
Version: 0.1 - April 2005
cswt_tr_localmax_ab
public subroutine cswt_tr_localmax_ab (tr, i_dil, n_regions, max_val, max_loc, max_siz, filename_connected) type (cswt_tr), intent(in) :: tr integer, intent(in) :: i_dil integer, allocatable, intent(out), dimension (:) :: n_regions real (kind=s2_sp), allocatable, intent(out), dimension (:,:) :: max_val integer, allocatable, intent(out), dimension (:,:,:) :: max_loc integer, allocatable, intent(out), dimension (:,:) :: max_siz character (len=*), optional, intent(in) :: filename_connected ! Calls: cswt_error, cswt_tr_connected_ab, cswt_tr_free, cswt_tr_io_fits_write_wcoeff end subroutine cswt_tr_localmax_abFind local maxima in a single ab slice of the wavelet coefficients (performed for each orientation separately). The input coefficients should already be thresholded so that only local non-zero regions remain for which the maximum of each is found.
Notes:
Author: J. D. McEwen
Version: 0.1 - April 2005
cswt_tr_connected_ab
private subroutine cswt_tr_connected_ab (tr, i_dil, i_gamma) type (cswt_tr), intent(inout) :: tr integer, intent(in) :: i_dil integer, intent(in) :: i_gamma ! Calls: cswt_error, cswt_tr_equivclass, cswt_tr_reallocate_mat end subroutine cswt_tr_connected_abFind wavelet coefficient connected components (defined by non-zero pixels) and overwrite with integer label for each connected component.
Notes:
Author: J. D. McEwen
Version: 0.1 - April 2005
cswt_tr_equivclass
private subroutine cswt_tr_equivclass (tab, n_equiv_pair, equiv) integer, intent(in), dimension (:,:) :: tab integer, intent(in) :: n_equiv_pair integer, allocatable, intent(out), dimension (:,:) :: equiv ! Calls: cswt_error, cswt_tr_reallocate_mat end subroutine cswt_tr_equivclassResolve a table of equivalence pairs into a table of equivalence classes.
Notes:
Author: J. D. McEwen
Version: 0.1 - April 2005
cswt_tr_reallocate_mat
private subroutine cswt_tr_reallocate_mat (mat, x_axis) integer, allocatable, dimension (:,:) :: mat logical, intent(in) :: x_axis ! Calls: cswt_error end subroutine cswt_tr_reallocate_matDynamically reallocate a 2D array to increase its size, either in the x or y direction.
Notes:
Author: J. D. McEwen
Version: 0.1 - April 2005
cswt_tr_present_vect_int
private function cswt_tr_present_vect_int (vect, val) result (pres) integer, intent(in), dimension (:) :: vect integer, intent(in) :: val logical :: pres end function cswt_tr_present_vect_intCheck if a value is present in a vector.
Notes:
Author: J. D. McEwen
Version: 0.1 - April 2005
cswt_tr_present_mat_int
private function cswt_tr_present_mat_int (mat, val) result (pres) integer, intent(in), dimension (:,:) :: mat integer, intent(in) :: val logical :: pres end function cswt_tr_present_mat_intCheck if a value is present in a 2D matrix.
Notes:
Author: J. D. McEwen
Version: 0.1 - April 2005
cswt_tr_mask_nonzero
public subroutine cswt_tr_mask_nonzero (tr_mask, ncoeff_eff, ncoeff_tot) type (cswt_tr), intent(in) :: tr_mask integer, intent(out), dimension (:,:) :: ncoeff_eff integer, intent(out) :: ncoeff_tot ! Calls: cswt_error end subroutine cswt_tr_mask_nonzeroCompute the number of non-zero values (i.e. effective remaining coefficients) in a given mask. (Computed for each dilation and orientation, i.e. for each alpha-beta `sky' of the mask.)
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_mask_nonzero_weight
public subroutine cswt_tr_mask_nonzero_weight (tr_mask, prop) type (cswt_tr), intent(in) :: tr_mask real (kind=s2_sp), intent(out), dimension (:,:) :: prop ! Calls: cswt_error end subroutine cswt_tr_mask_nonzero_weightCompute the proportion of weighted coefficients in a given mask. (Computed for each dilation and orientation, i.e. for each alpha-beta `sky' of the mask.)
Notes:
Author: J. D. McEwen
Version: 0.1 - December 2004
cswt_tr_mask_invert
public subroutine cswt_tr_mask_invert (tr_mask) type (cswt_tr), intent(inout) :: tr_mask ! Calls: cswt_error end subroutine cswt_tr_mask_invertInvert a coefficient mask by converting ones to zeros, and zeros to ones.
Variables:
Author: J. D. McEwen
Version: 0.1 - January 2005
cswt_tr_mask_apply
public subroutine cswt_tr_mask_apply (tr, tr_mask, display_in) type (cswt_tr), intent(inout) :: tr type (cswt_tr), intent(in) :: tr_mask logical, optional, intent(in) :: display_in ! Calls: cswt_error end subroutine cswt_tr_mask_applyApply an extended coefficient mask by multiplying the wavelet coefficients of the specified tr structure with the mask (contained in the wavelet coefficients of the tr_mask structure).
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_mask_thres_nsigma
public subroutine cswt_tr_mask_thres_nsigma (tr, nsigma, n_effective_samples, mode) type (cswt_tr), intent(inout) :: tr real (kind=s2_sp), intent(in) :: nsigma integer, intent(in), dimension (:) :: n_effective_samples integer, intent(in) :: mode ! Calls: cswt_error, cswt_tr_wcoeff_sigma end subroutine cswt_tr_mask_thres_nsigmaProduce a mask from the wavelet coefficients contained in the tr structure by thresholding the coefficients to binary 1,0 values. A range of thresholding 'directions' may be performed (see mode below), nevertheless each is realitive to the nsigma * sigma(a) (where sigma(a) is computed herein).
Notes:
Author: J. D. McEwen
Version: 0.1 - December 2004
cswt_tr_mask_copy
public subroutine cswt_tr_mask_copy (tr_mask, sky_mask) type (cswt_tr), intent(inout) :: tr_mask type (s2_sky), intent(in), dimension (:) :: sky_mask ! Calls: cswt_error, s2_sky_extract_ab end subroutine cswt_tr_mask_copyCopy masks defined on the sky (Healpix format) for each dilation to a cswt tr structure mask defined in the spherical wavelet coefficient domain.
Notes:
Author: J. D. McEwen
Version: 0.1 - December 2004
cswt_tr_mask_gen
public subroutine cswt_tr_mask_gen (tr_mask, sky_mask, mode, run_stage1_in, run_stage2_in, orig_mask_only_in, thres1_proportion_in, thres2_proportion_in, thres1_min_in, std_in) type (cswt_tr), intent(inout) :: tr_mask type (s2_sky), intent(in) :: sky_mask integer, intent(in) :: mode logical, optional, intent(in) :: run_stage1_in logical, optional, intent(in) :: run_stage2_in logical, optional, intent(in) :: orig_mask_only_in real (kind=s2_sp), optional, intent(in) :: thres1_proportion_in real (kind=s2_sp), optional, intent(in) :: thres2_proportion_in real (kind=s2_sp), optional, intent(in) :: thres1_min_in real (kind=s2_sp), optional, intent(in), dimension (:) :: std_in ! Calls: cswt_error, cswt_tr_morph_dilate_ab, cswt_tr_morph_erode_ab, cswt_tr_smooth_gaussian_ab, s2_sky_extract_ab end subroutine cswt_tr_mask_genGenerate an extended coefficient exclusion mask from an original sky mask and the spherical wavelet transform of the mask.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_morph_erode_ab
private subroutine cswt_tr_morph_erode_ab (tr, i_dil, i_gamma, kernel_size, kernel_type) type (cswt_tr), intent(inout) :: tr integer, intent(in) :: i_dil integer, intent(in) :: i_gamma integer, intent(in) :: kernel_size integer, intent(in) :: kernel_type ! Calls: cswt_error end subroutine cswt_tr_morph_erode_abMorphologically erode an ecp alpha-beta map with either a square or circular kernel.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_morph_dilate_ab
private subroutine cswt_tr_morph_dilate_ab (tr, i_dil, i_gamma, kernel_size, kernel_type) type (cswt_tr), intent(inout) :: tr integer, intent(in) :: i_dil integer, intent(in) :: i_gamma integer, intent(in) :: kernel_size integer, intent(in) :: kernel_type ! Calls: cswt_error end subroutine cswt_tr_morph_dilate_abMorphologically dilate an ecp alpha-beta map with either a square or circular kernel.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_smooth_gaussian
public subroutine cswt_tr_smooth_gaussian (tr, kernel_size1, kernel_size2, std) type (cswt_tr), intent(inout) :: tr integer, intent(in) :: kernel_size1 integer, intent(in) :: kernel_size2 real (kind=s2_sp), intent(in), dimension (:,:) :: std ! Calls: cswt_error, cswt_tr_smooth_gaussian_ab end subroutine cswt_tr_smooth_gaussianSmooth all tr%wcoeff maps over alpha-beta for each dilation and gamma Euler orientation.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_smooth_gaussian_ab
private subroutine cswt_tr_smooth_gaussian_ab (tr, kernel_size1, kernel_size2, std, i_dil, i_gamma) type (cswt_tr), intent(inout) :: tr integer, intent(in) :: kernel_size1 integer, intent(in) :: kernel_size2 real (kind=s2_sp), intent(in) :: std integer, intent(in) :: i_dil integer, intent(in) :: i_gamma ! Calls: cswt_error end subroutine cswt_tr_smooth_gaussian_abSmooth an ecp alpha-beta map by convolving it with a Gaussian kernel.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_extract_wcoeff_sky
public function cswt_tr_extract_wcoeff_sky (tr, i_dil, i_gamma, nside, interp, pix_scheme_in) result (sky) type (cswt_tr), intent(in) :: tr integer, intent(in) :: i_dil integer, intent(in) :: i_gamma integer, intent(in) :: nside logical, intent(in) :: interp integer, optional, intent(in) :: pix_scheme_in type (s2_sky) :: sky ! Calls: cswt_error end function cswt_tr_extract_wcoeff_skyExtract a sky representation of the ecp (equi-sampled) spherical wavelet coefficients for a given dilation and orientation.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_io_fits_write_wcoeff_sky
public subroutine cswt_tr_io_fits_write_wcoeff_sky (filename, tr, i_dil, i_gamma, nside, interp, pix_scheme_in, comment) character (len=*), intent(in) :: filename type (cswt_tr), intent(in) :: tr integer, intent(in) :: i_dil integer, intent(in) :: i_gamma integer, intent(in) :: nside logical, intent(in) :: interp integer, optional, intent(in) :: pix_scheme_in character (len=*), optional, intent(in) :: comment ! Calls: cswt_error, s2_sky_free, s2_sky_write_map_file end subroutine cswt_tr_io_fits_write_wcoeff_skyExtract a sky representation of the ecp (equi-sampled) spherical wavelet coefficients for a given dilation and orientation and write them directly to a fits sky file.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_io_fits_write_wcoeff
public subroutine cswt_tr_io_fits_write_wcoeff (filename, tr, comment) character (len=*), intent(in) :: filename type (cswt_tr), intent(in) :: tr character (len=*), optional, intent(in) :: comment ! Calls: cswt_error, cswt_tr_io_fits_error_check, cswt_tr_io_fits_exists, ftclos, ftfiou, ftgiou, ftibin, ftiimg, ftinit, ftp3de, ftpcle, ftpcom, ftpdat, ftphpr, ftpkye, ftpkyj, ftpkys, s2_sky_admiss_dil, s2_sky_free, s2_sky_get_param end subroutine cswt_tr_io_fits_write_wcoeffWrite a tr structure to an output fits file. Both the wavelet coefficients and the dilation values are written (and other additional wavelet transform parameters).
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_io_fits_read_wcoeff
private subroutine cswt_tr_io_fits_read_wcoeff (filename, tr) character (len=*), intent(in) :: filename type (cswt_tr), intent(out) :: tr ! Calls: cswt_error, cswt_tr_io_fits_error_check, cswt_tr_io_fits_exists, ftclos, ftfiou, ftg3de, ftgcve, ftgiou, ftgkye, ftgkyj, ftmahd, ftopen, ftthdu end subroutine cswt_tr_io_fits_read_wcoeffRead a fits wavelet coefficient file and allocate a new tr structure with the data read.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_io_fits_error_check
private subroutine cswt_tr_io_fits_error_check (status, halt) integer, intent(inout) :: status logical, intent(in) :: halt ! Calls: ftgerr, ftgmsg end subroutine cswt_tr_io_fits_error_checkCheck if a fits error has occured and print error message. Halt program execution if halt flag is set.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_io_fits_exists
private subroutine cswt_tr_io_fits_exists (filename, status, exists) character (len=*), intent(in) :: filename integer, intent(inout) :: status logical, intent(out) :: exists ! Calls: cswt_tr_io_fits_error_check, ftclos, ftfiou, ftgiou, ftopen end subroutine cswt_tr_io_fits_existsCheck if a fits file exists.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_io_fits_del
private subroutine cswt_tr_io_fits_del (filename, status) character (len=*), intent(in) :: filename integer, intent(inout) :: status ! Calls: ftcmsg, ftdelt, ftfiou, ftgiou, ftopen end subroutine cswt_tr_io_fits_delDelete a fits file.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_io_txt_dilation_write
public subroutine cswt_tr_io_txt_dilation_write (filename, tr, unit) character (len=*), intent(in) :: filename type (cswt_tr), intent(in) :: tr integer, intent(in) :: unit ! Calls: cswt_error end subroutine cswt_tr_io_txt_dilation_writeWrite tr structure dilation values to an output text file.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_io_txt_dilation_read
public subroutine cswt_tr_io_txt_dilation_read (filename, dilation) character (len=*), intent(in) :: filename real (kind=s2_sp), intent(out), allocatable, dimension (:,:) :: dilation ! Calls: cswt_error end subroutine cswt_tr_io_txt_dilation_readRead dilation values from an input dilation text file.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_init
public function cswt_tr_get_init (tr) result (init) type (cswt_tr), intent(in) :: tr logical :: init end function cswt_tr_get_initGet init variable from the passed tr.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_swav_mother
public function cswt_tr_get_swav_mother (tr) result (swav_mother) type (cswt_tr), intent(in) :: tr type (cswt_swav) :: swav_mother ! Calls: cswt_error end function cswt_tr_get_swav_motherGet copy of swav_mother variable from the passed tr.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_wcoeff
public subroutine cswt_tr_get_wcoeff (tr, wcoeff) type (cswt_tr), intent(in) :: tr real (kind=s2_sp), intent(out), dimension (1:,0:,0:,0:) :: wcoeff ! Calls: cswt_error end subroutine cswt_tr_get_wcoeffGet copy of the wavelet coefficients.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_dilation
public subroutine cswt_tr_get_dilation (tr, dilation) type (cswt_tr), intent(in) :: tr real (kind=s2_sp), intent(out), dimension (:,:) :: dilation ! Calls: cswt_error end subroutine cswt_tr_get_dilationGet copy of dilation variable from the passed tr.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_lmax
public function cswt_tr_get_lmax (tr) result (lmax) type (cswt_tr), intent(in) :: tr integer :: lmax ! Calls: cswt_error end function cswt_tr_get_lmaxGet copy of lmax variable from the passed tr.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_mmax
public function cswt_tr_get_mmax (tr) result (mmax) type (cswt_tr), intent(in) :: tr integer :: mmax ! Calls: cswt_error end function cswt_tr_get_mmaxGet copy of mmax variable from the passed tr.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_n_alpha
public function cswt_tr_get_n_alpha (tr) result (n_alpha) type (cswt_tr), intent(in) :: tr integer :: n_alpha ! Calls: cswt_error end function cswt_tr_get_n_alphaGet copy of n_alpha variable from the passed tr.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_n_beta
public function cswt_tr_get_n_beta (tr) result (n_beta) type (cswt_tr), intent(in) :: tr integer :: n_beta ! Calls: cswt_error end function cswt_tr_get_n_betaGet copy of n_beta variable from the passed tr.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_n_gamma
public function cswt_tr_get_n_gamma (tr) result (n_gamma) type (cswt_tr), intent(in) :: tr integer :: n_gamma ! Calls: cswt_error end function cswt_tr_get_n_gammaGet copy of n_gamma variable from the passed tr.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_n_dilation
public function cswt_tr_get_n_dilation (tr) result (n_dilation) type (cswt_tr), intent(in) :: tr integer :: n_dilation ! Calls: cswt_error end function cswt_tr_get_n_dilationGet copy of n_dilation variable from the passed tr.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_wcoeff_status
public function cswt_tr_get_wcoeff_status (tr) result (wcoeff_status) type (cswt_tr), intent(in) :: tr logical :: wcoeff_status ! Calls: cswt_error end function cswt_tr_get_wcoeff_statusGet copy of wcoeff_status variable from the passed tr.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004
cswt_tr_get_swav_mother_status
public function cswt_tr_get_swav_mother_status (tr) result (swav_mother_status) type (cswt_tr), intent(in) :: tr logical :: swav_mother_status ! Calls: cswt_error end function cswt_tr_get_swav_mother_statusGet copy of swav_mother_status variable from the passed tr.
Variables:
Author: J. D. McEwen
Version: 0.1 - November 2004