ramansep
ramansep is a Python package that tells strain apart from
charge in Raman maps of 2D materials (sheets only one or a few atoms
thick, such as graphene or monolayer MoS2).
A Raman peak moves when the material is stretched, and it also moves
when extra electrons or holes are added. One peak alone cannot say
which of the two happened. Two peaks that respond differently can: if
you know how much each peak moves per unit of strain and per unit of
charge, the two measured shifts give two equations with two unknowns.
ramansep solves those equations at every pixel of a map and gives a
strain map and a charge-density map, each with an error bar. It also
covers the steps around that:
- How do I read the text files my instrument exports, and get the peak shifts out of the measured spectra? Which pixels failed or carry no peak at all?
- What if two peaks overlap, so that their fitted positions are correlated, with two peaks or more? Are my error bars right when the noise grows with the counts (shot noise)?
- Which pair of peaks separates the two causes best?
- With three or more peaks, does "strain plus charge" actually explain what I measured, pixel by pixel?
- Can I trade some resolution for smaller error bars if the fields are smooth, how much smoothing do the data support, and can I fill the pixels whose fits failed?
- How do I measure the response numbers on my own instrument, even when the starting strain and charge of my sample are unknown, and how should I plan that measurement?
- How much of my final error bar comes from that calibration, with two peaks or more?
- What if laser heating also shifts the peaks?
- What are the mean strain and charge of a region, and how much more charge sits at an edge than inside, with an error bar that counts every source of error?
- How do strain and charge change with the distance from an edge, and how many extra electrons sit along each micrometer of edge?
The results are checked by automated tests against independent calculations and exact limits (see How the results are checked). When an input cannot give a trustworthy answer, the package stops with an error that says why, rather than returning a number that looks fine.
Install
pip install ramansep
For development: clone the repository and pip install -e .[test].
The source distribution on PyPI also carries the tests and, since
0.15.0, the tutorial scripts, so the whole test suite runs from it.
Units and conventions are listed in the guide.
A first look
1. Strain and charge at two spots of a MoS2 ribbon
The shifts here are the ones quoted by the source paper (Mahim and Rahman, under review) from tip-enhanced Raman maps (maps taken with a sharp metal tip that gives nanometer resolution; Krayev et al., Appl. Phys. Lett. 128, 203102 (2026)); the 0.1 cm^-1 shift error is illustrative.
import numpy as np
import ramansep as rs
model = rs.SeparationModel(rs.mos2_a1_2la()) # monolayer MoS2, A'1 + 2LA(M)
# Peak shifts (cm^-1) quoted by the source paper at two spots:
# the ribbon edge (A'1 -0.5, 2LA(M) 0.0) and an interior spot (-0.6, -2.8).
dw_a1 = np.array([-0.5, -0.6])
dw_2la = np.array([0.0, -2.8])
res = model.invert(dw_a1, dw_2la, sigma1=0.1, sigma2=0.1) # 0.1 cm^-1: illustrative
for name, i in [("edge", 0), ("interior", 1)]:
print(f"{name:8s} strain {res.strain[i]:+.3f} +/- {res.strain_sigma[i]:.3f} % "
f"electrons {res.density[i] * 1e13:+.2e} +/- {res.density_sigma[i] * 1e13:.1e} cm^-2")
print(f"condition number of the matrix: {res.condition_number:.1f}")
edge strain +0.000 +/- 0.005 % electrons +2.27e+12 +/- 4.7e+11 cm^-2
interior strain +0.134 +/- 0.005 % electrons -3.78e+11 +/- 4.7e+11 cm^-2
condition number of the matrix: 10.1
The edge carries about 2.3e12 electrons per cm^2 and no strain; the
interior spot is under 0.134 % tension, and its density is within one
error bar of zero. These match the paper's separations; the test
suite checks them (see below). res.correlation gives the
per-pixel correlation of the two estimates.
More in the examples.
Where to read on
- Examples: 21 short examples, each with the output it prints.
- Tutorials: complete analyses, from data to a result with error bars.
- Words, units and conventions: the terms used here, explained in plain words, and every unit and sign convention.
- What is in the package: every function, grouped by task.
- How the results are checked: what each test compares with and how closely, and the mistakes fixed in earlier versions.
- Limits: when the package refuses an input and why, and what it deliberately does not do.
- CHANGELOG: what changed in each version.
Where it comes from
T. M. Mahim and M. M. Rahman, "Two Raman peaks and transistor thresholds quantify the fixed negative charge at etched edges of monolayer MoS2" (under review). Code for the paper: https://github.com/Tanvir-Mahmud-Mahim/Width-scaling-in-monolayer-semiconductor-nanoribbon-transistors Data: 10.5281/zenodo.21670315 (concept DOI, resolves to the latest version)
This package is the general-purpose, material-agnostic tool; the paper repository reproduces that specific study.
Citing, support and license
If ramansep helps your work, please cite it with the concept DOI
10.5281/zenodo.22014913,
which always resolves to the latest version; every release is
archived on Zenodo. CITATION.cff has the details.
Written and maintained by Tanvir Mahmud Mahim (Department of Electrical and Electronic Engineering, BRAC University), who reviews every change and takes the final decision on scope and releases. Design questions are discussed in the open in issues and pull requests, and the standing rule of CONTRIBUTING.md binds the maintainer exactly as it binds contributors: a change that touches physics arrives with a test, and a constant arrives with its source.
Support runs through the issue tracker. Usage questions are welcome alongside bug reports; a docstring that left a unit or a sign convention unclear is treated as a documentation bug, not user error. While the version is below 1.0 the API may still move between minor versions; such changes are called out in the release notes.
Licensed under Apache-2.0.
Metadata
Release files for ramansep 0.17.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ramansep-0.17.1.tar.gz | 208.1 kB | With provenance | Details for ramansep-0.17.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ramansep-0.17.1-py3-none-any.whl | Python 3 | none | any | Details for ramansep-0.17.1-py3-none-any.whl |
Total release size: 296.3 kB
Release files / ramansep-0.17.1.tar.gz
| Download URL | ramansep-0.17.1.tar.gz |
|---|---|
| Size | 208.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c791a117da324f8f5385d5626983bfe84571a287386c35f0a418e527dffae36b
|
|
BLAKE2b-256 checksum How to use checksums |
6142a59095664ca4fbd951915e09be5479fd3affc5f6a76b9c175b4e567a512c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logRelease files / ramansep-0.17.1-py3-none-any.whl
| Download URL | ramansep-0.17.1-py3-none-any.whl |
|---|---|
| Size | 88.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94898b1c8f52f4047520d8b50301e88207337b851f0fcb48335338160ef2c9a1
|
|
BLAKE2b-256 checksum How to use checksums |
16072ead2072e2a6d598f3e46fa7de09525cf83930886bb13e6ddaa8317b4ccc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logSecurity for ramansep 0.17.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ramansep-0.17.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logA 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.