Python Automation and Machine Learning for EM and ICs

An Online Book, First Edition by Dr. Yougui Liao (2019)

Practical Electron Microscopy and Database - An Online Book

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

   
K-means clustering and PCA for failure analysis  
ML model complexity versus dataset size  
Clusters (Kubernetes, Apache Mesos, Spark Standalone, Apache Hadoop YARN) in Apache Spark  
Leveraging precision, speed, and automation: Integrating Mask R-CNN and YOLOv8  
Feature selection: removing unnecessary (constant & quasi constant) features  
Comparison between Clouds (Amazon, IBM, Google ...)  
Feature Selection: Chi Square to select dependent and independent variables  
Comparison between CNN, CNN with Attention and Autoencoder  
Mask R-CNN (Mask Region-based Convolutional Neural Network)  
Configuring Spark  
Deploy modes for driver process in Apache Spark: client mode and cluster mode  
Apache Spark applications to a Kubernetes cluster  
Apache Spark on IBM Cloud  
Catalyst in Spark  
Coarsening data  
Principles of ethical and responsible ML (selection bias, confirmation bias, automation bias, model fairness)  
Image classification with ML  
Google Cloud Shell  
Drawbacks of Coursera classes  
Spark Core of Apache Spark  
Parallel computing and distributed computing  
Calculation of Principal Component Analysis (PCA)  
Squared Pearson correlation coefficient  
Covariance  
Covariance versus Covariance Matrix  
Principal Component Analysis (PCA) versus Uniform Manifold Approximation and Projection (UMAP)  
Impact of corpus narrowness on language model training  
Context-free grammar (CFG)  
CaptionBot  
tf.keras.datasets (e.g. MNIST, CIFAR-10, CIFAR-100, Fashion MNIST)  
Conversion of Green Regions Connected to Red Areas in Images  
Image convolution  
Code blocks  
Python Conference  
Computer hardware architecture  
Labor cost of data analysis with and without automation and ML techniques  
Computer vision  
Clustering in computer vision  
Trade-off between minimizing loss and minimizing complexity  
Nearest-neighbor (NN) classification  
Replaces a symbol/character/letter in a string  
Analyzing the impact of fabrication conditions on semiconductor wafer fail rates  
Plot with letters/words/character as x-/y-axis  
Fit and Smooth Plotted Curves  
Maintaining arc-consistency  
Constraint Satisfaction Problems (CSPs) as Search Problems  
Arc consistency  
Binary constraint  
Node consistency  
Unary constraint  
Soft constraints and hard constraints  
Constraint satisfaction problem  
Hill Climbing  
Evaluation (Precision and Recall) in Text classification with Naive Bayes  
Text classification with Naive Bayes  
Markov chain  
Unconditional probability  
Path and Path Cost in ML  
Cost/loss function versus reward function  
Cost (expense) and speed (fastest and slowest) of computation in ML  
Credit assignment problem in reinforcement learning  
Electroencephalogram cap (EEG cap) for brain  
Nonlinear extensions of Independent Component Analysis (ICA)  
Cumulative Distribution Function (CDF)  
Formats of datasets for classification  
Finding a correct loss (risk, objective) function for a specific problem  
Cache  
Logistic regression as a one-neuron/single-layer neural network (connection between linear & activation parts)  
Softmax regression (multinomial logistic regression)/softmax multi-class network/softmax classifier  
Extract/confirm any substrings with any pattern (e.g. dot (.))  
Dependently Identically Distributed/Correlated Identically Distributed  
kfp.dsl package versus pipelines and components  
Probably Approximately Correct (PAC) learning  
Sample Complexity  
Convergence and Optimization  
Model Complexity  
Leave-One-Out Cross-Validation (LOOCV)  
Plot pixel intensity (histogram) along a line (row/column/x-axis/y-axis) of an image  
K-Fold Cross-Validation  
CIFAR (Canadian Institute for Advanced Research) (CIFAR-10 and CIFAR-100)  
Linear correlation between two variables with Pearson Correlation Coefficient, Spearman Rank Correlation Coefficient, Kendall's Tau, Linear Regression, Coefficient of Determination and Correlation Ratio  
Choice of parameters for training models  
Training error versus model complexity  
Cross-Validation in ML  
Comparison among classifier, hyperplane and decision boundary  
Optimal margin classifier/maximum margin separator  
Conditional probability  
Custom AI/ML chips/ICs  
Energy consumption in computation of machine learning  
Convolutional Layers (CONV) in Deep Learning  
Fully Connected Layers (FC) in Deep Learning  
Laplace smoothing/Laplace correction/add-one smoothing  
Categorical distribution  
Canonical response function  
Conferences on machine learning  
Linear regression versus classification  
Comparison between mean squared error (MSE), absolute error (L1 Loss) and fourth-power loss  
Comparison between L1 Regularization and L1 Loss (absolute loss or mean absolute error (MAE))  
Close() and close opened file
Close file after reading a file: avoid file locking  
cv2.waitKey(1): Will display a frame for 1 ms, after which display will be automatically closed. Since the OS has a minimum time between switching threads, the function will not wait exactly 1 ms, it will wait at least 1 ms, depending on what else is running on your computer at that time.  
close(): It closes the file or webpage, and frees the memory space acquired by that file.  
win32clipboard.CloseClipboard()  
Open and close any type of files with default programs/apps (e.g. word, excel, dm3, dm4, Digital Micrograph, powerpoint, internet explorer, chrome, and so on) in windows  
Minimize/maximize/restore/activate/resize/move/close Window objects  
Open and close specific files  
Fill in closed curves  
Methods to open google chrome (problems: Google chrome closes immediately after being launched with selenium) (with close-browser and quit-driver function)  
Convolution and convolutional layers  
Comparison of regression classes  
Independent Component Analysis (ICA)  
Convex optimization, convexity of loss functions, convex functions and convex sets  
Cocktail party problem  
Lipschitzness/Lipschitz continuity  
Point-Biserial Correlation  
Kendall Tau Rank Correlation Coefficient  
Pearson Correlation Coefficient/Pearson's r/Correlation Coefficient  
Spearman Rank Correlation/Spearman's rho/Spearman correlation  
Epsilon cover/ε-cover/epsilon-net  
Infinite Hypothesis Class  
Finite Hypothesis Class/finite Hypothesis Analysis  
Complementary inequality  
Core Steps/Procedure/Designing of Machine Learning  
Finite Hypothesis Class versus Infinite Hypothesis Class  
Various names or terms that describe similar concepts or techniques in ML  
Hypothesis class/hypothesis family/predictor class/model class/hypothesis family/predictor family/model family (h)  
Concentration inequality  
Central Limit Theorem (CLT)  
Covariance matrix  
Modify/replace the line in a text file if a line contains specific string  
Well-specified case  
Uniform convergence  
Consistency in Statistics  
Defect Detection and Classification by using Machine Learning  
Cross entropy (log loss/logistic loss)  
Trick: generic code/script templates for complex automation  
Loss (risk, cost, objective) function  
Confusion matrix heatmap  
Common Words for Classification of Groups of Texts  
Good research topics in the field of semiconductor manufacturing and computer vision  
Autonomous vehicles/cars and machine learning  
Classification tree/decision tree for classification  
Fréchet Inception Distance (FID) coefficient  
Misclassification rate (classification error rate or error rate) in machine learning  
Corpus  
Class Activation Mapping (CAM)  
Similarity-based clustering method (SCM)  
Comparison between supervised and unsupervised learning  
Convert a list to a matrix  
Execute a command on Command Prompt of Windows  
Continue script execution no matter whether some try fails or not (finally)  
Create a temporary file or directory/folder  
Remove unwanted/unnecessary parts from strings in a column of dataframe  
Convert dataframe row/column into a comma separated string  
Compare string entries/cells/elements of columns in different dataframes  
Candidate keywords  
Built-ins/Builtins Commands in Python  
Build own/customized keyword candidates  
Electrical characteristics of MOS capacitor  
Count how many empty strings in a list  
Semantic clustering  
Clustering versus Classification of texts and documents  
Clustering of texts  
Classification of texts  
Classification of groups of texts  
(Text and image) contrastive learning  
Create a log (log.log) file to monitor script execution  
Combine multiple images into a single multi-page image or vice versa  
Convert/change the case of all letters/word into uppercase (capital) or lowercase in a list of strings  
Compare dates (x days after or before a date), and difference between two dates in days  
Convert set into a list and vice versa  
Merge dictionaries (update(), **, chain(), ChainMap(), |, |=)  
Calculating the area fraction of each circle overlapped (filled with color) by a square grid and build wafer map with integration  
Convert strings to number (integers/float)  
Trick: Get coordinate difference between mouse positions  
Select/skip columns by index in DataFrame without changing the DataFrame itself, and change the order of of the selected columns  
Convert all elements of specific column or in entire dataframe into strings  
Find repeating patterns in columns, group them as cycles, and column correlations  
Find the same elements in columns in two separate dataframes and then merge them  
Remove the substring after the first or last character "::" in a given string, or extract the substring between the first and last "::"  
Codes: Automation of Mouse Movements and Clicks, and keyboard control (comparison among pyautogui, pygetwindow, pydirectinput, autoit, Quartz, platform, ctypes, uiautomation and Sikuli)  
Principle and troubleshooting: Automation of Mouse Movements and Clicks (comparison among pyautogui, pygetwindow, pydirectinput, autoit, Quartz, platform, ctypes, uiautomation and Sikuli)  
Create table on pptx with certain rows and columns of strings  
Create table on pptx with certain rows and columns in DataFrame  
Click a menus of an application  
exception KeyboardInterrupt, Raised when the user hits the interrupt key (normally Control-C/ctrl-c or Delete).  
Check
Compare (pattern/ratio of) two different columns, check whether column values match in DataFrame  
Check whether one column contains number only and another column contains letters only or mixture of numbers and letters in DataFrame  
Check the difference between two columns in DataFrame  
checkpoint_path  
Check if two circles intersect or overlap  
Check if rectangles overlap  
Check if two lists are same/identical  
Check all the imported/current modules/libraries  
Model checking  
Model Checking Algorithms and Modus Ponens Algorithms  
save_checkpoints_steps  
Convert a CSV file to an image with one column and another column as x-axis and y-axis, respectively.  
CSV Merger with Key-Based Matching and Column P Integration   
Column-Based Cell Value Extraction in the Same Row in CSV File  
Summary and cheatsheet of command for csv file  
Collect the file list in a folder into a csv file  
pandas for CSV  
Write cvs cells
.to_csv()/.writerow()  
pandas.DataFrame.to_csv(): DataFrame.to_csv(path_or_buf=None, sep=',', na_rep='', float_format=None, columns=None, header=True, index=True, index_label=None, mode='w', encoding=None, compression='infer', quoting=None, quotechar='"', line_terminator=None, chunksize=None, date_format=None, doublequote=True, escapechar=None, decimal='.', errors='strict', storage_options=None). Write the contents of the Frame into a CSV file  
writerow()/.writerows():: Save data into a CSV file.  
Write cell by cell with .loc  
Search/print/output the rows: Print the rows if their cell values are greater than a specific value, in the csv file with numbers only; output the rows if the cell value is in a specific range.  
Sort a csv file with column: used "key = operator.itemgetter()"  
Calculation and data extraction in csv under conditions: Compares with the ones which cannot be used for math calculation, find the maximum in a column  
Replace/change to new headers in a csv file  
Skip rows and/or columns in csv  
Merge/combine two csv files  
Split columns and merge in csv: Split columns and then merge the splits in a csv file.  
Count the number of lines (rows) and columns in a txt (and a csv) file, count different numbers in each region in a column, count missing or not available values.code  
Sort a csv file with column: used "key = operator.itemgetter()"  
Calculation in csv: Compares with the ones which cannot be used for math calculation, find the maximum in a column  
Replace/change to new headers in a csv file  
Skip rows and/or columns in csv  
Filters the rows based on the condition of being within n days of today's date  
.axes[0] and .axes [1]. for csv.  
.sum(): sum and percentage for csv  
Count duplicates/occurrence and show unique values in csv files  
Search in csv file  
Split columns and merge in csv: Split columns and then merge the splits in a csv file  
Count the number of lines (rows) and columns in a txt (and a csv) file, count different numbers in each region in a column, count missing or not available values.  
Search/print/output the rows: Print the rows if their cell values are greater than a specific value, in the csv file with numbers only; output the rows if the cell value is in a specific range.  
for ... in rang() in csv  
Guess and check algorithm with a combination of a for loop and an if statement  
Sort a csv file with column: used "key = operator.itemgetter()"  
Calculation in csv: Compares with the ones which cannot be used for math calculation, find the maximum in a column  
datatable.Frame.to_csv(): Write the contents of the Frame into a CSV file. If no path is given, then the Frame will be serialized into a string, and that string will be returned
csv.Sniffer(): The Sniffer class is used to deduce the format of a CSV file. It expects a sample string, not a file  
next(): Skip headers in CSV  
info(): Print information in CSV  
Series.to_csv(): Is a 1-D ndarray with axis labels and writes the given series object to a comma-separated values (csv) file/format  
line: Print line by line from a CSV file  
DataFrame.equals(): Confirm if the two csv files are the same or not  
dialect: string or csv.Dialect instance to expose more ways to specify the file format. To expose more ways to specify the file format  
Create a file (e.g. csv, pptx files)  
csv.writer(). Return a writer object responsible for converting the user’s data into delimited strings on the given file-like object. csvfile can be any object with a write() method  
Count duplicates/occurrence and show unique values in csv files  
Split columns and merge in csv: Split columns and then merge the splits in a csv file  
Count the number of lines (rows) and columns in a txt (and a csv) file, count different numbers in each region in a column, count missing or not available values  
Split columns and merge in csv: Split columns and then merge the splits in a csv file.  
Skip rows and/or columns in csv  
Print/obtain a specific digit in a number, e.g. in a cell value in csv  
Write to a specific cell in a csv file  
Mean (average, .mean())/.sum()/maximum(.max())/minimum(.min())/number of non-null values(.count())/.median()/variance(.var())/standard deviation(.std()/pstdev())  
Get the csv/pandas cell value with certain condition  
Add/insert a column into an existing csv file  
Change csv cell value under conditions (e.g. if a cell value is equal to another cell value, then compare the third cell value; if both cell value is the same, then change its value to a value)  
Read
csv.reader(): Return a reader object which will iterate over lines in the given csvfile  
tupleize_cols: If False (default), write as a list of tuples, otherwise write in an expanded line format suitable for read_csv
DictReader()  
pandas.read_table()  
pandas.read_csv()  
Iterate over rows in a DataFrame/read and print row-by-row (number of columns and rows, df.shape[0]/df.shape[1])  
Read columns with numeric values/numbers only in dataframe  
Electrical characteristics of the MOS capacitor  
Change date/month/year format  
Get header/column names from DataFrame  
Get the frequency of occurrence of a string in a column DataFrame  
Difference/comparison between real mouse click and click from script/program, e.g. Pyautogui  
Plot images with certain image size and in color  
Plot confidence bands  
.bat (batch) files for Command Prompt Windows  
Trick: pd.concat() for merging/adding (two) columns  
CycleGAN (Cycle-Consistent Adversarial Networks)  
Copy a file or all files (with os.mkdir) to save to somewhere (create a directory first if it does not exist)  
Remove decimal part in a string with comma  
Form a list of strings from an old string with all the 6 digits by removing all special characters or spaces  
Class  
self and __init__ method in Class  
Find the computer name  
__str__ method for a class  
__add__, __call__, __contains__, __delitem__, __delattr__, __eq__, __enter__, __ge__, __getattribute__, __getnewargs__, __getattr__, __getitem__, __gt__, __hash__, __reduce__, __iadd__, __imul__, __init_subclass__, __index__, __int__, __invert__, __new__, __neg__, __reduce_ex__, __reversed__, __rmul__, __radd__, __rand__, __rdivmod__, __rfloordiv__, __rlshift__, __rmod__, __ror__, __round__,__rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __dir__, __doc__, __divmod__, __iter__, __le__, __lt__, __len__, __ne__, __repr__, __setattr__, __setitem__, __sizeof__, __lshift__, __sub__, __subclasshook__, __str__  
Safely use credentials (username and password) in Python project  
Convert a sentence/text to a list  
Merge columns which contain specific strings  
Merge rows/columns of a csv file into an old csv file if the rows/columns are not in the old csv file  
Select specific columns from a DataFrame to form a new DataFrame  
Output the row into dataframe if the value of the cell in a column contains a specific substring in a csv file (with headers)  
Add letter/commas/numbers/characters to the end/beginning of strings in a list  
Word cloud visualization  
Extract the last column as subdataframe  
Convert a floating-point number to exponential format  
Apply a formatting function to all cells in a DataFrame  
Color the Tables in pptx (PowerPoint)  
Color and rotate/vertical text in pptx  
Selecting only numeric/number columns, and then select two specific columns for plot  
Merge columns with character/symbol Separation  
Hide x-axis tick labels (only show some labels) where x values are under certain conditions  
Create table with merged cells on pptx  
Change the width of the cell in ppt  
Highlight the plotted dots uncer certain condition  
Only use the first 4 characters in the headers of the table for pptx/dataframe  
Embed/hide codes or markers into HTML files  
Cheatsheet about headers (column names) in DataFrame  
Plot a heatmap with three columns of data  
Aggregate duplicates in columns of data  
Comparative overview of multivariate statistical methods (Correlation Analysis, Regression Analysis, Factor Analysis, Cluster Analysis, Principal Component Analysis (PCA), Canonical Correlation Analysis, Discriminant Analysis, Path Analysis, Structural Equation Modeling (SEM), Multivariate Analysis of Variance (MANOVA), Analysis of Covariance (ANCOVA) ): purposes, variables, and outputs  
Overcoming automation challenges and forward-looking suggestions  
.create_sheet('')  
from typing import List, Dict  
.str.split()  
expand=True  
rename()  
regex=True  
sort_values(by=...)  
head()  
dropna(): Allows the user to analyze and drop Rows/Columns with Null values in different ways.  
reset_index()  
.groupby('...')['...']  
unique()  
nunique()  
left_index=, right_index=  
classification_report  
.config()  
continue  
from pptx.dml.color import RGBColor  
.color.  
ctrlleft  
ctrlright  
ctrl  
from selenium.webdriver.common.keys import Keys  
from selenium.webdriver.common.by import By  
.center()  
hotkey('c')  
Type capital letters  
plt.colorbar()  
sklearn.cluster.KMeans()  
.DataFrame(): .drop(), index, columns, axes, dtypes, size, shape, ndim, empty, T (swap between column and row), values  
CNTK  
Crowd’s error  
cosine similarity/distance  
Add padding/black/colored edge to images  
Save the text in clipboard to a txt file  
Common values in two pandas series  
Save contents in the webpages obtained by Google search into a text file  
Color in table obtained by matplotlib.pyplot/change background color of cells in table  
Locate/find the center/coordinates of a bright (maximum/highest intensity) spot in an image  
Median blurring and cv2.medianBlur()  
Three dimensional (3D) shapes/structures (e.g. cylinder)  
Graphlab Create  
Categorical variables  
Save the image in clipboard to an image file  
Compile model  
Colab  
Categorical features preprocessing layers  
GPUs/CPUs  
googlecoursera/console.cloud.google  
Categorical bins  
tf.constant()  
find_element(CSS_SELECTOR, " ")  
tf.feature_column.categorical_column_with_identity  
Convert
Convert a number type to another  
Comparisons
Typical training setup in AI and comparisons of different training libraries  
Comparison between Python and C/C++  
Data structures (Data science, and comparison between list, tuple, set, dictionary)  
Comparison between steps and epochs in TensorFlow  
Comparison between iteration algorithm and recursive algorithm: a function repeat itself  
Comparison of qualifications and skills between data science manager, engineering and scientist  
Comparison between machine learning and human beings  
Comparison between strings  
Comparison with classical wafer map inspection algorithms  
Speed comparison with and without numpy  
Comparison between =, ==, .copy() and copy.copy() for "list": changes of "list"  
Convert capital alphabet letters/characters to number  
Extract three blue, green, red images from a color image or grey image, or convert RGB (color) image into three blue, green, red images  
Convert images between formats (e.g. jpg, png, tif)  
Print and set file path as a variable (e.g. convert all characters in the pathname to lowercase)  
Convert a text file to a string  
Find and convert the file time/date and compare with the current time  
Libraries used to convert incident documents into numerical vectors  
Convert PDF file to text file  
Put most code into a function or class  
Use __name__ to control execution of the code  
Match on images to find and to highlight unsimilar (threshold=0) to identical (threshold=1) regions of an image that match a template with a cross-correlation method  
Holidays/Festivals/Vocations (Thanksgiving/Christmas)  
Call and then run your own functions and modules in different/other Python files  
Automatically review, scroll, click webpage and its link  
Positions and colors of mouse/cursor and features  
while True, e.g. with the "while True" loop, e,g. it constantly/continuously refreshes actions.  
Coordinate at center of features, e.g. images  
Skip, remove, extract, use specific columns  
Automation of mouse movements and clicks  
Create a new presentation  
Move the cursor/mouse to the found, similar spots one-by-one  
Table of PC/computer/Windows shortcut hotkeys  
Table of Chrome shortcut hotkeys  
Selection between choices or options  
Copy and apply formatting in Word and PowerPoint  
Work (read, write, insert and delete rows and columns, and merge and unmerge cells, shift/move cell values) in Excel sheets  
Calculation in an Excel Sheet, Style, Bold, and Color  
Move the mouse/cursor to the left or right  
Get the name of the current/most front window  
Bind/link/combined multiple commands to buttons  
stopwatch and timing/countering a process  
Copy and then store it into memory and it can be pasted for use later (multiple clipboard)  
Copy text to Clipboard  
Courses/classes for Computer Science  
Text classification/sort/prediction, train/test e.g. Youtube spam  
Print colored text in Python IDLE's terminal  
Copy text into clipboard and then use it immediately (one time clipboard)  
matplotlib.pyplot axis/text color (xticks, rotation, xlabel, ylabel, title, fontsize, grid(), legend(), show())  
Image matching with cross correlation and overlap of template edge. In this matching process, Normalized cross-correlation with those edge images is performed.  
Cross correlation between two images  
Cross correlation between two images in any sizes. Multiscaling is used to avoid the issue caused by the different sizes of the template and original image, in order to find match in a original image, namely, the size of template is larger than the original image.  
watchdog to look for filesystem changes  
Skip, remove, extract, use specific columns  
Calibrate and put a scale bar, and draw a line segment on an image  
Matrix conversion to image  
Calculator of length accuracy in 3D structure  
Option/selection/choice methods ("pop-up windows of Yes and No ")  
Copy text into clipboard and then you can paste it anywhere  
Calculate/pass the arbitrary (any) number of variables or input arguments  
Merge/combine two text files into a new text file, add a new line to the beginning of a text file  
Create an executable (.exe) file from a Python script  
Mixing of using numbers and strings by conversions  
Calculators  
Numpy: Access the element at the second row, the third entry, access a specific row or a column, access some elements (submatrix), or replace/modify an element in the array, print a transfer of an array, access array under conditions or filtering  
Calculations in DataFrame: Add a column, calculate for a new column, delete a column, all the rows with values greater than 30 in "Score A" column  
Calculations in DataFrame: Add a column, calculate for a new column, delete a column, all the rows with values greater than 30 in "Score A" column  
Pint summary of the statistic data, change data format, sort/group columns  
Handle NaN value in DataFrame, replace empty cells with ...  
Copy text into clipboard and then you can paste it a webpage, text/txt, word or powerpoint file automatically  
Count the numbers of uppercase letters, lowercase letters and spaces in a string and then swap the cases of the letters.  
Count the times of repeated excutions  
Markers (e.g. color cross, scatter, and circles) at specific coordinates with x- and y-axis  
Find a similar feature and then click it  
Remove letters or characters on either side (both left and right sides) and stops when neither such letters no characters on either side  
Creates an image from an colored images after remove the grey components (image conversion from color to gray involved)  
Calculate the coordinates of a point in a given rectangle and the distance of a given point to a line  
Create images with global, adaptive mean, adaptive Gaussian, binary, trunc, Tozero, and tozero thresholds.  
Load/launch images and ColorMixing in DigitalMicrograph  
Automation of mouse movements and clicks, and keyboard control  
dropdown box/option/selection/choice  
Add a new slide into an existing ppt or a created ppt file  
Draw lines, elbow connectors and arrows in a ppt  
Find the color of a pixel on the screen  
Plot curve/chart in pptx  
Count and delete slides from ppt  
Infinite loops (e.g. stop infinite cycling of opening the same images)  
Get maximum and minimum value of column and its index  
Find a specific word in a webpage and count occurrences  
Web Scraping (save contents from a webpage)  
Copy a file to save to somewhere  
Get/list immediate subdirectories/subfolders; get only the last part of a path/folder/drive; split a dos path into its components, and then print the list  
Read its nthcharacter in a text file  
Circular dependencies in Python execution  
Launch script from another script using subprocess.run/subprocess.call  
Monitor multiple changed of folder and files  
Monitor the current folder  
Find files with a specific file extension/type or with file names ending with specific characters  
Move/copy all files from original folder in a directory to a new directory  
 
