Electron microscopy
 
Python Automation and Machine Learning for ICs: Chapter Appendix
- Python Automation and Machine Learning for ICs -
- An Online Book: Python Automation and Machine Learning for ICs by Yougui Liao -
Python Automation and Machine Learning for ICs                                                                http://www.globalsino.com/ICs/        


Table of Contents/Index 
Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix

=================================================================================

 

 

 

 

 
                                                       
thePPTXnameAndPath = f"//hmy/w/{xyz}_dd.pptx" or  = f'//hmy/w/{xyz}_dd.pptx', or yidy = r"//hmy/w/{j}.csv", or new_line = f'Filename="//hmy/w/{xyz}.csv",\n'
The symbol commonly used to represent entailment is "⇒" (a rightward-pointing arrow) Introduction
AND (∧, or &), OR (∨, or |), NOT (~, or ¬) Introduction
"p <-> q or (p and q) or (not p and not q)" to represent the biconditional Introduction
"p -> q or not p or q" to represent implication Introduction
A* (A-star) Search Introduction
Insert paragraphs of texts into Python script (f"""/f''') Introduction
String template class for formating strings (F-strings (for calculation) (f"{}"), format() method ({}), %s, %d, Template ($)) Introduction
"@echo off" and "pause" in Command Prompt Window Introduction
Merge dictionaries (update(), **, chain(), ChainMap(), |, |=) Introduction
Cheatsheet of string Introduction
                                                       
                                                       
                                                       
   
     
    X                                                  
                                                     
        #                                              
                                                     

 

                                                       
σ plt.text(r'$\mu=100,\ \sigma=15$'). (code).
µ plt.text(r'$\mu=100,\ \sigma=15$'). (code).
α r'$\alpha$'
\
Tell your code that the line break doesn’t make the new line a new function
\'
single quote. Code.
\"
double quote for a string in "" (Use '\"' instead of '"' only if the '"' is inside ""). Code and code.
\n "mistakes"
E.g. >>> print('C:\name\Yougui'), then output is:
C:
ame\Yougui
>>> print(r'C:\name\Yougui'), then output is:
C:\name\Yougui
\b
backspace. Code.
\t
tab space. Code.
\n
new line. Code.
Remove \n in string or new line in txt/text file Introduction
\r
carriage return. Code.
_
underscore. Introduction. code.
@ in Python
Introduction.
@trace
Can be used to decorate fuctions. Decorating them in this way could be useful for debugging purposes. Introduction
@staticmethod
This decorator is similar to @classmethod in that it can be called from an uninstantiated class object, although in this case there is no cls parameter passed to its method.
\\
backslash. Code.
~
Not. (code)
-1 Solid filled shapes. code.
...:... Introduction. E.g. [... : ...].
It can print the first and the second last characters. Example code.
"str()" and "," difference (code)
** Introduction. Exponentiation, or called power; arbitrary variables.
{0} Introduction
'{:,}'.format >>> x = '{:,}'.format(188899660)
>>> print (x)
Output: 188,899,660
Operators
= words/symbols that cause a program to do something to its variables. These are special symbols which help the programmer to carry out operations
Arithmetic operators
 
+ Addition. Example code for string, Example code for tuple .
- Subtraction
* Multiplication. For a string, it concatenates a given string the number of times, given as the first argument. Example code for string. copy method.
/ Division
// Floor division. This means it divides the left operand by the right operand and then it takes the largest integer value that is less than or equal to the result. Essentially, it rounds down to the nearest whole number. For instance, when you perform 13 // 2, Python calculates the result of dividing 13 by 2, which is 6.5. The floor division then takes the floor of 6.5, which is 6. This is why the result of 13 // 2 is 6 in Python.
% Modulo: The modulo operator finds the remained if the first number is greater than the other, otherwise it returns the first number as the output. E.g. 4%6 = 4
%matplotlib inline page3286
"%" operator Introduction.
cv.absdiff code.
   
Assignment operators
 
= Is interpreted as assignment
+= a +=b is the same as a = a + b.
–= a -=b is the same as a = a - b.
*= a *=b is the same as a = a * b.
/= a /=b is the same as a = a / b.
%= a %=b is the same as a = a % b.
**= a **=b is the same as a = a ** b.
//= a //=b is the same as a = a // b.
Relational operators

Also called comparison operators. The output of these comparison operators is always a Boolean value, either True or False. The operands can be Numbers or Strings or Boolean values. Strings are compared letter by letter using their ASCII values.

< Lesser than: If the value of left operand is less than the value of right operand, then condition becomes True.
<= Lesser than or equal to: If the value of left operand is less than or equal to the value of right operand, then condition becomes True.
> Greater than: If the value of left operand is greater than the value of right operand, then condition becomes True.
>= Greater than or equal to: If the value of left operand is greater than or equal to the value of right operand, then condition becomes True.
!= Not Equal to: If values of two operands are not equal, then the condition becomes True.
< >  
== Equal to: If the values of two operands are equal, then the condition becomes True. code.
   
+ String concatenation: Combine 2 or more strings together using the plus + sign. String and numbers can’t be combined directly. Code.
->, <-> dashed single arrow line. dashed double arrow line.
{ }/{} Introduction.
Old Style String Formats
%d Decimal integers (not floating point). code.
%i Same as %d
%o Octal number
%u Unsigned decimal
%x Hexadecimal lowercase
%X Hexadecimal uppercase
%e Exponential notation, lowercase “e”
%E Exponential notation, uppercase “E”
%f Floating point real number
'{:.1f}'.format() Also '{:.2f}'.format(), '{:.3f}'.format(), '{:.4f}'.format(). "f" stands for floating point. The integer (here 1, 2, 3, 4) represents the number of decimals after the point. Code.
%F Same as %f
%g Either %f or %e, whichever is shorter
%G Same as %g but uppercase
%c Character format
%r Repr format (debugging format)
%s String format
%% A percent sign
   
Formatting strings for dates and times
%a
Weekday, abbreviated Sun
%A
Weekday full Sunday
%w
Weekday number 0-6, where 0 is Sunday 0
%d
Number day of the month 01-31 31
%b
Month name abbreviated Jan
%B
Month name full January
%m
Month number 01-12 01
%y
Year without century 19
%Y
Year with century 2019
%H
Hour 00-23 23
%I
Hour 00-12 11
%p
AM/PM PM
%M
Minute 00-59 01
%S
Second 00-59 01
%f
Microsecond 000000-999999 495846
%z
UTC offset -0500
%Z
Time zone EST
%%
A % character %
%j
Day number of year 001-366 300
%U
Week number of year, Sunday as the first day of week, 00-53 50
%W
Week number of year, Monday as the first day of week, 00-53 50
%c
Local version of date and time Tue Dec 31
23:59:59 2018
%x
Local version of date 12/31/18
%X
Local version of time 23:59:59
: copy method.
Sequences
These are ordered collections of elements. There are three types of sequences in Python: string, tuples and lists
Escape sequences
The "escape" characters are special characters. Are a combination of a backslash (\) followed by either a letter or a combination of letters and digits. Are used to escape (avoid) the “special meaning” of a character.
\t Inserts a Tab in the string. Example code
\

Break a Line into Multiple lines while ensuring the continuation of the line

\\ Inserts a Backslash character in the string
\' Inserts a Single Quote character in the string
\" Inserts a Double Quote character in the string
\n Inserts a Tab in the string. code.
\r Inserts a Carriage Return in the string
\b Inserts a Backspace in the string
\u Inserts a Unicode character in the string
\033 code
\x1b
code
\0oo Inserts a character in the string based on its Octal value
\xhh Inserts a character in the string based on its Hex value
0xFF == ord('q') = 11111111 (a 8 bit binary), meaning "taking keyboard input here as 'q'". code
1 (and True) Introduction
[] Is also used for indexing. E.g. index forwards and backwards, index every other two. index start from 5 to the end of the string. code. Find the index of a letter.
[[]] . Such cell can be called by (refer to code).
Comparison between *, .extend((), append(), =, ==, .copy() and copy.copy() for "list": changes of "list" Introduction
Single/double quotation marks ("/' ) To quote a string in Python use single quotation marks inside of double quotation marks or vice versa.
from functools import reduce Reduce the list sign to "|". Introduction
1 Introduction
2 Introduction
3 Introduction
4 Introduction
5 Introduction
6 Introduction
7 Introduction
8 Introduction
27 code 27 for ESC key. code

 

Files which can be handled in python.

Codes Details
'r'
Introduction. Read Only: Open text file for reading. The handle is positioned at the beginning of the file. code
'r+' Introduction. Read and Write: Open the file for reading and writing. The handle is positioned at the beginning of the file. code
'w' Introduction. Write Only: Open the file for writing. For existing file, the data is truncated and over-written.
'w+' Introduction. Write and Read: Open the file for reading and writing. For existing file, data is truncated and over-written.
'a' Introduction. Append Only () : Open the file for writing. The file is created if it does not exist. The handle is positioned at the end of the file. The data being written will be inserted at the end, after the existing data.
'a+' Introduction. Open the file in append & read mode, e.g. append and Read: Open the file for reading and writing. The file is created if it does not exist. The handle is positioned at the end of the file. The data being written will be inserted at the end, after the existing data. (code)
   
Three dimensional (3D) shapes/structures Introduction
Loops (e.g. for loop) for 2D (two-dimensional) plot (or map) Introduction
Copy methods: b = [*a]; c = a * 1; d = a[:]; "e = []; e.extend(a)"; f = a[0:len(a)]; *g, = a; h = list(a); i = [z for z in a]; "j = [] for item in a: j.append(item)"; a.copy(); "import copy l = copy.copy(a)". code. code.
Calculator of length accuracy in 3D structure Introduction
ŷ, ≤  
                                                       
                                                       
                                                       
                                                       

 

 

=================================================================================