Commit 6165c4cd authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

use is_pixel_ok in most subroutines

this is preferred as it allows for cleaner way to ignore masked
pixels as in .not.is_pixel_ok(pixel, ignore_mask=.TRUE.)
parent b0f6f010
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ match all
! here masking produces warning
mask tau set 2 run 10556

fit   sample flag offset phase_offset 180.0
fit   sample flag offset phase_offset 90.0
!collect 

! here masking works
+4 −5
Original line number Diff line number Diff line
@@ -862,7 +862,7 @@ CONTAINS
    if (present(ignore_mask)) then
        if (ignore_mask) cmask = PIXEL_MASK_CLEAR
    end if
    res = IAND(this%status, cmask)==PIXEL_OK
    res = IAND(this%status, cmask).eq.PIXEL_OK
    return
  end function is_pixel_ok

@@ -1087,9 +1087,8 @@ CONTAINS
! ------------------------- further exclusion criteria as too large chisq or invalid flags or.....
! to be included here:
!
     if ( ps_sample%status    .ne. PIXEL_OK ) return
     if ( ps_reference%status .ne. PIXEL_OK ) return

     if (.not.is_pixel_ok(ps_sample)   ) return 
     if (.not.is_pixel_ok(ps_reference)) return 


!-- determine the addresses
@@ -1298,7 +1297,7 @@ CONTAINS
                                            ! note: if bin is empty it should be inf, this is done by setting w=1 (if)
     real(kind=DBL)           :: tau, qabs

     if ( ps_reference%status .ne. PIXEL_OK ) return
     if (.not.is_pixel_ok(ps_reference) ) return 

     tau  = ps_reference%tau
     qabs = ps_reference%Q_abs
+5 −8
Original line number Diff line number Diff line
@@ -373,8 +373,7 @@ contains
    write(out_unit,"(1x,a,a)"    )  '### phase.scan.up                  :' , trim(cformat_value(phase%up))
    write(out_unit,"(1x,a,a)"    )  '### phase.scan.down                :' , trim(cformat_value(phase%down))
    write(out_unit,"(1x,a,f12.6)")  '### phase.scan.chi_squared         :' , phase%chi_squared

    if ( phase%status.ne.PIXEL_OK ) return
    if (.not.is_pixel_ok(phase)) return

    write(out_unit,"(1x,a,a)"    )  '### phase.scan.delta_J_symm  [Tm]  :' , trim(cformat_value(phase%delta_J_symm))
    write(out_unit,"(1x,a,a)"    )  '### phase.scan.fqt                 :' , trim(cformat_value(phase%fqt))
@@ -420,7 +419,7 @@ contains
    end do
    close(iunit)

    if ( phase_scan%status/=PIXEL_OK .or. &
    if ( .not.is_pixel_ok(phase_scan) .or. &
         phase_scan%delta_J_symm%state==VAL_UNDEFINED ) return

    outfilename = dump_phase_fit_filename(map_dir,'firef', itau, indx(3:6))
@@ -463,8 +462,6 @@ contains
    x = 0
    y = 0

!    if ( phase_scan%status/=PIXEL_OK .or. &
!         phase_scan%delta_J_symm%state==VAL_UNDEFINED) return

    xmin =  phase_scan%delta_J(1)%value
    xmax =  phase_scan%delta_J(phase_scan%n_down)%value
@@ -670,7 +667,7 @@ contains
         ave     = 0
         pl1:   do ix=1,nx
            do iy=1,ny
               if(cur_point%pixelbin(kbin, ix, iy)%status.eq.PIXEL_OK ) then
               if(is_pixel_ok(cur_point%pixelbin(kbin, ix, iy))) then
                  nactive = nactive + 1
                  dj_ave = dj_ave +  cur_point%pixelbin(kbin,ix,iy)%delta_J_symm%value
                  dj_var = dj_var +  cur_point%pixelbin(kbin,ix,iy)%delta_J_symm%value**2
@@ -691,7 +688,7 @@ contains

         pl2:   do ix=1,nx
            do iy=1,ny
               if(cur_point%pixelbin(kbin, ix, iy)%status.eq.PIXEL_OK ) then
               if(is_pixel_ok(cur_point%pixelbin(kbin, ix, iy))) then
                  djj =  cur_point%pixelbin(kbin,ix,iy)%delta_J_symm%value - dj_ave
                  ijj = nint(djj*1d6)
                  if(ijj < lbound(j_histo,1)) ijj = lbound(j_histo,1)
+3 −3
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ contains
       do ix=1, xpix
          do iy=1, ypix
             ! FIXME what if res and scan are one and the same?
             if ( res_point%pixelbin( 0, ix, iy)%status .ne. PIXEL_OK ) then
             if ( .not.is_pixel_ok(res_point%pixelbin( 0, ix, iy), ignore_mask=.TRUE.)) then
                scan_point%pixelbin(it, ix, iy)%status = &
                     ior(scan_point%pixelbin(it, ix, iy)%status, &
                     PIXEL_NO_RESOLUTION)
@@ -339,7 +339,7 @@ contains
       end if
    endif

    if (phase_scan%status/=PIXEL_OK) return
    if (.not.is_pixel_ok(phase_scan, ignore_mask=.TRUE.)) return

    eshape_lams%nbin = [phase_scan%tbin_1, phase_scan%tbin_2]

@@ -382,7 +382,7 @@ contains
          end do hops
       end if
    end if
    if (phase_scan%status/=PIXEL_OK) return
    if (.not.is_pixel_ok(phase_scan, ignore_mask=.TRUE.)) return

    call get_phase_fit_values(eshape, phase_scan, eshape_lams, dj0_fit) ! get fit values
    phase_scan%fqt = get_fqt(phase_scan)
+2 −2
Original line number Diff line number Diff line
@@ -353,8 +353,8 @@ contains
             dtypd:    do py = 1,nypix
                datpix => dat_point%pixelbin(0, px, py)
                refpix => ref_point%pixelbin(0, px, py)
                if(datpix%status .ne. PIXEL_OK ) cycle dtypd
                if(refpix%status .ne. PIXEL_OK ) cycle dtypd
                if(.not.is_pixel_ok(datpix, ignore_mask=.TRUE.)) cycle dtypd
                if(.not.is_pixel_ok(refpix, ignore_mask=.TRUE.)) cycle dtypd
                if(all ( [ refpix%average%value    > reduction_parameters%average_min_value,&
                           refpix%fqt%value        > reduction_parameters%fqt_min_value,&
                           sqrt(refpix%fqt%sigma2) < reduction_parameters%fqt_max_sigma] )) then
Loading