Gwyscan Library
 All Data Structures Files Functions Enumerations Enumerator Macros Groups
Save Gwyddion File
GwyscanResult gwyscan_save_gwyddion_array (const double *data, int xres, int yres, double xreal, double yreal, const char *xyunit, const char *zunit, const char *description, const char *filename)
 Saves single array as a Gwyddion file. More...
 
GwyscanResult gwyscan_add_gwyddion_array (const double *data, int xres, int yres, double xreal, double yreal, const char *xyunit, const char *zunit, const char *description, const char *filename)
 Saves single array as a Gwyddion file, adding it as new channels if the file already exists. More...
 
GwyscanResult gwyscan_save_gwyddion_arrays_general (const double **data, int nchannels, const int *xres, const int *yres, const double *xreal, const double *yreal, const char **xyunit, const char **zunit, const char **description, const char *filename)
 Saves multiple arrays to a Gwyddion file. More...
 
GwyscanResult gwyscan_save_gwyddion_arrays (const double *data, int nchannels, int xres, int yres, double xreal, double yreal, const char **xyunit, const char **zunit, const char **description, const char *filename)
 Saves multiple arrays having same pixel resolution and same physical range into a Gwyddion file. More...
 
GwyscanResult gwyscan_save_gwyddion_xyz (const double *xypos, const double *zdata, int n, int nchannels, int xres, int yres, const char **description, const char *filename)
 Saves Gwyddion XYZ file. More...
 
GwyscanResult gwyscan_add_gwyddion_xyz (const double *xypos, const double *zdata, int n, int nchannels, int xres, int yres, const char **description, const char *filename, const char *tmp_filename, int *n_total)
 Adds XYZ data to existing Gwyddion XYZ file. More...
 

Detailed Description

Function Documentation

GwyscanResult gwyscan_add_gwyddion_array ( const double *  data,
int  xres,
int  yres,
double  xreal,
double  yreal,
const char *  xyunit,
const char *  zunit,
const char *  description,
const char *  filename 
)

Saves single array as a Gwyddion file, adding it as new channels if the file already exists.

Saves two dimensional array (represented as one-dimensional one) into a Gwyddion file. If the file already exists, it adds the array as a new channel.

Parameters
datais the array data to save, this array should have xres * yres resolution.
xresis x resolution of the data array to save.
yresis y resolution of the data array to save.
xrealis physical dimension of the array to save in x direction, in xyunit.
yrealis physical dimension of the array to save in y direction, in xyunit.
xyunitis the basic SI unit of x and y range, e.g. "m" for meters.
zunitis the basic SI unit of the data, e.g. "m" for meters.
descriptionis the channel description for Gwyddion file.
filenameis the filename where to save data.
Returns
error code.
Examples:
save_gwyddion_array.c.
GwyscanResult gwyscan_add_gwyddion_xyz ( const double *  xypos,
const double *  zdata,
int  n,
int  nchannels,
int  xres,
int  yres,
const char **  description,
const char *  filename,
const char *  tmp_filename,
int *  n_total 
)

Adds XYZ data to existing Gwyddion XYZ file.

Adds XYZ data to existing Gwyddion XYZ file. Number of channels must be the same. First use gwyscan_save_gwyddion_xyz() to create XYZ file when not existing. Then you can periodically call gwyscan_add_gwyddion_xyz() to create one big XYZ file.

Parameters
xyposis xy positions, stored as interleaved arrays (x1, y1, x2, y2 ... xn, yn) of size 2*n.
zdatais measured values (height, error signal, etc.), stored sequentially (e.g. za1, za2, .. zan, zb1, zb2, .. zbn for channels za and zb).
nis the number of non-equidistant data triplets available.
nchannelsis the number of channels.
xresis x resolution of the data array to save; information for Gwyddion, may be 100. XXX: This parameter does not actually do anything.
yresis y resolution of the data array to save; information for Gwyddion, may be 100. XXX: This parameter does not actually do anything.
descriptionis the channel description for Gwyddion file. XXX: This parameter does not actually do anything.
filenameis the filename of existing file. Data is added and saved to this file.
tmp_filenameis the filename of auxiliary, temporary file where xyz data is joined.
n_totaltotal number of saved points. It is incremented on every gwyscan_add_gwyddion_xyz() call. XXX: This is a lie. The value is never updated.
Returns
error code.
Examples:
add_gwyddion_xyz.c.
GwyscanResult gwyscan_save_gwyddion_array ( const double *  data,
int  xres,
int  yres,
double  xreal,
double  yreal,
const char *  xyunit,
const char *  zunit,
const char *  description,
const char *  filename 
)

Saves single array as a Gwyddion file.

Saves two dimensional array (represented as one-dimensional one) into a Gwyddion file.

