Skip to content

Add Raman spectra capabilities, closes #34 - #42

Open
pbulsink wants to merge 10 commits into
mainfrom
raman
Open

Add Raman spectra capabilities, closes #34#42
pbulsink wants to merge 10 commits into
mainfrom
raman

Conversation

@pbulsink

Copy link
Copy Markdown
Collaborator
  • Add read_raman() for RRUFF-style Raman data with ##FILETYPE=Raman headers
  • Add plot_raman(), plot_raman_stacked() with non-reversed x-axis (increasing wavenumber)
  • Add smooth_spectra() using signal::sgolayfilt() for Savitzky-Golay smoothing
  • Add baseline_correct() using baseline::als() for Asymmetric Least Squares correction
  • Add normalize_raman() for L2 vector norm and max intensity scaling
  • Add find_peak_maxima() with optional FWHM computation
  • Extend check_ftir_data() to accept 'raman' and 'normalized raman' intensity types
  • Update DESCRIPTION, NAMESPACE, documentation, and add comprehensive test coverage

pbulsink added 7 commits July 31, 2026 08:13
- Add read_raman() for RRUFF-style Raman data with ##FILETYPE=Raman headers
- Add plot_raman(), plot_raman_stacked() with non-reversed x-axis (increasing wavenumber)
- Add smooth_spectra() using signal::sgolayfilt() for Savitzky-Golay smoothing
- Add baseline_correct() using baseline::als() for Asymmetric Least Squares correction
- Add normalize_raman() for L2 vector norm and max intensity scaling
- Add find_peak_maxima() with optional FWHM computation
- Extend check_ftir_data() to accept 'raman' and 'normalized raman' intensity types
- Update DESCRIPTION, NAMESPACE, documentation, and add comprehensive test coverage
@pbulsink
pbulsink marked this pull request as ready for review August 4, 2026 15:56
Copilot AI review requested due to automatic review settings August 4, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds first-class Raman support to PlotFTIR: new IO for Raman files, new Raman plotting functions, and a set of Raman-focused utilities (smoothing, baseline correction, normalization, peak finding), plus updates to validation, docs, and tests.

Changes:

  • Add Raman readers/plotters: read_raman(), plot_raman(), plot_raman_stacked().
  • Add Raman utilities: Savitzky–Golay smoothing, AsLS baseline correction, Raman normalization, and peak maxima detection (optionally FWHM).
  • Extend core validation / IO paths and expand tests + generated documentation accordingly.

Reviewed changes

Copilot reviewed 19 out of 31 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
tests/testthat/test-raman_utils.R Adds test coverage for peak finding, smoothing, and baseline correction validation.
tests/testthat/test-plot_raman.R Adds test coverage for Raman plotting behavior (axes, labels, stacked plotting).
tests/testthat/test-plot_ftir.R Updates expected validation error strings to include intensity.
tests/testthat/test-maths.R Updates tests to bilingual expectations and adds tests for Raman normalization.
tests/testthat/test-manipulations.R Adds tests for band/marker behavior and internal transform helper.
tests/testthat/test-io.R Adds extensive tests for Raman CSV parsing and JCAMP-DX Raman branch coverage.
R/utils.R Extends check_ftir_data() to allow intensity column and Raman intensity types; extends intensity_type().
R/raman_utils.R Introduces find_peak_maxima() implementation (with optional FWHM).
R/plot_raman.R Introduces Raman plotting core + stacked + wrapper functions.
R/plot_ftir.R Minor formatting adjustment in ggplot2 dependency error message.
R/maths.R Adds normalize_raman() and updates baseline error handling to bilingual aborts.
R/manipulations.R Adds smooth_spectra() and baseline_correct() implementations; fixes an error label in add_band().
R/io.R Extends JCAMP-DX reader for Raman; adds read_raman() + CSV parser.
R/error_handling.R Formatting-only changes to bilingual error/warn/inform helpers.
R/aaa-shared_params.R Adds sample_ids to shared params (used by multiple new functions/docs).
NEWS.md Adds a development bullet for Raman feature set (#34).
NAMESPACE Exports newly added Raman functions/utilities; imports rlang .data.
man/smooth_spectra.Rd Generated docs for smooth_spectra().
man/read_raman.Rd Generated docs for read_raman().
man/plot_raman.Rd Generated docs for plot_raman().
man/plot_raman_stacked.Rd Generated docs for plot_raman_stacked().
man/plot_raman_core.Rd Generated docs for internal plot_raman_core().
man/normalize_raman.Rd Generated docs for normalize_raman().
man/find_peak_maxima.Rd Generated docs for find_peak_maxima().
man/dot-shared-params.Rd Generated shared-params Rd update for sample_ids.
man/dot-get_language.Rd Generated docs for .get_language().
man/chemospec_to_plotftir.Rd Minor generated Rd formatting update.
man/baseline_correct.Rd Generated docs for baseline_correct().
DESCRIPTION Adds baseline and signal to Suggests.
AGENTS.md Updates repository overview to include Raman and new file structure.
.gitignore Adds coverage.xml.
Files not reviewed (11)
  • man/baseline_correct.Rd: Generated file
  • man/chemospec_to_plotftir.Rd: Generated file
  • man/dot-get_language.Rd: Generated file
  • man/dot-shared-params.Rd: Generated file
  • man/find_peak_maxima.Rd: Generated file
  • man/normalize_raman.Rd: Generated file
  • man/plot_raman.Rd: Generated file
  • man/plot_raman_core.Rd: Generated file
  • man/plot_raman_stacked.Rd: Generated file
  • man/read_raman.Rd: Generated file
  • man/smooth_spectra.Rd: Generated file
Suppressed comments (1)

R/manipulations.R:1216

  • baseline_correct() documentation says the default lambda is 1e6, but the function default is lambda = 10, so user-facing docs and behavior disagree.
  ftir,
  sample_ids = NA,
  lambda = 10,
  p = 0.001

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/utils.R Outdated
Comment thread R/io.R
Comment thread R/manipulations.R Outdated
Comment thread R/plot_raman.R
Comment thread R/plot_raman.R Outdated
Comment thread tests/testthat/test-io.R
Comment thread tests/testthat/test-io.R
Comment thread tests/testthat/test-plot_ftir.R
Comment thread R/aaa-shared_params.R Outdated
Comment thread R/maths.R
pbulsink and others added 3 commits August 4, 2026 15:06
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants