On Tue, Sep 13, 2016 at 04:34:41PM +0200, Arian Sanusi wrote:
> I was wondering if it's possible to run gwyddion
> non-interactive/scripted e.g. from a Makefile,  like image-magick's
> convert does for images.

Not really but kind of.  You cannot run Gwyddion itself in such manner
because it is not externally scriptable.  What you can do is either:

- Write a standalone Python script that starts ‘import gwy’ (importing
  the standalone gwy.so Python module) and mostly works like a pygwy
  script run from within Gwyddion.

- Write a C program.  See gwybatch for an example
  http://gwyddion.net/apps/#gwybatch

To run data processing modules, as opposed to just calling DataField
methods and other fucntions, some more work is necessary to pretend your
program is Gwyddion.  Register loaded file to the data browser:

    GwyContainer *data = gwy_file_load(filename, GWY_RUN_NONINTERACTIVE, &err);
    gwy_app_data_browser_add(data);
    gwy_app_data_browser_set_keep_invisible(data, TRUE);

Set settings values to specifiy module behaviour:

    GwyContainer *settings = gwy_app_settings_get();
    gwy_container_set_double_by_name(settings, "/module/whatever/param", 1.4);

Run some data processing module:

    gwy_app_data_browser_select_data_field(data, 0);
    gwy_process_func_run("proc_func_name", data, GWY_RUN_IMMEDIATE);

There is some boilerplate code necessary but that can be generally
copied from gwybatch.

In Python it is similar (actually very similar to pygwy scripts).

Regards,

Yeti


------------------------------------------------------------------------------
_______________________________________________
Gwyddion-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gwyddion-users

Reply via email to