Module gwyutils
[hide private]
[frames] | no frames]

Module gwyutils

source code

Functions [hide private]
 
save_dfield_to_png(container, datafield_name, filename, run_type)
Save desired datafield given by name stored in container to file.
source code
 
get_data_fields(container)
Get list of available datafield stored in given container
source code
 
get_data_fields_dir(container)
Get list of available datafield stored in given container as directory where key is key name and value is DataField object.
source code
 
get_current_datafield()
Shorthand for gwy.gwy_app_data_browser_get_current(gwy.APP_DATA_FIELD)
source code
 
get_current_container()
Shorthand for gwy.gwy_app_data_browser_get_current(gwy.APP_CONTAINER)
source code
 
data_line_data_as_array(line)
Create a view the DataLine's data as numpy array.
source code
 
data_field_data_as_array(field)
Create a view the DataField's data as numpy array.
source code
 
brick_data_as_array(brick)
Create a view the Brick's data as numpy array.
source code
 
data_field_get_data(datafield)
Gets the data from a data field.
source code
 
data_field_set_data(datafield, data)
Sets the data of a data field.
source code
 
brick_get_data(brick)
Gets the data from a brick.
source code
 
brick_set_data(brick, data)
Sets the data of a brick.
source code
Variables [hide private]
  __package__ = None
Function Details [hide private]

save_dfield_to_png(container, datafield_name, filename, run_type)

source code 

Save desired datafield given by name stored in container to file.

Parameters:
  • container - gwy.Container which has datafield of given name
  • datafield_name - datafield name in string representation (like '/0/data')
  • filename - expected filename
  • run_type - select of interactive (RUN_INTERACTIVE) or noninteractive mode (RUN_NONINTERACTIVE)

Deprecated: This function was a workaround for old image export. Nowadays it is strictly worse than the two lines:

    gwy.gwy_app_data_browser_select_data_field(container, datafield_num)
    gwy.gwy_file_save(container, filename, run_type)

because it also unnecessarily forces the data field to be shown in a window.

get_data_fields(container)

source code 

Get list of available datafield stored in given container

Parameters:
  • container - gwy.Container with datafields
Returns:
a list of datafields

Deprecated: This function produces nonsense. It returns all kinds of data fields in on bag: images, masks, presentations, brick and surface previews, etc. Instead, use gwy.gwy_app_data_browser_get_data_ids(@container) and similar functions to get lists of specific data types.

get_data_fields_dir(container)

source code 

Get list of available datafield stored in given container as directory where key is key name and value is DataField object.

Parameters:
  • container - gwy.Container with datafields
Returns:
a directory of datafields

Deprecated: This function produces nonsense. It returns all kinds of data fields in on bag: images, masks, presentations, brick and surface previews, etc. Instead, use gwy.gwy_app_data_browser_get_data_ids(@container) and similar functions to get lists of specific data types.

get_current_datafield()

source code 

Shorthand for gwy.gwy_app_data_browser_get_current(gwy.APP_DATA_FIELD)

Returns:
current datafield

get_current_container()

source code 

Shorthand for gwy.gwy_app_data_browser_get_current(gwy.APP_CONTAINER)

Returns:
current container

data_line_data_as_array(line)

source code 

Create a view the DataLine's data as numpy array.

The array can point to an invalid memory location after using other gwyddion functions and lead to application crash. Use with care.

Parameters:
Returns:
array viewing the data

data_field_data_as_array(field)

source code 

Create a view the DataField's data as numpy array.

The array can point to an invalid memory location after using other gwyddion functions and lead to application crash. Use with care.

Parameters:
Returns:
array viewing the data

brick_data_as_array(brick)

source code 

Create a view the Brick's data as numpy array.

The array can point to an invalid memory location after using other gwyddion functions and lead to application crash. Use with care.

Parameters:
Returns:
array viewing the data

data_field_get_data(datafield)

source code 

Gets the data from a data field.

The returned array is a copy of the data. But it can be safely stored without ever referring to invalid memory.

Parameters:
  • datafield - The data field.

Deprecated: This helper function is pointless. Just use numpy.array(@datafield).

data_field_set_data(datafield, data)

source code 

Sets the data of a data field.

The data shape must correspond to the data field shape.

brick_get_data(brick)

source code 

Gets the data from a brick.

The returned array is a copy of the data. But it can be safely stored without ever referring to invalid memory.

Parameters:
  • brick - The data brick.

Deprecated: This helper function is pointless. Just use numpy.array(@brick).

brick_set_data(brick, data)

source code 

Sets the data of a brick.

The data shape must correspond to the brick shape.