lightr

lightr: import spectral data and metadata in R - Published in JOSS (2019)

https://github.com/ropensci/lightr

Science Score: 59.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 6 DOI reference(s) in README
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    1 of 34 committers (2.9%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (20.3%) to scientific vocabulary

Keywords

file-import r r-package reproducibility reproducible-research reproducible-science spectral-data spectroscopy

Scientific Fields

Engineering Computer Science - 60% confidence
Last synced: 6 months ago · JSON representation

Repository

Import spectral data and related metadata in R

Basic Info
Statistics
  • Stars: 13
  • Watchers: 3
  • Forks: 1
  • Open Issues: 14
  • Releases: 14
Topics
file-import r r-package reproducibility reproducible-research reproducible-science spectral-data spectroscopy
Created over 7 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Codemeta

README.md

lightr: import spectral data in R

Lifecycle: stable CRAN version R build status Coverage status Reviewed by rOpenSci JOSS paper <!-- badges: end -->

There is no standard file format for spectrometry data and different scientific instrumentation companies use wildly different formats to store spectral data. Vendor proprietary software sometimes has an option but convert those formats instead human readable files such as csv but in the process, most metadata are lost. However, those metadata are critical to ensure reproducibility (White et al, 2015).

This package aims at offering a unified user-friendly interface for users to read UV-VIS reflectance/transmittance/absorbance spectra files from various formats in a single line of code.

Additionally, it provides for the first time a fully free and open source solution to read proprietary spectra file formats on all systems.

🗟 Citation

To cite this package in publications, please use:

Gruson H., White T.E., Maia R., (2019). lightr: import spectral data and metadata in R. Journal of Open Source Software, 4(43), 1857, https://doi.org/10.21105/joss.01857

🔧 Installation

r install.packages("lightr")

You can also install the development version from rOpenSci's CRAN-like repository:

r install.packages("lightr", repos = "https://dev.ropensci.org")

💻 Usage

A thorough documentation is available with the package, using R usual syntax ?function or help(function). However, users will probably mainly use two functions:

```r

Get a data.frame containing all useful metadata from spectra in a folder

lrgetmetadata(where = system.file("testdata/procspec_files", package = "lightr"), ext = "ProcSpec") ```

and

```r

Get a single dataframe where the first column contains the wavelengths and

the next columns contain a spectra each (pavo's rspec class)

lrgetspec(where = system.file("testdata/procspec_files", package = "lightr"), ext = "ProcSpec") ```

lr_get_spec() returns a dataframe that is compatible with pavo custom S3 class (rspec) and can be used for further analyses using colour vision models.

All supported file formats can also be parsed using the lr_parse_$extension() function where $extension is the lowercase extension of your file. This family of functions return a list where the first element is the data dataframe and the second element is a vector with relevant metadata.

Only exceptions are .txt and .Transmission files because those extensions are too generic. Users will need to figure out which parser is appropriate in this case. lr_get_metadata() and lr_get_spec() automatically try generic parsers in this case.

Alternatively, you may simply want to convert your spectra in a readable standard format and carry on with your analysis with another software.

In this case, you can run:

```r

Convert every single ProcSpec file to a csv file with the same name and

location

lrconverttocsv(where = system.file("testdata/procspec_files", package = "lightr"), ext = "ProcSpec") ```

✔ Supported file formats

This package is still under development but currently supports (you can click on the extension in the tables to see an example of this file format):

OceanOptics/OceanInsight

| Extension | Parser | |:-----------------|:---------------------------------| | jdx | lr_parse_oceanoptics_jdx() | | ProcSpec | lr_parse_oceanoptics_procspec() | | spc | lr_parse_oceanoptics_spc() | | jaz | lr_parse_oceanoptics_jaz() | | JazIrrad | lr_parse_oceanoptics_jazirrad() | | Transmission | lr_parse_oceanoptics_jaz() | | txt | lr_parse_oceanoptics_jaz() |

Avantes

| Extension | Parser | |:--------------- |:------------------------------| | ABS | lr_parse_avantes_abs() | | ROH | lr_parse_avantes_roh() | | TRM | lr_parse_avantes_trm() | | trt | lr_parse_avantes_trt() | | ttt | lr_parse_avantes_ttt() | | txt | lr_parse_generic() | | DRK | lr_parse_avantes_trm() | | REF | lr_parse_avantes_trm() | | IRR8 | lr_parse_avantes_irr8() | | RFL8 | lr_parse_avantes_rfl8() | | Raw8 | lr_parse_avantes_raw8() |

CRAIC

| Extension | Parser | |:----------|:---------------------------| | txt | lr_parse_generic() | | spc | lr_parse_craic_spc() |

Others

| Extension | Parser | |:----------|:------------------------------| | csv | lr_parse_csv() | | dpt | lr_parse_generic(sep = ",") |

As a fallback, you should always try lr_parse_generic() which offers a flexible and general algorithm that manages to extract data from most files.

If you can't find the best parser for your specific file or if you believe you are using an unsupported format, please open an issue or send me an email.

🌐 Similar projects

  • lightr itself contains some code that has been initially forked from pavo, namely the lr_get_spec() function. The code has since then been refactored and optimised for speed. pavo differs from lightr in its focus and core functionalities. The main strength of pavo is the comprehensive and user-friendly set of functions to analyse spectral data using colour vision models, while lightr focuses on the data import step.
  • photobiologyInOut also provides functions to import spectral data. The goal of the author is to provide a complete pipeline of spectral data import and analysis using a set of tightly integrated R packages. This however makes it more difficult to use a different tool for a given step of the process. On the contrary, lightr aims at proposing a light package with limited dependencies that focuses on the data import step of the process and let the user pick their favourite tool for the analysis step (pavo, colourvision, Avicol, etc.).
  • spectrolab

To our knowledge, lightr is the only gratis tool to import some complex file formats such as Avantes (ABS, ROH, TRM, RFL8) or CRAIC (spc) binary files, or OceanOptics .ProcSpec. Because of its user-friendly high-levels functions and low dependency philosophy, lightr may also hopefully prove useful for people working with other languages than R.

Contributing

There are plenty of ways you can contribute to lightr. Please visit our contributing guide.

Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Owner

  • Name: rOpenSci
  • Login: ropensci
  • Kind: organization
  • Email: info@ropensci.org
  • Location: Berkeley, CA

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "lightr",
  "description": "Parse various reflectance/transmittance/absorbance spectra file formats to extract spectral data and metadata, as described in Gruson, White & Maia (2019) <doi:10.21105/joss.01857>. Among other formats, it can import files from 'Avantes' <https://www.avantes.com/>, 'CRAIC' <https://www.microspectra.com/>, and 'OceanInsight' (formerly 'OceanOptics') <https://www.oceaninsight.com/> brands.",
  "name": "lightr: Read Spectrometric Data and Metadata",
  "relatedLink": [
    "https://docs.ropensci.org/lightr/",
    "https://CRAN.R-project.org/package=lightr"
  ],
  "codeRepository": "https://github.com/ropensci/lightr",
  "issueTracker": "https://github.com/ropensci/lightr/issues",
  "license": "https://spdx.org/licenses/GPL-2.0",
  "version": "1.7.0.9000",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.2.1 (2022-06-23)",
  "provider": {
    "@id": "https://cran.r-project.org",
    "@type": "Organization",
    "name": "Comprehensive R Archive Network (CRAN)",
    "url": "https://cran.r-project.org"
  },
  "author": [
    {
      "@type": "Person",
      "givenName": "Hugo",
      "familyName": "Gruson",
      "email": "hugo.gruson+R@normalesup.org",
      "@id": "https://orcid.org/0000-0002-4094-1476"
    },
    {
      "@type": "Person",
      "givenName": "Rafael",
      "familyName": "Maia",
      "@id": "https://orcid.org/0000-0002-7563-9795"
    },
    {
      "@type": "Person",
      "givenName": "Thomas",
      "familyName": "White",
      "@id": "https://orcid.org/0000-0002-3976-1734"
    }
  ],
  "contributor": [
    {
      "@type": "Person",
      "givenName": "Kotya",
      "familyName": "Karapetyan"
    }
  ],
  "copyrightHolder": [
    {
      "@type": "Person",
      "givenName": "Hugo",
      "familyName": "Gruson",
      "email": "hugo.gruson+R@normalesup.org",
      "@id": "https://orcid.org/0000-0002-4094-1476"
    },
    {
      "@type": "Person",
      "givenName": "Rafael",
      "familyName": "Maia",
      "@id": "https://orcid.org/0000-0002-7563-9795"
    },
    {
      "@type": "Person",
      "givenName": "Thomas",
      "familyName": "White",
      "@id": "https://orcid.org/0000-0002-3976-1734"
    },
    {
      "@type": "Person",
      "givenName": "Kotya",
      "familyName": "Karapetyan"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Hugo",
      "familyName": "Gruson",
      "email": "hugo.gruson+R@normalesup.org",
      "@id": "https://orcid.org/0000-0002-4094-1476"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "digest",
      "name": "digest",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=digest"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "knitr",
      "name": "knitr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=knitr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "pavo",
      "name": "pavo",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=pavo"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "rmarkdown",
      "name": "rmarkdown",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rmarkdown"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "spelling",
      "name": "spelling",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=spelling"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "testthat",
      "name": "testthat",
      "version": ">= 3.0.0",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=testthat"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "withr",
      "name": "withr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=withr"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 3.5.0"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "future.apply",
      "name": "future.apply",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=future.apply"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "progressr",
      "name": "progressr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=progressr"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "xml2",
      "name": "xml2",
      "version": ">= 1.0.0",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=xml2"
    },
    "SystemRequirements": null
  },
  "fileSize": "5295.415KB",
  "citation": [
    {
      "@type": "ScholarlyArticle",
      "datePublished": "2019",
      "author": [
        {
          "@type": "Person",
          "givenName": "Hugo",
          "familyName": "Gruson"
        },
        {
          "@type": "Person",
          "givenName": "Thomas",
          "familyName": "White"
        },
        {
          "@type": "Person",
          "givenName": "Rafael",
          "familyName": "Maia"
        }
      ],
      "name": "lightr: import spectral data and metadata in R",
      "identifier": "10.21105/joss.01857",
      "url": "https://doi.org/10.21105/joss.01857",
      "pagination": "1857",
      "@id": "https://doi.org/10.21105/joss.01857",
      "sameAs": "https://doi.org/10.21105/joss.01857",
      "isPartOf": {
        "@type": "PublicationIssue",
        "issueNumber": "43",
        "datePublished": "2019",
        "isPartOf": {
          "@type": [
            "PublicationVolume",
            "Periodical"
          ],
          "volumeNumber": "4",
          "name": "Journal of Open Source Software"
        }
      }
    }
  ],
  "releaseNotes": "https://github.com/ropensci/lightr/blob/master/NEWS.md",
  "readme": "https://github.com/ropensci/lightr/blob/main/README.md",
  "contIntegration": [
    "https://github.com/ropensci/lightr/actions",
    "https://codecov.io/github/ropensci/lightr?branch=main"
  ],
  "developmentStatus": "https://lifecycle.r-lib.org/articles/stages.html",
  "review": {
    "@type": "Review",
    "url": "https://github.com/ropensci/software-review/issues/267",
    "provider": "https://ropensci.org"
  },
  "keywords": [
    "r",
    "spectroscopy",
    "spectral-data",
    "reproducible-research",
    "reproducible-science",
    "reproducibility",
    "r-package",
    "file-import"
  ]
}

GitHub Events

Total
  • Create event: 8
  • Release event: 2
  • Issues event: 9
  • Delete event: 10
  • Issue comment event: 8
  • Push event: 47
  • Pull request review comment event: 14
  • Pull request review event: 7
  • Pull request event: 14
Last Year
  • Create event: 8
  • Release event: 2
  • Issues event: 9
  • Delete event: 10
  • Issue comment event: 8
  • Push event: 47
  • Pull request review comment event: 14
  • Pull request review event: 7
  • Pull request event: 14

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 790
  • Total Committers: 34
  • Avg Commits per committer: 23.235
  • Development Distribution Score (DDS): 0.043
Past Year
  • Commits: 66
  • Committers: 2
  • Avg Commits per committer: 33.0
  • Development Distribution Score (DDS): 0.03
Top Committers
Name Email Commits
Hugo Gruson h****n@p****m 756
Copilot 1****t 2
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
and 4 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 44
  • Total pull requests: 26
  • Average time to close issues: 4 months
  • Average time to close pull requests: 3 months
  • Total issue authors: 5
  • Total pull request authors: 3
  • Average comments per issue: 0.84
  • Average comments per pull request: 0.38
  • Merged pull requests: 23
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 4
  • Average time to close issues: 10 days
  • Average time to close pull requests: 3 days
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.67
  • Average comments per pull request: 0.5
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Bisaloo (43)
  • itamshab (1)
  • maelle (1)
  • bittonp (1)
  • jeroen (1)
Pull Request Authors
  • Bisaloo (30)
  • maelle (2)
  • Copilot (2)
  • danielskatz (1)
Top Labels
Issue Labels
Type: enhancement (13) help wanted (11) good first issue (7) Scope: testing (4) Type: bug (4) question (3) Scope: performance (2) Scope: UX/docs (2) upkeep (1)
Pull Request Labels
Status: blocked (1)

Packages

  • Total packages: 1
  • Total downloads:
    • cran 695 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 2
  • Total versions: 14
  • Total maintainers: 1
cran.r-project.org: lightr

Read Spectrometric Data and Metadata

  • Versions: 14
  • Dependent Packages: 1
  • Dependent Repositories: 2
  • Downloads: 695 Last month
Rankings
Stargazers count: 15.8%
Dependent packages count: 18.1%
Average: 18.6%
Dependent repos count: 19.1%
Downloads: 19.2%
Forks count: 21.0%
Last synced: 6 months ago

Dependencies

.github/workflows/lint-changed-files.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/R-CMD-check_noLD.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/codemeta.yml actions
  • actions/checkout v1 composite
  • r-lib/actions/setup-r v1 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 3.5.0 depends
  • future.apply * imports
  • progressr * imports
  • xml2 >= 1.0.0 imports
  • digest * suggests
  • knitr * suggests
  • lintr * suggests
  • pavo * suggests
  • rmarkdown * suggests
  • spelling * suggests
  • testthat >= 3.0.0 suggests
  • withr * suggests