top and left for pptx (e.g. align the top-left corner of the image to the center of the slide no matter how the size of the images changes)  
Invert the contrasts of black and white images  
watchdog with conditioning break  
Count how many (number) files and folders in a directory  
Find contours in an image and their areas and coordinates  
Take a screenshot using a mouse click and drag method  
Global access to a local variable inside a function/class from outside of the function/class externally  
Calculation with combinations of variables from lists  
Get mouse position/coordinates on click  
Measure length/distance on an image w/o calibrated bar  
Get pixel location/coordinates on an image using mouse click/events  
Crop/snip (without opening the image) part of a image with definition by a pixel line (with transparent added portion)  
Change/swap values in a list  
Modify file path/directory by changing folder names by merging a list  
Merge/combine two pptx files into one  
Plot distance between points calculated by coordinates  
Break/exit/skip a function/code line after a certain time  
Classification and algorithms for classification  
Binary classifiers  
Clustering  
Count occurrence/nubmer of words/phrase in a text file  
Remove/repace (part) character(s) from string  
Change/capitalize the case of the first letter of a string  
Write/save content to a text file  
Generate text file with the bank of collecting all words, characters and strings from news  
Critical thinking in data science  
Support-vector clustering (SVC)  
Model-based clustering  
Nearest-neighbor (NN) cluster removal  
K-Means clustering for images  
Image segmentation ("clustering") in color  
Clustering of Laplacian  
Mask an image with a threshold or with a color as a threshold  
Convolutional neural networks (CNN)  
Wafer map failure pattern recognition (WMFPR)/wafer failure pattern detection (WFPD)/defect classification  
Convert images between Cartesian and Polar forms  
Draw circles/lines on images  
Detection and classification of defective dies/chips in wafer map  
Convolutional Autoencoder (CAE)  
Plot a list of x, y coordinates to an image  
Store images in pandas dataframe column  
Write contents of DataFrame/memory into text file  
Convert DataFrame to a HTML Table and save as a HTML webpage  
String template class for formating strings (F-strings (for calculation) (f"{}"), format() method ({}), %s, %d, Template ($))  
webdriver.Chrome()  
ODBC (Open Database Connectivity)  
Access and use SQL Database on SSMS (Microsoft SQL Server Management Studio Express) with pyodbc: localhost, insert rows, update, count updated, delete rows, comparision between extract data by Python and SQL itself  
Python drivers for SQL server (pyodbc, pymssql, PyMySQL, cx_Oracle)  
Call and run another script in a different/any (parent or children) directory/path/subfolder from a script  
Get the current directory/folder path  
Change the current directory to any directory/path (e.g. with os.chdir)  
Count number of lines in a text file  
Find common/different elements/items between two lists/sets  
Plot confidence bands  
Convert between numpy array and string  
igraph for clustering and network  
Call/run/execute JMP from Python  
Count the number of the pages in a single multi-page/frame image  
"@echo off" and "pause" in Command Prompt Window  
RegEx (Regular Expression) (characters to check if a string contains a specified search pattern, remove double spaces, and clean texts)  
Check ... empty  
Check if an item/element is in a list or not  
Check if a list is empty or not  
Check file existence with partial filename  
Check if a file/folder exists or not (Cannot find a specific file/folder? a specific folder in the path? select specific folders to form a string, split a dos path into its components, and then print the list, or check files with extension)  
Check if Windows/PC screen is locked  
Check if two lists have the same elements  
Check whether a file is empty or not  
Check if a variable does exist/is assigned/defined  
Check if a string is empty or space only  
Check if a key exists in a dictionary  
'xyz'.isalpha(): Check if string is alphabet (letter, or one type of character)  
Check all the imported/current modules/libraries  
   
