{ "cells": [ { "metadata": {}, "cell_type": "markdown", "source": "# How to extract symmetry maps from atomic resolution images", "id": "d3500980a70fbbf6" }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T03:23:15.738034Z", "start_time": "2024-05-20T03:23:12.926074Z" } }, "cell_type": "code", "source": [ "%matplotlib qt\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "from mtflearn import ZPs" ], "id": "a7e6a89e8beda717", "execution_count": 1, "outputs": [] }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T10:41:52.573922Z", "start_time": "2024-05-20T10:41:52.548902Z" } }, "cell_type": "code", "source": [ "from mtflearn.utils import normalize_image\n", "from skimage.transform import resize" ], "id": "f425368b13bfb9d", "execution_count": 17, "outputs": [] }, { "metadata": {}, "cell_type": "markdown", "source": "## load an image", "id": "fd32ef086403d1d0" }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T10:42:50.375633Z", "start_time": "2024-05-20T10:42:50.317613Z" } }, "cell_type": "code", "source": [ "filename = 'data\\\\monolayer_MoSe2_80K.npy'\n", "img = np.load(filename)[0:800, 0:800]\n", "img = resize(img, (512, 512), order=0)\n", "img = normalize_image(img)" ], "id": "fe1ce0a08b2ef4bf", "execution_count": 18, "outputs": [] }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T10:42:57.719652Z", "start_time": "2024-05-20T10:42:55.841789Z" } }, "cell_type": "code", "source": [ "zps = ZPs(n_max=10, size=72)\n", "m = zps.fit_transform(img)" ], "id": "27be3af3acab21b7", "execution_count": 19, "outputs": [] }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T09:00:20.798068Z", "start_time": "2024-05-20T09:00:20.777087Z" } }, "cell_type": "code", "source": "", "id": "7b41be2cb2b50f1f", "execution_count": 51, "outputs": [] }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T10:43:46.050988Z", "start_time": "2024-05-20T10:43:45.933989Z" } }, "cell_type": "code", "source": "m3, m6 = m.rot_maps([3, 6])", "id": "82d62306f686b64b", "execution_count": 25, "outputs": [] }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T10:43:46.438978Z", "start_time": "2024-05-20T10:43:46.424978Z" } }, "cell_type": "code", "source": "", "id": "9cc5d0c66a2cc0de", "execution_count": 25, "outputs": [] }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T10:43:54.441991Z", "start_time": "2024-05-20T10:43:52.392847Z" } }, "cell_type": "code", "source": "hh = m.mirror_map(m_unselect=[0,1])", "id": "9165b84596f1bd9", "execution_count": 27, "outputs": [] }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T10:43:54.965506Z", "start_time": "2024-05-20T10:43:54.949506Z" } }, "cell_type": "code", "source": "", "id": "b2b481946a1bae19", "execution_count": 27, "outputs": [] }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T10:43:55.266217Z", "start_time": "2024-05-20T10:43:55.166307Z" } }, "cell_type": "code", "source": "plt.imshow(hh[40:-40, 40:-40])\n", "id": "a58537bb55984668", "execution_count": 28, "outputs": [] }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T10:43:09.664312Z", "start_time": "2024-05-20T10:43:09.548315Z" } }, "cell_type": "code", "source": "plt.imshow(m3[40:-40, 40:-40])", "id": "25e088c02d876392", "execution_count": 22, "outputs": [] }, { "metadata": { "ExecuteTime": { "end_time": "2024-05-20T09:00:39.411083Z", "start_time": "2024-05-20T09:00:39.395085Z" } }, "cell_type": "code", "source": "", "id": "8c9885424b581017", "execution_count": 52, "outputs": [] }, { "metadata": {}, "cell_type": "code", "execution_count": null, "source": "", "id": "ce3c05b2d34ed100", "outputs": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 5 }