Commit b35b9912 authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

logging messages updates

- fit_utils, fit_data
- minor compiler bug in read_data
- new macro to test missing phase points
parent 11d38f66
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
macro

datapath /SNS/NSE//IPTS-27126/

read s10934.echo
+4 −3
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ contains
    integer, intent(in)                      :: fit_flag
    !
    type(scan_data_struct), pointer :: sig_point, ref_point
    integer :: iscan
    integer :: iscan, ierr
    real(kind=DBL) :: djoffset

    call msg_info('fit_echo_data', 'fitting echo data '//trim(data%file)//&
@@ -83,7 +83,8 @@ contains
          call get_echo_param(sig_point, sig_point%matching_ref, .false.) ! extract
          if ( iand(fit_flag, PHASE_FIT_OFFSET) /=0 ) then
            if (iand(fit_flag, PHASE_FIT_RESET) /=0 ) djoffset=0
            call get_phase_offset(sig_point, sig_point%matching_ref, djoffset)
            call get_phase_offset(sig_point, sig_point%matching_ref, djoffset, ierr)
            if (ierr/=0) return  ! errors are handled by get_phase_offset
            call get_echo_param(sig_point, sig_point%matching_ref, .true., djoffset)
          end if
       end if
@@ -244,7 +245,7 @@ contains
    djoffset = 0
    if (apply_offset) then
        if (present(offset) ) djoffset = offset
        call msg_info('get_echo_param', &
        call msg_info('get_echo_param:'//cpixel(run=scan_point%id, tau=scan_point%point), &
                        trim(msg_fmt("(1x,'applying phase offset: ',f12.3,' deg')", &
                        rad2deg(get_precession_phase(djoffset,scan_point%physics%lambda))))//&
                        trim(msg_fmt("(1x,'(',g12.5,' uTm)')", djoffset/UTESLA))//&
+10 −8
Original line number Diff line number Diff line
@@ -300,10 +300,11 @@ contains
  !! ========================================================================
  !> @brief get the global phase difference for data
  !!
  subroutine get_phase_offset(dat_point, ref_point, djoffset)
  subroutine get_phase_offset(dat_point, ref_point, djoffset, ierr)
    type(scan_data_struct), pointer, intent(inout) :: dat_point
    type(scan_data_struct), pointer, intent(inout) :: ref_point
    real(kind=DBL), intent(inout) :: djoffset
    integer, intent(out)          :: ierr ! 0 if success
    !
    integer, parameter        :: NIPT = 5
    !
@@ -326,6 +327,7 @@ contains
    nxpix = max(1, dat_point%no_xpix) ! at least one
    nypix = max(1, dat_point%no_ypix)
    xprange  = 1
    ierr     = -1


    centerbin => dat_point%centerbin
@@ -378,9 +380,8 @@ contains
          enddo dtxpd

          if(ssq_norpix == 0d0 .or. ssq_norpix >= HUGE(1d0)) then
            call msg_warning('get_phase_offset','phase offset determination failed ('&
!                    //trim(msg_fmt("('ssq normalization: ', g9.5)", ssq_norpix))//')' &
                    //'Check: r-parameters r.ave_min, r.fqt_min or r.fqt_maxsigma !)')
            call msg_warning('get_phase_offset:'//cpixel(datpix),'phase offset determination failed ('&
                    //'check: r-parameters r.ave_min, r.fqt_min or r.fqt_maxsigma !)')
            djoffset = 0
            return
          endif
@@ -434,19 +435,20 @@ contains
       deallocate(xipof)
       deallocate(yipof)


       if(abs(djoffset-xof2) < reduction_parameters%symmetry_phase_min_offset) exit xprt
       if(xprange > MAX_PHASE_RANGE ) then
            djoffset = 0.0d0
            call msg_error('get_phase_offset','phase offset determination failed: '//&
                msg_fmt("('max phase range exceeded ',i0)", xprange))
            exit xprt
            call msg_error('get_phase_offset:'//cpixel(datpix),'phase offset determination failed: '//&
                msg_fmt("('max phase range exceeded ',i0)", xprange), ERROR_DATA_PROCESSING)
            return
       end if
       xprange  = xprange * 2
       djoffset = 0.0d0
       call msg_debug('get_phase_offset','phase offset determination failed: '//&
                msg_fmt("('doubling the range to ',i0)", xprange))
    enddo xprt

    ierr = 0
  end subroutine get_phase_offset


+1 −1
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ contains
          if(iret.ne.0) then
             nphase = nphase - 1
             if ((number_of_phases-nphase)<=max_number_of_missing_phases) then ! FIXME: (paz) HACK - accept if at most two up points at the end of a scan
                call msg_warning('read_echo_data:'//cpixel(run=scan_data%id, tau=nscan),
                call msg_warning('read_echo_data:'//cpixel(run=ftype%number, tau=nscan),&
                  trim(msg_fmt("('scan point:', i0)", nscan))//' is missing '//&
                  trim(msg_fmt("(i0, ' phase point(s), accepting the data')", number_of_phases-nphase)))
                exit scan_point_do