Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6467ebcba0 | |||
| 14f7f5c6ac | |||
| a5d767baeb | |||
| 6cd2d6f356 | |||
| e9b87ae2c6 | |||
| a3492c10f3 | |||
| ab9fd59148 | |||
| 7ddeb3e505 | |||
| 7405c7104c |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
AFM_thumbs/__pycache__/
|
||||||
|
|
||||||
@@ -40,6 +40,14 @@
|
|||||||
# First git visibility : 2022/04/08, Clemens Barth
|
# First git visibility : 2022/04/08, Clemens Barth
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
# 2022/12/09
|
||||||
|
# ==========
|
||||||
|
# - Nanonis files: ISO-8859-1 decoding implemented (reading
|
||||||
|
# the header)
|
||||||
|
# - Nanonis - Multipass mode: first code lines inserted.
|
||||||
|
# Still to be done: title with "[Px]_" identifier for each
|
||||||
|
# image => This needs to be done in Channel.py.
|
||||||
|
#
|
||||||
# 2022/04/08
|
# 2022/04/08
|
||||||
# ==========
|
# ==========
|
||||||
# - First upload of AFM_thumbs.py onto our git server.
|
# - First upload of AFM_thumbs.py onto our git server.
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ from AFM_thumbs.Variables import globvar_color_dict
|
|||||||
from AFM_thumbs.Variables import globvar_spaces
|
from AFM_thumbs.Variables import globvar_spaces
|
||||||
|
|
||||||
|
|
||||||
|
# _________________________________________________________________ Definitions
|
||||||
|
|
||||||
def rename_channel(name):
|
def rename_channel(name):
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ def linalg_line_fit(size_x, size_y, data):
|
|||||||
xy = sum(line*x_vec)
|
xy = sum(line*x_vec)
|
||||||
|
|
||||||
B = scipy.mat([[xy],[y]])
|
B = scipy.mat([[xy],[y]])
|
||||||
c,resid,rank,sigma = linalg.lstsq(M,B)
|
c, resid, rank, sigma = linalg.lstsq(M, B)
|
||||||
|
|
||||||
plane.append([i * c[0][0] + c[1][0] for i in range(size_x)])
|
plane.append([i * c[0][0] + c[1][0] for i in range(size_x)])
|
||||||
|
|
||||||
@@ -198,7 +198,12 @@ def check_image_properties(data, data_file):
|
|||||||
|
|
||||||
list_nans = np.where(np.isnan(data))[0]
|
list_nans = np.where(np.isnan(data))[0]
|
||||||
data_clean = np.delete(data, list_nans)
|
data_clean = np.delete(data, list_nans)
|
||||||
data_mean = np.mean(data_clean)
|
|
||||||
|
# If all pixels are on NaN, then put the mean value onto 0.0.
|
||||||
|
if len(list_nans) == len(data):
|
||||||
|
data_mean = 0.0
|
||||||
|
else:
|
||||||
|
data_mean = np.mean(data_clean)
|
||||||
|
|
||||||
for nan in list_nans:
|
for nan in list_nans:
|
||||||
data[nan] = data_mean
|
data[nan] = data_mean
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import chardet
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from AFM_thumbs.Variables import globvar_AFMdata
|
from AFM_thumbs.Variables import globvar_AFMdata
|
||||||
@@ -48,6 +49,22 @@ from AFM_thumbs.Channel import plane_fit
|
|||||||
from AFM_thumbs.Channel import rename_channel
|
from AFM_thumbs.Channel import rename_channel
|
||||||
|
|
||||||
|
|
||||||
|
# ___________________________________________________________________ Constants
|
||||||
|
|
||||||
|
|
||||||
|
# This is used for checking the channels in the 'Multipass mode'.
|
||||||
|
multi_pass_ident = ["[P1]_",
|
||||||
|
"[P2]_",
|
||||||
|
"[P3]_",
|
||||||
|
"[P4]_",
|
||||||
|
"[P5]_",
|
||||||
|
"[P6]_",
|
||||||
|
"[P7]_",
|
||||||
|
"[P8]_",
|
||||||
|
"[P9]_",
|
||||||
|
"[P10]_"]
|
||||||
|
|
||||||
|
|
||||||
# _________________________________________________________________ Definitions
|
# _________________________________________________________________ Definitions
|
||||||
|
|
||||||
def is_SPECS_Nanonis_file(directory, files):
|
def is_SPECS_Nanonis_file(directory, files):
|
||||||
@@ -76,14 +93,17 @@ def is_SPECS_Nanonis_file(directory, files):
|
|||||||
# an .sxm into the parameter class of AFM_thumbs.
|
# an .sxm into the parameter class of AFM_thumbs.
|
||||||
def read_SPECS_Nanonis_image_data(nanonis_file):
|
def read_SPECS_Nanonis_image_data(nanonis_file):
|
||||||
|
|
||||||
# # Print the entire header.
|
# Debug: Print the entire header.
|
||||||
# nanonis_file_path = os.path.join(globvar_AFMdir.working_directory, nanonis_file)
|
FLAG_debug = False
|
||||||
# nanonis_file_p = open(nanonis_file_path, "rb")
|
if FLAG_debug:
|
||||||
# line = ""
|
nanonis_file_path = os.path.join(globvar_AFMdir.working_directory, nanonis_file)
|
||||||
# while line!=b':SCANIT_END:':
|
nanonis_file_p = open(nanonis_file_path, "rb")
|
||||||
# line = nanonis_file_p.readline().rstrip()
|
line = ""
|
||||||
# print(line)
|
while line!=b':SCANIT_END:':
|
||||||
# nanonis_file_p.close()
|
line = nanonis_file_p.readline().rstrip()
|
||||||
|
print(line)
|
||||||
|
nanonis_file_p.close()
|
||||||
|
exit(-1)
|
||||||
|
|
||||||
initialize_AFM_data()
|
initialize_AFM_data()
|
||||||
|
|
||||||
@@ -97,7 +117,15 @@ def read_SPECS_Nanonis_image_data(nanonis_file):
|
|||||||
list_line = []
|
list_line = []
|
||||||
while line_!=b':SCANIT_END:':
|
while line_!=b':SCANIT_END:':
|
||||||
line_ = nanonis_file_p.readline().rstrip()
|
line_ = nanonis_file_p.readline().rstrip()
|
||||||
list_line.append(line_.decode("utf-8"))
|
|
||||||
|
# If it is a special standard, like ISO-8859-1, then treat
|
||||||
|
# it as such.
|
||||||
|
encoding = chardet.detect(line_)['encoding']
|
||||||
|
if encoding == "ISO-8859-1":
|
||||||
|
line_ = line_.decode("iso-8859-1")
|
||||||
|
list_line.append(line_)
|
||||||
|
else:
|
||||||
|
list_line.append(line_.decode("utf-8"))
|
||||||
|
|
||||||
# Offset position of the data inside the sxm file. It is said that these
|
# Offset position of the data inside the sxm file. It is said that these
|
||||||
# are normally 4 bytes after the identifier ':SCANIT_END:'. However,
|
# are normally 4 bytes after the identifier ':SCANIT_END:'. However,
|
||||||
@@ -124,6 +152,7 @@ def read_SPECS_Nanonis_image_data(nanonis_file):
|
|||||||
globvar_AFMdata.date += ", " + line
|
globvar_AFMdata.date += ", " + line
|
||||||
if ":SCAN_FILE:" in list_line[i]:
|
if ":SCAN_FILE:" in list_line[i]:
|
||||||
i += 1
|
i += 1
|
||||||
|
#print(list_line[i])
|
||||||
line = list_line[i].rstrip().strip()
|
line = list_line[i].rstrip().strip()
|
||||||
globvar_AFMdata.datfile = [line]
|
globvar_AFMdata.datfile = [line]
|
||||||
if ":SCAN_RANGE:" in list_line[i]:
|
if ":SCAN_RANGE:" in list_line[i]:
|
||||||
@@ -229,6 +258,10 @@ def read_SPECS_Nanonis_image_data(nanonis_file):
|
|||||||
if channel_name in channels_not_supported:
|
if channel_name in channels_not_supported:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# For the "Multipass mode": Cut the '[Px]_' prefix.
|
||||||
|
if channel_name[:5] in multi_pass_ident:
|
||||||
|
channel_name = channel_name[5:]
|
||||||
|
|
||||||
# Assign the correct channel names
|
# Assign the correct channel names
|
||||||
if channel_name == "Current":
|
if channel_name == "Current":
|
||||||
channel_name = "I"
|
channel_name = "I"
|
||||||
|
|||||||
@@ -24,6 +24,10 @@
|
|||||||
# DO NOT REMOVE THIS PREAMBLE !!!
|
# DO NOT REMOVE THIS PREAMBLE !!!
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@@ -47,27 +51,33 @@ globvar_configfile_path = "./AFM_thumbs/"
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# _____________________________________________________________________ to here
|
# _____________________________________________________________________ to here
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
|
# ____________________________________________________________ Git hash version
|
||||||
|
|
||||||
|
# Get the git hash version
|
||||||
|
def get_git_revision(base_path):
|
||||||
|
|
||||||
|
git_dir = pathlib.Path(base_path) / '.git'
|
||||||
|
|
||||||
|
with (git_dir / 'HEAD').open('r') as head:
|
||||||
|
ref = head.readline().split(' ')[-1].strip()
|
||||||
|
with (git_dir / ref).open('r') as git_hash:
|
||||||
|
return git_hash.readline().strip()
|
||||||
|
|
||||||
|
|
||||||
# ____________________________________________________________ Global variables
|
# ____________________________________________________________ Global variables
|
||||||
|
|
||||||
# DO NOT CHANGE ANYTHING BELOW, OTHERWISE YOU KNOW WHAT TO DO !
|
# DO NOT CHANGE ANYTHING BELOW, OTHERWISE YOU KNOW WHAT TO DO !
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
globvar_contributions = "Reinhard Olbrich (testing)\n" \
|
globvar_contributions = "Reinhard Olbrich (testing)\n" \
|
||||||
"Matthias Temmen (testing)\n" \
|
"Matthias Temmen (testing)\n" \
|
||||||
"Alexander v Schmidtsfeld (testing)\n" \
|
"Alexander v Schmidtsfeld (testing)\n" \
|
||||||
"..."
|
"..."
|
||||||
|
|
||||||
globvar_year = "2022-04-09"
|
globvar_year = "2023-04-26"
|
||||||
globvar_version = "3.0.0"
|
globvar_version = "3.0.1111"
|
||||||
|
globvar_git_version = get_git_revision(os.path.join(os.path.dirname(__file__), "../"))
|
||||||
|
|
||||||
globvar_spaces = " "
|
globvar_spaces = " "
|
||||||
globvar_name = "AFM thumbs v" + globvar_version
|
globvar_name = "AFM thumbs v" + globvar_version
|
||||||
@@ -85,14 +95,16 @@ globvar_note = ("Version " + globvar_version + " (" +
|
|||||||
"Contributions from:\n" +
|
"Contributions from:\n" +
|
||||||
globvar_contributions)
|
globvar_contributions)
|
||||||
|
|
||||||
globvar_console = ("\n\n"+
|
globvar_console = ("\n\n" +
|
||||||
globvar_spaces +
|
globvar_spaces +
|
||||||
globvar_name + " - " +
|
globvar_name + " - " +
|
||||||
globvar_year + "\n" +
|
globvar_year + "\n" +
|
||||||
globvar_spaces + "www.root-1.de\n\n" +
|
globvar_spaces +
|
||||||
globvar_spaces + "Today: " +
|
"GIT commit: " + globvar_git_version + "\n" +
|
||||||
time.strftime("%d-%m-%Y") +
|
globvar_spaces + "www.root-1.de\n\n" +
|
||||||
", Time: " +
|
globvar_spaces + "Today: " +
|
||||||
|
time.strftime("%d-%m-%Y") +
|
||||||
|
", Time: " +
|
||||||
time.strftime("%H:%M:%S"))
|
time.strftime("%H:%M:%S"))
|
||||||
|
|
||||||
globvar_python_directory = "AFM_thumbs"
|
globvar_python_directory = "AFM_thumbs"
|
||||||
|
|||||||
Binary file not shown.
11
README.md
11
README.md
@@ -1,11 +1,16 @@
|
|||||||
|
## Important note
|
||||||
|
Note that the pages here are currently under construction! Soon, we will will have a first version, including an extensive description of `AFM_thumbs.py`. Please, be patient. -- Clemens Barth (2022-04-20)
|
||||||
|
|
||||||
|
|
||||||
# AFM_thumbs.py
|
# AFM_thumbs.py
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
The python program AFM_thumbs creates a pdf file, which shows all SPM
|
The python program `AFM_thumbs.py` creates a pdf file, which shows all SPM
|
||||||
(Scanning Probe Microscopy: like AFM, STM, KPFM, etc.) images and relevant
|
(Scanning Probe Microscopy: like AFM, STM, KPFM, etc.) images and relevant
|
||||||
data stored in a directory. In first place, AFM_thumbs is interesting for
|
spectroscopy data stored in a directory. In first place, `AFM_thumbs.py`
|
||||||
scientists, who would like to obtain an overview of their SPM data.
|
is interesting for scientists, who would like to obtain an overview of
|
||||||
|
their SPM data.
|
||||||
|
|
||||||
## Supported SPM data
|
## Supported SPM data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user