file_reader#
- kikuchipy.io.plugins.ebsd_directory.file_reader(filename: Union[str, Path], xy_pattern: Optional[str] = None, show_progressbar: Optional[bool] = None, lazy: bool = False) List[Dict] [source]#
Read all images in a directory, assuming they are electron backscatter diffraction (EBSD) patterns of equal shape and data type.
Not meant to be used directly; use
load()
.- Parameters:
- filename
Name of directory with patterns.
- xy_pattern
Regular expression to extract map coordinates from the filenames. If not given, two regular expressions will be tried: assuming (x, y) = (5, 10), “_x5y10.tif” or “-5-10.bmp”. Valid
xy_pattern
equal to these arer"_x(\d+)y(\d+).tif"
andr"-(\d+)-(\d+).bmp"
, respectively. If none of these expressions match the first file’s name in the directory, a warning is printed and the returned signal will have only one navigation dimension.- show_progressbar
Whether to show a progressbar when reading the signal into memory when
lazy=False
.- lazy
Read the patterns lazily without actually reading them from disk until required. Default is
False
.
- Returns:
scan
Data, axes, metadata and original metadata.
- Warns:
UserWarning
If navigation coordinates can not be read from the filenames.
UserWarning
If there are more detected patterns in the directory than the navigation shape determined from the filenames suggest.
Notes
Adapted from https://blog.dask.org/2019/06/20/load-image-data.