{"id":13771284,"url":"https://github.com/ropensci/lightr","last_synced_at":"2025-04-11T18:07:56.677Z","repository":{"id":36192592,"uuid":"156700292","full_name":"ropensci/lightr","owner":"ropensci","description":"Import spectral data and related metadata in R","archived":false,"fork":false,"pushed_at":"2025-02-05T17:18:31.000Z","size":6955,"stargazers_count":13,"open_issues_count":17,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-10T15:47:50.216Z","etag":null,"topics":["file-import","r","r-package","reproducibility","reproducible-research","reproducible-science","spectral-data","spectroscopy"],"latest_commit_sha":null,"homepage":"https://docs.ropensci.org/lightr","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ropensci.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null}},"created_at":"2018-11-08T11:59:31.000Z","updated_at":"2025-02-05T17:18:35.000Z","dependencies_parsed_at":"2024-01-12T00:28:21.286Z","dependency_job_id":"77da95d8-4778-4880-a6db-1dee00682dca","html_url":"https://github.com/ropensci/lightr","commit_stats":{"total_commits":724,"total_committers":34,"mean_commits":"21.294117647058822","dds":0.1671270718232044,"last_synced_commit":"ff286dc09c21e25997ebf1486ae514eb24eb1ca9"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Flightr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Flightr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Flightr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Flightr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci","download_url":"https://codeload.github.com/ropensci/lightr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248304939,"owners_count":21081551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-import","r","r-package","reproducibility","reproducible-research","reproducible-science","spectral-data","spectroscopy"],"created_at":"2024-08-03T17:00:49.887Z","updated_at":"2025-04-11T18:07:56.650Z","avatar_url":"https://github.com/ropensci.png","language":"R","funding_links":[],"categories":["Import-Export","R"],"sub_categories":[],"readme":"# `lightr`: import spectral data in R \u003cimg src=\"man/figures/logo.gif\" align=\"right\" alt=\"\" width=\"120\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n[![CRAN version](https://www.r-pkg.org/badges/version-ago/lightr)](https://cran.r-project.org/package=lightr)\n[![R build status](https://github.com/ropensci/lightr/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/lightr/actions)\n[![Coverage status](https://codecov.io/gh/ropensci/lightr/branch/main/graph/badge.svg)](https://app.codecov.io/github/ropensci/lightr?branch=main)\n[![Reviewed by rOpenSci](https://badges.ropensci.org/267_status.svg)](https://github.com/ropensci/software-review/issues/267)\n[![JOSS paper](https://joss.theoj.org/papers/10.21105/joss.01857/status.svg)](https://joss.theoj.org/papers/10.21105/joss.01857)\n\u003c!-- badges: end --\u003e\n\n\nThere is no standard file format for spectrometry data and different scientific\ninstrumentation companies use wildly different formats to store spectral data.\nVendor proprietary software sometimes has an option but convert those formats\ninstead human readable files such as `csv` but in the process, most metadata\nare lost. However, those metadata are critical to ensure reproducibility ([White\n*et al*, 2015](https://doi.org/10.1016/j.anbehav.2015.05.007)).\n\nThis package aims at offering a unified user-friendly interface for users to \nread UV-VIS reflectance/transmittance/absorbance spectra files from various\nformats in a single line of code.\n\nAdditionally, it provides for the first time a fully free and open source \nsolution to read proprietary spectra file formats on all systems.\n\n## 🗟 Citation\n\nTo cite this package in publications, please use: \n\n\u003e Gruson H., White T.E., Maia R., (2019). lightr: import spectral data and\nmetadata in R. Journal of Open Source Software, 4(43), 1857,\nhttps://doi.org/10.21105/joss.01857\n\n## 🔧 Installation\n\n```r\ninstall.packages(\"lightr\")\n```\n\nYou can also install the development version from rOpenSci's CRAN-like \nrepository:\n\n```r\ninstall.packages(\"lightr\", repos = \"https://dev.ropensci.org\")\n```\n\n## 💻 Usage\n\nA thorough documentation is available with the package, using R usual syntax\n`?function` or `help(function)`. However, users will probably mainly use two \nfunctions:\n\n```r\n# Get a data.frame containing all useful metadata from spectra in a folder\nlr_get_metadata(where = system.file(\"testdata/procspec_files\", \n                                    package = \"lightr\"), \n                ext = \"ProcSpec\")\n```\n\nand\n\n```r\n# Get a single dataframe where the first column contains the wavelengths and \n# the next columns contain a spectra each (pavo's rspec class)\nlr_get_spec(where = system.file(\"testdata/procspec_files\", package = \"lightr\"),\n            ext = \"ProcSpec\")\n```\n\n`lr_get_spec()` returns a dataframe that is compatible with [`pavo`] custom S3\nclass (`rspec`) and can be used for further analyses using colour vision models.\n\nAll supported file formats can also be parsed using the `lr_parse_$extension()` \nfunction where `$extension` is the lowercase extension of your file. This\nfamily of functions return a list where the first element is the data dataframe\nand the second element is a vector with relevant metadata.\n\nOnly exceptions are `.txt` and `.Transmission` files because those extensions\nare too generic. Users will need to figure out which parser is appropriate in \nthis case. `lr_get_metadata()` and `lr_get_spec()` automatically try generic \nparsers in this case.\n\nAlternatively, you may simply want to convert your spectra in a readable \nstandard format and carry on with your analysis with another software.\n\nIn this case, you can run:\n\n```r\n# Convert every single ProcSpec file to a csv file with the same name and \n# location\nlr_convert_tocsv(where = system.file(\"testdata/procspec_files\", \n                                      package = \"lightr\"),\n                 ext = \"ProcSpec\")\n```\n\n## ✔ Supported file formats\n\nThis package is still under development but currently supports (you can click\non the extension in the tables to see an example of this file format):\n\n### [OceanOptics/OceanInsight](https://www.oceanoptics.com/)\n\n  | Extension        | Parser                |\n  |:-----------------|:----------------------|\n  | [`jdx`]          | `lr_parse_jdx()`      |\n  | [`ProcSpec`]     | `lr_parse_procspec()` |\n  | [`spc`][spc1]    | `lr_parse_spc()`      |\n  | [`jaz`]          | `lr_parse_jaz()`      |\n  | [`JazIrrad`]     | `lr_parse_jazirrad()` |\n  | [`Transmission`] | `lr_parse_jaz()`      |\n  | [`txt`](https://raw.githubusercontent.com/ropensci/lightr/main/inst/testdata/OceanView.txt) | `lr_parse_jaz()` |\n\n[`jdx`]: https://raw.githubusercontent.com/ropensci/lightr/main/inst/testdata/OceanOptics_period.jdx\n[`ProcSpec`]: https://github.com/ropensci/lightr/raw/main/inst/testdata/procspec_files/whiteref.ProcSpec\n[spc1]: https://github.com/ropensci/lightr/raw/main/inst/testdata/OceanOptics.spc\n[`jaz`]: https://raw.githubusercontent.com/ropensci/lightr/main/inst/testdata/jazspec.jaz\n[`JazIrrad`]: https://raw.githubusercontent.com/ropensci/lightr/main/inst/testdata/irrad.JazIrrad\n[`Transmission`]: https://raw.githubusercontent.com/ropensci/lightr/main/inst/testdata/FMNH6834.00000001.Master.Transmission\n\n### [Avantes](https://www.avantes.com/)\n\n  | Extension        | Parser                |\n  |:---------------  |:----------------------|\n  | `ABS`            | `lr_parse_abs()`      |\n  | [`ROH`]          | `lr_parse_roh()`      |\n  | [`TRM`]          | `lr_parse_trm()`      |\n  | [`trt`]          | `lr_parse_trt()`      |\n  | [`ttt`]          | `lr_parse_ttt()`      |\n  | [`txt`](https://raw.githubusercontent.com/ropensci/lightr/main/inst/testdata/avasoft8.txt) | `lr_parse_generic()` |\n  | [`DRK`]          | `lr_parse_trm()`      |\n  | [`REF`]          | `lr_parse_trm()`      |\n  | [`IRR8`]         | `lr_parse_irr8()`     |\n  | [`RFL8`]         | `lr_parse_rfl8()`     |\n  | [`Raw8`]         | `lr_parse_raw8()`     |\n  \n[`TRM`]: https://github.com/ropensci/lightr/raw/main/inst/testdata/avantes2.TRM\n[`ROH`]: https://github.com/ropensci/lightr/raw/main/inst/testdata/avantes_reflect.ROH\n[`trt`]: https://github.com/ropensci/lightr/raw/main/inst/testdata/avantes_export2.trt\n[`ttt`]: https://github.com/ropensci/lightr/raw/main/inst/testdata/avantes_export.ttt\n[`DRK`]: https://github.com/ropensci/lightr/raw/main/inst/testdata/1305084U1.DRK\n[`REF`]: https://github.com/ropensci/lightr/raw/main/inst/testdata/1305084U1.REF\n[`IRR8`]: https://github.com/ropensci/lightr/raw/main/inst/testdata/eg.IRR8\n[`RFL8`]: https://github.com/ropensci/lightr/raw/main/inst/testdata/compare/Avantes/feather.RFL8\n[`Raw8`]: https://github.com/ropensci/lightr/raw/main/inst/testdata/1904090M1_0003.Raw8\n\n### [CRAIC](https://www.microspectra.com/)\n\n  | Extension | Parser               |\n  |:----------|:---------------------|\n  | [`txt`](https://raw.githubusercontent.com/ropensci/lightr/main/inst/testdata/CRAIC_export.txt) | `lr_parse_generic()` |\n  | [`spc`]   | `lr_parse_spc()`     |\n  \n[`spc`]: https://github.com/ropensci/lightr/raw/main/inst/testdata/compare/CRAIC/CRAIC.spc\n  \n### Others\n\n  | Extension | Parser                        |\n  |:----------|:------------------------------|\n  | [`csv`]   | `lr_parse_generic(sep = \",\")` |\n  | [`dpt`]   | `lr_parse_generic(sep = \",\")` |\n\n[`csv`]: https://raw.githubusercontent.com/ropensci/lightr/main/inst/testdata/spec.csv\n[`dpt`]: https://raw.githubusercontent.com/ropensci/lightr/main/inst/testdata/RS-1.dpt\n\nAs a fallback, you should always try `lr_parse_generic()` which offers a\nflexible and general algorithm that manages to extract data from most files.\n\nIf you can't find the best parser for your specific file or if you believe you\nare using an unsupported format, please \n[open an issue](https://github.com/ropensci/lightr/issues) or send me an email. \n\n## 🌐 Similar projects\n\n* `lightr` itself contains some code that has been initially forked from \n  [`pavo`], namely the `lr_get_spec()` function. The code has since then been \n  refactored and optimised for speed. [`pavo`] differs from `lightr` in its\n  focus and core functionalities. The main strength of [`pavo`] is the \n  comprehensive and user-friendly set of functions to analyse spectral data\n  using [colour vision models](https://en.wikipedia.org/wiki/Color_model), while\n  `lightr` focuses on the data import step.\n* [`photobiologyInOut`] also provides functions to import spectral data. \n  The goal of the author is to provide a complete pipeline of spectral data \n  import and analysis using a \n  [set of tightly integrated R packages](https://www.r4photobiology.info/). \n  This however makes it more difficult to use a different tool for a given step\n  of the process. On the contrary, `lightr` aims at proposing a light package \n  with limited dependencies that focuses on the data import step of the process\n  and let the user pick their favourite tool for the analysis step ([`pavo`],\n  [`colourvision`](https://cran.r-project.org/package=colourvision),\n  [`Avicol`](https://sites.google.com/site/avicolprogram/), etc.).\n* [`spectrolab`](https://github.com/meireles/spectrolab)\n\nTo our knowledge, `lightr` is the only gratis tool to import some complex file\nformats such as Avantes (`ABS`, `ROH`, `TRM`, `RFL8`) or CRAIC (`spc`) binary \nfiles, or OceanOptics `.ProcSpec`. Because of its user-friendly high-levels\nfunctions and low dependency philosophy, `lightr` may also hopefully prove\nuseful for people working with other languages than R.\n\n## Contributing\n\nThere are plenty of ways you can contribute to `lightr`. Please visit our \n[contributing guide](https://docs.ropensci.org/lightr/CONTRIBUTING.html).\n\nPlease note that this package is released with a [Contributor Code of\nConduct](https://ropensci.org/code-of-conduct/). By contributing to this\nproject, you agree to abide by its terms.\n\n\n[`pavo`]: https://cran.r-project.org/package=pavo\n\n[`photobiologyInOut`]: https://cran.r-project.org/package=photobiologyInOut\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Flightr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fropensci%2Flightr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Flightr/lists"}