Skip to main content

sm4file

sm4file is Python library for reading RHK .sm4 files.

Installing

Installation via pip:

pip install sm4file

Example Usage

from sm4file import Sm4


sm4 = Sm4("path/to/sm4-file")

This return a list of all acquired measurement channels. Metadata can be accessed as properties on a channel. For example to print the bias voltage for all channels:

for channel in sm4:
    print(channel.bias)

The measurement's numerical data is stored in the data property on each channel. For images this is a two dimensional numpy array. For lines / spectra it is a (n, m) where n is the number of acquired data points and m is the number of spectra + 1. The array's first column contains the x-values and all subsequent ones the corresponding y-values.

Plot images from all channels

import matplotlib.pyplot as plt


for channel in sm4:
    plt.imshow(channel.data)
    plt.title(f"{channel.label} - {channel.scan_direction}")
    plt.show()

Plot all spectra, e.g. IV

for channel in sm4:
    for i in range(1, len(channel.data[0])):
        plt.plot(channel.data[:, 0], channel.data[:, i], label=f"{i}")
        plt.title(channel.label)
        plt.legend()

    plt.show()

Metadata

Release files for sm4file 0.1.0

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

Source distribution (sdist)

Source distribution for sm4file 0.1.0
File Size Uploaded
sm4file-0.1.0.tar.gz 13.7 kB Details

Built distribution (wheel)

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

Total release size: 28.3 kB

Release files / sm4file-0.1.0.tar.gz

Download URL sm4file-0.1.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5e774b7589684c8a9f28f1fde150ef43fea6b694eabd5f9d348e541025efd82c
BLAKE2b-256 checksum
How to use checksums
a1785bfee384be588ee58d661c7a07b6ac5ffa6123e5d1b34534f83810416a46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.5 Darwin/23.6.0

Release files / sm4file-0.1.0-py3-none-any.whl

Download URL sm4file-0.1.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e44f4dba36bc51ee2d3366484c1f2b26e3a056da14f38717cef22b015da51fbc
BLAKE2b-256 checksum
How to use checksums
05f164fede2b50ed3f1b68abf81b3b9d5f0a48f04769f1928f43858a7f56e7bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.5 Darwin/23.6.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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