Check if one list is subset of another (partially (part of))  
Check if a variable is a number or string  
Check if an element in a sublist of a list  
Check if a file exists again (double check)  
Clean clipboard and/or check if clipboard is empty, text or image  
Check updated new files in a folder  
Check if all the (and how many, length of a string) characters in the text are digits/numbers  
Check to see if or get a window with a name containing specific titles or texts  
Check the letters and symbols starting and ending with  
Keyword search function/check whether or not a string is within another string (a space is included as a string character)  
Check if a popup dialog is a window or not for Selenium app  
checkbox  
Check/find/get a file name or the last folder name (e.g. from a path/directory)  
Check if both files are the same file, e.g. symbolic link, shortcut  
Check if a letter is in a string  
Check if a string can be converted to float  
Check if a letter/character is in a string  
Extract text/check specific text from multiple powerpoint files  
Add a new slide into an existing ppt, or work on existing slides, check the existence of a pptx file, if does not exist then create it  
Compare/check if two text files have the same contents  
Check existence of phrase on text file line-by-line  
from keyboard import is_pressed (Esc, check pressed key)  
Check and drop negative from dataframe pandas  
Check (difference) whether or not a cell value in a column of a CSV file Matchs a value in a column of another CSV file, then do something: e.g. add a value to another column of a csv file   
File name, folder name. {}{}....format. Manipulation of file and folder names (rename file name and folder name): i) Check and create a new folder and then copy all files from a folder to the new folder and rename the file, and then open the file. If the folder exists, then no file will be copied, but the file will still be opened. ii) Print and export the folder names and file names (with or without extensions) from a folder into a text file. iii) csv2image filename.  
Check if CSV cell value is NaN  
Check if a CSV file contains all of the specified strings  
   
