Skip to main content

hpSPM+ Studio Library Description

The hpSPM+ Studio Python Library is a powerful API designed for seamless interaction with hpSPM+ systems, providing comprehensive tools for system customization, real-time monitoring, and data management. Its modular structure allows easy integration into scientific and industrial workflows.

Key features include:

  • Device Control:
    • Complete control over scanning processes, voltage configurations, and offset adjustments.
    • Optimizes system performance with automatic calibration and setup features.
  • Real-Time System Monitoring:
    • Provides real-time access to essential metrics like system status and scan progress.
    • Delivers detailed feedback on scanning status, voltage levels, and system activities.
  • Data Management:
    • Records, organizes, and analyzes scanned images and system readings.
    • Offers the ability to manage image containers effectively.
  • Customizable Solutions:
    • Configures scanning parameters and other settings to meet experimental or industrial requirements.
    • Its modular design enhances system scalability.

This library is an ideal tool for automating workflows, optimizing device performance, and developing custom applications.

Prerequisites

  • Operating System: Windows 10 or later.
  • Python Version: Python versions 3.9 to 3.12. Download Python from python.org.
  • hpSPM+ Studio Software: The hpSPM+ Studio software must be installed, and its API feature should be activated.
  • Network Access: The hpSPM+ device must be accessible via its designated IP address and port.
  • pip Package Manager: The Python pip package manager is required to install the library.
  • Dependencies: All required dependencies are installed automatically during the library setup.
  • Development Environment (Recommended): Using Visual Studio Code is recommended for writing, debugging, and running Python scripts.

Note: Ensure your Python environment is properly configured before proceeding with the installation.

Installation and Upgrading

  • To Install the hpSPM+ Python Library:
    • Open a Windows Command Prompt or terminal with Python installed.
    • Enter the following command:

pip install hpspmplusstudio

  • To Upgrade to the Latest Version of the hpSPM+ Library:
    • Use the following command:

pip install hpspmplusstudio -U

Note: Ensure your Python environment meets all the prerequisites listed before proceeding with the installation or upgrade.

Running the Examples

The hpSPM+ Studio Python Library provides comprehensive documentation, sample scripts, and application templates to help users get started quickly. These resources are organized into separate directories such as Docs and Samples within the package.

To locate these files on your system, follow these steps:

  1. Open a terminal or command prompt with Python installed.
  2. Enter the following commands to access the library's help feature:

python

>>> import hpSPMPlusStudio

>>> hpSPMPlusStudio.help()

  1. The output will display the exact paths to the documentation (Docs) and example scripts (Samples). For instance:
    1. Docs: Contains the PDF manual and library overview files.
    2. Samples: Includes subfolders like Basics and Experiments with practical examples.

We recommend using Visual Studio Code or a similar IDE for writing, debugging, and running Python scripts. You can explore the examples in the Samples folder to better understand how to interact with the hpSPM+ API and customize it for your needs.

Connection and Logging

  • Every request uses a timeout of 5 s (connect) / 60 s (read). It can be changed per endpoint, e.g. NMIEndpoint("192.168.10.110", 9024, timeout=(5, 120)).
  • Failed requests and server error messages are printed to the console and written to the hpSPMPlusStudio logger, and the method returns None.
  • The reason of the last failure is kept in Endpoint.last_error ({"command", "status_code", "message"}; None after a successful request).
  • Console printing can be turned off with hpSPMPlusStudio.set_verbose(False); the messages are still logged.
  • The library does not write a log file by default. To write the library logs to a file:

>>> import hpSPMPlusStudio

>>> hpSPMPlusStudio.enable_file_logging("logFile_API.log")

Reading Values

Some flags come from the server as JSON booleans and others as the strings "True"/"False" (for example SCAN().Get_IsScanning(), STATUS().Get_DashboardStatus(), PID().Get_PID()). In Python bool("False") is True, so use the helpers:

>>> from hpSPMPlusStudio import to_bool, to_float

>>> to_bool(Device.SCAN().Get_IsScanning()["IsScanning"])

  • to_bool(value): "True"/"False", "1"/"0" and booleans.
  • to_float(value): numbers, decimal-comma strings ("1,25") and "NaN"/"Infinity".
  • get_first(response, "NewKey", "OldKey"): first key that exists in a response.

Modules

