Nanonis: ISO-8859-1 and Multipass mode

- Nanonis files: ISO-8859-1 decoding implemented
- Nanonis => Multipass mode: first code lines
This commit is contained in:
2022-12-12 08:15:56 +01:00
parent 7ddeb3e505
commit ab9fd59148
5 changed files with 53 additions and 11 deletions

View File

@@ -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.

View File

@@ -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):

View File

@@ -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"

View File

@@ -66,8 +66,8 @@ globvar_contributions = "Reinhard Olbrich (testing)\n" \
"Alexander v Schmidtsfeld (testing)\n" \ "Alexander v Schmidtsfeld (testing)\n" \
"..." "..."
globvar_year = "2022-04-09" globvar_year = "2022-12-09"
globvar_version = "3.0.0" globvar_version = "3.00111"
globvar_spaces = " " globvar_spaces = " "
globvar_name = "AFM thumbs v" + globvar_version globvar_name = "AFM thumbs v" + globvar_version