Skip to content

Conversation

Copy link

Copilot AI commented Dec 15, 2025

Implements comprehensive test coverage for find.turn.point and its helper functions using simulated gaussian mixture distributions.

Test Coverage

  • Single and multi-component gaussians: 1, 2, and 3-peak mixtures with varying separation, overlap, and amplitude
  • Edge cases: constant values, NA filtering
  • Helper functions: msExtrema and find_local_maxima validation

Example Test Pattern

test_that("find.turn.point identifies two-component gaussian mixture", {
  # Create mixture of two gaussians
  x <- seq(-10, 10, length.out = 400)
  y <- 0.6 * dnorm(x, mean = -3, sd = 1) + 0.4 * dnorm(x, mean = 3, sd = 1.5)
  
  result <- find.turn.point(y)
  
  # Validates 2 peaks detected, valleys at boundaries and between peaks
  expect_equal(length(result$pks), 2)
  expect_true(length(result$vlys) >= 3)
}

All test data generated via dnorm() for reproducible scenarios.

Original prompt

This section details on the original issue you should resolve

<issue_title>Implement test for the find.turn.point function using simulated gaussian mixture data</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Implement test for find.turn.point function with gaussian mixture data Add test suite for find.turn.point with gaussian mixture data Dec 15, 2025
Copilot AI requested a review from hechth December 15, 2025 16:44
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.

Implement test for the find.turn.point function using simulated gaussian mixture data

2 participants