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

Merge branch 'matching' into pztest

parents e0b9aa87 7e40d0c2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@ read s5854.echo s5855.echo s5857.echo s5858.echo s5859.echo s5860.echo s5861.ech

c === process
match all
fit   all
fit   res
fit   sam flag offset
collect

report start
+4 −0
Original line number Diff line number Diff line
@@ -32,3 +32,7 @@ match show
! match tau 2 run 10875 => tau 3 run 10903 (bgr)
match run 10875 tau 2 to 10903 tau2 3 ! 11A bgr to 8A sample
match show

! test fitting/collection
fit all
collect
+20 −14
Original line number Diff line number Diff line
@@ -1018,8 +1018,8 @@ CONTAINS
     logical, intent(in), optional                       :: use_arithmetic_mean

     integer                  :: it, iq                        ! pixel bin addresses to be determined
     real(kind=DBL),parameter :: RELATIVE_TOLERANCE=0.003_DBL  ! maching ckeck tolerance
     real(kind=DBL),parameter :: THETA_TOLERANCE   =0.1_DBL    ! degrees (CHECKCHECK)
     !real(kind=DBL),parameter :: RELATIVE_TOLERANCE=0.003_DBL  ! maching ckeck tolerance
     !real(kind=DBL),parameter :: THETA_TOLERANCE   =0.1_DBL    ! degrees (CHECKCHECK)

     real(kind=DBL)           :: w          ! error dependent weight factor for the summation of fqt
     real(kind=DBL)           :: ws         ! error dependent weight factor for the summation of sqt
@@ -1043,24 +1043,30 @@ CONTAINS



     if( abs(ps_reference%J0 - ps_sample%J0)/ps_reference%J0 > RELATIVE_TOLERANCE * 10 ) then
       write(6,*)"add_pix_to_sqt: Reference and Sample J0 are too different !"
       return
     if( abs(ps_reference%J0 - ps_sample%J0)/ps_reference%J0 > matching_tolerance%J0_rel ) then
        call msg_warning('add_pix_to_sqt', "Reference and Sample J0 are too different !")
        !write(6,*)"add_pix_to_sqt: Reference and Sample J0 are too different !"
        !return
     endif         
     
     if( abs(ps_reference%lambda_1 - ps_sample%lambda_1)/ps_reference%lambda_1 > RELATIVE_TOLERANCE) then
       write(6,*)"add_pix_to_sqt: Reference and Sample lambda1 are too different !"
       return
     !if( abs(ps_reference%lambda_1 - ps_sample%lambda_1)/ps_reference%lambda_1 > matching_tolerance%J0_rel) then
     if( abs(ps_reference%lambda_1 - ps_sample%lambda_1) > matching_tolerance%lambda_min) then
        call msg_warning('add_pix_to_sqt', "Reference and Sample lambda1 are too different !")
        !write(6,*)"add_pix_to_sqt: Reference and Sample lambda1 are too different !"
        !return
     endif      
  
     if( abs(ps_reference%lambda_2 - ps_sample%lambda_2)/ps_reference%lambda_2 > RELATIVE_TOLERANCE) then
       write(6,*)"add_pix_to_sqt: Reference and Sample lambda2 are too different !"
       return
     !if( abs(ps_reference%lambda_2 - ps_sample%lambda_2)/ps_reference%lambda_2 > matching_tolerance%J0_rel) then
     if( abs(ps_reference%lambda_2 - ps_sample%lambda_2) > matching_tolerance%lambda_max) then
        call msg_warning('add_pix_to_sqt', "Reference and Sample lambda2 are too different !")
        !write(6,*)"add_pix_to_sqt: Reference and Sample lambda2 are too different !"
        !return
     endif   
      
     if( abs(ps_reference%scattering_angle_polar - ps_sample%scattering_angle_polar) > THETA_TOLERANCE) then
       write(6,*)"add_pix_to_sqt: Reference and Sample theta are too different !"
       return
     if( abs(ps_reference%scattering_angle_polar - ps_sample%scattering_angle_polar) > matching_tolerance%scattering_angle) then
        call msg_warning('add_pix_to_sqt', "Reference and Sample theta are too different !")
        !write(6,*)"add_pix_to_sqt: Reference and Sample theta are too different !"
        !return
     endif         

!> @note we still have to include further exclusion criteria     
+23 −1
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
!! the corresponding arrays
!! and issue an intelligible error message if dimensions are exceeded.
module drspine_parameters

  implicit none
  save
  ! integer, parameter :: SGL = SELECTED_REAL_KIND(p=6,  r=37)
@@ -179,6 +178,29 @@ module drspine_parameters
       1D-5       & ! max magnetic field variation
       )
  !


  !> Parameters that control the matching tolerance , +initializing
  !! @note discrimating value for modes is still missing (e.g. current)
  type matching_tolerance_struct
    real(kind=DBL)  :: J0_abs
    real(kind=DBL)  :: J0_rel
    real(kind=DBL)  :: scattering_angle
    real(kind=DBL)  :: sample_angle
    real(kind=DBL)  :: lambda_min
    real(kind=DBL)  :: lambda_max
  end type matching_tolerance_struct

  type(matching_tolerance_struct) :: matching_tolerance = matching_tolerance_struct( &
                            300.00D-06,        & ! J0 abs tolerance 300 uTm
                              0.03_DBL,        & ! J0 relative tolerance, default 3%
                              0.15/180.0*ACOS(-1.0_DBL), & ! scattering angle tolerance
                              ACOS(-1.0_DBL),  & ! sample angle tolerance, default is disabled (?)
                              0.10D-10      ,  & ! min. neutron wavelength tolerance, default 0.1 A
                              0.10D-10         & ! max. neutron wavelength tolerance, default 0.1 A
                            )


CONTAINS
  !> conversion functions
  !!
+0 −21
Original line number Diff line number Diff line
@@ -15,30 +15,9 @@ module matching

  private

  !> Parameters that control the matching tolerance , +initializing
  !! @note discrimating value for modes is still missing (e.g. current)
  type matching_tolerance_struct
    real(kind=DBL)  :: J0_abs
    real(kind=DBL)  :: J0_rel
    real(kind=DBL)  :: scattering_angle
    real(kind=DBL)  :: sample_angle
    real(kind=DBL)  :: lambda_min
    real(kind=DBL)  :: lambda_max
  end type matching_tolerance_struct

  type(matching_tolerance_struct) :: matching_tolerance = matching_tolerance_struct( &
                            300*UTESLA   ,  & ! J0 abs tolerance 300 uTm
                              0.03_DBL   ,  & ! J0 relative tolerance, default 3%
                              0.15*DEGREE,  & ! scattering angle tolerance
                            180.00*DEGREE,  & ! sample angle tolerance, default is disabled (?)
                            0.1*ANGSTROEM,  & ! min. neutron wavelength tolerance, default 0.1 A
                            0.1*ANGSTROEM   & ! max. neutron wavelength tolerance, default 0.1 A
                            )

  public  :: taupoint_match, taupoint_mismatch, cformat_match_accuracy
  public  :: clear_matches, list_matching_ids
  public  :: match_scan_global, match_scan_force, match_show, match_clear
  public  :: matching_tolerance

contains
  !--------------------------------------------------------------------------