max_spectrum Subroutine

public subroutine max_spectrum(data, spectrum, dim_v, dim_y, dim_x, norm_value)

Compute the MAX spectrum of a cube along the spatial axis

Arguments

Type IntentOptional AttributesName
real(kind=xp), intent(in), dimension(:,:,:), allocatable:: data

initial fits data

real(kind=xp), intent(inout), dimension(:), allocatable:: spectrum

max_spectrum of the observation

integer, intent(in) :: dim_v

dimension along v axis

integer, intent(in) :: dim_y

dimension along spatial axis y

integer, intent(in) :: dim_x

dimension along spatial axis x

real(kind=xp), intent(in), optional :: norm_value

max value of the mean spectrum to normalze the max spectrum if present


Calls

proc~~max_spectrum~~CallsGraph proc~max_spectrum max_spectrum proc~max_2d max_2D proc~max_spectrum->proc~max_2d proc~ravel_2d ravel_2D proc~max_2d->proc~ravel_2d

Contents

Source Code


Source Code

  subroutine max_spectrum(data, spectrum, dim_v, dim_y, dim_x, norm_value)
    !! Compute the MAX spectrum of a cube along the spatial axis
    implicit none

    real(xp), intent(in), dimension(:,:,:), allocatable :: data !! initial fits data
    real(xp), intent(in), optional :: norm_value !! max value of the mean spectrum to normalze the max spectrum if present
    integer, intent(in) :: dim_v !! dimension along v axis
    integer, intent(in) :: dim_y !! dimension along spatial axis y 
    integer, intent(in) :: dim_x !! dimension along spatial axis x

    real(xp), intent(inout), dimension(:), allocatable :: spectrum !! max_spectrum of the observation
    real(xp), dimension(:,:), allocatable :: map !! 2D array

    integer :: i !! loop index

    do i=1,dim_v
       allocate(map(dim_y,dim_x))
       map = data(i,:,:)
       spectrum(i) = max_2D(map, dim_y, dim_x) 
       deallocate(map)
    end do

    if (present(norm_value)) then
       spectrum = spectrum / (maxval(spectrum) / norm_value)
    end if

    
    
  end subroutine max_spectrum