SensoPy
Python library for the design and analysis of sensory discrimination tests. I have plans to make this a full-fledged sensory data analysis library by including all common standard techniques (Preference Mapping, Penalty Analysis, DOE, etc.)
Installation
pip install SensoPy
Usage
Difference test
One-tailed test of H0: p_d = 0 (no difference) against H1: p_d > 0 (a difference exists). 19 correct responses out of 30 panelists using the Triangle method:
from sensopy import DiscriminationTest
from sensopy.discrimination import TRIANGLE
test = DiscriminationTest(TRIANGLE)
result = test.difference(19, 30)
print(f"d' = {result.d_prime.estimate:.4f} [{result.d_prime.lower:.4f}, {result.d_prime.upper:.4f}]")
print(f"p_d = {result.pd.estimate:.4f} [{result.pd.lower:.4f}, {result.pd.upper:.4f}]")
print(f"p-value = {result.p_value:.4f}")
d' = 2.1462 [1.1262, 3.1336]
p_d = 0.4500 [0.1578, 0.7011]
p-value = 0.0007
- d' = 2.15 (95% CI: [1.13, 3.13]): estimated Thurstonian discriminal distance, a method-independent measure of the sensory difference between the two products.
- p_d = 0.45 (95% CI: [0.16, 0.70]): an estimated 45% of the panel can reliably detect the difference.
- p-value = 0.0007: strong evidence against H0; the products are perceptibly different at any conventional significance level.
Equivalence test
One-tailed test of H0: p_d >= 0.30 against H1: p_d < 0.30 (the products are
sensorially similar). pd0 = 0.30 sets the equivalence threshold: the maximum
proportion of discriminators we are willing to tolerate and still call the products
equivalent. 16 correct out of 30 panelists using the 2-AFC method:
from sensopy import DiscriminationTest
from sensopy.discrimination import TWO_AFC
test = DiscriminationTest(TWO_AFC)
result = test.equivalence(16, 30, pd0=0.30)
print(f"d' = {result.d_prime.estimate:.4f} [{result.d_prime.lower:.4f}, {result.d_prime.upper:.4f}]")
print(f"p_d = {result.pd.estimate:.4f} [{result.pd.lower:.4f}, {result.pd.upper:.4f}]")
print(f"p-value = {result.p_value:.4f}")
d' = 0.1183 [0.0000, 0.8099]
p_d = 0.0667 [0.0000, 0.4332]
p-value = 0.1263
- d' = 0.12 (95% CI: [0.00, 0.81]): small estimated sensory distance, consistent with near-identical products.
- p_d = 0.07 (95% CI: [0.00, 0.43]): only ~7% of the panel estimated to reliably discriminate the products.
- p-value = 0.13: insufficient evidence to conclude equivalence at α = 0.05 with pd0 = 0.30 (i.e., we cannot rule out that ≥ 30% of consumers can detect the difference); a larger panel would be needed to meet that threshold.
Roadmap
See ROADMAP.md.
Citing
If you use SensoPy in your work, please cite it using CITATION.cff; GitHub's "Cite this repository" button exports it as APA or BibTeX.
Credits
- Edgar Ramírez Mondragón
References
- Bi, J. 2015. Sensory Discrimination Tests and Measurements. Sensometrics in Sensory Evaluation. Wiley Blackwell, Richmond, Virginia, USA.
Metadata
Release files for sensopy 0.0.2
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 |
|---|---|---|---|---|
| sensopy-0.0.2.tar.gz | 59.8 kB | With provenance | Details for sensopy-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sensopy-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for sensopy-0.0.2-py3-none-any.whl |
Total release size: 72.6 kB
Release files / sensopy-0.0.2.tar.gz
| Download URL | sensopy-0.0.2.tar.gz |
|---|---|
| Size | 59.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bcd6882694e644af918696a83fd5ff8c138ae0d27e64108570426ee38391f645
|
|
BLAKE2b-256 checksum How to use checksums |
6de6df5f192eada8cff7a240b5bd50261b34d11e5e1b162434af14065332f18a
|
| 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 Nov 10, 2026.
Transparency logRelease files / sensopy-0.0.2-py3-none-any.whl
| Download URL | sensopy-0.0.2-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b60b06f1598592f17eae0effdc2d7ddc53336e610b71522b1a26f5e7c5d14247
|
|
BLAKE2b-256 checksum How to use checksums |
4e8ae06a67333f60a3b2410a1ece7f61dee8ba2b0268475c233f6c642027bdf0
|
| 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 Nov 10, 2026.
Transparency logSecurity for sensopy 0.0.2
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 sensopy-0.0.2.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 Nov 10, 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.