Mark S. Bentley
2014-07-02 11:04:32 UTC
Dear all,
I have a (hopefully) straightforward question. I have all of my AFM
image and meta data in python (numpy array and dictionary) and want to
simply write to a Gwyddion native file. I have imported the gwy module,
created a new container and DataField object (initialise to the correct
size/number of pixels), set the meta data and channel title etc.
However, I can't find an easy way to populate the contents of the data
itself...
DataField.get_data() works fine, and returns the initialised zero
values. There is a function DataField.set_data() on inspecting the
object, but this is not listed in the API and I can't get it to work.
There was a similar question on the list a while back, which was solved
by using gwyutils. But I guess this only works inside of Gwyddion, and I
need something that will run standalone...
Calling DataField.set_val() in a loop works fine - is this the preferred
python option? The docs talk about using get_data() and referencing the
returned buffer, but I guess this comes directly from the underlying C
docs and is not relevant here..
Thanks for your help!
Mark
I have a (hopefully) straightforward question. I have all of my AFM
image and meta data in python (numpy array and dictionary) and want to
simply write to a Gwyddion native file. I have imported the gwy module,
created a new container and DataField object (initialise to the correct
size/number of pixels), set the meta data and channel title etc.
However, I can't find an easy way to populate the contents of the data
itself...
DataField.get_data() works fine, and returns the initialised zero
values. There is a function DataField.set_data() on inspecting the
object, but this is not listed in the API and I can't get it to work.
There was a similar question on the list a while back, which was solved
by using gwyutils. But I guess this only works inside of Gwyddion, and I
need something that will run standalone...
Calling DataField.set_val() in a loop works fine - is this the preferred
python option? The docs talk about using get_data() and referencing the
returned buffer, but I guess this comes directly from the underlying C
docs and is not relevant here..
Thanks for your help!
Mark