Accessor Module Notes
STATUS() APP System state, dashboard, DeviceInformations()
SYSTEMREADINGS() SystemReadings Live signals; Get_SystemReadingsWithTimestamp() adds the frame time
SCAN() Scan Scan geometry, speed, start/stop, save folder/name, scan channel selection
SCANNEDIMAGES() ScannedImages Image containers, image data (any frame), Save_Container()
EXPERTSCAN() ExpertScan New in 1.2.0. Expert AFM scan (line by line): Expert PID selection (AFM/STM feedback, AFM set point source), Pass Configuration (FirstPass / SecondPass forward and backward cards: feedback, constant Vz / lift-off, excitation, bias, quadlock, PID cards), live value capture, plan check, presets. hpSPMExtended only (server)
IMAGETOOLS() ImageTools New in 1.1.0. GUI Image Tools: analysis (cross section, roughness, histogram, distance, angle, pixel), processing that adds a new image (plane/line correction, scars, flip, rotate, crop, filters), undo of API results, export on the instrument PC (server)
OPTIONS() Options SPM type, AFM mode, scanner type, XY/Z scale
XYOFFSET() XYOffset XY offset (ramped or direct), GUI offset updater
PID() PID P/I/D, set point, enable, polarity
TIPFEEDBACK() TipFeedback New in 1.0.9. Z feedback state: FeedbackOn / FeedbackOff / Standby
APPROACH() Approach Coarse motors, Get_MotorState(), Get_LandHistory()
AUTOTUNE() AutoTune Frequency sweep, excitation, Null Phase, Q factor
IVCURVE() IVCurve New in 1.0.9. IV spectroscopy (bias sweep)
PHOTODIODE() PhotoDiode Photodiode signals, laser power/RF, laser on/off
VBIAS() VBias Bias DC/AC, /500 divider, polarity, measured bias, applied DC Get_DCOffsetOut()
HALLCARD() HallCard Hall probe and coil driver
FIBERCARD() FiberCard Fiber interferometer card, quadlock
ADJUSTFIBER() AdjustFiber Find Quadrature
WINDOWCONTROLLER() WindowControl GUI tool windows
DIO(), SPAREDAC() DIO, SpareDac NMISPMStudio only. hpSPM+ has no such routes; calls return None

Laser: PHOTODIODE().Set_LaserOn() / Set_LaserOff() switch the laser. Set_LaserEnable() / Set_LaserDisable() only unlock or lock the GUI "Laser" checkbox.

Units: XY lengths (offsets, image size, CustomScanner sizes) are in the GUI XY scale unit (OPTIONS().Get_XYScale()). IV curve bias values are in mV. SCAN().Set_ScanTemperature() is the piezo calibration temperature in Kelvin.

Changelog

1.2.1

(server): the new commands and fields are in hpSPMExtended from the November 2026 readings update; older builds answer "Route not found" for the new commands (the methods return None) and do not send the new reading fields.

  • SYSTEMREADINGS().Get_SystemReadings / Get_SystemReadingsWithTimestamp also return the GUI Readings panel values: ExcitationOutAmplitude (Vpp), ExcitationOutFrequency (Hz), OscAmplitudeNm (nm), VBiasDCOffset (V, set point), VBiasDCOut (V, DC applied to the bias DAC in set-point units), VBiasACAmplitude (Vpp), VBiasACFrequency (Hz), FiberPZTSet (V), IHallSet (uA); SystemReadingsChannels lists them. SCAN().Get_DirectCapturePixel sends them as null.
  • Get_SystemReadingsUnitText corrected (server): VHall, Backplane2, Backplane3 are V, IHall is uA (the values did not change). SCAN().Get_DirectCapturePixel VHall is now V like the status frame (was mV).
  • New VBIAS().Get_DCOffsetOut: the DC the firmware reports on the bias DAC (status firmware v131), with the set point and IsDcDrivenByKpfmPid.
  • New AUTOTUNE().Get_ExcitationFrequencyRead: PLL DDS (excitation output) frequency in Hz, next to Get_ExcitationRead (amplitude).
  • PID().Get_PID replies also carry the status-frame values IsEnableRead, SetRead_Value, Output_Value, FeedbackChannel (JSON numbers / bool).
  • Documentation only (server): hpSPMExtended after 1.5.0.2 has a single bias DC-source rule. While the KPFM PID is on (KPFM mode, and now Expert mode) it drives the DC: VBIAS().Set_DCOffset is refused and Get_IsSwForcedDC is False; with the KPFM PID off the DC offset is forced. In EXPERTSCAN() the card field VBiasSwForcedDc is derived from the KPFM PID of each pass (a written value is ignored with a warning) and Get_PassPlan steps report VBias.DcSource (KpfmPid / Forced). hpSPMExtended 1.5.0.2 still writes the stored VBiasSwForcedDc (default False, the bias then follows the KPFM/STM PID output): set it True in every pass whose KPFM PID is off.

