r-hyperspec / hySpc.read.txt

Import ASCII formatted data into hyperSpec
https://r-hyperspec.github.io/hySpc.read.txt/
MIT License
0 stars 1 forks source link

Features/42-read-asc-andor #45

Closed sangttruong closed 3 years ago

sangttruong commented 3 years ago

Add unit test for read_asc_Andor.R

GegznaV commented 3 years ago

Please, always add references to linked/related issues.

Related #42

bryanhanson commented 3 years ago

If you are going to check at all you may as well compare the whole vector. But for my money the check on the dimensions would be enough.

Sent from an undisclosed location - check with the NSA.

On Aug 1, 2021, at 3:12 PM, Vilmantas Gegzna @.***> wrote:

 @GegznaV requested changes on this pull request.

In R/read_asc_Andor.R:

  • })
  • test_that("Andor Solis .asc spectral data", {
  • @.***$spc), c(5,63))
  • @.***$spc),
  • c("161.408","165.729","170.046","174.361","178.672","182.981","187.285","191.588","195.887",
  • "200.184","204.477","208.767","213.054","217.339","221.62", "225.898","230.173","234.445",
  • "238.714","242.981","247.244","251.505","255.762","260.016","264.268","268.516","272.762",
  • "277.004","281.244","285.48", "289.714","293.945","298.172","302.397","306.619","310.838",
  • "315.054","319.267","323.477","327.685","331.889","336.091","340.289","344.484","348.677",
  • "352.867","357.054","361.238","365.419","369.596","373.772","377.945","382.114","386.281",
  • "390.444","394.605","398.763","402.919","407.071","411.22", "415.366","419.51", "423.651"))
  • })
  • test_that("Andor Solis .asc wavelength", { Change to "Wavelengths from Andor Solis .asc are correct"

In R/read_asc_Andor.R:

@@ -49,11 +49,33 @@ read_asc_Andor <- function(file = stop("filename or connection needed"),

hySpc.testthat::test(read_asc_Andor) <- function() { context("read_asc_Andor")

  • test_that("Andor Solis .asc text files", {
  • skip("Need to adapt to new package")
  • expect_known_hash(
  • read_asc_Andor("fileio/asc.Andor/ASCII-Andor-Solis.asc"),
  • "9ead937f51"
  • )
  • andor <- system.file("extdata/fileio/asc.Andor/", "ASCII-Andor-Solis.asc",package = "hySpc.read.txt") Add space after comma

In R/read_asc_Andor.R:

  • "9ead937f51"
  • )
  • andor <- system.file("extdata/fileio/asc.Andor/", "ASCII-Andor-Solis.asc",package = "hySpc.read.txt")
  • spc <- read_asc_Andor(andor)
  • test_that("Andor Solis .asc labels are correct",{
  • @.***$.wavelength, NULL)
  • @.***$spc, NULL)
  • @.***$filename, "filename")
  • })
  • test_that("Andor Solis .asc spectral data", {
  • @.***$spc), c(5,63))
  • @.***$spc), I asked Sang to check if wavelengths are read correctly. Just I'm wondering if we should check all the values or just a few (smallest, largest, and several intermediate). What do you think @bryanhanson, @cbeleites?

This concerns this one and especially the future unit tests.

In R/read_dat_Witec.R:

@@ -58,7 +58,7 @@ hySpc.testthat::test(read_dat_Witec) <- function() { test_that("-y file guessing", { spc <- read_dat_Witec(paste0(tmpdir, "/Witec-timeseries-x.dat")) spc$filename <- gsub("^.*/", "", spc$filename)

  • capture_output(paste0(tmpdir, "/Witec-timeseries-x.dat")) Why do we need to capture the output of paste0()? Why is the captured output not used?

In R/read_asc_Andor.R:

  • skip("Need to adapt to new package")
  • expect_known_hash(
  • read_asc_Andor("fileio/asc.Andor/ASCII-Andor-Solis.asc"),
  • "9ead937f51"
  • )
  • andor <- system.file("extdata/fileio/asc.Andor/", "ASCII-Andor-Solis.asc",package = "hySpc.read.txt")
  • spc <- read_asc_Andor(andor)
  • test_that("Andor Solis .asc labels are correct",{
  • @.***$.wavelength, NULL)
  • @.***$spc, NULL)
  • @.***$filename, "filename")
  • })
  • test_that("Andor Solis .asc spectral data", { Change to "Spectra intensities from Andor Solis .asc are correct"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

GegznaV commented 3 years ago

Related #42

GegznaV commented 3 years ago

@cbeleites, I'm merging this now. If you'd like additional improvements, please, open a new issue for that. OK?