topostats ========= .. py:module:: topostats .. autoapi-nested-parse:: Topostats. .. !! processed by numpydoc !! Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/topostats/array_manipulation/index /autoapi/topostats/entry_point/index /autoapi/topostats/filters/index /autoapi/topostats/grains/index /autoapi/topostats/grainstats/index /autoapi/topostats/io/index /autoapi/topostats/logs/index /autoapi/topostats/plotting/index /autoapi/topostats/plottingfuncs/index /autoapi/topostats/processing/index /autoapi/topostats/run_modules/index /autoapi/topostats/scars/index /autoapi/topostats/statistics/index /autoapi/topostats/theme/index /autoapi/topostats/thresholds/index /autoapi/topostats/tracing/index /autoapi/topostats/unet_masking/index /autoapi/topostats/utils/index /autoapi/topostats/validation/index Attributes ---------- .. autoapisummary:: topostats.LOGGER topostats.__version__ topostats.__release__ Classes ------- .. autoapisummary:: topostats.ImageGrainCrops topostats.Colormap topostats.TopoStats Functions --------- .. autoapisummary:: topostats.setup_logger Package Contents ---------------- .. py:class:: ImageGrainCrops Dataclass for storing the crops of grains in an image. .. attribute:: above Grains in the above direction. :type: GrainCropDirection | None .. attribute:: below Grains in the below direction. :type: GrainCropDirection | None .. !! processed by numpydoc !! .. py:attribute:: above :type: GrainCropsDirection | None .. py:attribute:: below :type: GrainCropsDirection | None .. py:method:: __eq__(other: object) -> bool Check if two ImageGrainCrops objects are equal. :param other: Object to compare to. :type other: object :returns: True if the objects are equal, False otherwise. :rtype: bool .. !! processed by numpydoc !! .. py:method:: image_grain_crops_to_dict() -> dict[str, numpy.typing.NDArray[numpy.bool_] | dict[str:Any]] Convert ImageGrainCrops to dictionary indexed by attributes. :returns: Dictionary indexed by attribute of the grain attributes. :rtype: dict[str, Any] .. !! processed by numpydoc !! .. py:method:: debug_locate_difference(other: object) -> None Debug function to find the culprit when two ImageGrainCrops objects are not equal. :param other: Object to compare to. :type other: object :raises ValueError: If the objects are not equal. .. !! processed by numpydoc !! .. py:function:: setup_logger(log_name: str = LOGGER_NAME) -> logging.Logger Logger setup. The logger for the module is initialised when the module is loaded (as this functions is called from __init__.py). This creates two stream handlers, one for general output and one for errors which are formatted differently (there is greater information in the error formatter). To use in modules import the 'LOGGER_NAME' and create a logger as shown in the Examples, it will inherit the formatting and direction of messages to the correct stream. :param log_name: Name under which logging information occurs. :type log_name: str :returns: Logger object. :rtype: logging.Logger .. rubric:: Examples To use the logger in (sub-)modules have the following. import logging from topostats.logs.logs import LOGGER_NAME LOGGER = logging.getLogger(LOGGER_NAME) LOGGER.info('This is a log message.') .. !! processed by numpydoc !! .. py:class:: Colormap(name: str = 'nanoscope') Class for setting the Colormap. :param name: Name of colormap to use. :type name: str .. !! processed by numpydoc !! .. py:attribute:: name :value: 'nanoscope' .. py:attribute:: cmap :value: None .. py:method:: __str__() -> str Return string representation of object. :returns: String detailing the colormap. :rtype: str .. !! processed by numpydoc !! .. py:method:: set_cmap(name: str) -> None Set the ColorMap. :param name: Name of the colormap to return. :type name: str .. !! processed by numpydoc !! .. py:method:: get_cmap() -> matplotlib.cm Return the matplotlib.cm colormap object. :returns: Matplotlib Color map object. :rtype: matplotlib.cm .. !! processed by numpydoc !! .. py:method:: nanoscope() -> matplotlib.colors.LinearSegmentedColormap :staticmethod: Matplotlib compatible colormap that replicates the Bruker Nanoscope colorscale. The colormap is implemented in Gwyddion's GwyGradient via 'Nanoscope.txt'. :returns: MatplotLib LinearSegmentedColourmap that replicates Bruker Nanoscope colorscale. :rtype: LinearSegmentedColormap .. !! processed by numpydoc !! .. py:method:: gwyddion() -> matplotlib.colors.LinearSegmentedColormap :staticmethod: Set RGBA colour map for the Gwyddion.net colour gradient. :returns: The 'gwyddion' colormap. :rtype: LinearSegmentedColormap .. !! processed by numpydoc !! .. py:method:: blue() -> matplotlib.colors.ListedColormap :staticmethod: Set RGBA colour map of just the colour blue. :returns: The 'blue' colormap. :rtype: ListedColormap .. !! processed by numpydoc !! .. py:method:: blue_purple_green() -> matplotlib.colors.ListedColormap :staticmethod: RGBA colour map of just the colour blue/purple/green. :returns: The 'blue/purple/green' colormap. :rtype: ListedColormap .. !! processed by numpydoc !! .. py:data:: LOGGER .. py:data:: __version__ .. py:data:: __release__ :value: '' .. py:class:: TopoStats Class for storing TopoStats objects. .. attribute:: image_grain_crops ImageGrainCrops of processed image. :type: ImageGrainCrops | None .. attribute:: filename Filename. :type: str | None .. attribute:: pixel_to_nm_scaling Pixel to nanometre scaling. :type: str | None .. attribute:: img_path Original path to image. :type: str | None .. attribute:: image Flattened image (post ''Filter()''). :type: npt.NDArray | None .. attribute:: image_original Original image. :type: npt.NDArray | None .. attribute:: topostats_version TopoStats version. :type: str | None .. !! processed by numpydoc !! .. py:property:: image_grain_crops :type: grains.ImageGrainCrops Getter for the Image Grain Crops. :returns: Image Grain Crops. :rtype: ImageGrainCrops .. !! processed by numpydoc !! .. py:property:: filename :type: str Getter for the ''filename'' attribute. :returns: Image filename. :rtype: str .. !! processed by numpydoc !! .. py:property:: pixel_to_nm_scaling :type: str Getter for the ''pixel_to_nm_scaling'' attribute. :returns: Image ''pixel_to_nm_scaling''. :rtype: str .. !! processed by numpydoc !! .. py:property:: img_path :type: pathlib.Path Getter for the ''img_path'' attribute. :returns: Path to original image on disk. :rtype: Path .. !! processed by numpydoc !! .. py:property:: image :type: str Getter for the ''image'' attribute, post filtering. :returns: Image image. :rtype: str .. !! processed by numpydoc !! .. py:property:: image_original :type: str Getter for the ''image_original'' attribute. :returns: Original image. :rtype: str .. !! processed by numpydoc !! .. py:property:: topostats_version :type: str Getter for the ''topostats_version'' attribute, post filtering. :returns: Version of TopoStats the class was created with. :rtype: str .. !! processed by numpydoc !! .. py:method:: __eq__(other: object) -> bool Check if two TopoStats objects are equal. :param other: Object to compare to. :type other: object :returns: True if the objects are equal, False otherwise. :rtype: bool .. !! processed by numpydoc !! .. py:method:: topostats_to_dict() -> dict[str, str | grains.ImageGrainCrops | numpy.typing.NDArray] Convert ''TopoStats'' object to dictionary. :returns: Dictionary of ''TopoStats'' object. :rtype: dict[str, str | ImageGrainCrops | npt.NDArray] .. !! processed by numpydoc !!