Commit 72b552f5 authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

more info in get_phase_offset

parent ff6de504
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -321,15 +321,19 @@ contains
    real(kind=DBL), allocatable  :: xipof(:), yipof(:)
    type(phase_scan_struct),pointer :: centerbin, datpix, refpix
    type(lambda_struct) :: eshape_lams
    real(kind=DBL) :: dj_phase_step

    nxpix = max(1, dat_point%no_xpix) ! at least one
    nypix = max(1, dat_point%no_ypix)
    xprange  = 1


    centerbin => dat_point%centerbin
    call init_lambda_struct(eshape_lams, dat_point%spectrum(0))
    if (djoffset==0.0d0) djoffset = centerbin%delta_J_symm%value

    call msg_debug('get_phase_offset', trim(msg_fmt("(' dj0 [uTm] =', f12.6)", djoffset/UTESLA)))

    xprt:  do
       ssqmin    = HUGE(ssqmin)

@@ -338,9 +342,10 @@ contains
       !! ! this do loop shall be replace by a faster and more accurate minimum search
       !! ! NOTE that if we stay within about +-30 degrees phase difference the ssq vs ioffset
       !! ! functions is very close to a (smooth) parabola....

       dj_phase_step = centerbin%delta_J(2)%value-centerbin%delta_J(1)%value
       dipt:  do ipt=-NIPT,NIPT
          dj = ipt*(centerbin%delta_J(2)%value-centerbin%delta_J(1)%value)/real(xprange*NIPT) + djoffset
          call assert(dj_phase_step>0,'get_phase_offset: phase step must be positive')
          dj = ipt*dj_phase_step/real(xprange*NIPT) + djoffset
          ssq_allpix = 0
          ssq_norpix = 0

@@ -383,9 +388,9 @@ contains

          call msg_debug('get_phase_offset', &
            trim(msg_fmt("(' ipt =',i4)", ipt))//' '//&
            trim(msg_fmt("(' dj  =',f12.6)", dj))//' '//&
            trim(msg_fmt("(' ssq_norpix=',f12.6)", ssq_norpix))//' '//&
            trim(msg_fmt("(' ssq_allpix=',f12.6)", ssq_allpix)))
            trim(msg_fmt("(' dj [uTm] =', f12.6)", dj/UTESLA))//' '//&
            trim(msg_fmt("(' ssq_norpix=',g13.6)", ssq_norpix))//' '//&
            trim(msg_fmt("(' ssq_allpix=',g13.6)", ssq_allpix)))

          if(ssq_allpix < ssqmin) then
             ssqmin = ssq_allpix