On Tue, May 10, 2016 at 03:40:32PM +0200, Mark S. Bentley wrote:
> I would like to read an existing Gwyddion file and save a single channel 
> as a VTK file. From the GUI this works fine, but I'm not sure how to do 
> it from python:
> 
> In [28]: C = gwy.gwy_file_load('test.gwy', gwy.RUN_NONINTERACTIVE)

Use

C = gwy.gwy_app_file_load('test.gwy')
gwy.gwy_app_data_browser_select_data_field(C, 0)

instead.

The reason why is complicated.

The difference between these two functions is that the plain (non-app)
one just loads the data file and gives you the resulting Container.  You
can do whatever you want with it; the main program does not know about
it.  The app one loads the file as if the user opened it from the GUI.

The save function needs the main program to know about the data because
it asks the data browser which image is currently active.  Because it is
in fact an export function – it cannot save the entire data (like true
saving to .gwy that would work even with a random Container).

Now, of course, that opens the image in the GUI, so you probably want to
add

gwy.gwy_app_data_browser_remove(C)

afterwards.

Regards,

Yeti


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Gwyddion-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gwyddion-users

Reply via email to