9 Commits

Author SHA1 Message Date
6467ebcba0 Concerns last commit: I forgot to add 'import os' and to add some spaces. 2023-04-26 15:55:49 +02:00
14f7f5c6ac Git hash is now also in. 2023-04-26 15:52:09 +02:00
a5d767baeb Better version number 2023-04-26 15:42:20 +02:00
6cd2d6f356 Update of date and version 2023-04-26 15:40:50 +02:00
e9b87ae2c6 Gitignore added 2023-04-26 15:38:55 +02:00
a3492c10f3 If all data pixel are on NaN, then assign a value of 0.0 for each pixel. 2023-04-26 15:36:08 +02:00
ab9fd59148 Nanonis: ISO-8859-1 and Multipass mode
- Nanonis files: ISO-8859-1 decoding implemented
- Nanonis => Multipass mode: first code lines
2022-12-12 08:15:56 +01:00
7ddeb3e505 Readme 2022-04-25 10:19:43 +02:00
7405c7104c Important note 2022-04-20 18:21:45 +02:00
8 changed files with 95 additions and 29 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
AFM_thumbs/__pycache__/

View File

@@ -40,6 +40,14 @@
# 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
# ==========
# - First upload of AFM_thumbs.py onto our git server.

View File

@@ -33,6 +33,7 @@ from AFM_thumbs.Variables import globvar_color_dict
from AFM_thumbs.Variables import globvar_spaces
# _________________________________________________________________ Definitions
def rename_channel(name):

View File

@@ -119,7 +119,7 @@ def linalg_line_fit(size_x, size_y, data):
xy = sum(line*x_vec)
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)])
@@ -198,7 +198,12 @@ def check_image_properties(data, data_file):
list_nans = np.where(np.isnan(data))[0]
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:
data[nan] = data_mean

View File

@@ -26,6 +26,7 @@
import sys
import os
import chardet
import numpy as np
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
# ___________________________________________________________________ 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
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.
def read_SPECS_Nanonis_image_data(nanonis_file):
# # Print the entire header.
# nanonis_file_path = os.path.join(globvar_AFMdir.working_directory, nanonis_file)
# nanonis_file_p = open(nanonis_file_path, "rb")
# line = ""
# while line!=b':SCANIT_END:':
# line = nanonis_file_p.readline().rstrip()
# print(line)
# nanonis_file_p.close()
# Debug: Print the entire header.
FLAG_debug = False
if FLAG_debug:
nanonis_file_path = os.path.join(globvar_AFMdir.working_directory, nanonis_file)
nanonis_file_p = open(nanonis_file_path, "rb")
line = ""
while line!=b':SCANIT_END:':
line = nanonis_file_p.readline().rstrip()
print(line)
nanonis_file_p.close()
exit(-1)
initialize_AFM_data()
@@ -97,7 +117,15 @@ def read_SPECS_Nanonis_image_data(nanonis_file):
list_line = []
while line_!=b':SCANIT_END:':
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
# 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
if ":SCAN_FILE:" in list_line[i]:
i += 1
#print(list_line[i])
line = list_line[i].rstrip().strip()
globvar_AFMdata.datfile = [line]
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:
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
if channel_name == "Current":
channel_name = "I"

View File

@@ -24,6 +24,10 @@
# DO NOT REMOVE THIS PREAMBLE !!!
#
import os
import time
import pathlib
#
#
@@ -47,27 +51,33 @@ globvar_configfile_path = "./AFM_thumbs/"
#
#
# _____________________________________________________________________ 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
# DO NOT CHANGE ANYTHING BELOW, OTHERWISE YOU KNOW WHAT TO DO !
import time
globvar_contributions = "Reinhard Olbrich (testing)\n" \
"Matthias Temmen (testing)\n" \
"Alexander v Schmidtsfeld (testing)\n" \
"..."
globvar_year = "2022-04-09"
globvar_version = "3.0.0"
globvar_year = "2023-04-26"
globvar_version = "3.0.1111"
globvar_git_version = get_git_revision(os.path.join(os.path.dirname(__file__), "../"))
globvar_spaces = " "
globvar_name = "AFM thumbs v" + globvar_version
@@ -85,14 +95,16 @@ globvar_note = ("Version " + globvar_version + " (" +
"Contributions from:\n" +
globvar_contributions)
globvar_console = ("\n\n"+
globvar_spaces +
globvar_name + " - " +
globvar_year + "\n" +
globvar_spaces + "www.root-1.de\n\n" +
globvar_spaces + "Today: " +
time.strftime("%d-%m-%Y") +
", Time: " +
globvar_console = ("\n\n" +
globvar_spaces +
globvar_name + " - " +
globvar_year + "\n" +
globvar_spaces +
"GIT commit: " + globvar_git_version + "\n" +
globvar_spaces + "www.root-1.de\n\n" +
globvar_spaces + "Today: " +
time.strftime("%d-%m-%Y") +
", Time: " +
time.strftime("%H:%M:%S"))
globvar_python_directory = "AFM_thumbs"

View File

@@ -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
## 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
data stored in a directory. In first place, AFM_thumbs is interesting for
scientists, who would like to obtain an overview of their SPM data.
spectroscopy data stored in a directory. In first place, `AFM_thumbs.py`
is interesting for scientists, who would like to obtain an overview of
their SPM data.
## Supported SPM data