1.2.0

(server): the ExpertScan API is in hpSPMExtended from the November 2026 Expert scan update (NMISPMStudio and hpSPMPlus have no Expert line-by-line scan). Other products and older builds answer "Route not found" (HTTP 404): the methods return None (Get_Commands() returns []) and Endpoint.last_error names the command.

  • New EXPERTSCAN() controller (server):
    • Expert PID selection: Get_ExpertStatus, Set_FeedbackType (Afm / Stm; main PID = PID() index 0 / 2), Set_AfmSetPointSource (Vpd / Rms / DeltaF). In Expert mode both re-wire the feedback channel at once.
    • Pass Configuration: Get_PassConfiguration, Set_PassConfiguration(config, replace=False) (JSON with the GUI preset field names; only the given fields change; the reply lists Changed, Clamped, Warnings and the plan errors), helpers Set_PassDirection, Set_PassPid, Set_SecondPassEnabled, Set_BackwardSameAsForward, Capture_LiveValues (GUI refresh button), Reset_PassConfiguration.
    • Get_PassPlan: the passes an Expert scan runs (inherited card values), Errors that would stop the scan, Warnings and the selected channels by group (FirstPass / SecondPass / Spare).
    • Presets on the instrument PC: Get_PresetList, Save_Preset (an existing name needs overwrite=True), Apply_Preset, Delete_Preset; files on this computer: Load_PresetFile (GUI preset or PassConfigCurrent.json), Save_PresetFile.
    • Pass Configuration is a setting: it is applied pass by pass when an Expert scan starts (SCAN().StartScan()). During an Expert scan changes apply from the next line (IsLiveApplyActive, LiveApplyMessage); Second Pass on/off, replace=True, Reset_PassConfiguration and Apply_Preset are refused then. SecondPass images need the SecondPass_* channels (SCAN().Set_ScanChannels).
  • TIPFEEDBACK().Set_State and SCANNEDIMAGES().Save_Container match the state / format case-insensitively, as the server does ("standby" and "NMI" were refused before).
  • New sample ExpertScan.py.

1.1.0

(server): the ImageTools API is in hpSPMExtended, NMISPMStudio and hpSPMPlus from the October 2026 Image Tools update. Older builds answer "Route not found" (HTTP 404) for the whole /ImageTools prefix: the methods return None (Get_Commands() returns []) and Endpoint.last_error names the command.

  • New IMAGETOOLS() controller (server), one method per command:
    • Analysis (read only): Get_Selected, Get_ImageInfo, Get_FilterList, Get_CrossSection (2 points or a polyline of up to 64 points), Get_Distance, Get_Angle, Get_PixelValue, Get_Roughness (frame or rectangle), Get_LineRoughness, Get_RectangleMeasurement, Get_Histogram.
    • Processing, each adds a new image to the container and selects it in the GUI (GUI undo stack): Apply_AutoPlaneCorrection, Apply_FloorPlaneLineCorrection, Apply_HorizontalLineCorrection, Apply_RemoveHorizontalScars, Apply_ThreePointPlaneCorrection, Apply_ManualLineCorrection, Apply_Flip, Apply_Rotate, Apply_Crop, Apply_Filter (Gaussian, Mean, Lowpass_3x3, MotionBlur, HighPass, Emboss, Laplacian, LaplacianOfGaussian, Roberts, Prewitt, Sobel, CustomConvolution, Median); Undo_LastApiResult removes the newest image created through the API.
    • Export on the instrument PC: Export_Image (wsxm, gwyddion, csv, bin, txt), Export_MultiFrame (returns once started; poll Get_ExportStatus).
  • Pixel coordinates are buffer pixels: x to the right, y down from the top edge. Processing acts on the frame shown in the GUI and mirrors the GUI algorithms (including their quirks, e.g. Crop snaps to multiples of 16 px). Calls estimated above 512 MiB need allow_large=True.
  • Arguments are checked before sending (filter/format/direction/sampling/mode names, point counts, integer pixel/frame/bins/kernel values; 3.0 is sent as 3). A refused call returns None and sets Endpoint.last_error (status_code None).
  • New sample ImageTools.py.

