Skip to content

Commit

Permalink
adds more features to EM4DEBSD program
Browse files Browse the repository at this point in the history
  • Loading branch information
marcdegraef committed Apr 5, 2024
1 parent b15b7ec commit 23d1e8f
Show file tree
Hide file tree
Showing 5 changed files with 503 additions and 202 deletions.
10 changes: 6 additions & 4 deletions NamelistTemplates/EM4DEBSD.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
!=====================================
! Virtual Detector Parameters
!=====================================
! detector type: 'Rect', 'Gaus', 'Hann'
! virtual detector type: 'Rect', 'Gaus', 'Hann'
VDtype = 'Rect',
! detector reference: 'EBSP', 'MPat'
! virtual detector reference: 'EBSP', 'MPat'
VDreference = 'EBSP',
! center coordinates (in terms of EBSD pattern)
! center coordinates of virtual detector
! in terms of EBSD pattern coordinates for VDreference='EBSD'
! in terms of master pattern coordinates for VDreference='MPat'
VDlocx = 0.0,
VDlocy = 0.0,
! rectangular virtual detector width and height (should be odd numbers !)
! rectangular virtual detector width and height (should be odd numbers of the form 4*n+1 !)
VDwidth = 5,
VDheight = 5,
! Gaussian virtual detector standard deviation
Expand Down
2 changes: 1 addition & 1 deletion Source/EMsoftOOLib/mod_PGA3D.f90
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ recursive subroutine mvec_log_(self, pre)
end if
! create the substring entry
entry = ''
write (entry,"(F14.6)") c
write (entry,"(F18.6)") c
entry = sgn//trim(adjustl(entry))//' '//trim(adjustl(basis(i)))
! add to the output string
call Message%printMessage(entry, frm="(A,$)")
Expand Down
38 changes: 27 additions & 11 deletions Source/EMsoftOOLib/mod_filters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ recursive subroutine InversionDivision(input, output, dims)
end subroutine InversionDivision

!--------------------------------------------------------------------------
recursive subroutine HannWindow(roi_size, window)
recursive subroutine HannWindow(roi_size, window, alpha)
!DEC$ ATTRIBUTES DLLEXPORT :: HannWindow
!
!> @brief Hann windowing function for pattern region of interest
Expand All @@ -1276,17 +1276,33 @@ recursive subroutine HannWindow(roi_size, window)

integer(kind=irg),INTENT(IN) :: roi_size
real(kind=dbl),INTENT(INOUT) :: window(roi_size, roi_size)

integer(kind=irg) :: i, j
real(kind=dbl) :: fr

fr = cPi / dble(roi_size)

do i=1,roi_size
do j=1,roi_size
window(i,j)=cos((dble(i-roi_size/2) * fr))*cos((dble(roi_size/2-j) * fr))
real(kind=dbl),INTENT(IN),OPTIONAL :: alpha

integer(kind=irg) :: i, j, r
real(kind=dbl) :: fr, hx, x, y, cx, cy

if (present(alpha)) then
! this version implements the 2D HannWindow function from Mathematica
! the assumption is that roi_size is an odd number
r = (roi_size-1)/2
fr = 1.D0/dble(r)
window = 0.D0
do i=-r/2,r/2
cx = cos(2.D0*cPi*dble(i)*fr)
hx = alpha*(1.D0-cx) + cx
do j=-r/2,r/2
cy = cos(2.D0*cPi*dble(j)*fr)
window(i+r+1,j+r+1) = hx * ( alpha*(1.D0-cy) + cy )
end do
end do
end do
else
fr = cPi / dble(roi_size)
do i=1,roi_size
do j=1,roi_size
window(i,j)=cos((dble(i-roi_size/2) * fr))*cos((dble(roi_size/2-j) * fr))
end do
end do
end if

end subroutine HannWindow

Expand Down
Loading

0 comments on commit 23d1e8f

Please sign in to comment.