Hello David,
Thanks for your explanations which confirm what I have seen in the
sources of pySPM.
My reference is the actual text output of gwyddion.
In fact I am coding a Scilab (www.scilab.org) script for a student of
our lab who want to read a SPM file therein, and my first source of
inspiration is the "Bruker.py" file of pySPM. I hate python (I hate also
RE (regular exepressions) when the person who has coded does not explain
what does the RE) , but I managed to understand what they do but pySPM
does not yield the correct scale. Actually they use method 1 and (almost
by accident, i.e. I multiplied all the numbers I could get) I concluded
that method 2 leads to the actual gwyddion results.
Thanks for your insights !
Best,
S.
Le 13/09/2022 à 16:36, David Nečas (Yeti) a écrit :
On Mon, Sep 12, 2022 at 05:34:48PM +0200, Stéphane Mottelet wrote:
I have great difficulties for understand how is computed the final factor by
which is multiplied the raw data (e.g. 32 bits signed integer) to obtain the
correct unit
Welcome to the club. We've been having the same difficulties for almost
20 years now (nanoscope.c is pure madness). There seem to be two basic
ways to get the conversion factor. I will refer to the parts of the
header fields as follows (only HardValue is non-optional):
\@Key: V [SoftScale] (HardScale) HardValue
1) The method which I think corresponds to what Veeco user guide used to
say.
Look for key ‘2:Z scale’ or ‘4:Z scale’ in the corresponding data
section.
Read the hardvalue (not hardscale). This gives you factor 1.
Read also the softscale. This gives you another key (like ‘Sens.
ZsensSens’).
Look for that key and read the hardvalue. This gives you factor 2.
Look for key Bytes/pixel. Read the hardvalue as bpp, or use 2 if not
present.
Multiply factors 1 and 2. Divide by 256^bpp. Multiply all the raw
values by this.
2) The method which I do not think you can find in the guide but is
apparently the new and correct one.
Look for key ‘2:Z scale’ or ‘4:Z scale’ in the corresponding data
section.
Read the hardscale (not hardvalue). This gives you factor 1.
Read also the softscale. This gives you another key (like ‘Sens.
ZsensSens’).
Look for that key and read the hardvalue. This gives you factor 2.
Multiply factors 1 and 2. Multiply all the raw values by this.
In either you need to keep track of powers of 10 in units, i.e. nm means
10⁻⁹ m.
Often both methods give you the same correct result, which is nice.
Sometimes one of them give you the right result, but for whatever reason
not the other. Method 2 seems to work with force mapping, force curves,
peakforce QNM and these types of things. Method 1 seems to well with
more traditional modes like tapping.
Sometimes neither of them gives you the right result. When, why and
how this happens is anyone's guess.
Then there are also very old files for which you need to know some
semi-hardcoded conversion factors which depend on the data type (height,
phase, …). Pray you do not encounter any of those.
Hope it helps at least a bit. If someone could explain Icon raw data
conversion to me in a way which makes sense *and* works for all files, I
would be grateful…
Regards,
Yeti
_______________________________________________
Gwyddion-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gwyddion-users
--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
_______________________________________________
Gwyddion-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gwyddion-users