Commit 9214fee6 authored by Michael Monkenbusch's avatar Michael Monkenbusch
Browse files

sqt comparison check with some questionmarks for the sqt sewction ind...

sqt comparison check with some questionmarks for the sqt sewction ind add_pix_to_sqt and may testprints
parent 35a7cf47
Loading
Loading
Loading
Loading
+37 −1
Original line number Diff line number Diff line
@@ -1024,6 +1024,7 @@ CONTAINS
     !
     real(kind=DBL)           :: xtmp ! tmp variable
     real(kind=DBL)           :: tau, qabs
     real(kind=DBL)           :: ud_err2

!!!>>> preliminary hint >>> !!!
     if(present(ps_background)) then
@@ -1170,17 +1171,52 @@ CONTAINS
               + (ps_reference%calibration_factor%value/ps_reference%amplitude%value)**2  * ps_sample%amplitude%sigma2             &
               + (sofqt/ps_reference%amplitude%value)**2                                  * ps_reference%amplitude%sigma2

!! >>new>> OK?  !!!??????!!  
    sofqt       = ( 2*ps_sample%amplitude%value / ps_sample%resolution%value )
    sofqt_err2  = (1d0/ ps_sample%resolution%value**2)*( 4*ps_sample%amplitude%sigma2 +  ps_sample%resolution%sigma2 * sofqt**2)
!! <<new<<     !!!?????!!


! -- and determine the appropriate weight
     delta2    = sofqt_err2
     delta2_n  = sqt%tq_bin(it,iq)%sqt_err2

!  ?? ud_err2   = ps_sample%up%sigma2+ps_sample%down%sigma2
!  ?? delta2 = (1d0/ud_err2**2)*(sofqt_err2 +  ud_err2 * (sofqt/(ps_sample%up%value-ps_sample%down%value))**2)


     if(delta2_n > 0.0_DBL) then
       ws = delta2_n / (delta2_n + delta2)
     else
       ws = 1.0_DBL
     endif

! -- then combine the results for this item  
! ?? write(*,'(a,i8,2i5,5e15.7,2x,f12.6)') "Tw: ",sqt%update_counter ,it,iq, w, ws, sofqt, sofqt_err2, ud_err2, w/ws-1

!! (mm) overriding the previous weigth setting by the fqt weigt setting
!! this seems to be required to yiled consistent results
!! Is there an error in the above implementation of ws or is this an intrinsic feature?
!! CHECK! TBD
!!
    ws = w !!! ??
!!  ======        ATTENTION CHECK 

!! -- then combine the results for this item  
!    (Check whether udratioRes is present or must be computed !:.)