CSV  
Convert between rows and columns from csv: Convert resulting row from CSV search into a column.  
Convert CSV to images, row-by-row, with pixel values: each row is an image  
Heatmap with input from a csv/pkl file  
Print all values cell by cell in order of row and column in the csv file  
Replace/change to new headers in a csv file  
Remove duplicate cell values from a csv file/dataframe (e.g. keeping the first/top one; drop_duplicates(); .duplicated(); .get_option(); .set_option(); keep='first'/keep='last'; display.max_rows; display.max_columns)  
Skip rows and/or columns in csv  
Data cleaning examples in csv files  
Skip/remove empty rows (row-by-row) in DataFrame/csv  
Convert a CSV file to a JSON file  
csv workflow: Read into dataframeSelect a specific column from DataFrame, Select several specific columns to plot 
Change/convert a colored image to a grey image(, and then show pixel values). cv2, cv2, cv2/skimage. cv2/skimage. PIL. matplotlib.
Convert a CSV file to a TXT file  
Multiple headers in a csv file: Count the number of header rows first and then split a single csv file to multiple csv files  
Change/rename a column name/header in a CSV file  
Delete the column/row in a CSV file if they are empty or less than a number (or header/index only)  
Read specific cells (cell by cell) in csv file  
Create CSV files (e.g. with headers only)  
CSV column transposer (rows/columns)  
Input a sentence and then output a sentence based on a dictionary obtained from csv  
Creates a dictionary from a csv file  
Skip/replace empty cells/NaN value from DataFrame/CSV file  
Trick: Output a portion of rows and columns from a csv file cell by cell into another csv file  
Nearest/most similar lyrics of a sentence/text to a CSV file  
Write special/certain rows (row-by-row) of one csv file to another csv file  
Convert csv/dataframe column to a list or vice versa  
Plot graph/figure/image from CSV file/DataFrame by removing/hiding blank/empty cells with axis range (plt.xlim())  
Plot graph/figure/image from CSV file  
Creates a dictionary from a csv file  
Correlations/similarity/dissimilarity/pair/match of two columns in csv data  
Put the keywords in a grouped string into the first available cells in the corresponding columns in a csv file  
Separately plot data into the same graph/figure/image from different csv files for each category (import multiple CSV files and concatenate into one DataFrame): append row-by-row or column-by-column  
Convert a csv column to a string seperated by comma  
cv2.imwrite:: Save images  
names: Names in headers of csv files code. code
.groupby(): sort/group columns. (code). CSV: (code)
quoting: Set quoting rules as in csv module (default csv.QUOTE_MINIMAL)  
cv2.imread(/path/to/image, flag): A method loads an image from the specified file. If the image cannot be read (because of missing file, improper permissions, unsupported or invalid format) then this method returns an empty matrix. imread() decodes the image into a matrix with the color channels stored in the order of Blue, Green, Red and A (Transparency) respectively: (:, :, 0) represents Blue channel; (:, :, 1) represents Green channel; (:, :, 2) represents Red channel; (:, :, 3) represents Transparency channel. The flag is optional. code. code. code. code.
cv2.IMREAD_GRAYSCALE: Reads the image as grey image. If the source image is color image, grey value of each pixel is calculated by taking the average of color channels. = 0, code.
   
