Conversation
pbulsink
commented
Jul 31, 2026
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
- 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
Contributor
There was a problem hiding this comment.
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 defaultlambdais 1e6, but the function default islambda = 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.