From cbd4e7f97fab64716ae20cee81d20658382d903f Mon Sep 17 00:00:00 2001 From: Max Kannenberg <95709892+MaxKannenberg@users.noreply.github.com> Date: Mon, 8 Aug 2022 16:12:08 +0200 Subject: [PATCH] Round output data depending on the settings' approximation level --- src/output.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/output.jl b/src/output.jl index 7775049..a77688a 100644 --- a/src/output.jl +++ b/src/output.jl @@ -45,17 +45,17 @@ function createOutput(settings::Settings, drivingCourse::Vector{Dict}, pointsOfI end if settings.outputFormat == :dataframe - return createDataFrame(output, settings.outputDetail) + return createDataFrame(output, settings.outputDetail, settings.approxLevel) elseif settings.outputFormat == :vector return output end end -function createDataFrame(output_vector::Vector{Dict}, outputDetail) +function createDataFrame(output_vector::Vector{Dict}, outputDetail, approxLevel::Int) if outputDetail == :running_time # create a DataFrame with running time information - dataFrame = DataFrame(t=[output_vector[end][:t]]) + dataFrame = DataFrame(t=[round(output_vector[end][:t], digits=approxLevel)]) else # :points_of_interest, :data_points or :driving_course columnSymbols = [:label, :behavior, :s, :v, :t, :a, :F_T, :F_R, :R_path, :R_traction, :R_wagons] @@ -72,6 +72,7 @@ function createDataFrame(output_vector::Vector{Dict}, outputDetail) for point in output_vector push!(currentRealColumn, point[columnSymbols[column]]) end + currentRealColumn = round.(currentRealColumn, digits=approxLevel) push!(allColumns, currentRealColumn) end end # for