DataFrame workflow: Drop/delete rows with empty cells in a column, Sort DataFrame by time/date order
   
Electrical circuit simulations  
NgSpice/PySpice  
Switches simulations  
Diodes simulations  
Plot workflow: Create new empty column in DataFrameMove the cells in a column to another column under certain conditionSelect specific columns for scatter plot
inplace=True Change the items permanently. (code). (code).
   
columns= (code). (code).
   
   
   
delim_whitespace Parse whitespace-delimited (spaces or tabs) file (much faster than using a regular expression)
compression decompress ’gzip’ and ’bz2’ formats on the fly. Set to ’infer’ (the default) to guess a format based on the file extension.
   
dtype A data type name or a dict of column name to data type. If not specified, data types will be inferred.
(Unsupported with engine=’python’)
header= Whether to write out the column names (default True). Introduction. (code). Row number(s) to use as the column names, and the start of the data. Defaults to 0 if no names passed, otherwise None. Explicitly pass header=0 to be able to replace existing names. The header can be a list of integers that specify row locations for a multi-index on the columns E.g. [0,1,3]. Intervening rows that are
not specified will be skipped (e.g. 2 in this example are skipped). Note that this parameter ignores commented lines and empty lines if skip_blank_lines=True (the default), so header=0 denotes the first line of data rather than the first line of the file.
skip_blank_lines whether to skip over blank lines rather than interpreting them as NaN values
skiprows A collection of numbers for rows in the file to skip. Can also be an integer to skip the first n rows
index_col column number, column name, or list of column numbers/names, to use as the index (row labels) of the resulting DataFrame. By default, it will number the rows without using any column, unless there is one more data column than there are headers, in which case the first column is taken as the index.
names List of column names to use as column names. To replace header existing in file, explicitly pass header=0.
 

 

