Welcome to PySilentSubstitution!
PySilSub is a Python toolbox for performing the method of silent substitution in vision and nonvisual photoreception research.
Note: See also, PyPlr, a sister project offering a Python framework for researching the pupillary light reflex with the Pupil Core eye tracking platform.
With PySilSub, observer- and device-specific solutions to silent substitution problems are found with linear algebra or numerical optimisation via a configurable, intuitive interface.
# Example 1 - Target melanopsin with 100% contrast (no background
# specified), whilst ignoring rods and minimizing cone contrast,
# for a 42-year-old observer and field size of 10 degrees. Solved
# with numerical optimization.
from pysilsub import observers, problems
ssp = problems.SilentSubstitutionProblem.from_package_data('STLAB_1_York') # Load example data
ssp.observer = observers.ColorimetricObserver(age=42, field_size=10) # Assign custom observer model
ssp.ignore = ['rh'] # Ignore rod photoreceptors
ssp.silence = ['sc', 'mc', 'lc'] # Minimise cone contrast
ssp.target = ['mel'] # Target melanopsin
ssp.target_contrast = 1.0 # With 100% contrast
solution = ssp.optim_solve() # Solve with optimisation
fig = ssp.plot_solution(solution.x) # Plot the solution
Another example:
# Example 2 - Target S-cones with 45% contrast against a specified
# background spectrum (all primaries, half max) whilst ignoring rods
# and minimizing contrast on L/M cones and melanopsin, assuming
# 32-year-old observer and 10-degree field size. Solved with linear
# algebra.
from pysilsub import problems
ssp = problems.SilentSubstitutionProblem.from_package_data('STLAB_1_York') # Load example data
ssp.background = [.5] * ssp.nprimaries # Specify background spectrum
ssp.ignore = ['rh'] # Ignore rod photoreceptors
ssp.silence = ['mc', 'lc', 'mel'] # Silence L/M cones and melanopsin
ssp.target = ['sc'] # Target S cones
ssp.target_contrast = .45 # With 45% contrast
solution = ssp.linalg_solve() # Solve with linear algebra
fig = ssp.plot_solution(solution) # Plot the solution
Some features may serve a broader purpose in vision and circadian research. For example, computing and saving a full set of CIEPO06- and CIES026-compliant action spectra for a given observer age and field size.
from pysilsub.observers import ColorimetricObserver
ColorimetricObserver(age=32, field_size=10).save_action_spectra()
For more information, check out the code, read the docs, and run pip install pysilsub to try out the examples above.
Metadata
Release files for pysilsub 0.1.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 |
|---|---|---|---|---|
| pysilsub-0.1.1.tar.gz | 8.4 MB | Without provenance | Details for pysilsub-0.1.1.tar.gz |
Release files / pysilsub-0.1.1.tar.gz
| Download URL | pysilsub-0.1.1.tar.gz |
|---|---|
| Size | 8.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d07c46b12c3c6a605bb43761b6e5415be96a045a6cb74183a83fdbd31658b310
|
|
BLAKE2b-256 checksum How to use checksums |
6829f94eaa37d1f101539feb51612f12551cec9b675e3c1bff8bbfb544326b36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/6.0.0 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.9
|
Security for pysilsub 0.1.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.