Python Code Snippets

PspptReader

This is an example of reading a PS-PPT file and plotting a force image. An …

import pspylib.ppt.tools as Tools import pspylib.ppt.defines as Defines from pspylib.ppt.reader …
Data Augmentation (Height Distortion: Fluctuation)

It is expected that the data can be used for augmentation in neural network training.

import numpy as np def _slinedata(np_array): """ Used when sum …
Data Augmentation (Height Distortion: Tip Damage)

It is expected that the data can be used for augmentation in neural network training.

import numpy as np def _slinedata(np_array): """ Used when sum …
Data Augmentation (Height Distortion: Sample Slope)

It is expected that the data can be used for augmentation in neural network training.

import numpy as np def _mlinedata(np_array): """ Used when mulitply …
image scan (NCM)

Code implemented to operate according to the sequence for acquiring NCM images. Default parameters are …

from time import sleep from glob import glob from json …
Control Head mode

[set] Head Mode Change SLD On/Off [get] sld on/off mode type pspd align [dependency] - …

from SmartRemote import SmartRemote class HeadMode: def __init__(self, SR:SmartRemote): self.__sr …
Image Acquisition Code for Cantilever Training Model

Sample: The specimen to be measured (if too close, sample color may mix with the …

import numpy as np from SmartRemote import SmartRemote as SR …
Flatten the grating sample

Code that uses K-Means clustering to split the Top and Bottom regions and performs line …

import os import warnings import numpy as np import matplotlib.pyplot …
Calculate the region histogram range

Code to calculate the height of a grating sample with two regions. [dependency] - numpy …

import os import warnings import numpy as np from sklearn.cluster …
3d plot tiff

Visualize the TIFF image as a 3D plot. [dependency] - numpy - matplotlib - pspylib

import os import numpy as np import matplotlib.pyplot as plt …
plot tiff

Adjust the color map range to make the TIFF visualization look better. [dependency] - numpy …

import os import numpy as np import matplotlib.pyplot as plt …
Set Data location

Set the save location for TIFF files measured by SmartScan. [dependency] - SmartRemote

from json import dumps from SmartRemote import SmartRemote class DataLocation: …
Start NCM Sweep

Code that performs an NCM Sweep

from SmartRemote import SmartRemote class NCMSweep: def __init__(self, SR:SmartRemote): self.__sr …
Add and delete bulk channels

Code to add or remove channel data displayed in the line profile. [dependency] - SmartRemote

from json import dumps from SmartRemote import SmartRemote class ControlBulkChannel: …
Control the Z Scanner

[set] You can retract the Z Scanner or adjust its operating range. [get] You can …

from SmartRemote import SmartRemote class ControlZScanner: def __init__(self): self.__sr = …