true_values list of strings to recognize as True
false_values list of strings to recognize as False
keep_default_na whether to include the default set of missing values in addition to the ones specified in na_values
parse_dates if True then index will be parsed as dates (False by default). You can specify more complicated
options to parse a subset of columns or a combination of columns into a single date column (list of ints or names, list of lists, or dict) [1, 2, 3] -> try parsing columns 1, 2, 3 each as a separate date column [[1, 3]] -> combine columns 1 and 3 and parse as a single date column {‘foo’ : [1, 3]} -> parse columns 1, 3 as date and call result ‘foo’
keep_date_col if True, then date component columns passed into parse_dates will be retained in the output (False by default).
date_parser function to use to parse strings into datetime objects. If parse_dates is True, it defaults to the very robust dateutil.parser. Specifying this implicitly sets parse_dates as True. You can also use functions from community supported date converters from date_converters.py
.to_datetime() Change data format. (code)
dayfirst if True then uses the DD/MM international/European date format (This is False by default)
thousands specifies the thousands separator. If not None, this character will be stripped from numeric dtypes. However, if it is the first character in a field, that column will be imported as a string. In the PythonParser, if not None, then parser will try to look for it in the output and parse relevant data to numeric dtypes. Because it has to essentially scan through the data again, this causes a significant performance hit so only use if necessary.
lineterminator string (length 1), default None, Character to break file into lines. Only valid with C parser
quotechar string, The character to used to denote the start and end of a quoted item. Quoted items can include the delimiter and it will be ignored.
 

 

skipinitialspace boolean, default False, Skip spaces after delimiter
escapechar string, to specify how to escape quoted data
comment

Indicates remainder of line should not be parsed. If found at the beginning of a line, the line will be ignored altogether. This parameter must be a single character. Like empty lines, fully commented lines are ig-
nored by the parameter header but not by skiprows. For example, if comment=’#’, parsing ‘#emptyn1,2,3na,b,c’ with header=0 will result in ‘1,2,3’ being treated as the header.

.value_counts() .value_counts(normalize=False, sort=True, ascending=False, bins=None, dropna=True). (code) (code)
skip_footer number of lines to skip at bottom of file (default 0) (Unsupported with engine=’c’)
confirm() confirm(text='', title='', buttons=['OK', 'Cancel']) (code)
converters a dictionary of functions for converting values in certain columns, where keys are either integers
or column labels
encoding a string representing the encoding to use for decoding unicode data, e.g. ’utf-8‘ or ’latin-1’. Full list of Python standard encodings
verbose show number of NA values inserted in non-numeric columns
squeeze if True then output with only one column is turned into Series
error_bad_lines if False then any lines causing an error will be skipped bad lines
usecols skip column. Only store the columns which are need so that a subset of columns is returned, resulting in much faster parsing time and lower memory usage. code. code. code. code.
mangle_dupe_cols boolean, default True, then duplicate columns will be specified as ‘X.0’...’X.N’, rather than ‘X’...’X’
tupleize_cols boolean, default False, if False, convert a list of tuples to a multi-index of columns, otherwise, leave the column index as a list of tuples
float_precision

string, default None. Specifies which converter the C engine should use for floating-point values. The options are None for the ordinary converter, ‘high’ for the high-precision converter, and ‘round_trip’ for the round-trip converter.

   
path_or_buf A string path to the file to write or a StringIO
sep Field delimiter for the output file (default ”,”)
na_rep A string representation of a missing value (default ‘’)
float_format Format string for floating point numbers
cols Columns to write (default None)
index whether to write row (index) names (default True)
index_label

Column label(s) for index column(s) if desired. If None (default), and header and index are True, then the index names are used. (A sequence should be given if the DataFrame uses MultiIndex).

mode Python write mode, default ‘w’
encoding a string representing the encoding to use if the contents are non-ASCII, for python versions prior to 3
line_terminator Character sequence denoting line end (default ‘\n’)
   
quotechar Character used to quote fields (default ‘”’)
doublequote Control quoting of quotechar in fields (default True)
escapechar Character used to escape sep and quotechar when appropriate (default None)
chunksize Number of rows to write at a time
   
date_format Format string for datetime objects
   
   
 

 

   
   
   
   
lineterminator code.
   
describe() Print statistic summary of the data. (code)
import pandas as pd code.
skiprows code. code. code.
   
skipfooter skip rows from bottom. code.
header skip header. code. code. code. code.
engine code.
   
skiprows = lambda x: code. code. code.
index_col Skip column index. code. code. code.
   
.fillna() Replace empty cells with anything. (code)
drop() (code)(code)
   
confusion_matrix (code). (code)
click() .click() function is just a convenient wrapper around these two .mouseDown() and .mouseUp() function calls. click() without parameters gives a single, left-button mouse click at the mouse’s current position; click(x, y) calls moveTo() before the click. 'left', 'middle', and 'right' specify a different mouse button. (code)
.clear()
Delete all the dictionary's key-value pairs. General.
__class__  
__class_getitem__  
clear  
copy  
__ceil__  
__class__  
count  
conjugate  
math.ceil() The ceiling of a given number is the nearest integer greater than or equal to that number. For example, the ceiling of 4.568 is 5. Code
math.ceil()  
math.cos()  
math.copysign(x, y) Copy sign: The sign of the second argument is returned along with the result on the execution of this function. x: Integer value to be converted, y: Integer whose sign is required. Example code
math.cosh()  
case_sensitive=True (code)
Integer/fractions/round /decimal/digits/floating
/ceil/floor
It does not have any fractional part. Introduction. int: Example code.
Complex It can store real and imaginary parts
Conversions
Cast, or convert a variable from one type to another. Input() always stores a string, even if the value inputted is a number. Casting = temporarily converting a value to another type. There could be loss of precision: i.e. int(1.5) turns it into 1. code.
int() Converts a float number or a string to an integer, cast the number. code1
float() Returns a floating point number constructed from a number or string
str() Introduction. Returns a string which is fairly human readable. code.
"str()" and "," difference (code)
chr() Convert an integer to a string of one character whose ASCII code is same as the integer. Introduction.
complex() Print a complex number with the value real + imag*j or convert a string or number to a complex number
ord() Returns an integer representing Unicode code point for the given Unicode character. code. code
hex() Convert an integer number (of any size) to a lowercase hexadecimal string prefixed with “0x”
oct() Convert an integer number (of any size) to an octal string prefixed with “0o”
.convert() Image.convert(mode=None, matrix=None, dither=None, palette=0, colors=256). Dither: Dithering method, used when converting from mode “RGB” to “P” or from “RGB” or “L” to “1”. Available methods are NONE or FLOYDSTEINBERG (default). code. code.
 