!! >>new>> OK?  !!!?????? (either here or above but not both !! !  

!!?     sqt%tq_bin(it,iq)%updown       = (1.0_DBL-ws)    *sqt%tq_bin(it,iq)%updown     &
!!?                                    + ws*(ps_sample%up%value-ps_sample%down%value)
!!?     sqt%tq_bin(it,iq)%updown_var   = (1.0_DBL-ws)    *sqt%tq_bin(it,iq)%updown_var &
!!?                                    + ws*(ps_sample%up%value-ps_sample%down%value)**2
!!?     sqt%tq_bin(it,iq)%updown_err2  = (1.0_DBL-ws)**2 *sqt%tq_bin(it,iq)%updown_err2       &
!!?                                    + ws**2 *(ps_sample%up%sigma2+ps_sample%down%sigma2) 
!! <<new<<     !!!?????!!


 !--
     sqt%tq_bin(it,iq)%sqt          = (1.0_DBL-ws)    *sqt%tq_bin(it,iq)%sqt          + ws    * sofqt
     sqt%tq_bin(it,iq)%sqt_var      = (1.0_DBL-ws)    *sqt%tq_bin(it,iq)%sqt_var      + ws    * sofqt**2
     sqt%tq_bin(it,iq)%sqt_err2     = (1.0_DBL-ws)**2 *sqt%tq_bin(it,iq)%sqt_err2     + ws**2 * sofqt_err2
+15 −3
Original line number Diff line number Diff line
@@ -3304,6 +3304,8 @@ se: if(found('close') .or. found('end')) then
    double precision        , allocatable :: tau(:)
    double precision        , allocatable :: fqt(:)
    double precision        , allocatable :: fqt_err(:)
    double precision        , allocatable :: fqt_alt(:)       !! >>new>> 
    double precision        , allocatable :: fqt_alt_err(:)   !! <<new<<
!    type(namedvalue_struct) , allocatable :: q_values(:) ! paz - unused variable
    double precision        , allocatable :: deff(:)
    double precision        , allocatable :: deff_err(:)
@@ -3396,6 +3398,8 @@ se: if(found('close') .or. found('end')) then
    allocate( tau        ( mt ) )
    allocate( fqt        ( mt ) )
    allocate( fqt_err    ( mt ) )
    allocate( fqt_alt    ( mt ) ) !! >>new>>
    allocate( fqt_alt_err( mt ) ) !! <<new>>
!?    allocate( q_values   ( mq ) )
    allocate( deff       ( mq ) )
    allocate( deff_err   ( mq ) )
@@ -3440,8 +3444,8 @@ se: if(found('close') .or. found('end')) then
      "\bf \large "//trim(comment)//"\\ "// &
      " With direct background subtraction"//&  !: transmission factor= "//tex_scientific_number_fmt(tfac,4)//&
      "   volfrac=TBD!! "&                      !!mm  //tex_scientific_number_fmt(volfrac,4) &
        //"("//tex_integer_number_fmt(coll_data%direct_bgr_subtracted ,4)//"," &
        //tex_integer_number_fmt(coll_data%update_counter ,4)//")" &
        //"("//tex_integer_number_fmt(coll_data%direct_bgr_subtracted ,0)//"," &
        //tex_integer_number_fmt(coll_data%update_counter ,0)//")" &
       )
    elseif(nint(bgr_flag) > 0) then
      call tex_colored_box(1d0,1d0,"cyan", &
@@ -3551,7 +3555,15 @@ ntl: do i=0, nt
          tau(ii)     = cdX%tq_bin(i,j)%fqt_tau/NS
          fqt(ii)     = cdX%tq_bin(i,j)%fqt
          fqt_err(ii) = sqrt(abs(cdX%tq_bin(i,j)%fqt_err2))

          fqt_alt(ii)     = cdX%tq_bin(i,j)%sqt/(cdX%tq_bin(i,j)%updown)  !! test >>new>>
          fqt_alt_err(ii) =sqrt ((1d0/cdX%tq_bin(i,j)%updown**2) * &   !! test >>new>>
                                (cdX%tq_bin(i,j)%sqt_err2 + fqt_alt(ii)**2 *cdX%tq_bin(i,j)%updown_err2)) !! test >>new>>


          if(verbose) write(*,*)"TEST: ntl  ", j, i, ii, tau(ii), fqt(ii)
write(*,*)"TEST NTL: ",j,i,ii, tau(ii), fqt(ii),  fqt_alt(ii) , cdX%tq_bin(i,j)%sqt, cdX%tq_bin(i,j)%updown !!TEST!! defintion/role of updown??

       end do ntl
       ntx = ii

@@ -3563,7 +3575,7 @@ ntxi: if(ntx>ntxmin) then
          call tex(trim(buf1))

          call add_plot_curdat(n= ntx, xval=tau, yval=fqt, yerrors=fqt_err,more= "only marks ")
! fitting curve with simple streched exponential
          call add_plot_curdat(n= ntx, xval=tau, yval=fqt_alt  , yerrors=fqt_alt_err,more= "only marks ") !!TEST!! fitting curve with simple streched exponential
          a0    =  fqt(1)
          if(.not. fit_a0) then
             a0 = a0_start
+1 −0
Original line number Diff line number Diff line
@@ -621,6 +621,7 @@ contains

  write(cbuffer,'(i0.0)')digits
  fmt = '(i'//trim(cbuffer)//'.1)'
  if(digits==0) fmt = "(i0)"
  write(cbuffer,fmt) val
  
  tex_integer_number_fmt = cbuffer