Parameters
dataare the array data to save, this array should have xres * yres resolution.
xresis x resolution of the data array to save.
yresis y resolution of the data array to save.
xrealis physical dimension of the array to save in x direction, in xyunit.
yrealis physical dimension of the array to save in y direction, in xyunit.
xyunitis the basic SI unit of x and y range, e.g. "m" for meters.
zunitis the basic SI unit of the data, e.g. "m" for meters.
descriptionis the channel description for Gwyddion file.
filenameis the filename where to save data.
Returns
error code.
GwyscanResult gwyscan_save_gwyddion_arrays ( const double *  data,
int  nchannels,
int  xres,
int  yres,
double  xreal,
double  yreal,
const char **  xyunit,
const char **  zunit,
const char **  description,
const char *  filename 
)

Saves multiple arrays having same pixel resolution and same physical range into a Gwyddion file.

Saves set of two dimensional arrays (represented as a single one-dimensional one) into a Gwyddion file, typically representing several channels obtained within a measurement. In contrast to gwyscan_save_gwyddion_arrays_general(), all the arrays must have the same pixel size and the same physical size.

Warning
number of nchannels must be the same as number of items in xyunit, zunit and description.
Parameters
datais the array data to save, this array should have xres * yres * nchannels resolution.
nchannelsis the number of channels.
xresis x resolution of the data arrays to save.
yresis y resolution of the data arrays to save.
xrealis physical dimension of the arrays to save in x direction, in xyunit.
yrealis physical dimension of the arrays to save in y direction, in xyunit.
xyunitis an array of the basic SI units of x and y range, e.g. "m" for meters.
zunitis an array of the basic SI units of the data, e.g. "m" for meters.
descriptionis an array of the channel descriptions for Gwyddion file.
filenameis the filename where to save data.
Returns
error code.
Examples:
save_gwyddion_arrays.c.
GwyscanResult gwyscan_save_gwyddion_arrays_general ( const double **  data,
int  nchannels,
const int *  xres,
const int *  yres,
const double *  xreal,
const double *  yreal,
const char **  xyunit,
const char **  zunit,
const char **  description,
const char *  filename 
)

Saves multiple arrays to a Gwyddion file.

Saves set of two dimensional arrays (represented as array of one-dimensional arrays) into a Gwyddion file, typically representing several channels obtained within a measurement. In contrast to gwyscan_save_gwyddion_arrays(), the arrays can have different pixel size and different physical size.

Warning
number of arrays in data must be the same as number of items in xreal yreal.
number of nchannels must be the same as number of items in xyunit, zunit and description.
Parameters
datais array of pointers to one-dimensional arrays to save, this arrays should have xres[i] * yres[i] resolution for i-th channel.
nchannelsis the number of channels.
xresis an array of x resolutions of the data arrays to save.
yresis an array of y resolutions of the data arrays to save.
xrealis an array of physical dimensions of the arrays to save in x direction, in xyunit.
yrealis an array of physical dimensions of the arrays to save in y direction, in xyunit.
xyunitis an array of strings of the basic SI units of x and y ranges, e.g. "m" for meters.
zunitis an array of strings of the the basic SI units of the data, e.g. "m" for meters.
descriptionis an array of the channel description for Gwyddion file.
filenameis the filename where to save data.
Returns
error code.
Examples:
save_gwyddion_arrays_general.c.
GwyscanResult gwyscan_save_gwyddion_xyz ( const double *  xypos,
const double *  zdata,
int  n,
int  nchannels,
int  xres,
int  yres,
const char **  description,
const char *  filename 
)

Saves Gwyddion XYZ file.

Saves XYZ data to Gwyddion XYZ file. Saves all channels from zdata. xypos the xy positions, stored as interleaved arrays (x1, y1, x2, y2 ... xn, yn) of size 2*n; zdata channels that are stored sequentially (e.g. za1, za2, .. zan, zb1, zb2, .. zbn for channels za and zb) n is the number of non-equidistant data triplets available nchannels the number of channels xres x resolution for final render while Gwyddion loads the data yres y resolution for final render while Gwyddion loads the data filename where to store the data.

Parameters
xyposis xy positions, stored as interleaved arrays (x1, y1, x2, y2 ... xn, yn) of size 2*n.
zdatais measured values (height, error signal, etc.), stored sequentially (e.g. za1, za2, .. zan, zb1, zb2, .. zbn for channels za and zb).
nis the number of non-equidistant data triplets available.
nchannelsis the number of channels.
xresis x resolution of the data array to save; information for Gwyddion, may be 100.
yresis y resolution of the data array to save; information for Gwyddion, may be 100.
descriptionis the channel description for Gwyddion file.
filenameis the filename where to save data.
Returns
error code.
Examples:
add_gwyddion_xyz.c, preview.c, and save_gwyddion_xyz.c.