https://github.com/thomased/spec.vis
A database/R data package of photoreceptor absorbance and ocular transmission spectra and their metadata
https://github.com/thomased/spec.vis
database modelling r vision
Last synced: 3 months ago
JSON representation
A database/R data package of photoreceptor absorbance and ocular transmission spectra and their metadata
- Host: GitHub
- URL: https://github.com/thomased/spec.vis
- Owner: thomased
- Created: 2019-04-15T02:50:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-17T09:42:22.000Z (about 7 years ago)
- Last Synced: 2025-04-08T16:55:20.509Z (over 1 year ago)
- Topics: database, modelling, r, vision
- Language: R
- Homepage:
- Size: 4.25 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `spec.vis`
[](https://www.repostatus.org/#wip)
[](https://cran.r-project.org/package=spec.vis/)
[](https://travis-ci.org/thomased/spec.vis/)
[](https://codecov.io/github/thomased/spec.vis?branch=master)
[](https://cran.r-project.org/package=spec.vis/)
## Spectral sensitivity data package
`spec.vis` is a mini-database and R data package of receptor absorbance
and ocular transmission spectra with metadata, useful for
visual/colorspace modelling among other things. It currently contains
**410 spectra** from **119 species**.
## Installation
To download the development version of `spec.vis`, you can:
- use the [`remotes`](https://github.com/r-lib/remotes) package:
``` r
# install.packages("remotes")
remotes::install_github("thomased/spec.vis")
```
- download files from GitHub and install using `$R CMD INSTALL` or,
from within R:
``` r
install.packages(path, type = "source", repos = NULL)
```
## Browsing and searching spectra
The entire database can be loaded into memory by simply calling
`data(specvis_spectra)`, along with the metadata `data(specvis_meta)`
and dictionary `data(specvis_dict)`.
Alternately, the `specvis_search()` function allows you to query the
available data and return a select subset based on search terms
(e.g. `specvis_search(genus == 'bombus')`), with the option of
returning either raw spectra or metadata via the `return.spectra`
argument.
Finally, if you’re not an `R` person, the ‘database’ boils down to a few
text files located in the `data.raw/` directory, which you’re free to
download and use as you please.
## Example
# Load packages
library(spec.vis)
library(pavo)
# Grab some spectra
apis <- specvis_search(genus == 'apis', species == 'mellifera', return.spectra = TRUE)
canis <- specvis_search(genus == 'canis', species == 'familiaris', return.spectra = TRUE)
bluetit <- specvis_search(genus == 'cyanistes', species == 'caeruleus', return.spectra = TRUE)
# Plot them
par(mfrow=c(1,3))
plot(as.rspec(canis), main = 'Canis familiaris', ylab = 'Absorbance', xlab = '')
plot(as.rspec(apis), ylab = '', main = 'Apis mellifera (f)')
plot(as.rspec(bluetit), ylab = '', main = 'Cyanistes caeruleus', xlab = '')

## Contributing
Contributions of spectra to the package are most welcome. There are a
few ways to do so, from most- to least-involved:
- **via pull request**
- Install the `spec.vis` package in the usual manner.
- Fork and clone the package repository.
- Append your spectra to the `data-raw/specvis_spectra.csv` file,
and complete all metadata fields in the
`data-raw/specvis_meta.csv` file. Spectra should follow the
naming convention `_.`, where
`` begins at 1 and proceeds from the shortest- to
longest- wavelength sensitive receptor.
- Run the function `specvis_rebuild()` to rebuild the database
(i.e. to save the raw data as `.rda` files.
- Commit and push your changes, and submit a pull request.
- **via email, v1**
- Take a look at the structure of the package’s spectral data
(`data(specvis_spectra)`) and metadata (`data(specvis_meta)`).
- [Email me](mailto:thomas.white@sydney.edu.au) your data in as
similar a format as possible (but I’ll take anything).
- **via email, v2**
- [Email me](mailto:thomas.white@sydney.edu.au) a paper containing
data that you’d like added (containing either lambda-max values
or plotted absorbance curves, at a minimum).
## Citing
If you find the package useful, please cite the original data
source(s)and the `spec.vis` package (see `citation("spec.vis")` for the
reference).