Skip to content

About

A (small) repository of Gwyddion's PyGwy scripts

Resources

Stars

2 stars

Watchers

2 watching

Forks

Repository files navigation

PyGwy repository

This repository is intended as a collection of Gwyddion PyGwy scripts: some that I made and some contributed/available on the web (GitHub).

If you want to contribute by adding scripts, suggestions, or in any other form (or would like your link removed!), you can contact me (emmegamma [at] inventati dot org) or file an Issue.

For more information about Gwyddion and PyGwy, see the official documentation. See below for Pygwy installation instructions.

Scripts in this directory

Currently three scripts are available: SXM_searchFiles, batch_export_to_image, and export_profiles.

SXM_searchFiles

Search files with filters according to some properties - filename, real image size, setpoint, scantime, comments - through one or multiple folders.
Useful e.g. when scraping through old data.

Features:

  • Search recursively through folders (by using \* and escape characters in the folder search)
  • Copy the files to a target folder (this can be useful when searching recursively, to collect all files/images in one place for a later check)
  • Customize output (print filename, setpoint, size/speed, etc.)

It's designed for Nanonis .SXM files/metadata (also when saved as .gwy), but can be adapted to other formats (I'd like to make it a 'modular' search script, but haven't had the need so far: please get in contact if interested)

The first part of the file contains options/customizations with comments that should make them understandable:

### Folder and filetype ###
# Set folder(s) to search (use *\* for recursive searches) 
# and filetype (uncomment as needed)
folder = r'C:\Users\Myuser\DATA\STM\2024-10-*'
#filetype = '.gwy' 
filetype = '.sxm' 
#filetype = 'both' 

The script can also run as standalone in Python: the required libraries are loaded in the first lines of the file, just make sure Gwyddion's install folder is correct

batch_export_to_image

A script to export .gwy (or .sxm) files in a folder to images, inspired by kugatomodai/gwyddion_convert_many_files (see the repo list below).

The filetype/extension of the images is .jpg by default but customizable in variable imagefile, line 76.

It can filter filenames similar to the script above, and has options to overwrite/not-overwrite and for dry run (ultrasafe).

export_profiles

My very first script: export all the profiles (Graphs) in the open files to ASCII .txt files. Intended for use in some other program (IgorPro or similar).

It works either recursively on all open files or only on the active one. The profiles are exported as OriginaleFilename_prof_xx.txt

Scripts repository

These are scripts contributed by other authors + some that I've collected for ease of use - mostly the result of a 'pygwy' search in GitHub discarding obsolete projects.
If you want your script added to (or removed from) this list, feel free to contact me - I have no intention to steal anyone's credits.

Note: they are untested unless otherwise stated

Contributed

  • MohamedAzizAllani/AutoProcess_plugin-Gwyddion: a great GUI plugin to apply several operations (color gradient and range, crop, renaming, or even custom macros) to a series of files or channels to be selected.
    Tested and working on Gwyddion 2.69
  • rohanplatts/Python-in-Gwyddion: not really PyGwy, but very useful: a Gwyddion module that executes any python script from any python environment (e.g. installed with conda/anaconda: so also python 3) in Gwyddion. The script is executed on the open image and reads the output back in Gwyddion. It's compiled for Windows 64bit only, which means it can't work with PyGwy (32bit only) but also having some python capabilities in 64bit installations
  • rohanplatts/nanonis-file-conversion: also not really PyGwy: scripts to convert Nanonis human-readable .dat files to both .sxm (Gwyddion-readable) and .jpg

Other scripts in GitHub

  • harripj/pygwy: a series of scripts, seemingly to batch-apply basic Gwyddion operations (Median level, Gaussian filter, etc.)
  • Madhavanlabcode/Gwyddion-Scripts: three-fold symmetrization of an image, intended for FFT
  • onakanob/PyGwyBatch: a batch handler to apply a single PyGwy/Python function to multiple files
  • Drilack7/Python-Scripts-for-Gwyddion: different scripts for
    • batch flattening and mean depth calculation
    • creating a collage of images
    • simple batch operations (change Color scale, Scale min/max, Level)
    • file actions (Open all files in a folder, Save all files in a folder to .gwy, etc.)
  • kugatomodai/gwyddion_convert_many_files: batch conversion of files in a folder to png.
    *Not working and using deprecated methods: use only for inspiration
  • wampiter/gwyscripts: batch image processing scripts to
    • export files in a folder to .gwy+png, sorted by channel
    • stitch images in a line
    • save all open files to a folder with corresponding .png
  • TomVincentUK/gwy2py: a script to export Gwyddion data to numpy .npy files

PyGwy installation

Windows

To install PyGwy on Windows, follow the official documentation. You can also find the needed installers and short instructions in the Python 2 dependencies folder. The installers are also available on gwyddion's repository. Note that you need Gwyddion 32bit for PyGwy to work (not available in the 64bit installation).

Linux

Instructions vary depending on the distribution, especially since Python 2 is outdated, but a Flatpak that includes PyGwy is available on Flathub (see also forum discussion). This seems to be the only way to use PyGwy on e.g. Ubuntu at the moment.

If you have instructions for a specific distribution, contact me and I'll be happy to add them.

About

A (small) repository of Gwyddion's PyGwy scripts

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages