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:
@@ -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.
|
||||
|
||||
@@ -33,6 +33,7 @@ from AFM_thumbs.Variables import globvar_color_dict
|
||||
from AFM_thumbs.Variables import globvar_spaces
|
||||
|
||||
|
||||
# _________________________________________________________________ Definitions
|
||||
|
||||
def rename_channel(name):
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -66,8 +66,8 @@ globvar_contributions = "Reinhard Olbrich (testing)\n" \
|
||||
"Alexander v Schmidtsfeld (testing)\n" \
|
||||
"..."
|
||||
|
||||
globvar_year = "2022-04-09"
|
||||
globvar_version = "3.0.0"
|
||||
globvar_year = "2022-12-09"
|
||||
globvar_version = "3.00111"
|
||||
|
||||
globvar_spaces = " "
|
||||
globvar_name = "AFM thumbs v" + globvar_version
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user