Adapt Rscript to different system
This commit is contained in:
parent
690bb50888
commit
cb80cc40cb
12
OpusData.R
12
OpusData.R
@ -1,26 +1,26 @@
|
|||||||
#!/usr/bin/env Rscript
|
#!/usr/bin/env Rscript
|
||||||
|
|
||||||
# Package installation, execute once
|
# Package installation, execute once
|
||||||
#if (!require("remotes")) install.packages("remotes")
|
#install.packages("remotes")
|
||||||
#remotes::install_github("philipp-baumann/simplerspec")
|
#remotes::install_github("philipp-baumann/simplerspec")
|
||||||
|
|
||||||
# Attach package to workspace, execute with every new session
|
# Attach package to workspace, execute with every new session
|
||||||
library("simplerspec")
|
library("simplerspec")
|
||||||
|
|
||||||
# Determine file path
|
# Determine file path
|
||||||
path <- paste(getwd(), "\\OPUS\\", sep = "")
|
path <- paste(getwd(), "/OPUS/", sep = "")
|
||||||
file_name <- "Rng02_Rng2630_01.0"
|
file_name <- commandArgs(trailingOnly = TRUE)[1]
|
||||||
file_path <- paste(path, file_name, sep = "")
|
file_path <- paste(path, file_name, sep = "")
|
||||||
|
|
||||||
# Convert opus binary file into extractable data
|
# Convert opus binary file into extractable data
|
||||||
data <- read_opus_univ(file_path, extract = "spc",atm_comp_minus4offset = FALSE)
|
data <- read_opus_univ(file_path, extract = "spc",atm_comp_minus4offset = FALSE)
|
||||||
|
|
||||||
#Cut the beginning (ugly solution)
|
#Cut the beginning (ugly solution)
|
||||||
file_path <- substr(file_path, start = 20, stop = nchar(file_path))
|
#file_path <- substr(file_path, start = 10, stop = nchar(file_path))
|
||||||
|
|
||||||
# Extract data
|
# Extract data
|
||||||
data_x_values <- data[[file_path]]$wavenumbers
|
data_x_values <- data[[file_name]]$wavenumbers
|
||||||
data_y_values <- as.numeric(data[[file_path]]$spc[1,])
|
data_y_values <- as.numeric(data[[file_name]]$spc[1,])
|
||||||
|
|
||||||
# Set working directory to path where the result file should appear
|
# Set working directory to path where the result file should appear
|
||||||
setwd(paste(path, "..\\DPT", sep = ""))
|
setwd(paste(path, "..\\DPT", sep = ""))
|
||||||
|
Loading…
Reference in New Issue
Block a user