module s2_pl_mod ! Uses use s2_types_mod use s2_error_mod ! Types public type s2_pl ! Interfaces public interface s2_pl_init public interface s2_pl_conv ! Subroutines and functions private function s2_pl_init_array (data) result (pl) private function s2_pl_init_array_const (const, lmax) result (pl) private function s2_pl_init_file_ascii (filename, lmin, lmax, ncomment, scale_in, line_nos_in) result (pl) private function s2_pl_init_file_fits (filename) result (pl) private function s2_pl_init_copy (orig) result (copy) private function s2_pl_init_copy_truncate (orig, lmax) result (copy) public function s2_pl_init_guassian (fwhm, lmax) result (pl) public subroutine s2_pl_free (pl) public function s2_pl_add (pl1, pl2) result (pl_sum) private subroutine s2_pl_conv_alm (pl, alm) private subroutine s2_pl_conv_pl (pl1, pl2) public function s2_pl_power (pl) result (power) public subroutine s2_pl_plot (pl, filename, scale_to_dl_in, title) public subroutine s2_pl_io_ascii_write (filename, pl, dl_scale) public subroutine s2_pl_io_fits_write (filename, pl, comment) private subroutine s2_pl_io_fits_read (filename, pl) private subroutine s2_pl_io_fits_error_check (status, halt) private subroutine s2_pl_io_fits_exists (filename, status, exists) private subroutine s2_pl_io_fits_del (filename, status) public function s2_pl_get_init (pl) result (init) public function s2_pl_get_lmax (pl) result (lmax) public subroutine s2_pl_get_spec (pl, pl_spec) public function s2_pl_get_spec_l (pl, l) result (pl_val) end module s2_pl_modProvides functionality to support and manipulate a p(l) (l spectrum) function.
Author: J. D. McEwen (mcewen@mrao.cam.ac.uk)
Version: 0.1 August 2004
public type s2_pl private logical :: init = .false. integer :: lmax = 0 real (kind=s2_sp), allocatable, dimension (:) :: pl end type s2_pl
public interface s2_pl_init module procedure s2_pl_init_array module procedure s2_pl_init_array_const module procedure s2_pl_init_file_ascii module procedure s2_pl_init_file_fits module procedure s2_pl_init_copy module procedure s2_pl_init_copy_truncate end interface s2_pl_init
public interface s2_pl_conv module procedure s2_pl_conv_alm module procedure s2_pl_conv_pl end interface s2_pl_conv
private function s2_pl_init_array (data) result (pl) real (kind=s2_sp), intent(in), dimension (:) :: data type (s2_pl) :: pl ! Calls: s2_error end function s2_pl_init_arrayInitiliase a pl from a array of data values.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_pl_init_array_const
private function s2_pl_init_array_const (const, lmax) result (pl) real (kind=s2_sp), intent(in) :: const integer, intent(in) :: lmax type (s2_pl) :: pl ! Calls: s2_error end function s2_pl_init_array_constInitiliase a pl with a constant value over all l.
Variables:
Author: J. D. McEwen
Version: 0.1 February 2005
s2_pl_init_file_ascii
private function s2_pl_init_file_ascii (filename, lmin, lmax, ncomment, scale_in, line_nos_in) result (pl) character (len=*), intent(in) :: filename integer, intent(in) :: lmin integer, intent(in) :: lmax integer, intent(in) :: ncomment logical, optional, intent(in) :: scale_in logical, optional, intent(in) :: line_nos_in type (s2_pl) :: pl ! Calls: s2_error end function s2_pl_init_file_asciiInitialise a pl from a ascii file.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_pl_init_file_fits
private function s2_pl_init_file_fits (filename) result (pl) character (len=*), intent(in) :: filename type (s2_pl) :: pl ! Calls: s2_error, s2_pl_io_fits_read end function s2_pl_init_file_fitsWrapper to initialise a pl data structure from a s2_pl fits file. The pl structure is read and initialised by the routine s2_pl_io_fits_read.
Variables:
Author: J. D. McEwen
Version: 0.1 - April 2005
s2_pl_init_copy
private function s2_pl_init_copy (orig) result (copy) type (s2_pl), intent(in) :: orig type (s2_pl) :: copy ! Calls: s2_error end function s2_pl_init_copyInitialse a pl from a copy of another pl.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_pl_init_copy_truncate
private function s2_pl_init_copy_truncate (orig, lmax) result (copy) type (s2_pl), intent(in) :: orig integer, intent(in) :: lmax type (s2_pl) :: copy ! Calls: s2_error end function s2_pl_init_copy_truncateInitialse a pl from a copy of another pl but truncate to a lower lmax.
Variables:
Author: J. D. McEwen
Version: 0.1 Januray 2005
s2_pl_init_guassian
public function s2_pl_init_guassian (fwhm, lmax) result (pl) real (kind=s2_sp), intent(in) :: fwhm integer, intent(in) :: lmax type (s2_pl) :: pl ! Calls: s2_error end function s2_pl_init_guassianInitiliase a pl with a Gaussian beam with specified full width half max.
Notes:
Author: J. D. McEwen
Version: 0.1 May 2005
s2_pl_free
public subroutine s2_pl_free (pl) type (s2_pl), intent(inout) :: pl ! Calls: s2_error end subroutine s2_pl_freeFree all data associated with an initialised pl and reset all other attributes.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_pl_add
public function s2_pl_add (pl1, pl2) result (pl_sum) type (s2_pl), intent(in) :: pl1 type (s2_pl), intent(in) :: pl2 type (s2_pl) :: pl_sum ! Calls: s2_error end function s2_pl_addAll two pl spectrums.
Notes:
Author: J. D. McEwen
Version: 0.1 May 2005
s2_pl_conv_alm
private subroutine s2_pl_conv_alm (pl, alm) type (s2_pl), intent(in) :: pl complex (kind=s2_spc), intent(inout), dimension (0:,0:) :: alm ! Calls: s2_error end subroutine s2_pl_conv_almConvolve an alm with the pl. The original alm is overwritten with the convolved alm on ouput. If length of alm is shorter than pl then neglect larger pl values. If length of alm is greater than pl then effectivly pad the pl with zeros, i.e. set high l alm values to zero.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_pl_conv_pl
private subroutine s2_pl_conv_pl (pl1, pl2) type (s2_pl), intent(inout) :: pl1 type (s2_pl), intent(in) :: pl2 ! Calls: s2_error end subroutine s2_pl_conv_plConvolve two power spectra. Pl1 is overwritten with the convolved spectrum on output. (Spectra must have same lmax.)
Variables:
Author: J. D. McEwen
Version: 0.1 May 2005
s2_pl_power
public function s2_pl_power (pl) result (power) type (s2_pl), intent(in) :: pl real (kind=s2_sp) :: power ! Calls: s2_error end function s2_pl_powerCompute full power from a pl spectrum
Variables:
Author: J. D. McEwen
Version: 0.1 May 2006
s2_pl_plot
public subroutine s2_pl_plot (pl, filename, scale_to_dl_in, title) type (s2_pl), intent(in) :: pl character (len=*), intent(in) :: filename logical, optional, intent(in) :: scale_to_dl_in character (len=*), optional, intent(in) :: title ! Calls: pgclos, pgenv, pgline, pgmtxt, pgopen, s2_error end subroutine s2_pl_plotPlot the pl angular power spectrum as a postscript.
Notes:
Author: J. D. McEwen
Version: 0.1 February 2005
s2_pl_io_ascii_write
public subroutine s2_pl_io_ascii_write (filename, pl, dl_scale) character (len=*), intent(in) :: filename type (s2_pl), intent(in) :: pl logical, optional, intent(in) :: dl_scale end subroutine s2_pl_io_ascii_writeWrite a s2_pl object to an ascii file.
Variables:
Author: J. D. McEwen
Version: 0.1 - June 2005
s2_pl_io_fits_write
public subroutine s2_pl_io_fits_write (filename, pl, comment) character (len=*), intent(in) :: filename type (s2_pl), intent(in) :: pl character (len=*), optional, intent(in) :: comment ! Calls: ftclos, ftfiou, ftgiou, ftibin, ftinit, ftpcle, ftpcom, ftpdat, ftphpr, ftpkyj, s2_error, s2_pl_io_fits_error_check, s2_pl_io_fits_exists end subroutine s2_pl_io_fits_writeWrite a s2_pl object to a fits file.
Variables:
Author: J. D. McEwen
Version: 0.1 - April 2005
s2_pl_io_fits_read
private subroutine s2_pl_io_fits_read (filename, pl) character (len=*), intent(in) :: filename type (s2_pl), intent(out) :: pl ! Calls: ftclos, ftfiou, ftgcve, ftgiou, ftgkyj, ftmahd, ftopen, ftthdu, s2_error, s2_pl_io_fits_error_check, s2_pl_io_fits_exists end subroutine s2_pl_io_fits_readRead a fits pl file and allocate a new pl structure with the data read.
Variables:
Author: J. D. McEwen
Version: 0.1 - April 2005
s2_pl_io_fits_error_check
private subroutine s2_pl_io_fits_error_check (status, halt) integer, intent(inout) :: status logical, intent(in) :: halt ! Calls: ftgerr, ftgmsg end subroutine s2_pl_io_fits_error_checkCheck if a fits error has occured and print error message. Halt program execution if halt flag is set.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
s2_pl_io_fits_exists
private subroutine s2_pl_io_fits_exists (filename, status, exists) character (len=*), intent(in) :: filename integer, intent(inout) :: status logical, intent(out) :: exists ! Calls: ftclos, ftfiou, ftgiou, ftopen, s2_pl_io_fits_error_check end subroutine s2_pl_io_fits_existsCheck if a fits file exists.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
s2_pl_io_fits_del
private subroutine s2_pl_io_fits_del (filename, status) character (len=*), intent(in) :: filename integer, intent(inout) :: status ! Calls: ftcmsg, ftdelt, ftfiou, ftgiou, ftopen end subroutine s2_pl_io_fits_delDelete a fits file.
Notes:
Author: J. D. McEwen
Version: 0.1 - November 2004
s2_pl_get_init
public function s2_pl_get_init (pl) result (init) type (s2_pl), intent(in) :: pl logical :: init end function s2_pl_get_initGet init variable from the passed pl.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_pl_get_lmax
public function s2_pl_get_lmax (pl) result (lmax) type (s2_pl), intent(in) :: pl integer :: lmax ! Calls: s2_error end function s2_pl_get_lmaxGet lmax variable from the passed pl.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_pl_get_spec
public subroutine s2_pl_get_spec (pl, pl_spec) type (s2_pl), intent(in) :: pl real (kind=s2_sp), intent(out), dimension (:) :: pl_spec ! Calls: s2_error end subroutine s2_pl_get_specGet pl spectrum variable from the passed pl.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004
s2_pl_get_spec_l
public function s2_pl_get_spec_l (pl, l) result (pl_val) type (s2_pl), intent(in) :: pl integer, intent(in) :: l real (kind=s2_sp) :: pl_val ! Calls: s2_error end function s2_pl_get_spec_lGet spectrum value for a given l from the pl.
Variables:
Author: J. D. McEwen
Version: 0.1 August 2004