Skip to content

Commit

Permalink
minor uodates (e.g., epsilon now also parameter)
Browse files Browse the repository at this point in the history
  • Loading branch information
buddekai committed Apr 21, 2022
1 parent 2cfffaa commit 2d5130c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: oscilliscopeR
Type: Package
Title: Import and work with data from oscilloscope
Version: 0.1.0
Version: 0.1.1
Author: c(person("Kai", "Budde", email = "[email protected]",
role = c("aut", "cre"))
Maintainer: Kai Budde <[email protected]>
Expand Down
5 changes: 5 additions & 0 deletions R/getWaveforms.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ getWaveforms <- function(input_file = NULL, input_directory = NULL) {
yaml_files <- input_file
}

if(length(yaml_files) == 0){
print("No yaml files found.")
return(NULL)
}

for(i in 1:length(yaml_files)){
# Read data
if(zip_container){
Expand Down
9 changes: 5 additions & 4 deletions R/plotWaveforms.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#' and max values to be shown on y axis)
#' @param filter_stim_off A boolean (indicates whether measurements while
#' stim==off are to be filtered)
#' @param epsilon A number (min. distance for mean from 0 needed)
#' @param plot_title A character (title of the plot)
#' @return 0

Expand All @@ -29,11 +30,11 @@ plotWaveforms <- function(input_data = NULL, output_dir = NULL,
channel_stimulation_pulse = "CHAN2",
voltage_plot_bound = NULL,
filter_stim_off = TRUE,
epsilon = 1,
plot_title = NULL) {

# Some function parameters
factor_for_min_max_scaling <- 1.1
epsilon <- 1

# Check for input data
if(is.null(input_data)){
Expand Down Expand Up @@ -172,10 +173,10 @@ plotWaveforms <- function(input_data = NULL, output_dir = NULL,

plot_waveform <- ggplot2::ggplot(data = input_data_filtered,
aes(x = time, y = U, color=Channel)) +
geom_path() +
geom_line() +
geom_hline(yintercept=max_value, linetype="dashed", color = "darkgray", size=1) +
geom_hline(yintercept=min_value, linetype="dashed", color = "darkgray", size=1) +
geom_hline(yintercept=mean_value, linetype="dashed", color = "darkgray", size=1) +
geom_hline(yintercept=mean_value, linetype="dotdash", color = "darkgray", size=1) +
annotate("text", x=plot_annotation_x, y=(voltage_plot_bound-2), label=p2p_value) +
coord_cartesian(ylim = c(-voltage_plot_bound, voltage_plot_bound)) +
labs(title=paste(plot_title, input_data_filtered$date_time[1], sep=" "),
Expand Down Expand Up @@ -235,7 +236,7 @@ plotWaveforms <- function(input_data = NULL, output_dir = NULL,
scattermore::geom_scattermore() +
geom_hline(yintercept=max_value, linetype="dashed", color = "darkgray") +
geom_hline(yintercept=min_value, linetype="dashed", color = "darkgray") +
geom_hline(yintercept=mean_value, linetype="dashed", color = "darkgray", size=1) +
geom_hline(yintercept=mean_value, linetype="dotdash", color = "darkgray", size=1) +
annotate("text", x=plot_annotation_x, y=(voltage_plot_bound-2), label=p2p_value) +
coord_cartesian(ylim = c(-voltage_plot_bound, voltage_plot_bound)) +
labs(title=paste(plot_title, sep=" "),
Expand Down

0 comments on commit 2d5130c

Please sign in to comment.