-
Notifications
You must be signed in to change notification settings - Fork 3
/
DEPRECATED-read.txt.Horiba.R
131 lines (119 loc) · 3.62 KB
/
DEPRECATED-read.txt.Horiba.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#' @name DEPRECATED-read.txt.Horiba
#' @concept moved to hySpc.read.txt
#'
#' @title (DEPRECATED)
#' Import Horiba Labspec exported ASCII files
#'
#' @description
#' These data input functions are **deprecated** and they will be removed in
#' the next release of \pkg{hyperspec} package.
#' Now functions in package \pkg{hySpc.read.txt}
#' ([link](https://r-hyperspec.github.io/hySpc.read.txt/reference/index.html))
#' should be used as the alternatives.
#'
#' @details
#'
#' Read ASCII (`.txt`) files exported by Horiba's Labspec software
#' (LabRAM spectrometers)
#'
#' `read.txt.Horiba.xy` reads maps, i.e. `.txt` files where the first two columns give x and y coordinates.
#'
#' @param file connection (file name and path) to the `.txt` file
#' @param cols,header,sep,row.names,check.names,... further parameters are handed over to [hyperSpec::read.txt.wide()]
#' @author C. Beleites
#' @return hyperSpec object
#'
#' @export
read.txt.Horiba <- function(file, cols = c(
spc = "I / a.u.",
.wavelength = expression(Delta * tilde(nu) / cm^-1)
),
header = TRUE, sep = "\t", row.names = NULL,
check.names = FALSE, ...) {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
deprecated_read_txt(new = "read_txt_Horiba")
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spc <- read.txt.wide(file,
cols = cols,
header = header, sep = sep, row.names = row.names,
check.names = check.names, ...
)
## consistent file import behaviour across import functions
## is already provided by read.txt.wide
spc
}
hySpc.testthat::test(read.txt.Horiba) <- function() {
context("read.txt.Horiba")
test_that(
"deprecated",
expect_warning(
expect_error(read.txt.Horiba(file = ""), "no lines available"),
"deprecated"
)
)
}
#' @rdname DEPRECATED-read.txt.Horiba
#' @export
#'
# @concept io
#' @concept moved to hySpc.read.txt
#'
read.txt.Horiba.xy <- function(file, ...) {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
deprecated_read_txt()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
read.txt.Horiba(
file = file,
cols = c(
x = expression(x / mu * m),
y = expression(y / mu * m),
spc = "I / a.u.",
.wavelength = expression(Delta * tilde(nu) / cm^-1)
),
...
)
}
hySpc.testthat::test(read.txt.Horiba.xy) <- function() {
context("read.txt.Horiba.xy")
test_that(
"deprecated",
expect_warning(
expect_error(read.txt.Horiba.xy(file = ""), "no lines available"),
"deprecated"
)
)
}
#' @rdname DEPRECATED-read.txt.Horiba
#'
#' @details
#' `read.txt.Horiba.t` reads time series, i.e. .txt files with the time in the first column
#'
#' @export
#'
# @concept io
#' @concept moved to hySpc.read.txt
#'
read.txt.Horiba.t <- function(file, header = TRUE, sep = "\t", row.names = NULL,
check.names = FALSE, ...) {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
deprecated_read_txt()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
read.txt.Horiba(file,
cols = c(
t = "t / s",
spc = "I / a.u.",
.wavelength = expression(Delta * tilde(nu) / cm^-1)
),
...
)
}
hySpc.testthat::test(read.txt.Horiba.t) <- function() {
context("read.txt.Horiba.t")
test_that(
"deprecated",
expect_warning(
expect_error(read.txt.Horiba.t(file = ""), "no lines available"),
"deprecated"
)
)
}