ramansep
Separate strain from carrier density in Raman maps of 2D materials, using two phonon modes whose lever arms differ.
A single Raman frequency responds to strain and to carrier density at once, so one mode cannot tell the two apart. Two modes with sufficiently different responses form a linear, invertible probe: measure both shift maps, invert a 2x2 matrix per pixel, and obtain a strain map and a carrier-density map with propagated uncertainties.
Status
v0.5.0 (alpha). The inversion core, uncertainty propagation, conditioning diagnostics, a synthetic end-to-end example, two cited coefficient sets for monolayer MoS2, a cited graphene G + 2D set, a peak-fitting front end, and the overdetermined multimode GLS inversion with its chi-square model check are implemented and tested. The API may change before v1.0.
More than two modes, with model checking (new in v0.5)
MultiModeModel generalizes the inversion to any number of modes by
weighted (Gauss-Markov) least squares: each extra mode shrinks the
strain and density uncertainties, and the redundancy buys a per-pixel
chi-square goodness-of-fit with m - 2 degrees of freedom, so pixels where
strain and density alone cannot explain the shifts (a third latent
variable, a phase boundary, a bad fit) are flagged by their p-value map,
something no exactly determined two-mode inversion can detect.
compare_mode_sets ranks candidate mode subsets by the uncertainty they
deliver. For two modes the estimator reduces exactly to the 2x2 core
inversion (asserted to machine precision in the tests).
from ramansep import MultiModeModel
mm = MultiModeModel(K) # K: (m, 2) lever arms
res = mm.invert([dw1, dw2, dw3], sigmas=[0.15, 0.10, 0.12])
suspect = res.p_value < 1e-3 # model-violation map
Cited coefficient sets (new in v0.2)
Two example sets for monolayer 1H-MoS2 ship with full provenance, and the test-suite reproduces the published separation results of the source paper from them (edge charge of 2.3e12 cm^-2 from a 0.5 cm^-1 A'1 redshift with 2LA(M) unmoved; 0.134% interior tension carrying no significant charge):
mos2_a1_2la(): the A'1 + 2LA(M) pair of the source paper. Strain lever arms -5.1 and -20.9 cm^-1 per percent of biaxial strain (frozen-phonon DFT, ratio 4.1); A'1 doping coefficient -2.2 cm^-1 per 1e13 cm^-2 of electrons (measured, Chakraborty et al., Phys. Rev. B 85, 161403(R) (2012)). The 2LA(M) doping coefficient is unmeasured and set to zero; the source paper bounds the consequence of that choice at 16% of a recovered edge charge.mos2_eprime_a1(): the historically used all-optical E' + A'1 pair, built from the measured biaxial Grueneisen parameters of Michail et al., ACS Appl. Mater. Interfaces 16, 49602 (2024). Both optical modes respond weakly to strain, so for equal shift noise this pair returns about five times the strain uncertainty of the A'1 + 2LA(M) pair; it is included for comparison and for workflows where the overtone is not available.
New in v0.3, graphene_g_2d_lee2012(): the G + 2D pair of monolayer
graphene, expressing the vector decomposition of Lee et al., Nat. Commun.
3, 1024 (2012) as a linear inversion. Strain axis: -23.5 cm^-1 per percent
of randomly oriented uniaxial strain with the measured 2D/G slope of
2.2 +/- 0.2; hole-doping axis: the measured slope 0.70 +/- 0.05. The
doping output of this set is deliberately NOT a carrier density but the
G-band shift attributable to hole doping (cm^-1): the G-mode doping
response of graphene is nonlinear and sign-dependent, so no universal
linear per-density rate exists to ship, and the docstring points to the
gated calibrations (Froehlicher and Berciaud, Phys. Rev. B 91, 205413
(2015)) a user needs for the conversion on their own substrate.
Each function's docstring states which number comes from which source and the conditions of applicability (for MoS2: 1H monolayer, SiO2-supported, 300 K; 532 nm for the disorder-activated calibration). Check that your sample matches before use.
What this package deliberately does not include
No constants beyond the three documented sets are shipped. Lever arms
depend on material, mode pair, excitation wavelength and substrate; a
measurement tool that ships unverified constants propagates wrong results.
For any other system you provide a ModeCoefficients from the literature
or your own calibration, and the reference field is mandatory so the
provenance of every number travels with the analysis.
Install
pip install ramansep
For development, clone the repository and pip install -e .[test].
Use
import numpy as np
from ramansep import SeparationModel, ModeCoefficients
coeffs = ModeCoefficients(
mode1_name="A'1", mode2_name="2LA(M)",
k1_strain=..., # cm^-1 per unit strain, from your calibration
k1_density=..., # cm^-1 per unit carrier density
k2_strain=...,
k2_density=...,
reference="cite the source of these numbers",
)
model = SeparationModel(coeffs)
result = model.invert(dw_mode1, dw_mode2, sigma1=0.1, sigma2=0.1)
# result.strain, result.density, result.strain_sigma, result.density_sigma
SeparationModel warns when the mode pair is poorly conditioned, i.e. when
the two modes respond too similarly for a reliable separation.
Method
The method of using the first-order A'1 mode together with the disorder-activated 2LA(M) overtone, whose strain lever arms differ severalfold while only A'1 responds appreciably to carrier density, is developed in:
T. M. Mahim and M. M. Rahman, "Two Raman phonons quantify the fixed edge charge left by patterning monolayer transition metal dichalcogenides" (under review). Code for the paper itself: https://github.com/Tanvir-Mahmud-Mahim/Width-scaling-in-monolayer-semiconductor-nanoribbon-transistors
This package is the general-purpose, material-agnostic inversion tool; the paper repository reproduces the specific published study.
Peak fitting (new in v0.4)
The roadmap's front end is in: fit_two_modes takes a raw spectrum,
fits a Lorentzian to each mode window with a NumPy-only
Levenberg-Marquardt solver (analytic Jacobians, linearized 1-sigma
uncertainties), and returns exactly the shifts and uncertainties that
SeparationModel.invert consumes.
from ramansep import SeparationModel, fit_two_modes, mos2_a1_2la
model = SeparationModel(mos2_a1_2la())
dw1, dw2, s1, s2, fit1, fit2 = fit_two_modes(
wavenumber, counts,
window1=(395.0, 415.0), window2=(440.0, 465.0),
ref1=404.7, ref2=452.0) # your pristine references
result = model.invert(dw1, dw2, s1, s2)
The fitter is deliberately Lorentzian-only: that is the lifetime lineshape of a phonon, and an instrument-dominated line deserves a Voigt treatment this package does not yet pretend to have. The test suite checks the analytic Jacobian against finite differences, exact parameter recovery on noiseless lines, statistical compatibility of the reported center uncertainty with the actual scatter on noisy lines, and a full spectrum-to-inversion round trip.
Roadmap
- v0.2 (done): documented example coefficient sets with citations
- v0.3 (done): graphene G+2D coefficient set (Lee 2012)
- v0.4 (done): peak-fitting front end (fit the two modes, feed the inversion)
- v0.5 (done): overdetermined multimode GLS inversion with per-pixel chi-square model checking and mode-set comparison
- v0.6: joint Bayesian inversion with spatial priors
Support and governance
The package is 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. There is no separate governance body; 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 at https://github.com/TaN-MM-Org/ramansep/issues. Usage questions are welcome there alongside bug reports; a docstring that left a unit or a sign convention unclear is treated as a documentation bug, not as user error. The maintainer aims to respond within a week.
While the version is below 1.0 the API may still move between minor versions; such changes are called out in the release notes, and the roadmap above states what is planned, so that a user can tell a missing feature from an omission by design.
License
Apache-2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ramansep-0.5.0.tar.gz.
File metadata
- Download URL: ramansep-0.5.0.tar.gz
- Upload date:
- Size: 29.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
564b59fea110a8be9a5b1d5123c11856535ad43ce0dd1e584332f2e88347e768
|
|
| MD5 |
94036eb6ac00f4ea0064852780f42198
|
|
| BLAKE2b-256 |
175cc1c59e5ef6220a4976a7089b1da06d777feb9f45a99b6355c640d4a0e1de
|
Provenance
The following attestation bundles were made for ramansep-0.5.0.tar.gz:
Publisher:
publish.yml on TaN-MM-Org/ramansep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ramansep-0.5.0.tar.gz -
Subject digest:
564b59fea110a8be9a5b1d5123c11856535ad43ce0dd1e584332f2e88347e768 - Sigstore transparency entry: 2703950219
- Sigstore integration time:
-
Permalink:
TaN-MM-Org/ramansep@06e464a988e59ffcc7bce1aaffb92f094e38819a -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/TaN-MM-Org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@06e464a988e59ffcc7bce1aaffb92f094e38819a -
Trigger Event:
release
-
Statement type:
File details
Details for the file ramansep-0.5.0-py3-none-any.whl.
File metadata
- Download URL: ramansep-0.5.0-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff02260dcb2b232727085580902199385e59b2e8fe81266a94826291e56347d9
|
|
| MD5 |
abac8c74459e8bb3eff453157c6854b1
|
|
| BLAKE2b-256 |
493e0af75c59ecb7296680333290336c0c5faf50d5172964051c7e5174c6c5ec
|
Provenance
The following attestation bundles were made for ramansep-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on TaN-MM-Org/ramansep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ramansep-0.5.0-py3-none-any.whl -
Subject digest:
ff02260dcb2b232727085580902199385e59b2e8fe81266a94826291e56347d9 - Sigstore transparency entry: 2703950773
- Sigstore integration time:
-
Permalink:
TaN-MM-Org/ramansep@06e464a988e59ffcc7bce1aaffb92f094e38819a -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/TaN-MM-Org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@06e464a988e59ffcc7bce1aaffb92f094e38819a -
Trigger Event:
release
-
Statement type: