Skip to main content

Python API for Nanosurf controllers

Project description

Python API for Nanosurf controllers

Package for data acquisition and control of Nanosurf atomic force microscopes.

Nanosurf Python

Prerequisites

  • Python >=3.9 installed on Windows OS.
  • A Nanosurf controller software running and a controller connected to the PC.
  • Nanosurf Scripting Interface option activated

Installation and upgrading

Assuming that a Python interpreter is already installed on your PC.

To install the package, open a Windows Command Prompt and run:

pip install nanosurf

To upgrade your nanosurf package to the newest version, open Windows Command Prompt and run:

pip install nanosurf -U

If for some reason pip does not work, unzip the content of the package into a folder and in this folder run:

python setup.py install

Get help, where are the examples ?

In the library, Nanosurf provides a documentation, some script demos and full fledged application templates to give you a quick start. But where are these files placed after the installation?

They are in the nanosurf package sub folders "app" and "doc". But where are they on your system?

Depending on the exact installation of python, the package folders can be at very different places.

Therefore, the nanosurf package provides a command shell script to help you:

Open Windows Command Prompt and type:

nanosurf_help

The output of this command print the exact path to the app and doc folder. Use this path to open the example scripts in Visual Studio Code (or any other python IDE) and run them.

If this shell script does not run you can do it manually: Open Windows Command Prompt and type:

python 
>>> import nanosurf
>>> nanosurf.help()

Open the examples in Visual Studio Code (or any other python IDE) and run them

Usage Example

import nanosurf as nsf

spm = nsf.SPM()  # or .C3000() or .CX(), or .CoreAFM()
application = spm.application

scan = application.Scan
opmode = application.OperatingMode
approach = application.Approach
zcontrol = application.ZController
head = application.ScanHead

# Set file mask
mask = "TestSample-"
application.SetGalleryHistoryFilenameMask(mask)

# Choose cantilever
head.CantileverByGUID = spm.CantileverGUID.Dyn190Al

# Operating mode
opmode.OperatingMode = spm.OperatingMode.DynamicAFM
opmode.VibratingAmpl = 0.5 # [V] 

# Set scan parameters
scan.ImageWidth = 5e-6 # [m]
scan.ImageHeight = 5e-6 # [m]
scan.Scantime = 0.55 # s
scan.Points = 256 # points per line
scan.Lines = 256 # lines
scan.CenterPosX = 10e-6 # [m]
scan.CenterPosY = 10e-6 # [m]
scan.SlopeX = 0.0 # degree
scan.SlopeY = 0.0 # degree
scan.Overscan = 5 #%

# Set Z controller parameters
zcontrol.SetPoint = 70 # [%]
zcontrol.PGain = 3100
zcontrol.IGain = 3500

# Start scan
scan.StartFrameUp()

# Check if scanning
scanning = scan.IsScanning
print(scanning)

# Stop scan
scan.Stop()

# Get image
scan.StartCapture()

del spm

Scripting Manual

Full list of objects and methods can be found in the Scripting Manual in Nanosurf controller software under Help tab: Help -> Manuals -> Script Programmers Manual, or here.

Library Version History

  • v1.3.4

    • fix bug in frequency_sweep
  • v1.3.3

    • Improve visual appearance of some nsf.gui elements
    • fix eeprom memory write access for i2c.chip_24LC34A
    • better return value for fileutil.create_unique_folder() in case of error
  • v1.3.2

    • Bugfix: Studio - handling of boolean properties was nor working
    • Add support for DriveAFM Camera i2c-chip
  • v1.3.1

    • Bugfix: App_switching_spectroscopy - selection of output and amplitude setting had some issues
  • v1.3.0

    • Add simplifies library usage is possible. Just write 'import nanosurf as nsf' and full access to sub-libraries is provided in visual studio code
    • new app: app_switching_spectroscopy provides the possibility to measure in "Switching Spectroscopy"-Mode
    • new qui elements: nsf.gui.NSFEdit and nsf.gui.NSFComboBox
    • Bugfix: Wrong number type in Python for double based property
    • Bugfix: nsf.spm.workflow.frequency_sweep: PositionX/Y/Z was not working as output
  • v1.2.0

    • Add Studio scripting support
  • v1.1.0

    • Add direct I2C motor control
  • v1.0.0

    • Initial release

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nanosurf-1.3.4.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nanosurf-1.3.4-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file nanosurf-1.3.4.tar.gz.

File metadata

  • Download URL: nanosurf-1.3.4.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.13

File hashes

Hashes for nanosurf-1.3.4.tar.gz
Algorithm Hash digest
SHA256 ef5642a25fe87eb6ee2067a2b17d48d56ec8c10b99c5dfa841df1e818e9cb21c
MD5 976b8495d8c797f0304427fe14fba1a6
BLAKE2b-256 dfaca8003ebb48a86ea14468b1b677ee594e6b887efcbafdc5fb5efea180ec78

See more details on using hashes here.

File details

Details for the file nanosurf-1.3.4-py3-none-any.whl.

File metadata

  • Download URL: nanosurf-1.3.4-py3-none-any.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.13

File hashes

Hashes for nanosurf-1.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4ccf193fd733fb86f47eb541f6a8091c1ffd5d3c201f2fb7a6b420e267218d3f
MD5 b171220e51636bb35f76766869ced8a4
BLAKE2b-256 a933a2256b12b414d86c7c7eff3e6ac2c77ad08c24e1bcf932e20311498350de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page