Skip to content

Commit

Permalink
Merge branch 'develop' into Release5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marcdegraef committed Oct 14, 2019
2 parents ec68904 + d911ed7 commit a9d8ccd
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 61 deletions.
2 changes: 1 addition & 1 deletion NamelistTemplates/EMEBSDDI.template
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
!
! name of datafile where the patterns are stored; path relative to EMdatapathname
exptfile = 'undefined',
! input file type parameter: Binary, EMEBSD, TSLHDF, TSLup2, OxfordHDF, OxfordBinary, BrukerHDF
! input file type parameter: Binary, EMEBSD, TSLHDF, TSLup2, OxfordHDF, OxfordBinary, BrukerHDF, NORDIF
inputtype = 'Binary',
! here we enter the HDF group names and data set names as individual strings (up to 10)
! enter the full path of a data set in individual strings for each group, in the correct order,
Expand Down
4 changes: 2 additions & 2 deletions NamelistTemplates/EMEBSDDIpreview.template
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
numav = 0,
! name of datafile where the patterns are stored; path relative to EMdatapathname
exptfile = 'undefined',
! input file type parameter: Binary, EMEBSD, TSLHDF, TSLup2, OxfordHDF, OxfordBinary, BrukerHDF
! input file type parameter: Binary, EMEBSD, TSLHDF, TSLup2, OxfordHDF, OxfordBinary, BrukerHDF, NORDIF
inputtype = 'Binary',
! here we enter the HDF group names and data set names as individual strings (up to 10)
! enter the full path of a data set in individual strings for each group, in the correct order,
Expand All @@ -34,4 +34,4 @@
! pattern coordinates to be used for the preview
patx = 1,
paty = 1,
/
/
31 changes: 31 additions & 0 deletions NamelistTemplates/EMIntegrateSTEM.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
&IntegrateSTEMNamelist
! DO NOT CHANGE THIS LINE
!------------------------
! IO Filenames
!------------------------
! Name of the file containing diffraction data
inputfilename = 'undefined',
!------------------------
! Detector Parameters
!------------------------
! Size of detector pixels in nm
pixsize = 9000,
! Inner diameter of the annular detector, if used [mm]
id = 4,
! Outer diamater of the annular detector, if used [mm]
od = 10,
! Camera length [cm]
camlen = 3,
!------------------------
! Operating Parameters
!------------------------
! Operating mode
! 1 = single reflection, 2 = annular detector
! default is annular detector
mode = 2,
! If using a single reflection integration, specify the reflection here
! Default is the through-beam 0,0,0
ref = 0,0,0,
! Generate a CBED pattern, only works if mode = 2
CBED = .False.,
/
2 changes: 1 addition & 1 deletion NamelistTemplates/EMSphInx.template
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
masterfile = 'undefined',
! experimental patter file name [relative to EMdatapathname]
patfile = 'undefined',
! input file type parameter: Binary, EMEBSD, TSLHDF, TSLup2, OxfordHDF, OxfordBinary, BrukerHDF
! input file type parameter: Binary, EMEBSD, TSLHDF, TSLup2, OxfordHDF, OxfordBinary, BrukerHDF, NORDIF
inputtype = 'Binary',
! here we enter the HDF group names and data set names as individual strings (up to 10)
! enter the full path of a data set in individual strings for each group, in the correct order,
Expand Down
2 changes: 1 addition & 1 deletion NamelistTemplates/EMgetADP.template
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
!
! name of datafile where the patterns are stored; path relative to EMdatapathname
exptfile = 'undefined',
! input file type parameter: Binary, EMEBSD, TSLHDF, TSLup2, OxfordHDF, OxfordBinary, BrukerHDF
! input file type parameter: Binary, EMEBSD, TSLHDF, TSLup2, OxfordHDF, OxfordBinary, BrukerHDF, NORDIF
inputtype = 'Binary',
! here we enter the HDF group names and data set names as individual strings (up to 10)
! enter the full path of a data set in individual strings for each group, in the correct order,
Expand Down
85 changes: 50 additions & 35 deletions NamelistTemplates/EMmdSTEM.template
Original file line number Diff line number Diff line change
@@ -1,37 +1,52 @@
&MDSTEMlist
! do not change the first line in this file !
!
! Note: All parameter values are default values for the program
!
!--------------
! the name of the crystal input file MUST be specified (full pathname)
xtalname = 'xtalfile',
! DDD or MD input file MUST be specified
inputfilename = 'input'
! output will be stored here (full pathname)
datafile = 'output.h5',
! scale factor for DDD data - this MUST be specified based on scaling of your displacement grid (sx,sy,sz,dx,dy,dz)
scalefactor = sx,sy,sz,dx,dy,dz,
! size of the CBED disk in pixels
discsize = 10,
! orientation of crystal; euler angle representation in degrees
eu = 0.0,0.0,0.0,
! orientation of crystal; euler angle representation in degrees
eulerconvention = 'bsd',
! ph1,ph2,phi3
phi1 = 0.0,
phi2 = 0.0,
phi3 = 0.0,
! minimum d-spacing to be taken into account [nm]
dmin = 0.06,
! microscope accelerating voltage [kV]
&MDSTEMlist
! DO NOT CHANGE THIS LINE
!------------------------
! IO Filenames
!------------------------
! Name of the crystal structure file
xtalname = 'undefined',
! Name of the file containing displace vectors
inputfilename = 'undefined',
! Output file containing diffracted intensities
datafile = 'undefined',
!------------------------
! Diffraction Parameters
!------------------------
! Accelerating Voltage, in kV
voltage = 200.0,
! beam convergence angle
convergence = 4.0,
! platform id for opencl
! Smallest d-spacing to take into account [nm]
dmin = 0.08,
! Convergence angle of the beam cone, in mRad
convergence = 3.0,
! Number of rings in the beam cone discretization
discsize = 81,
!------------------------
! Crystal Parameters
!------------------------
! Crystal orientation Euler angles
eu = 0.0, 0.0, 0.0,
! Nearest zone axis in this orientation
ZAindex = 0,0,1,
! Laue shift values in the basis vectors of the CBED pattern
lauec = 0,0,
! Distance between points in the Z direction in the displacement field, in nm
thk = 4.0,
! Number of subslices to use for each displacement point. E
subslice = 20,
!------------------------
! OpenCL Parameters
!------------------------
! Device ID for GPU
devid = 1,
! device id for opencl
platid = 1
! this last line must be present!
/

! Platform ID for GPU
platid = 1,
!------------------------
! Parameters for DDD simulations
!------------------------
! Is the data presorted into a 4D array in an h5 file?
presorted = .True.,
! Scaling factor for input data that is not presorted, (x,y,z,dx,dy,dz)
! If you used a python script similar to the one in the ***** folder, to
! format your data as an h5 file, this is not used
scalefactor = 1,1,1,1,1,1,
/
93 changes: 81 additions & 12 deletions Source/EMsoftHDFLib/patternmod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ end subroutine invert_ordering_arrays
!> @date 05/10/18 MDG 1.5 changed .up2 access mode to STREAM to facilitate record positioning
!> @date 06/21/18 SS 1.6 changed recorsize to L*4 instead of recsize (correctsize*4); recsize has padded 0's
!> @date 05/01/19 MA 1.7 add support for Oxford Instruments binary pattern files
!> @date 10/09/19 HWÅ 1.8 support for NORDIF binary pattern files
!--------------------------------------------------------------------------
recursive function openExpPatternFile(filename, npat, L, inputtype, recsize, funit, HDFstrings) result(istat)
!DEC$ ATTRIBUTES DLLEXPORT :: openExpPatternFile
Expand Down Expand Up @@ -357,8 +358,13 @@ recursive function openExpPatternFile(filename, npat, L, inputtype, recsize, fun
! we can do this because the pmHDF_head pointer is private and has SAVE status for this entire module

case(9) ! "NORDIF"
! to be written
call FatalError("openExpPatternFile","NORDIF input format not yet implemented")
open(unit=funit, file=trim(ename), status='old', access='stream', &
iostat=ios)
if (ios.ne.0) then
io_int(1) = ios
call WriteValue("File open error; error type ", io_int, 1)
call FatalError("openExpPatternFile", "Cannot continue program")
end if

case default
istat = -1
Expand Down Expand Up @@ -395,6 +401,7 @@ end function openExpPatternFile
!> @date 03/21/19 MDG 1.4 fixed off-by-one error in column labels for up1 and up2 file formats
!> @date 05/01/19 MA 1.5 add support for Oxford Instruments binary pattern files
!> @date 09/26/19 MDG 1.6 add option for vertical flip of patterns
!> @date 10/09/19 HWÅ 1.7 support for NORDIF binary pattern files
!--------------------------------------------------------------------------
recursive subroutine getExpPatternRow(iii, wd, patsz, L, dims3, offset3, funit, inputtype, HDFstrings, &
exppatarray, ROI, flipy)
Expand Down Expand Up @@ -622,11 +629,45 @@ recursive subroutine getExpPatternRow(iii, wd, patsz, L, dims3, offset3, funit,
end do

case(9) ! "NORDIF"
! to be written
call FatalError("getExpPatternRow","NORDIF input format not yet implemented")
! Buffer for single patterns
buffersize = lL
allocate(buffer(buffersize))


case default
! Pairs to store all patterns in a row
buffersize = lwd * lL
allocate(pairs(buffersize))

! Loop over pixels and convert byte values into single byte integers
do ii = 1, lwd
! pos = [(row-1)*scan_width + column - 1]*pattern_size + 1
read(unit=funit, pos=((liii-1)*lwd + ii - 1)*lL + 1, &
iostat=ios) buffer
do jj = 1_ill, lL
pairs((ii-1)*lL + jj) = ichar(buffer(jj))
end do
end do
deallocate(buffer)

! Place patterns in experimental pattern array
exppatarray = 0.0
! Pattern pixels to read (might not be full pattern, depending on ROI)
pixcnt = (kkstart-1)*dims3(1)*dims3(2) + 1
! Loop over row (might not be full row, depending on ROI)
do kk = kkstart, kkend
kspot = (kk-kkstart) * patsz
! Loop over rows of pattern pixels
do jj = 1, dims3(2)
jspot = (jj-1) * dims3(1)
! Loop over columns of pattern pixels, converting into float32
do ii = 1, dims3(1)
exppatarray(kspot + jspot + ii) = float(pairs(pixcnt))
pixcnt = pixcnt + 1
end do
end do
end do
deallocate(pairs)

case default
end select

end subroutine getExpPatternRow
Expand All @@ -652,6 +693,7 @@ end subroutine getExpPatternRow
!
!> @date 02/20/18 MDG 1.0 original
!> @date 07/13/19 MDG 1.1 added option to read single pattern from OxfordBinary file
!> @date 10/09/19 HWÅ 1.7 support for reading single pattern from NORDIF binary file
!--------------------------------------------------------------------------
recursive subroutine getSingleExpPattern(iii, wd, patsz, L, dims3, offset3, funit, inputtype, HDFstrings, exppat)
!DEC$ ATTRIBUTES DLLEXPORT :: getSingleExpPattern
Expand Down Expand Up @@ -839,10 +881,38 @@ recursive subroutine getSingleExpPattern(iii, wd, patsz, L, dims3, offset3, funi
end do

case(9) ! "NORDIF"
! to be written
call FatalError("getSingleExpPattern","NORDIF input format not yet implemented")

case default
! Use ill-type integers
lL = L
lwd = wd

! Buffers for single patterns
buffersize = lL
allocate(buffer(buffersize), pairs(buffersize))

! Read single pattern into buffer
! offset3(3) = row * scan width + column
offset = offset3(3)*lL + 1
read(unit=funit, pos=offset, iostat=ios) buffer

! Convert byte values into single byte integers
pairs = ichar(buffer)
deallocate(buffer)

! Place pattern in experimental pattern array
exppat = 0.0
pixcnt = 1
! Loop over rows of pattern pixels
do jj = 1, dims3(2)
jspot = (jj-1)*dims3(1)
! Loop over columns of pattern pixels, converting into float32
do ii = 1, dims3(1)
exppat(jspot + ii) = float(pairs(pixcnt))
pixcnt = pixcnt + 1
end do
end do
deallocate(pairs)

case default

end select

Expand Down Expand Up @@ -897,8 +967,7 @@ recursive subroutine closeExpPatternFile(inputtype, funit)
deallocate(semix, semiy)

case(9) ! "NORDIF"
! to be written
call FatalError("closeExpPatternFile","input format not yet implemented")
close(unit=funit, status='keep')

case default
call FatalError("closeExpPatternFile","unknown input format")
Expand Down
Loading

0 comments on commit a9d8ccd

Please sign in to comment.