Hi.
Let's say that you save an AFM image of size s and resolution r in txt
format. Then your txt file contains a r*r matrix. The (i,j) element of the
matrix is the z-value located at x = (i - 1) * step, y = (j - 1) * step,
for step = s / r, for i,j = 1, ...r. This following the gwyddion rule which
sets the (1,1) element of your matrix as the origin of plane x,y.
This is the python script:
res = 512. # number of pixels (float kind)
size = 5000. # size of (squared) image in nm (float kind)
length_step = size / res
f1 = open('H.txt') # input file: topographic image by Gwyddion
f2 = open('H-XYZ.txt', 'w') # output file
linesA = f1.readlines() # read all the rows of the input image
x_ind = 0 # index of rows
for lineA in linesA:
lineA = lineA.replace('\n', '') # remove end line character from row
line
z_values = lineA.split('\t') # split the row line in the z-values
x_data = str(x_ind * length_step) # x coordinate in nm
x_ind += 1
y_ind = 0 # index of columns
for z_value in z_values:
y_data = str(y_ind * length_step) # y coordinate in nm
data = x_data + '\t' + y_data + '\t' + str(float(z_value) * 1E9) +
'\n' # x, y, z coordinates in nm, correspondent to the element (x_ind + 1,
y_ind + 1) of the original matrix
f2.write(data)
y_ind += 1
f1.close()
f2.close()
Best regards
Stefania
On Tue, Jan 13, 2015 at 3:46 PM, Moriceau, Julien <
[email protected]> wrote:
> Hello,
>
> Thank you for your spontaneous help.
>
> I would be interested to know how you did this python script. I would be
> really glad if you can explain it here.
>
> Thank you for your help.
>
> Regards
>
> --
>
> Julien
>
>
>
> *From:* Stefania Carapezzi [mailto:[email protected]]
> *Sent:* Friday, January 09, 2015 11:04 AM
>
> *To:* Gwyddion use discussion
> *Subject:* Re: [Gwyddion-users] NaN value in statistical measurment
>
>
>
> Hi. I'm working with AFM images as well. I was in need to get my image
> as a .txt file with 3 rows (XYZ) for further analysis. I did this by saving
> from gwiddyon as .txt and then using the matrix file as input in a python
> program that output the .txt file with XYZ rows. the same of course can be
> done in matlab, et similia. if you wish I can send you my python script, or
> I can briefly describe the algorythm (very short).
>
> best regards
>
> Stefania Carapezzi
>
>
>
> On Thu, Jan 8, 2015 at 3:23 PM, Moriceau, Julien <
> [email protected]> wrote:
>
> That's great.
> Thank you so much!
> Regards
> --
> Julien
>
> -----Original Message-----
> From: David Nečas (Yeti) [mailto:[email protected]]
> Sent: Thursday, January 08, 2015 9:21 AM
> To: Gwyddion use discussion
> Subject: Re: [Gwyddion-users] NaN value in statistical measurment
>
> On Thu, Jan 08, 2015 at 08:54:08AM +0100, David Nečas (Yeti) wrote:
> > > I was wondering if it was possible to save a file with the same
> > > organization as my original file, meaning XYZ...
> >
> > This should not be a big problem to add.
>
> Added. It will appear in tomorrow's or later development snapshot.
> Select ‘XYZ text data’ as the export file format, or just use the .xyz
> extension to choose it.
>
> Regards,
>
> Yeti
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> Gwyddion-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gwyddion-users
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> Gwyddion-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gwyddion-users
>
>
>
>
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet
> _______________________________________________
> Gwyddion-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gwyddion-users
>
>
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Gwyddion-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gwyddion-users