2
Fork 0

file structure changes / Execute Rscript with parameter

This commit is contained in:
Ruben Hartenstein (PEA4-Fe) 2021-01-20 16:04:23 +01:00
parent 8addcea3ba
commit 50e2d69897
57 changed files with 3 additions and 1811 deletions

View File

@ -1 +1,2 @@
R CMD BATCH --no-save OpusData.R
Rscript OpusData.R Rng02_Rng2630_01.0
pause

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -16,7 +16,7 @@ file_path <- paste(path, file_name, sep = "")
data <- read_opus_univ(file_path, extract = "spc",atm_comp_minus4offset = FALSE)
#Cut the beginning (ugly solution)
file_path <- substr(file_path, start = 4, stop = nchar(file_path))
file_path <- substr(file_path, start = 20, stop = nchar(file_path))
# Extract data
data_x_values <- data[[file_path]]$wavenumbers

View File

@ -1,65 +0,0 @@
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R ist freie Software und kommt OHNE JEGLICHE GARANTIE.
Sie sind eingeladen, es unter bestimmten Bedingungen weiter zu verbreiten.
Tippen Sie 'license()' or 'licence()' für Details dazu.
R ist ein Gemeinschaftsprojekt mit vielen Beitragenden.
Tippen Sie 'contributors()' für mehr Information und 'citation()',
um zu erfahren, wie R oder R packages in Publikationen zitiert werden können.
Tippen Sie 'demo()' für einige Demos, 'help()' für on-line Hilfe, oder
'help.start()' für eine HTML Browserschnittstelle zur Hilfe.
Tippen Sie 'q()', um R zu verlassen.
> #!/usr/bin/env Rscript
>
> # Package installation, execute once
> #if (!require("remotes")) install.packages("remotes")
> #remotes::install_github("philipp-baumann/simplerspec")
>
> # Attach package to workspace, execute with every new session
> library("simplerspec")
Lade nötiges Paket: foreach
>
> # Determine file path
> path <- paste(getwd(), "\\OPUS\\", sep = "")
> file_name <- "Rng02_Rng2630_01.0"
> file_path <- paste(path, file_name, sep = "")
>
> # Convert opus binary file into extractable data
> data <- read_opus_univ(file_path, extract = "spc",atm_comp_minus4offset = FALSE)
Extracted spectra data from file: <OpusData\OPUS\Rng02_Rng2630_01.0>
>
> #Cut the beginning (ugly solution)
> file_path <- substr(file_path, start = 4, stop = nchar(file_path))
>
> # Extract data
> data_x_values <- data[[file_path]]$wavenumbers
> data_y_values <- as.numeric(data[[file_path]]$spc[1,])
>
> # Set working directory to path where the result file should appear
> setwd(paste(path, "..\\DPT", sep = ""))
>
> # Convert data into dataframe
> data <- data.frame(data_x_values, data_y_values, row.names = NULL)
>
> # Replace last "." with "_", add ".DPT" and create file
> file_name <- paste(sub(".([^.]*)$", "_\\1", file_name), ".DPT", sep = "")
> file.create(file_name)
[1] TRUE
>
> # Fill file with dataframe
> write.table(data, file_name, row.names = FALSE, col.names = FALSE, sep=",")
>
>
>
>
>
>
> proc.time()
User System verstrichen
0.50 0.12 0.67