### Install kikuchipy from source Source: https://kikuchipy.org/en/stable/_sources/user/installation.rst.txt Steps to clone the repository and perform an editable installation. ```bash git clone https://github.com/pyxem/kikuchipy.git cd kikuchipy pip install --editable . ``` -------------------------------- ### LazyEBSD Examples Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.signals.LazyEBSD.html Illustrates how to use the LazyEBSD class with practical examples. ```APIDOC ## Examples using `LazyEBSD` ### Extract patterns from a grid This example demonstrates how to extract patterns from a grid using the `LazyEBSD` class. ``` -------------------------------- ### Install optional dependencies Source: https://kikuchipy.org/en/stable/_sources/user/installation.rst.txt Command to install all optional dependencies for extended functionality. ```bash pip install "kikuchipy[all]" ``` -------------------------------- ### Install Documentation Dependencies Source: https://kikuchipy.org/en/stable/dev/building_writing_documentation.html Installs necessary Python packages for building the documentation. Ensure you are in the project's root directory. ```bash pip install --editable ".[doc]" ``` -------------------------------- ### Install development dependencies Source: https://kikuchipy.org/en/stable/dev/setting_up_development_installation.html Install the package in editable mode along with all development dependencies. ```bash pip install --editable ".[dev]" ``` -------------------------------- ### PCCalibrationMovingScreen.lines_start Property Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.detectors.PCCalibrationMovingScreen.lines_start.rst.txt The lines_start property is part of the PCCalibrationMovingScreen class and is used to define the starting lines for calibration. The minigallery provides examples of its usage. ```APIDOC ## PCCalibrationMovingScreen.lines_start ### Description This property is part of the `kikuchipy.detectors.PCCalibrationMovingScreen` class. It is used to specify the starting lines for a moving screen calibration process. ### Property `lines_start` ### Module `kikuchipy.detectors` ### Examples ```python # Example usage of PCCalibrationMovingScreen.lines_start # (Refer to the minigallery for specific code examples) ``` ### See Also - `kikuchipy.detectors.PCCalibrationMovingScreen` ``` -------------------------------- ### Install test dependencies Source: https://kikuchipy.org/en/stable/dev/running_writing_tests.html Install necessary dependencies for running tests and coverage. This command installs the package in editable mode. ```bash pip install -e ".[tests,coverage]" ``` -------------------------------- ### Examples using PCCalibrationMovingScreen.plot Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.detectors.PCCalibrationMovingScreen.plot.rst.txt This section provides examples of how to use the plot method for visualizing PCCalibrationMovingScreen data. Ensure the necessary imports are present before execution. ```python from kikuchipy.detectors import PCCalibrationMovingScreen # Example usage of the plot method # Assuming 'calibration_data' is an instance of PCCalibrationMovingScreen # calibration_data.plot() ``` -------------------------------- ### Get EBSD Patterns with Varying Projection Centers Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.signals.EBSDMasterPattern.get_patterns.html Generates EBSD patterns using `EBSDMasterPattern.get_patterns`. This example demonstrates how to use varying projection centers for different rotations and visualizes the resulting patterns. Ensure `orix`, `hyperspy`, and `kikuchipy` are installed. ```python import numpy as np from orix.quaternion import Rotation import hyperspy.api as hs import kikuchipy as kp mp = kp.data.nickel_ebsd_master_pattern_small(projection="lambert") det = kp.detectors.EBSDDetector( shape=(60, 60), pc=np.array([ [[0.4, 0.5, 0.4], [0.6, 0.5, 0.4]], [[0.4, 0.5, 0.6], [0.6, 0.5, 0.6]], ]) ) rot = Rotation.identity(det.navigation_shape) s = mp.get_patterns(rot, det, compute=True, show_progressbar=False) _ = hs.plot.plot_images( s, per_row=2, cmap="inferno", label=np.array_str(det.pc.reshape((-1, 3)))[1:-1].split("\n "), axes_decor=None, ) ``` -------------------------------- ### Test docstring examples Source: https://kikuchipy.org/en/stable/dev/running_writing_tests.html Run tests on examples embedded within docstrings across the source modules. This ensures that examples remain functional and accurate. ```bash pytest --doctest-modules src ``` -------------------------------- ### Importing necessary libraries Source: https://kikuchipy.org/en/stable/_sources/tutorials/load_save_data.ipynb.txt Initial setup for the environment, including matplotlib configuration and library imports. ```python # Exchange inline for notebook or qt5 (from pyqt) for interactive plotting %matplotlib inline import os from pathlib import Path import tempfile import dask.array as da import imageio.v3 as iio import numpy as np import matplotlib.pyplot as plt import hyperspy.api as hs import kikuchipy as kp ``` -------------------------------- ### Install kikuchipy via pip Source: https://kikuchipy.org/en/stable/index.html Use this command to install the library in a standard Python environment. ```bash pip install kikuchipy ``` -------------------------------- ### Install pre-commit hook Source: https://kikuchipy.org/en/stable/dev/code_style.html Install the pre-commit hook to automatically format code with Black before each commit. This ensures consistent code style across the project. ```bash pre-commit install ``` -------------------------------- ### Initialize Environment and Load EBSD Data Source: https://kikuchipy.org/en/stable/tutorials/load_save_data.html Setup the plotting environment and load an EBSD pattern file from a specified path. ```python %matplotlib inline import os from pathlib import Path import tempfile import dask.array as da import imageio.v3 as iio import numpy as np import matplotlib.pyplot as plt import hyperspy.api as hs import kikuchipy as kp ``` ```python data_path = Path("../../src/kikuchipy/data") nordif_ebsd = "nordif/Pattern.dat" s = kp.load(data_path / nordif_ebsd) s ``` -------------------------------- ### SimilarityMetric.prepare_experimental Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.indexing.SimilarityMetric.prepare_experimental.rst.txt This section provides documentation and examples for the prepare_experimental method of the SimilarityMetric class. ```APIDOC ## SimilarityMetric.prepare_experimental ### Description Prepares experimental data for similarity metric calculations. ### Method (Method details not specified in the provided text) ### Endpoint (Endpoint details not specified in the provided text) ### Parameters (Parameter details not specified in the provided text) ### Request Example (Request example not specified in the provided text) ### Response (Response details not specified in the provided text) ### Response Example (Response example not specified in the provided text) ### Examples using ``SimilarityMetric.prepare_experimental`` (Examples not specified in the provided text) ``` -------------------------------- ### PCCalibrationMovingScreen.lines_start Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.detectors.PCCalibrationMovingScreen.lines_start.html Retrieves the starting points of lines within the patterns. ```APIDOC ## Property: PCCalibrationMovingScreen.lines_start ### Description Returns the starting points of lines within the patterns. ### Return Value - **ndarray** - An array of shape (2, n_lines, 2) representing the starting coordinates of the lines. ``` -------------------------------- ### Install and manage kikuchipy with pip Source: https://kikuchipy.org/en/stable/_sources/user/installation.rst.txt Commands for installing, upgrading, or pinning a specific version of kikuchipy using pip. ```bash pip install kikuchipy ``` ```bash pip install --upgrade kikuchipy ``` ```bash pip install kikuchipy==0.8.5 ``` -------------------------------- ### Importing kikuchipy and loading data Source: https://kikuchipy.org/en/stable/_sources/reference/index.rst.txt Recommended import pattern for kikuchipy and an example of loading a sample dataset. ```python >>> import kikuchipy as kp >>> s = kp.data.nickel_ebsd_small() >>> s ``` -------------------------------- ### Initialize EBSDMasterPattern and access properties Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.signals.EBSDMasterPattern.html Demonstrates how to load a sample EBSD master pattern and access its hemisphere, phase, and projection properties. Ensure Kikuchipy is installed and the data is available. ```python >>> import kikuchipy as kp >>> s = kp.data.nickel_ebsd_master_pattern_small() >>> s >>> s.hemisphere 'upper' >>> s.phase >>> s.projection 'stereographic' ``` -------------------------------- ### Install kikuchipy via package managers Source: https://kikuchipy.org/en/stable/_sources/index.rst.txt Use pip or conda to install the library in your Python environment. ```bash pip install kikuchipy ``` ```bash conda install kikuchipy -c conda-forge ``` -------------------------------- ### KikuchiPatternSimulator Class Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.simulations.KikuchiPatternSimulator.html Setup and calculation of geometrical or kinematical Kikuchi pattern simulations. ```APIDOC ## Class kikuchipy.simulations.KikuchiPatternSimulator ### Description Setup and calculation of geometrical or kinematical Kikuchi pattern simulations. ### Parameters #### Initialization Parameters - **reflectors** (ReciprocalLatticeVector) - Required - Reflectors to use in the simulation, flattened to one navigation dimension. ### Attributes - **phase** - Return the phase with unit cell and symmetry. - **reflectors** - Return the reflectors to use in the simulation. ### Methods #### calculate_master_pattern - **Description**: Return a kinematical master pattern in the stereographic projection. - **Parameters**: Accepts a list of reflectors. #### on_detector - **Description**: Project Kikuchi lines and zone axes onto a detector, one per crystal orientation. - **Parameters**: Accepts crystal orientation and detector parameters. #### plot - **Description**: Plot reflectors as lines or bands in the stereographic or spherical projection. - **Parameters**: - **projection** (string) - Optional - The type of projection to use ('stereographic' or 'spherical'). - ****kwargs** - Optional - Additional keyword arguments for plotting. ``` -------------------------------- ### GeometricalKikuchiPatternSimulation.plot Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.simulations.GeometricalKikuchiPatternSimulation.plot.rst.txt This section provides examples and documentation for the `plot` method of the `GeometricalKikuchiPatternSimulation` class, used for visualizing simulated Kikuchi patterns. ```APIDOC ## GeometricalKikuchiPatternSimulation.plot ### Description Plots the geometrical Kikuchi pattern simulation. ### Method This documentation refers to the `plot` method within the `GeometricalKikuchiPatternSimulation` class. ### Endpoint N/A (This is a method within a class, not a REST API endpoint). ### Parameters This method does not have explicitly defined parameters in the provided text. Refer to the class documentation for details on how the plot is generated based on the simulation's state. ### Request Example N/A (This is a method call, not a request body). ### Response #### Success Response (200) N/A (This method typically generates a visual output, not a structured response). #### Response Example N/A (Visual output, not a JSON response). ``` -------------------------------- ### Install and manage kikuchipy with Anaconda Source: https://kikuchipy.org/en/stable/_sources/user/installation.rst.txt Commands for creating a conda environment and managing the kikuchipy package. ```bash conda create --name kp-env python=3.12 conda activate kp-env ``` ```bash conda install kikuchipy --channel conda-forge ``` ```bash conda update kikuchipy ``` ```bash conda install kikuchipy==0.8.5 ``` -------------------------------- ### GET PCCalibrationMovingScreen.lines Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.detectors.PCCalibrationMovingScreen.lines.html Retrieves the start and end points of all possible lines between all points per pattern. ```APIDOC ## GET PCCalibrationMovingScreen.lines ### Description Returns the start and end points of all possible lines between all points per pattern. ### Endpoint PCCalibrationMovingScreen.lines ### Response - **lines** (ndarray) - An array of shape (2, n_lines, 4), where the last axis represents (x1, y1, x2, y2) coordinates. ``` -------------------------------- ### Save signals to file Source: https://kikuchipy.org/en/stable/_sources/tutorials/load_save_data.ipynb.txt Examples of saving signals to HDF5 or NORDIF binary formats, including handling file overwrites. ```python temp_dir = Path(tempfile.mkdtemp()) s.save(temp_dir / "patterns") ``` ```python s.save("patterns.h5", overwrite=True) ``` ```python s.save(temp_dir / "patterns.dat") ``` -------------------------------- ### Initialize EBSD Indexer Source: https://kikuchipy.org/en/stable/tutorials/esteem2022_diffraction_workshop.html Create an EBSDIndexer instance with phase and detector calibration parameters. ```python sig_shape = s.axes_manager.signal_shape[::-1] indexer = ebsd_index.EBSDIndexer( phaselist=["FCC"], vendor="KIKUCHIPY", sampleTilt=det_cal.sample_tilt, camElev=det_cal.tilt, patDim=sig_shape, ) ``` -------------------------------- ### Initialize Kikuchi pattern simulator Source: https://kikuchipy.org/en/stable/_sources/tutorials/kinematical_ebsd_simulations.ipynb.txt Create a simulator instance for the Sigma phase. ```python simulator_sigma = kp.simulations.KikuchiPatternSimulator(ref_sigma) simulator_sigma ``` -------------------------------- ### Install kikuchipy via conda Source: https://kikuchipy.org/en/stable/index.html Use this command to install the library from the conda-forge channel. ```bash conda install kikuchipy -c conda-forge ``` -------------------------------- ### Initialize Virtual BSE Imager Source: https://kikuchipy.org/en/stable/tutorials/esteem2022_diffraction_workshop.html Sets up the imager for virtual backscatter electron imaging. ```python vbse_imager = kp.imaging.VirtualBSEImager(s) vbse_imager ``` ```python VirtualBSEImager for ``` -------------------------------- ### Initialize Simulator Source: https://kikuchipy.org/en/stable/_sources/tutorials/kinematical_ebsd_simulations.ipynb.txt Create a simulator instance from the filtered reflectors. ```python simulator_ni = kp.simulations.KikuchiPatternSimulator(ref_ni) simulator_ni.reflectors.size ``` -------------------------------- ### Write patterns to directory for loading Source: https://kikuchipy.org/en/stable/tutorials/load_save_data.html Demonstrates preparing a directory of image files for loading as an EBSD signal by writing patterns to a temporary directory. ```python temp_dir2 = Path(tempfile.mkdtemp()) s = kp.data.nickel_ebsd_small() y, x = np.indices(s.axes_manager.navigation_shape[::-1]) y = y.ravel() x = x.ravel() s.unfold_navigation_space() for i in range(s.axes_manager.navigation_size): iio.imwrite(temp_dir2 / f"pattern_x{x[i]}y{y[i]}.tif", s.data[i]) ``` -------------------------------- ### Initialize Kikuchi Pattern Simulator Source: https://kikuchipy.org/en/stable/tutorials/mandm2021_sunday_short_course.html Create a simulator instance using the symmetrized reciprocal lattice vectors. ```python simulator = kp.simulations.KikuchiPatternSimulator(g2) simulator.reflectors.size ``` -------------------------------- ### Import libraries and configure environment Source: https://kikuchipy.org/en/stable/tutorials/esteem2022_diffraction_workshop.html Initializes the plotting backend and imports necessary libraries for EBSD data analysis. ```python %matplotlib inline from pathlib import Path import matplotlib.pyplot as plt import numpy as np from diffsims.crystallography import ReciprocalLatticeVector import hyperspy.api as hs import kikuchipy as kp from orix.crystal_map import CrystalMap, Phase, PhaseList from orix.quaternion import Orientation, symmetry from orix import io, plot, sampling from orix.vector import Vector3d from pyebsdindex import ebsd_index, pcopt plt.rcParams.update( {"figure.facecolor": "w", "font.size": 15, "figure.dpi": 75} ) data_path = Path("../../../kikuchipy_test/esteem") ``` -------------------------------- ### Build HTML Documentation Source: https://kikuchipy.org/en/stable/dev/building_writing_documentation.html Builds the HTML version of the documentation from the 'doc' directory. The output will be in 'doc/_build/html'. ```bash cd doc make html ``` -------------------------------- ### GET Window.name Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.filters.Window.name.html Retrieves the name of the window as a string. ```APIDOC ## GET Window.name ### Description Returns the name of the window. ### Property Window.name (str) ``` -------------------------------- ### get_dynamic_background Function Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.pattern.get_dynamic_background.rst.txt Provides details and examples for the get_dynamic_background function. ```APIDOC ## get_dynamic_background ### Description This function is part of the kikuchipy.pattern module. ### Examples Examples using ``get_dynamic_background`` are provided below. .. minigallery:: kikuchipy.pattern.get_dynamic_background :add-heading: Examples using ``get_dynamic_background`` ``` -------------------------------- ### Initialize and run geometrical simulations Source: https://kikuchipy.org/en/stable/tutorials/geometrical_ebsd_simulations.html Creates a simulator instance with reciprocal lattice vectors and generates simulations on the detector. ```python simulator = kp.simulations.KikuchiPatternSimulator(rlv) ``` ```python sim = simulator.on_detector(s.detector, rot) ``` -------------------------------- ### PCCalibrationMovingScreen.lines_end Property Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.detectors.PCCalibrationMovingScreen.lines_end.rst.txt Information and examples for accessing the lines_end property. ```APIDOC ## PCCalibrationMovingScreen.lines_end ### Description Represents the end line of a detected screen in the PCCalibrationMovingScreen. ### Method Attribute Access ### Endpoint N/A (Class Property) ### Parameters N/A ### Request Example ```python from kikuchipy.detectors import PCCalibrationMovingScreen # Assuming 'detector_instance' is an instance of PCCalibrationMovingScreen # lines_end_value = detector_instance.lines_end ``` ### Response #### Success Response (Attribute Value) - **lines_end** (int or float) - The value indicating the end line. #### Response Example ```json { "lines_end": 150 } ``` ### Examples using ``PCCalibrationMovingScreen.lines_end`` ```python # Example usage would be shown here if provided in the source text. # For instance: # detector = PCCalibrationMovingScreen() # detector.process_data(some_data) # end_line = detector.lines_end # print(f"The detected end line is: {end_line}") ``` ``` -------------------------------- ### Initialize Indexer Source: https://kikuchipy.org/en/stable/_sources/tutorials/hough_indexing.ipynb.txt Create an indexer from the detector using the average PC and specified phase list. ```python indexer = det.get_indexer( phase_list, [[1, 1, 1], [2, 0, 0], [2, 2, 0], [3, 1, 1]], nBands=10, tSigma=2, rSigma=2, ) indexer.PC ``` -------------------------------- ### PCCalibrationMovingScreen.lines_out_in_end Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.detectors.PCCalibrationMovingScreen.lines_out_in_end.rst.txt This section provides details and examples for the lines_out_in_end property. ```APIDOC ## PCCalibrationMovingScreen.lines_out_in_end ### Description This property is part of the PCCalibrationMovingScreen class and is related to line detection or calibration. ### Method N/A (This is a property, not an endpoint) ### Endpoint N/A (This is a property, not an endpoint) ### Parameters N/A (This is a property, not an endpoint) ### Request Example N/A (This is a property, not an endpoint) ### Response N/A (This is a property, not an endpoint) ### Examples using ``PCCalibrationMovingScreen.lines_out_in_end`` ```python # Example usage will be displayed here if available in the source ``` ``` -------------------------------- ### Initialize Indexer Source: https://kikuchipy.org/en/stable/tutorials/hybrid_indexing.html Creates an indexer instance with specified phase list and parameters. ```python indexer = det.get_indexer(phase_list, g.unique(True), rSigma=2, tSigma=2) ``` -------------------------------- ### Get Rotations Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.simulations.GeometricalKikuchiPatternSimulation.rotations.html Retrieves the crystal orientations for which simulations were generated. ```APIDOC ## GET GeometricalKikuchiPatternSimulation.rotations ### Description Return the crystal orientations for which simulations were generated. ### Method GET ### Endpoint /websites/kikuchipy_en_stable/GeometricalKikuchiPatternSimulation.rotations ### Response #### Success Response (200) - **rotations** (Rotation) - The crystal orientations for which simulations were generated. ``` -------------------------------- ### Import necessary libraries Source: https://kikuchipy.org/en/stable/tutorials/hybrid_indexing.html Initializes the environment with required libraries for data processing and visualization. ```python # Exchange inline for notebook or qt5 (from pyqt) for interactive plotting %matplotlib inline import matplotlib.pyplot as plt import numpy as np from diffsims.crystallography import ReciprocalLatticeVector import hyperspy.api as hs import kikuchipy as kp from orix import io, plot, sampling from orix.crystal_map import PhaseList from orix.vector import Vector3d plt.rcParams.update( { "figure.facecolor": "w", "font.size": 15, "figure.dpi": 75, } ) ``` -------------------------------- ### Get image quality Source: https://kikuchipy.org/en/stable/_sources/tutorials/multivariate_analysis.ipynb.txt Calculates the image quality of the signal. ```python iq1 = s.get_image_quality() ``` -------------------------------- ### Clone the repository Source: https://kikuchipy.org/en/stable/dev/setting_up_development_installation.html Create a local copy of your forked repository and navigate into the directory. ```bash git clone https://github.com/your-username/kikuchipy.git cd kikuchipy ``` -------------------------------- ### Initialize Kikuchi Pattern Simulator Source: https://kikuchipy.org/en/stable/tutorials/esteem2022_diffraction_workshop.html Sets up the Kikuchi pattern simulator with the calculated reflectors. This object is used for generating simulated Kikuchi patterns. ```python simulator = kp.simulations.KikuchiPatternSimulator(g) ``` -------------------------------- ### VirtualBSEImager.grid_shape Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.imaging.VirtualBSEImager.grid_shape.html Property to get or set the detector grid shape for the VirtualBSEImager. ```APIDOC ## VirtualBSEImager.grid_shape ### Description Return or set the detector grid shape for the VirtualBSEImager. ### Parameters #### Request Body - **shape** (tuple or list of int) - Required - Integer number of rows and columns of the detector grid. Cannot be greater than signal shape of signal. ``` -------------------------------- ### Load Nickel EBSD dataset Source: https://kikuchipy.org/en/stable/_sources/tutorials/multivariate_analysis.ipynb.txt Initializes the environment and loads the sample Nickel EBSD dataset for processing. ```python # Exchange inline for notebook or qt5 (from pyqt) for interactive plotting %matplotlib inline import matplotlib.pyplot as plt import numpy as np import hyperspy.api as hs import kikuchipy as kp s = kp.data.nickel_ebsd_large(allow_download=True) # External download s ``` -------------------------------- ### NormalizedCrossCorrelationMetric.prepare_dictionary Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.indexing.NormalizedCrossCorrelationMetric.prepare_dictionary.rst.txt This section provides documentation and examples for the prepare_dictionary method of the NormalizedCrossCorrelationMetric class. ```APIDOC ## NormalizedCrossCorrelationMetric.prepare_dictionary ### Description Prepares a dictionary for normalized cross-correlation calculations. ### Method (Not specified in the provided text, likely a class method or instance method) ### Endpoint (Not applicable for this Python method) ### Parameters (Parameters are not explicitly detailed in the provided text, but typically would include data structures or configurations for correlation) ### Request Example (Not applicable for this Python method) ### Response (Response details are not explicitly detailed in the provided text, but typically would be a processed dictionary or data structure) ### Examples using ``NormalizedCrossCorrelationMetric.prepare_dictionary`` (Examples are referenced but not provided in the input text) ``` -------------------------------- ### Create and Plot EBSDDetector Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.detectors.EBSDDetector.html Instantiate an EBSDDetector with specific parameters, including shape, projection center (PC) with a given convention, pixel size, binning, and tilt angles. This example also demonstrates plotting the detector's PC on a sample EBSD pattern, visualizing gnomonic circles, and accessing detector properties like navigation shape and bounds. ```python import numpy as np import kikuchipy as kp det = kp.detectors.EBSDDetector( shape=(60, 60), pc=np.ones((10, 20, 3)) * (0.421, 0.779, 0.505), convention="edax", px_size=70, binning=8, tilt=5, sample_tilt=70, ) det det.navigation_shape det.bounds det.gnomonic_bounds[0, 0] s = kp.data.nickel_ebsd_small() det.plot( pattern=s.inav[0, 0].data, coordinates="gnomonic", draw_gnomonic_circles=True ) ``` -------------------------------- ### GET lines_coordinates Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.simulations.GeometricalKikuchiPatternSimulation.lines_coordinates.html Retrieves the Kikuchi line coordinates for a specific simulation index. ```APIDOC ## GET lines_coordinates ### Description Return Kikuchi line coordinates for a single simulation. ### Method GET ### Parameters #### Query Parameters - **index** (int | tuple) - Optional - Index of the simulation to get line coordinates for. Defaults to the first simulation. - **coordinates** (Literal['detector', 'gnomonic']) - Optional - Coordinate space, either 'detector' (default) or 'gnomonic'. - **exclude_nan** (bool) - Optional - Whether to exclude coordinates of Kikuchi lines not present in the pattern. Default is True. ### Response #### Success Response (200) - **coords** (ndarray) - Kikuchi line coordinates. ``` -------------------------------- ### Initialize KikuchiPatternSimulator Source: https://kikuchipy.org/en/stable/tutorials/kinematical_ebsd_simulations.html Initializes a KikuchiPatternSimulator with a reference structure (ref_sic). This is the first step in simulating Kikuchi patterns. ```python simulator_sic = kp.simulations.KikuchiPatternSimulator(ref_sic) ``` -------------------------------- ### GET Window.origin Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.filters.Window.origin.rst.txt Retrieves the origin property of the Window class in the kikuchipy.filters module. ```APIDOC ## GET Window.origin ### Description Accesses the origin property of the Window class within the kikuchipy.filters module. ### Method GET ### Endpoint kikuchipy.filters.Window.origin ``` -------------------------------- ### VirtualBSEImager.grid_cols Property Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.imaging.VirtualBSEImager.grid_cols.rst.txt Details and examples for accessing and using the grid_cols property of the VirtualBSEImager class. ```APIDOC ## VirtualBSEImager.grid_cols ### Description Represents the number of columns in the grid for the VirtualBSEImager. ### Method Property (getter/setter) ### Endpoint N/A (This is a class property, not an API endpoint) ### Parameters N/A ### Request Example ```python # Assuming 'imager' is an instance of VirtualBSEImager num_cols = imager.grid_cols print(num_cols) imager.grid_cols = 10 # Example of setting the value ``` ### Response #### Success Response (200) - **grid_cols** (int) - The number of columns in the grid. #### Response Example ```json { "grid_cols": 8 } ``` ### Examples using ``VirtualBSEImager.grid_cols`` ```python # Example usage from minigallery # (Actual code would depend on the context of VirtualBSEImager instantiation) pass ``` ``` -------------------------------- ### VirtualBSEImager.plot_grid Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.imaging.VirtualBSEImager.plot_grid.rst.txt This section provides documentation and examples for the plot_grid method within the VirtualBSEImager class. ```APIDOC ## VirtualBSEImager.plot_grid ### Description Plots the grid of the imager. ### Method (Method details not provided in the source text) ### Endpoint (Endpoint details not provided in the source text) ### Parameters (Parameter details not provided in the source text) ### Request Example (Request example not provided in the source text) ### Response #### Success Response (200) (Success response details not provided in the source text) #### Response Example (Response example not provided in the source text) ``` -------------------------------- ### Get EBSD Detector Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.simulations.GeometricalKikuchiPatternSimulation.detector.html Retrieves the EBSD detector object used for generating simulations. ```APIDOC ## GET GeometricalKikuchiPatternSimulation.detector ### Description Return the EBSD detector onto which simulations were generated. ### Method GET ### Endpoint /websites/kikuchipy_en_stable/detector ### Parameters None ### Request Example None ### Response #### Success Response (200) - **detector** (EBSDDetector) - The EBSD detector object. #### Response Example ```json { "detector": { ... EBSDDetector object details ... } } ``` ``` -------------------------------- ### GET /kikuchipy/pattern/get_dynamic_background Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.pattern.get_dynamic_background.html Calculates the dynamic background of an EBSD pattern using Gaussian filtering. ```APIDOC ## get_dynamic_background ### Description Get the dynamic background in an EBSD pattern. The background is obtained either in the frequency domain, by a low pass Fast Fourier Transform (FFT) Gaussian filter, or in the spatial domain by a Gaussian filter. ### Parameters - **pattern** (ndarray) - Required - EBSD pattern. - **filter_domain** (str) - Optional - Whether to obtain the dynamic background by applying a Gaussian convolution filter in the "frequency" (default) or "spatial" domain. - **std** (int | float | None) - Optional - Standard deviation of the Gaussian window. If not given, a deviation of pattern width/8 is chosen. - **truncate** (int | float) - Optional - Truncate the Gaussian window at this many standard deviations. Default is 4.0. ### Response - **dynamic_bg** (ndarray) - The dynamic background. ``` -------------------------------- ### GET PCCalibrationMovingScreen.shape Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.detectors.PCCalibrationMovingScreen.shape.html Retrieves the detector shape as a tuple of integers representing rows and columns. ```APIDOC ## GET PCCalibrationMovingScreen.shape ### Description Returns the detector shape as a tuple of integers (nrows, ncols). ### Method GET ### Endpoint PCCalibrationMovingScreen.shape ### Response #### Success Response (200) - **shape** (tuple[int, int]) - The detector shape containing (nrows, ncols). ``` -------------------------------- ### Initialize Hough Indexer Source: https://kikuchipy.org/en/stable/tutorials/hybrid_indexing.html Create an indexer using the detector calibration and phase list. ```python det_cal = s_cal.detector phase_list = PhaseList(phase) indexer = det_cal.get_indexer(phase_list, g.unique(True)) ``` -------------------------------- ### GET EBSDDetector.navigation_dimension Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.detectors.EBSDDetector.navigation_dimension.html Retrieves the number of navigation dimensions for the EBSDDetector projection center array. ```APIDOC ## GET EBSDDetector.navigation_dimension ### Description Returns the number of navigation dimensions of the projection center array. The value is limited to a maximum of 2. ### Method GET ### Response #### Success Response (200) - **navigation_dimension** (int) - The number of navigation dimensions. ``` -------------------------------- ### Importing libraries and configuring environment Source: https://kikuchipy.org/en/stable/_sources/tutorials/hough_indexing.ipynb.txt Sets up the plotting environment and imports necessary modules for crystallography and EBSD data handling. ```python # Exchange inline for notebook or qt5 (from pyqt) for interactive plotting %matplotlib inline import matplotlib.pyplot as plt import numpy as np from diffpy.structure import Atom, Lattice, Structure from diffsims.crystallography import ReciprocalLatticeVector import kikuchipy as kp from orix import io, plot from orix.crystal_map import Phase, PhaseList from orix.vector import Vector3d plt.rcParams.update({"font.size": 15, "lines.markersize": 15}) ``` -------------------------------- ### PCCalibrationMovingScreen.lines_out_in_start Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.detectors.PCCalibrationMovingScreen.lines_out_in_start.rst.txt Information about the lines_out_in_start property. ```APIDOC ## PCCalibrationMovingScreen.lines_out_in_start ### Description This property is part of the PCCalibrationMovingScreen class and is related to the detection of lines out of the screen. ### Module kikuchipy.detectors ### Examples ```python # Example usage would go here, demonstrating how to access or utilize this property. # For instance: # from kikuchipy.detectors import PCCalibrationMovingScreen # detector = PCCalibrationMovingScreen() # lines_start = detector.lines_out_in_start ``` ### Related Properties - `lines_out_in_end` ``` -------------------------------- ### EBSD Dataset Functions Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.data.html Functions to retrieve various EBSD example datasets for testing functionality. ```APIDOC ## Data Retrieval Functions ### Description Functions to load example EBSD datasets. Datasets are cached locally in the directory returned by `pooch.os_cache("kikuchipy")` or the path defined by the `KIKUCHIPY_DATA_DIR` environment variable. ### Available Functions - **ebsd_master_pattern(phase[, allow_download, ...])**: EBSD master pattern of an available phase. - **ni_gain([number, allow_download, ...])**: EBSD dataset of (149, 200) patterns. - **ni_gain_calibration([number, ...])**: EBSD calibration patterns. - **nickel_ebsd_large([allow_download, ...])**: 4125 EBSD patterns. - **nickel_ebsd_master_pattern_small(**kwargs)**: Nickel master pattern at 20 keV. - **nickel_ebsd_small(**kwargs)**: Small Ni EBSD patterns. - **si_ebsd_moving_screen([distance, ...])**: Single EBSD pattern from silicon. - **si_wafer([allow_download, show_progressbar])**: EBSD dataset from silicon wafer. ``` -------------------------------- ### get_image_quality Function Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.pattern.get_image_quality.rst.txt This section provides documentation for the get_image_quality function, including its purpose, parameters, and examples. ```APIDOC ## get_image_quality ### Description Calculates the image quality based on Kikuchi patterns. ### Method N/A (This is a function, not an API endpoint) ### Endpoint N/A ### Parameters This function does not have explicitly defined parameters in the provided text. Refer to the library's source code for detailed parameter information. ### Request Example N/A ### Response N/A ### Examples using ``get_image_quality`` ```python # Example usage would be shown here if provided in the source text. # For instance: # from kikuchipy.pattern import get_image_quality # quality = get_image_quality(image_data) ``` ``` -------------------------------- ### Initialize EBSDIndexer Source: https://kikuchipy.org/en/stable/tutorials/esteem2022_diffraction_workshop.html Creates an indexer instance configured for FCC phase and specific sample geometry. ```python sig_shape_cal = s_cal.axes_manager.signal_shape[::-1] indexer_cal = ebsd_index.EBSDIndexer( phaselist=["FCC"], vendor="KIKUCHIPY", sampleTilt=70, camElev=0, patDim=sig_shape_cal, ) ``` -------------------------------- ### Create conda environment Source: https://kikuchipy.org/en/stable/dev/setting_up_development_installation.html Initialize a new conda environment for development. ```bash conda create --name kp-dev conda activate kp-dev ``` -------------------------------- ### EBSDMasterPattern.phase Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.signals.EBSDMasterPattern.phase.html Get or set the phase describing the crystal structure used in the master pattern simulation. ```APIDOC ## EBSDMasterPattern.phase ### Description Return or set the phase describing the crystal structure used in the master pattern simulation. ### Method GET/SET (Assumed, as it's a property) ### Endpoint Not applicable (property of an object) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "phase": "Phase" } ``` ### Response #### Success Response (200) - **phase** (Phase) - The phase used in the master pattern simulation. #### Response Example ```json { "phase": "Phase" } ``` ``` -------------------------------- ### Access Crystal Map Rotations Source: https://kikuchipy.org/en/stable/_sources/tutorials/load_save_data.ipynb.txt Get the rotation data from the CrystalMap stored in the 'xmap' attribute. ```python s.xmap.rotations ``` -------------------------------- ### NormalizedDotProductMetric.prepare_experimental Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.indexing.NormalizedDotProductMetric.prepare_experimental.rst.txt Documentation for the prepare_experimental method in the kikuchipy indexing module. ```APIDOC ## prepare_experimental ### Description Prepares experimental data for use with the NormalizedDotProductMetric indexing method. ### Method Method call: kikuchipy.indexing.NormalizedDotProductMetric.prepare_experimental ``` -------------------------------- ### GET kikuchipy.data.nickel_ebsd_master_pattern_small Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.data.nickel_ebsd_master_pattern_small.html Retrieves the nickel EBSD master pattern dataset as an EBSDMasterPattern signal object. ```APIDOC ## GET kikuchipy.data.nickel_ebsd_master_pattern_small ### Description Loads a (401, 401) uint8 square Lambert or stereographic projection of the upper and lower hemisphere of a nickel master pattern at 20 keV accelerating voltage. ### Parameters #### Query Parameters - **kwargs** (dict) - Optional - Keyword arguments passed to the internal load() function. ### Response #### Success Response (200) - **ebsd_master_pattern_signal** (EBSDMasterPattern) - The EBSD master pattern signal object. ### Request Example ```python import kikuchipy as kp s = kp.data.nickel_ebsd_master_pattern_small(projection="lambert") ``` ``` -------------------------------- ### KikuchiPatternSimulator Class Overview Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.simulations.KikuchiPatternSimulator.rst.txt Overview of the KikuchiPatternSimulator class, including its attributes and methods. ```APIDOC ## KikuchiPatternSimulator ### Description Simulates Kikuchi diffraction patterns. ### Attributes - **phase** (object) - The crystallographic phase. - **reflectors** (list) - A list of reflectors. ### Methods - **calculate_master_pattern**() - Calculates the master Kikuchi pattern. - **on_detector**() - Determines which reflections are visible on the detector. - **plot**() - Plots the simulated Kikuchi pattern. ``` -------------------------------- ### GET kikuchipy.data.ni_gain Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.data.ni_gain.html Retrieves an EBSD dataset of polycrystalline recrystallized Ni from a specified gain level. ```APIDOC ## GET kikuchipy.data.ni_gain ### Description Loads an EBSD dataset of (149, 200) patterns of (60, 60) pixels from polycrystalline recrystallized Ni. Ten datasets are available with increasing detector gain. ### Method GET ### Parameters #### Query Parameters - **number** (int) - Optional - Dataset number 1-10. Gains in dB are 0, 3, 6, 9, 12, 15, 17, 20, 22, and 24. Default is 1. - **allow_download** (bool) - Optional - Whether to allow downloading the dataset from the internet. Default is False. - **show_progressbar** (bool) - Optional - Whether to show a progressbar when downloading. - **kwargs** (dict) - Optional - Keyword arguments passed to the load() function. ### Response #### Success Response (200) - **ebsd_signal** (EBSD) - The loaded EBSD signal object. ``` -------------------------------- ### Define Silicon Carbide 6H phase Source: https://kikuchipy.org/en/stable/_sources/tutorials/kinematical_ebsd_simulations.ipynb.txt Start defining the 6H Silicon Carbide phase. ```python phase_sic = Phase( ``` -------------------------------- ### Convert PC to EMsoft convention Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.detectors.EBSDDetector.pc_emsoft.html Demonstrates initializing an EBSDDetector and converting its pattern center coordinates to the EMsoft convention using different version parameters. ```python >>> import kikuchipy as kp >>> det = kp.detectors.EBSDDetector( ... shape=(60, 80), ... pc=(0.4, 0.2, 0.6), ... convention="bruker", ... px_size=59.2, ... binning=8, ... ) >>> det.pc_emsoft() array([[ 64. , 144. , 17049.6]]) >>> det.pc_emsoft(4) array([[ -64. , 144. , 17049.6]]) ``` -------------------------------- ### Initialize EBSD data Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.signals.EBSD.rescale_intensity.html Load the sample nickel EBSD dataset for processing. ```python >>> import numpy as np >>> import kikuchipy as kp >>> s = kp.data.nickel_ebsd_small() ``` -------------------------------- ### Initialize Lazy Signal Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.signals.LazyEBSDMasterPattern.compute.html Setup a lazy signal from a dask array for use with compute operations. ```python >>> import dask.array as da >>> data = da.zeros((100, 100, 100), chunks=(10, 20, 20)) >>> s = hs.signals.Signal2D(data).as_lazy() ``` -------------------------------- ### GET KikuchiPatternSimulator.phase Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.simulations.KikuchiPatternSimulator.phase.html Retrieves the phase object associated with the KikuchiPatternSimulator, containing unit cell and symmetry data. ```APIDOC ## GET KikuchiPatternSimulator.phase ### Description Returns the phase object associated with the KikuchiPatternSimulator instance. This object contains information regarding the unit cell and symmetry of the material. ### Endpoint KikuchiPatternSimulator.phase ### Response - **phase** (Phase#) - The phase object containing unit cell and symmetry information. ``` -------------------------------- ### Set up Reciprocal Lattice Vectors Source: https://kikuchipy.org/en/stable/tutorials/mandm2021_sunday_short_course.html Initialize the reflectors using diffsims' ReciprocalLatticeVector with specified hkl indices. ```python g = ReciprocalLatticeVector( phase, hkl=[[1, 1, 1], [2, 0, 0], [2, 2, 0], [3, 1, 1]] ) g ``` -------------------------------- ### EBSDMasterPattern.projection Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.signals.EBSDMasterPattern.projection.html This property allows you to get or set the projection type for the EBSDMasterPattern. The accepted values are 'stereographic' or 'lambert'. ```APIDOC ## EBSDMasterPattern.projection ### Description Return or set which projection the pattern is in. ### Method GET / SET (property access) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python # Get projection projection_type = ebsd_master_pattern.projection # Set projection ebsd_master_pattern.projection = "stereographic" ``` ### Response #### Success Response (200) - **projection** (str) - The current projection type ('stereographic' or 'lambert'). #### Response Example ```json { "projection": "stereographic" } ``` ### Parameters #### Value - **value** (str) - Required - Which projection the pattern is in, either “stereographic” or “lambert”. ``` -------------------------------- ### Initialize and inspect EBSD signal Source: https://kikuchipy.org/en/stable/examples/selecting_data/crop_signal_axes.html Loads a sample EBSD dataset and displays its initial properties and shape. ```python import hyperspy.api as hs import kikuchipy as kp # Import data s = kp.data.nickel_ebsd_small() s.remove_static_background(show_progressbar=False) # Inspect data and attributes plot_kwds = dict(axes_decor=None, label=None, colorbar=None, tight_layout=True) _ = hs.plot.plot_images(s, **plot_kwds) print(s) print(s.static_background.shape) print(s.detector) ``` ```text (60, 60) EBSDDetector(shape=(60, 60), pc=(0.425, 0.213, 0.501), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, binning=8.0, px_size=1.0 um) ``` -------------------------------- ### Prepare and save virtual BSE images as TIFF Source: https://kikuchipy.org/en/stable/_sources/tutorials/load_save_data.ipynb.txt Rescale intensity and unfold navigation space before saving as a TIFF stack. ```python vbse.rescale_intensity() vbse.unfold_navigation_space() # 1D navigation space required for TIFF vbse ``` ```python vbse_fname = "vbse.tif" vbse.save(temp_dir / vbse_fname) # Easily read into e.g. ImageJ ``` -------------------------------- ### Access Static Background Data Source: https://kikuchipy.org/en/stable/_sources/tutorials/load_save_data.ipynb.txt Get the static background data from the 'static_background' attribute. This is None if not available. ```python s.static_background ``` -------------------------------- ### GET /kikuchipy.io.plugins.emsoft_tkd_master_pattern.file_reader Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.io.plugins.emsoft_tkd_master_pattern.file_reader.html Reads simulated transmission Kikuchi diffraction master patterns from EMsoft HDF5 files. ```APIDOC ## GET kikuchipy.io.plugins.emsoft_tkd_master_pattern.file_reader ### Description Read simulated transmission kikuchi diffraction master patterns from EMsoft’s HDF5 file format. This function is not meant to be used directly; use `load()` instead. ### Parameters #### Path Parameters - **filename** (str | Path) - Required - Full file path of the HDF file. #### Query Parameters - **energy** (range | None) - Optional - Desired beam energy or energy range. If not given, all available energies are read. - **projection** (Literal['stereographic', 'lambert']) - Optional - Projection(s) to read. Defaults to 'stereographic'. - **hemisphere** (Literal['upper', 'lower', 'both']) - Optional - Projection hemisphere(s) to read. Defaults to 'upper'. - **lazy** (bool) - Optional - Open the data lazily without reading from disk until requested. Defaults to False. - **kwargs** (dict) - Optional - Keyword arguments passed to h5py.File. ### Response #### Success Response (200) - **signal_dict_list** (list[dict]) - Data, axes, metadata and original metadata. ``` -------------------------------- ### Initialize EBSD Data Source: https://kikuchipy.org/en/stable/tutorials/multivariate_analysis.html Load the nickel EBSD dataset and configure the plotting environment. ```python %matplotlib inline import matplotlib.pyplot as plt import numpy as np import hyperspy.api as hs import kikuchipy as kp s = kp.data.nickel_ebsd_large(allow_download=True) # External download s ``` -------------------------------- ### GET Window.n_neighbours Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.filters.Window.n_neighbours.html Retrieves the maximum number of nearest neighbours in each navigation axis to the origin for a Window object. ```APIDOC ## GET Window.n_neighbours ### Description Returns the maximum number of nearest neighbours in each navigation axis to the origin. ### Method GET ### Endpoint Window.n_neighbours ### Response - **n_neighbours** (tuple) - The maximum number of nearest neighbours in each navigation axis to the origin. ``` -------------------------------- ### Create a Custom Window from a NumPy Array Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.filters.Window.html Shows how to create a custom window by passing a NumPy array directly to the Window constructor. ```python >>> w = kp.filters.Window(np.arange(6).reshape(3, 2)) >>> w Window (3, 2) custom [[0 1] [2 3] [4 5]] ``` -------------------------------- ### GET EBSDDetector.r_max Source: https://kikuchipy.org/en/stable/reference/generated/kikuchipy.detectors.EBSDDetector.r_max.html Retrieves the maximum distance from the pattern center (PC) to the detector edge in gnomonic coordinates. ```APIDOC ## GET EBSDDetector.r_max ### Description Returns the maximum distance from the pattern center (PC) to the detector edge in gnomonic coordinates. ### Method GET ### Endpoint EBSDDetector.r_max ### Response #### Success Response (200) - **r_max** (ndarray) - The maximum distance from PC to detector edge in gnomonic coordinates. ``` -------------------------------- ### Window Class Overview Source: https://kikuchipy.org/en/stable/_sources/reference/generated/kikuchipy.filters.Window.rst.txt Provides an overview of the Window class, its attributes, and methods. ```APIDOC ## Window Class ### Description Represents a window for filter operations in Kikuchipy. ### Attributes - **circular** (bool): Indicates if the window is circular. - **distance_to_origin** (float): The distance of the window to the origin. - **is_valid** (bool): Checks if the window is valid. - **n_neighbours** (int): The number of neighbours in the window. - **name** (str): The name of the window. - **origin** (tuple): The origin coordinates of the window. ### Methods - **make_circular()**: Makes the window circular. - **plot()**: Plots the window. - **shape_compatible(other_window)**: Checks if the shape of this window is compatible with another window. ```