{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Sample code (TEM3)\n", "This page presents a simple sample code using the TEM3 package." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The functions to be introduced are as follows\n", "\n", "- Get a list of detectors that can be controlled\n", "- Get or set a detector information\n", "- Image capturing\n", "\n", "**Prerequisites** \n", "\n", "- TEMCenter is running (in the case of online)\n", "- TEMServer is running (in the case of online)\n", "- Ver.1.3.0 (Operation check environment)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 0. Import TEM3\n", "*** " ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# online\n", "from PyJEM import TEM3\n", "TEM3.connect()\n", "\n", "## offline\n", "#from PyJEM,offline import TEM3\n", "#TEM3.connect()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Get current mag value\n", "***\n", "\n", "* Use GetMagValue() function in EOS class to get the value. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1.1. Create EOS instance" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "eos = TEM3.EOS3()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1.2. Call GetMagValue method" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[200, 'X', 'X200']" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "eos.GetMagValue()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Change the magnification\n", "***\n", "\n", "* The magnification can be changed with SetSelector() defined in TEM3.EOS3().\n", " * SetSelector () has one argument and will be changed to a magnification according to the entered value. \n", " * The input value is 0 to 40 in index. \n", "* The Set function has no return value. You can check the changed magnification with GetMagValue (). " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.1. Call a SetSelector method \n", "* change to 1 (index) mag value." ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": true }, "outputs": [], "source": [ "eos.SetSelector(1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.2. Check TEM state" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[250, 'X', 'X250']" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "eos.GetMagValue()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Increase the magnification by some step\n", "***\n", "\n", "10 steps from the current magnification using the for statement \n", "\n", "* Use \"for\" statement \n", "\n", " ```python\n", " >>> for i in range(10):\n", " ```\n", "\n", "* Use function *UpSelector()* to increase the magnification one step at a time." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1. Execute" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[300, 'X', 'X300']\n", "[400, 'X', 'X400']\n", "[500, 'X', 'X500']\n", "[600, 'X', 'X600']\n", "[800, 'X', 'X800']\n", "[1000, 'X', 'X1000']\n", "[1200, 'X', 'X1200']\n", "[1500, 'X', 'X1500']\n", "[2000, 'X', 'X2000']\n", "[2500, 'X', 'X2500']\n" ] } ], "source": [ "for i in range(10):\n", " eos.UpSelector()\n", " print(eos.GetMagValue())" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 1 }