Round output data depending on the settings' approximation level
parent
5e33e62a79
commit
cbd4e7f97f
|
@ -45,17 +45,17 @@ function createOutput(settings::Settings, drivingCourse::Vector{Dict}, pointsOfI
|
||||||
end
|
end
|
||||||
|
|
||||||
if settings.outputFormat == :dataframe
|
if settings.outputFormat == :dataframe
|
||||||
return createDataFrame(output, settings.outputDetail)
|
return createDataFrame(output, settings.outputDetail, settings.approxLevel)
|
||||||
elseif settings.outputFormat == :vector
|
elseif settings.outputFormat == :vector
|
||||||
return output
|
return output
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function createDataFrame(output_vector::Vector{Dict}, outputDetail)
|
function createDataFrame(output_vector::Vector{Dict}, outputDetail, approxLevel::Int)
|
||||||
if outputDetail == :running_time
|
if outputDetail == :running_time
|
||||||
# create a DataFrame with running time information
|
# 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
|
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]
|
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
|
for point in output_vector
|
||||||
push!(currentRealColumn, point[columnSymbols[column]])
|
push!(currentRealColumn, point[columnSymbols[column]])
|
||||||
end
|
end
|
||||||
|
currentRealColumn = round.(currentRealColumn, digits=approxLevel)
|
||||||
push!(allColumns, currentRealColumn)
|
push!(allColumns, currentRealColumn)
|
||||||
end
|
end
|
||||||
end # for
|
end # for
|
||||||
|
|
Loading…
Reference in New Issue