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

get Witec test data for 2x3 image #15

Open cbeleites opened 4 years ago

cbeleites commented 4 years ago
eoduniyi commented 4 years ago

@cbeleites this may be related, but I'm currently not understanding why I keep getting an error with scan() when I try:

> file <- "Witec_TrueMatch.txt"
> read.txt.Witec(file, type = "single", hdr.label = TRUE, encoding = "unknown")

Error in scan(text = tmp, skip = skip, quiet = quiet, encoding = encoding,  : 
  scan() expected 'a real', got 'Version'
> read.txt.Witec(file, type = "map", hdr.label = TRUE, encoding = "unknown")

Error in scan(text = tmp, skip = skip, quiet = quiet, encoding = encoding,  : 
  scan() expected 'a real', got 'Version'
> read.txt.Witec(file)

Error in scan(text = tmp, skip = skip, quiet = quiet, encoding = encoding,  : 
  scan() expected 'a real', got '[WITEC_TRUEMATCH_ASCII_HEADER]'
> read.txt.Witec(file, hdr.label = TRUE)

Error in scan(text = tmp, skip = skip, quiet = quiet, encoding = encoding,  : 
  scan() expected 'a real', got 'Version'
eoduniyi commented 4 years ago

Also, these all run fine:

file <- "Witec_TrueMatch.txt"
microbenchmark(
  read.table (file, header = TRUE, dec = ",", sep = "\t"),
  readLines(file),
  read.ini(file),
  readtext(file)
)
cbeleites commented 4 years ago

@eoduniyi, I don't think these are related: the TrueMatch ASCII file is not suitable for testing scan() since it has this ini-file format. scan() can only be used on strings that are basically ASCII printouts of numbers only, no other character strings. So for the TrueMatch files, you need to read e.g. by readLines(), and then use scan to convert only those lines that are in the [SpectrumData] sections.

Other ASCII file formats, e.g. the "naked" number tables in the .txt or .dat ones and in the (X).txt and (Y).txt files of the Graph ASCII format are more directly suitable for scan().

eoduniyi commented 4 years ago

@eoduniyi, I don't think these are related: the TrueMatch ASCII file is not suitable for testing scan() since it has this ini-file format. scan() can only be used on strings that are basically ASCII printouts of numbers only, no other character strings. So for the TrueMatch files, you need to read e.g. by readLines(), and then use scan to convert only those lines that are in the [SpectrumData] sections.

Other ASCII file formats, e.g. the "naked" number tables in the .txt or .dat ones and in the (X).txt and (Y).txt files of the Graph ASCII format are more directly suitable for scan().

Hmm, so is scan() even something I want to microbench?

eoduniyi commented 4 years ago

@eoduniyi, I don't think these are related: the TrueMatch ASCII file is not suitable for testing scan() since it has this ini-file format. scan() can only be used on strings that are basically ASCII printouts of numbers only, no other character strings. So for the TrueMatch files, you need to read e.g. by readLines(), and then use scan to convert only those lines that are in the [SpectrumData] sections. Other ASCII file formats, e.g. the "naked" number tables in the .txt or .dat ones and in the (X).txt and (Y).txt files of the Graph ASCII format are more directly suitable for scan().

Hmm, so is scan() even something I want to microbench?

And so @GegznaV and @cbeleites the read.txt.Witec() is not suitable for benchmarking the file io for read_txt_Witec_TrueMatch.R

eoduniyi commented 4 years ago

@cbeleites has this been taken care of?