capitalize() (Code) Returns a copy of the original string and converts the first character of the string to a capital (uppercase) letter while making all other characters in the string lowercase letters. code. code.
os.chdir code
ctypes Code. Code.
ctypes.windll.user32.MessageBoxW Code. Code.
shutil.copyfileobj code.
shutil.copy() (code)
.correlate2d code. code.
Correlate1D() Performs a 1D correlation using Fourier transforms.
Correlate2D Performs a 2D correlation using Fourier transforms and uses ft.fft2d and ft.ifft2d.
Correlate2DF Can be is used in cases where the input and filter are already in Fourier space, and can also be used to finish the correlation computation between the inputs and
filter. Code.
conjugate( ) Code.
ConfigParser Manipulate data and manage user-editable configuration files for an application. The configuration files are organized into sections, and each section can contain name-value pairs for configuration dat
scipy.linalg.circulant Create a circulant matrix.
scipy.linalg.companion Create a companion matrix.
scipy.linalg.convolution_matrix Create a convolution matrix.
linalg.cholesky(a) Cholesky decomposition.
linalg.cond(x[, p]) Compute the condition number of a matrix.
command Introduction. code. code.
cmap=plt.cm.gray code.
__call__/method-wrapper name/type: implementation of the () operator; a.k.a. the callable object protocol
__closure__/tuple name/type: the function closure, i.e. bindings for free variables (often is None)
__code__/code name/type: function metadata and function body compiled into bytecode
skimage.measure.compare_mse(im1, im2) Compute the mean-squared error between two images.
skimage.measure.compare_nrmse(im_true, im_test) Compute the normalized root mean-squared error (NRMSE) between two images.
skimage.measure.compare_psnr(im_true, im_test) Compute the peak signal to noise ratio (PSNR) for an image.
skimage.measure.correct_mesh_orientation(...) Correct orientations of mesh faces.
skimage.measure.CircleModel() Total least squares estimator for 2D circles.
compare_ssim(X, Y[, ...]), or skimage.measure.compare_ssim(X, Y[, ...])
Is a function from scikit-image, a score (structural similarity index between the two input images. Compute the mean structural similarity index between two images. This value can fall into the range [-1, 1] with a value of one being a “perfect match”) and difference image can be calculated. code.
import clipboard (code)
Chainer

Is a competitor to Hebel. It aims at increasing the flexibility of deep learning models. The three key focus areas of chainer include :
a. Transportation system: The makers of Chainer have consistently shown an inclination towards automatic driving cars and they have been in talks with Toyota Motors about the same.
b. Manufacturing industry: From object recognition to optimization, Chainer has been used effectively for robotics and several machine learning tools.
c. Bio-health care: To deal with the severity of cancer, the makers of Chainer have invested in research of various medical images for early diagnosis of cancer cells.

v2.rectangle(image, start_point, end_point, color of border line, border thickness) border. Compute the bounding box of the contour and then draw the bounding box on an image to represent where the ROI is. code. code. code.
cv2.circle() cv2.circle(image, center_coordinates, radius, color, thickness). (code). code. code.
cv2.EVENT_FLAG_LBUTTON Mouse callback function with a single left click. code.
cv2.EVENT_LBUTTONDOWN Mouse callback function with a single left click. code. (code)
cv2.EVENT_FLAG_MBUTTON Mouse callback function with a single left click. code.
cv2.EVENT_LBUTTONUP Mouse callback function with a single left click. code.
cv2.EVENT_LBUTTONDBLCLK Mouse callback function with double left clicks. code.
cv2.EVENT_RBUTTONDOWN Mouse callback function with a single right click. code.
cv2.EVENT_RBUTTONUP Mouse callback function with a single right click. code.
cv2.EVENT_FLAG_RBUTTON Mouse callback function with a single right click. code.
cv2.EVENT_FLAG_CTRLKEY Mouse callback function with double right clicks. code.
cv2.EVENT_MBUTTONDOWN Mouse callback function with the single middle mouse click. code.
cv2.EVENT_MBUTTONUP Mouse callback function with the single middle mouse click. code.
cv2.EVENT_MOUSEMOVE Mouse move. code.
cv2.matchTemplate Introduction. Returns a correlation map, essentially a grayscale image. Other than contour filtering, matching keypoints, contour detection and processing (with thresholding, edge detection, etc. to generate a binary image), template matching is arguably one of the most simple forms of object detection (only 2-3 lines of code), which can detect multiple instances of the same/similar object in an input image. This method quickly fails when there are unknown changes of rotation, scale, viewing angle, etc. In those cases, you should use dedicated object detectors including HOG + Linear SVM, Faster R-CNN, SSDs, YOLO, etc. code. code. code. code. code.
Limitations: The matching can fail (if there is no special treatments in the script) if the size of the template is substantially smaller than the feature in the image being searched.
cv2.Canny()/Canny filter Introduction. Canny Edge Detection is a popular edge detection algorithm. This detection is susceptible to noise in the image, so that first step is to remove the noise in the image with a 5x5 Gaussian filter. Code. code. code.
cv2.TM_SQDIFF() method=CV_TM_SQDIFF
cv2.TM_SQDIFF_NORMED method=CV_TM_SQDIFF_NORMED
cv2.TM_CCORR method=CV_TM_CCORR
cv2.TM_CCORR_NORMED method=CV_TM_CCORR_NORMED
cv2.TM_CCOEFF_NORMED() method=CV_TM_CCOEFF_NORMED
The third parameter here is the method used for matching. code, code. code.
cv2.TM_CCOEFF method=CV_TM_CCOEFF
cv2.add code.
   
cv2.resize Resizing does only change the width and height of the image. code.
cv2.waitKey(0) Will display the window infinitely until any keypress (it is suitable for image display). Therefore, if you use waitKey(0) you see a still image until you actually press something. code. code. code. code.
cv2.setMouseCallback Mouse clicks: introduction. code. code.
cv2.destroyAllWindows() Simply destroys all the windows we created. code. code.
cv2.destroyWindow() To destroy any specific window with the exact window name.
cv2.imshow A method is used to display an image in a window. The window automatically fits to the image size. First argument is a window name which is a string. Second argument is our image. code. code. Code.
cv2.cvtColor() Is used to convert an image from one color space to another. code.
cv2.COLOR_BGR2GRAY code.
cv2.THRESH_BINARY If pixel intensity is greater than the set threshold, value set to 255, else set to 0 (black). code. code
cv2.THRESH_BINARY_INV Inverted or Opposite case of cv2.THRESH_BINARY. code. code
cv2.line() Draw a line in a image. code
cv2.arrowedLine() cv2.arrowedLine(image, start_point, end_point, color[, thickness[, line_type[, shift[, tipLength]]]]) is used to draw arrow segment pointing from the start point to the end point. The parameters of the cv2.arrowedLine function are the same as those for cv2.line. code.
cv2.putText()

cv2.putText(image, text, org, font, fontScale, color[, thickness[, lineType[, bottomLeftOrigin]]]) is used to draw a text string on any image. The font types are FONT_HERSHEY_SIMPLEX = 0, FONT_HERSHEY_PLAIN = 1, FONT_HERSHEY_DUPLEX = 2, FONT_HERSHEY_COMPLEX = 3, FONT_HERSHEY_TRIPLEX = 4, FONT_HERSHEY_COMPLEX_SMALL = 5, FONT_HERSHEY_SCRIPT_SIMPLEX = 6, FONT_HERSHEY_SCRIPT_COMPLEX = 7, and FONT_ITALIC = 16. The thickness of the line is in pixel. lineType: This is an optional parameter.It gives the type of the line to be used. bottomLeftOrigin: This is an optional parameter. When it is true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner. code. (code)

