Welcome to PySilentSubstitution!
================================
[![DOI](https://zenodo.org/badge/390693759.svg)](https://zenodo.org/badge/latestdoi/390693759) [![PyPI version](https://badge.fury.io/py/pysilsub.svg)](https://badge.fury.io/py/pysilsub) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](./CODE_OF_CONDUCT.md) [![PyPi license](https://badgen.net/pypi/license/pip/)](https://pypi.com/project/pip/) [![PyPI status](https://img.shields.io/pypi/status/ansicolortags.svg)](https://pypi.python.org/pypi/ansicolortags/)
<img src="https://github.com/PySilentSubstitution/pysilsub/blob/main/logo/photoreceptor_characters.png?raw=True" alt="photoreceptor-characters" width="200"/>
*PySilSub* is a Python toolbox for performing the method of [silent substitution](https://pysilentsubstitution.github.io/pysilsub/01_background.html) in vision and nonvisual photoreception research.
**Note:** See also, [PyPlr](https://pyplr.github.io/cvd_pupillometry/index.html),
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.
```Python
# 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
```
<img src="https://raw.githubusercontent.com/PySilentSubstitution/pysilsub/main/img/example_1.svg" alt="Example 1" />
Another example:
```Python
# 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
```
<img src="https://raw.githubusercontent.com/PySilentSubstitution/pysilsub/main/img/example_2.svg" alt="Example 2" />
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.
```python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/PySilentSubstitution/pysilsub",
"name": "pysilsub",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "silent substitution,vision,psychology,perception,metamer,spectra,LED",
"author": "Joel T. Martin",
"author_email": "joel.t.martin36@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/68/29/f94eaa37d1f101539feb51612f12551cec9b675e3c1bff8bbfb544326b36/pysilsub-0.1.1.tar.gz",
"platform": null,
"description": "Welcome to PySilentSubstitution!\n================================\n\n[![DOI](https://zenodo.org/badge/390693759.svg)](https://zenodo.org/badge/latestdoi/390693759) [![PyPI version](https://badge.fury.io/py/pysilsub.svg)](https://badge.fury.io/py/pysilsub) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](./CODE_OF_CONDUCT.md) [![PyPi license](https://badgen.net/pypi/license/pip/)](https://pypi.com/project/pip/) [![PyPI status](https://img.shields.io/pypi/status/ansicolortags.svg)](https://pypi.python.org/pypi/ansicolortags/) \n\n<img src=\"https://github.com/PySilentSubstitution/pysilsub/blob/main/logo/photoreceptor_characters.png?raw=True\" alt=\"photoreceptor-characters\" width=\"200\"/>\n\n*PySilSub* is a Python toolbox for performing the method of [silent substitution](https://pysilentsubstitution.github.io/pysilsub/01_background.html) in vision and nonvisual photoreception research.\n\n**Note:** See also, [PyPlr](https://pyplr.github.io/cvd_pupillometry/index.html),\na sister project offering a Python framework for researching the pupillary \nlight reflex with the Pupil Core eye tracking platform.\n\nWith *PySilSub*, observer- and device-specific solutions to silent substitution \nproblems are found with linear algebra or numerical optimisation via a configurable, \nintuitive interface.\n\n```Python\n# Example 1 - Target melanopsin with 100% contrast (no background \n# specified), whilst ignoring rods and minimizing cone contrast, \n# for a 42-year-old observer and field size of 10 degrees. Solved\n# with numerical optimization.\n\nfrom pysilsub import observers, problems\n\nssp = problems.SilentSubstitutionProblem.from_package_data('STLAB_1_York') # Load example data\nssp.observer = observers.ColorimetricObserver(age=42, field_size=10) # Assign custom observer model\nssp.ignore = ['rh'] # Ignore rod photoreceptors\nssp.silence = ['sc', 'mc', 'lc'] # Minimise cone contrast\nssp.target = ['mel'] # Target melanopsin\nssp.target_contrast = 1.0 # With 100% contrast \nsolution = ssp.optim_solve() # Solve with optimisation\nfig = ssp.plot_solution(solution.x) # Plot the solution\n```\n\n\n<img src=\"https://raw.githubusercontent.com/PySilentSubstitution/pysilsub/main/img/example_1.svg\" alt=\"Example 1\" />\n\nAnother example: \n\n```Python\n# Example 2 - Target S-cones with 45% contrast against a specified \n# background spectrum (all primaries, half max) whilst ignoring rods \n# and minimizing contrast on L/M cones and melanopsin, assuming \n# 32-year-old observer and 10-degree field size. Solved with linear \n# algebra.\n\nfrom pysilsub import problems\n\nssp = problems.SilentSubstitutionProblem.from_package_data('STLAB_1_York') # Load example data\nssp.background = [.5] * ssp.nprimaries # Specify background spectrum\nssp.ignore = ['rh'] # Ignore rod photoreceptors\nssp.silence = ['mc', 'lc', 'mel'] # Silence L/M cones and melanopsin\nssp.target = ['sc'] # Target S cones\nssp.target_contrast = .45 # With 45% contrast \nsolution = ssp.linalg_solve() # Solve with linear algebra\nfig = ssp.plot_solution(solution) # Plot the solution\n```\n\n<img src=\"https://raw.githubusercontent.com/PySilentSubstitution/pysilsub/main/img/example_2.svg\" alt=\"Example 2\" />\n\nSome 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.\n\n```python\nfrom pysilsub.observers import ColorimetricObserver\n\nColorimetricObserver(age=32, field_size=10).save_action_spectra()\n```\n \nFor more information, check out the code, read the docs, and run `pip install pysilsub` to try out the examples above.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Software for performing silent substitution in Python.",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://pysilentsubstitution.github.io/pysilsub/index.html",
"Homepage": "https://github.com/PySilentSubstitution/pysilsub"
},
"split_keywords": [
"silent substitution",
"vision",
"psychology",
"perception",
"metamer",
"spectra",
"led"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6829f94eaa37d1f101539feb51612f12551cec9b675e3c1bff8bbfb544326b36",
"md5": "5340c4c27a4089467b78f3a7c0731947",
"sha256": "d07c46b12c3c6a605bb43761b6e5415be96a045a6cb74183a83fdbd31658b310"
},
"downloads": -1,
"filename": "pysilsub-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "5340c4c27a4089467b78f3a7c0731947",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 8369605,
"upload_time": "2023-07-17T13:50:46",
"upload_time_iso_8601": "2023-07-17T13:50:46.564862Z",
"url": "https://files.pythonhosted.org/packages/68/29/f94eaa37d1f101539feb51612f12551cec9b675e3c1bff8bbfb544326b36/pysilsub-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-17 13:50:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PySilentSubstitution",
"github_project": "pysilsub",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "pysilsub"
}