An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# `spec.vis`

[![Project Status: WIP – Initial development is in progress, but there
has not yet been a stable, usable release suitable for the
public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![cran
version](https://www.r-pkg.org/badges/version-ago/spec.vis)](https://cran.r-project.org/package=spec.vis/)
[![Build
Status](https://travis-ci.org/thomased/spec.vis.svg?branch=master)](https://travis-ci.org/thomased/spec.vis/)
[![Coverage
status](https://codecov.io/gh/thomased/spec.vis/branch/master/graph/badge.svg)](https://codecov.io/github/thomased/spec.vis?branch=master)
[![cran
downloads](https://cranlogs.r-pkg.org/badges/grand-total/spec.vis)](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 = '')

Example spectra available in the package.

## 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).