cv2.namedWindow code.
cv2.moveWindow Set the position (coordinates) of the opened window. code.
cv.THRESH_TRUNC If pixel intensity value is greater than threshold, it is truncated to the threshold. The pixel values are set to be the same as the threshold. All other values remain the same. code. code
cv.THRESH_TOZERO Pixel intensity is set to 0, for all the pixels intensity, less than the threshold value. code. code
cv.THRESH_TOZERO_INV Inverted or Opposite case of cv2.THRESH_TOZERO. code. code
v2.rectangle(image, start_point, end_point, color of border line, border thickness) border. Compute the bounding box of the contour and then draw the bounding box on an image to represent where the ROI is. code. code. code.
Get dimensions (sizes) of image:
dimensions = img.shape
Get height, width, number of channels in image
height = img.shape[0]
width = img.shape[1]
channels = img.shape[2]
General, code. code. code. code. code. code.
Split a list into columns Introduction
Colors

cmaps['Perceptually Uniform Sequential'] = ['viridis', 'plasma', 'inferno', 'magma', 'cividis']
cmaps['Sequential'] = ['Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds', 'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu', 'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn']
cmaps['Sequential (2)'] = ['binary', 'gist_yarg', 'gist_gray', 'gray', 'bone', 'pink', 'spring', 'summer', 'autumn', 'winter', 'cool', 'Wistia', 'hot', 'afmhot', 'gist_heat', 'copper']
cmaps['Diverging'] = [ 'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu', 'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']
cmaps['Cyclic'] = ['twilight', 'twilight_shifted', 'hsv']
cmaps['Qualitative'] = ['Pastel1', 'Pastel2', 'Paired', 'Accent', 'Dark2', 'Set1', 'Set2', 'Set3',
'tab10', 'tab20', 'tab20b', 'tab20c']
cmaps['Miscellaneous'] = ['flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern', 'gnuplot', 'gnuplot2', 'CMRmap', 'cubehelix', 'brg', 'gist_rainbow', 'rainbow', 'jet', 'turbo', 'nipy_spectral', 'gist_ncar']. code

matplotlib.cbook (code) (code)
va='center' code.
   
   
Caffe2 Is a Lightweight, Modular, and Scalable Deep Learning Framework. It aims to provide an easy and straightforward way for you to experiment with deep learning.
random.choice() Randomly select from options. (code)
t.circle()

turtle.circle(radius, extent=None, steps=None). radius – a number; extent – a number (or None); steps – an integer (or None). (code)

.color() (code)
Collections of geometric shape (code)
GetKeyState(VK_CAPITAL) Caps Lock, .press("capslock"). (code).
from pynput.mouse import Controller (code)
.click(Button.left, x) x clicks of mouse. (code)
.locateCenterOnScreen() x, y = MySearch_img to get the x- and y-coordinates of centers of the feature. (code)
.getAllTitles() Get all the Python program windows, *IDLE Shell window, e.g. *IDLE Shell 3.9.5, the most front window on Dreamweaver, the most front webpage on each Chrome window, the name of each opened applications, e.g. DigitalMicrograph. Introduction
confidence= (code), (code), (code).
.configure() (code)
   
.copy() Copy text. (code)
CountVectorizer() Introduction. It is the bag of words technique, which means counting how many times each word appears and puts them into a vector.
cross_val_score (code).
from collections import defaultdict (code).
CBW model (for training) (code)
driver.current_window_handle <Instruction>
Cm Inches, Emu, Cm, Mm, Pt, and Px are base class for length classes, providing properties for converting length values to convenient units.
.pixelMatchesColor() Introduction
from pptx.chart.data import ChartData: ChartData() (code)
.categories (code)
.chart (code)
bokeh.plotting.figure.circle()

The circle() function in plotting module of bokeh library is used to Configure and add Circle glyphs to a figure.
Syntax: circle(x, y, *, angle=0.0, angle_units=’rad’, fill_alpha=1.0, fill_color=’gray’, line_alpha=1.0, line_cap=’butt’, line_color=’black’, line_dash=[], line_dash_offset=0, line_join=’bevel’, line_width=1, name=None, radius=None, radius_dimension=’x’, radius_units=’data’, size=4, tags=[], **kwargs)
Parameters: This method accept the following parameters that are described below:
x: This parameter is the x-coordinates for the center of the markers.
y: This parameter is the y-coordinates for the center of the markers.
angle: This parameter is the angles to rotate the markers.
fill_alpha: This parameter is the fill alpha values for the markers.
fill_color: This parameter is the fill color values for the markers.
line_alpha: This parameter is the line alpha values for the markers with default value of 1.0 .
line_cap: This parameter is the line cap values for the markers with default value of butt.
line_color: This parameter is the line color values for the markers with default value of black.
line_dash: This parameter is the line dash values for the markers with default value of [].
line_dash_offset: This parameter is the line dash offset values for the markers with default value of 0.
line_join: This parameter is the line join values for the markers with default value of bevel.
line_width: This parameter is the line width values for the markers with default value of 1.
mode: This parameter can be one of three values : [“before”, “after”, “center”].
name: This parameter is the user-supplied name for this model.
tags: This parameter is the user-supplied values for this model.
radius: This parameter is the radius values for circle markers .
radius_dimension: This parameter is the dimension to measure circle radii along.
size: This parameter is the size (diameter) values for the markers in screen space units.
alpha: This parameter is used to set all alpha keyword arguments at once.
color: This parameter is used to to set all color keyword arguments at once.
legend_field: This parameter is the name of a column in the data source that should be used or the grouping.
legend_group: This parameter is the name of a column in the data source that should be used or the grouping.
legend_label: This parameter is the legend entry is labeled with exactly the text supplied here.
muted: This parameter contains the bool value.
name: This parameter is the optional user-supplied name to attach to the renderer.
source: This parameter is the user-supplied data source.
view: This parameter is the view for filtering the data source.
visible: This parameter contains the bool value.
x_range_name: This parameter is the name of an extra range to use for mapping x-coordinates.
y_range_name: This parameter is the name of an extra range to use for mapping y-coordinates.
level: This parameter specify the render level order for this glyph.
Introduction

   
Image overlap. Code. copy method
Template matching: a technique for finding areas of an image that are similar to a patch (template). Patch are small images with a certain feature. The goal of template matching is to find and/or highlight the patch/template in an image.
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.
   
Computing equations and formulas with Python Examples. Numerical integration at code.
Prevent other applications to modify the content until other Python script runs code.
Choose a file with simple dialog. Code. code. code. With a default folder: code1 and code2. .
Open webpages in internet browsers (Chrome, Microsoft edge, IE browser) Introduction
Open an image to file from URL (webpage), then it can be saved in PC (computer) code, code. open with color changed.
Copy images to a different folder/Save an image in a new folder code, code. code. code.
Set the output image to zero everywhere except my mask (color filter), and display red, green, and blue (RGB) channels of an image. code, code.
Compute the difference between two images by using Structural Similarity Index with "pip install --upgrade imutils" code. code