1.0.9

Commands marked (server) need hpSPM software with the October 2026 API update; older software answers "Command not found" / "Route not found" and the method returns None.

  • New IVCURVE() controller (all IV curve commands; Get_ChartData(channel) returns (keys, values)).
  • New TIPFEEDBACK() controller (server).
  • New commands (server): Approach Get_MotorState, Get_LandHistory; Scan Get/Set_ImageDirectory, Get/Set_ImageName, Get_ScanSpeedTypeList, Get/Set_ScanSpeedType, Get_ScanChannels, Set_ScanChannelSelected, Set_ScanChannels; ScannedImages frame index, Get_FrameCount, Save_Container; VBias Get_BiasVoltRead, Get_MaxACAmplitude, Get_IsSwForcedDC, Get/Set_DividerEnabled, Get/Set_Polarity; AutoTune Get/Set_ExcitationSetMode, Get_MaxExcitation, Get_ExcitationRead, Get/Set_TuningAutoNullPhase, Get_QFactor, Get_FreeRms, Get/Set_AutoRetract, NullPhase; FiberCard Get_FiberPZTVoltageRead, Get_Vpd, Get_FiberVoltageLimits, Get_FiberCardMode; AdjustFiber Get/Set_FindQuadraturePztDelay, Get/Set_FindQuadratureMiddleDelay; IVCurve Get/Set_FirstPointDelay, Get/Set_IsFreezeFeedback, channels Vpd, FN, FN10; PhotoDiode Set_LaserOn, Set_LaserOff, Get_IsLaserChangeEnabled; SystemReadings Get_SystemReadingsWithTimestamp; XYOffset Get_IsGuiOffsetUpdaterRunning.
  • STATUS().DeviceInformations(); HALLCARD().Get_HallAmplitudeBandwidth() alias; HallCard bandwidth accepts 0.01 / 0.1 kHz; ADJUSTFIBER().Set_SlopeMode(direction, point).
  • Enum values are checked before sending (Approach distance/speed type, AutoTune frequency slope, AdjustFiber slope mode, IV type/channel, tip feedback state).
  • Request layer: Endpoint.last_error, set_verbose(), HTTP status and plain-text errors are reported, a JSON null body no longer raises, NaN/inf values are not sent, NMIEndpoint.close() / with NMIEndpoint(...), NMIDevice applies the timeout of a new endpoint for the same address.
  • CustomScanner: ramps to the first pixel before stopping the GUI offset updater, restores the updater and the original offset in all cases, checks the offset limits and every direct move, origin="center", NaN padding for failed external devices.
  • Samples fixed (to_bool for IsScanning, units, laser lock vs. on/off, slope mode, restoring PID values); new IVCurve.py, TipFeedback.py, ScanCustom.py.

Metadata

Release files for hpspmplusstudio 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hpspmplusstudio 1.2.1
File Size Uploaded Provenance Actions
hpspmplusstudio-1.2.1.tar.gz 2.1 MB Without provenance Details for hpspmplusstudio-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hpspmplusstudio 1.2.1
File Interpreter ABI Platform Actions
hpspmplusstudio-1.2.1-py3-none-any.whl Python 3 none any Details for hpspmplusstudio-1.2.1-py3-none-any.whl

Total release size: 4.2 MB

Release files / hpspmplusstudio-1.2.1.tar.gz

Download URL hpspmplusstudio-1.2.1.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
74fd1b4fe51a65bf0ee2af27f73d16b623a1b5ca87fef220e4da2e7837e4a680
BLAKE2b-256 checksum
How to use checksums
610a5072cfe22b61b4ecd79088cceef73cc3230a6eee3bcef2b86e99946e0562
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.4

Release files / hpspmplusstudio-1.2.1-py3-none-any.whl

Download URL hpspmplusstudio-1.2.1-py3-none-any.whl
Size 2.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
7d7de7515797ef4ff2ff0935c26c5c69b1e9a1d6bc38aaa57fe51fbd1667cd2d
BLAKE2b-256 checksum
How to use checksums
c4b110695e585b6308a7118a5f2a3a0e9f139d5d1c9adb1759da4468ed64e128
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.4

Security for hpspmplusstudio 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page