Closed benedond closed 3 years ago
I cannot reproduce your problem with my setup. Is the error message accompanied by a backtrace? If yes, please send it here.
Also, I upgraded the dependencies of the Thermobench package recently. It could be that you are using different version of some dependency. Can you try activating and instantiating my environment as described at https://ctu-iig.github.io/thermobench/dev/#Installation?
Stacktrace says:
julia> df = Thermobench.interpolate(d)
ERROR: InexactError: Int64(237.69506768475188)
Stacktrace:
[1] Int64 at ./float.jl:710 [inlined]
[2] convert at ./number.jl:7 [inlined]
[3] setindex! at ./array.jl:847 [inlined]
[4] setindex!(::SentinelArrays.SentinelArray{Int64,1,Int64,Missing,Array{Int64,1}}, ::Float64, ::Int64) at /home/benedond/.julia/packages/SentinelArrays/Ubf17/src/SentinelArrays.jl:224
[5] insert_single_entry!(::DataFrame, ::Float64, ::Int64, ::Int64) at /home/benedond/.julia/packages/DataFrames/yqToF/src/dataframe/dataframe.jl:520
[6] setindex!(::DataFrame, ::Float64, ::Int64, ::Int64) at /home/benedond/.julia/packages/DataFrames/yqToF/src/dataframe/dataframe.jl:560
[7] interpolate!(::DataFrame) at /home/benedond/Workspace/thermobench/julia/src/Thermobench.jl:333
[8] interpolate at /home/benedond/Workspace/thermobench/julia/src/Thermobench.jl:380 [inlined]
[9] interpolate(::Thermobench.Data) at /home/benedond/Workspace/thermobench/julia/src/Thermobench.jl:377
[10] top-level scope at none:1
I will try to upgrade the dependencies as described in your readme.
After calling
(@v1.5) pkg> activate /path/to/thermobench/julia
(Thermobench) pkg> instantiate
the problem still persists.
status command produces:
(Thermobench) pkg> status
Project Thermobench v0.1.0
Status `~/Workspace/thermobench/julia/Project.toml`
[a5944310] CMPFit v0.3.1
[336ed68f] CSV v0.8.2
[35d6a980] ColorSchemes v3.10.2
[5ae59095] Colors v0.12.4
[a93c6f00] DataFrames v0.22.2
[1313f7d8] DataFramesMeta v0.6.0
[31a5f54b] Debugger v0.6.6
[31c24e10] Distributions v0.23.12
[e30172f5] Documenter v0.26.1
[997ab1e6] DocumenterMarkdown v0.2.1
[dc211083] Gnuplot v1.3.0
[2fda8390] LsqFit v0.10.0 `https://github.com/JuliaNLSolvers/LsqFit.jl.git#master`
[7eb4fadd] Match v1.1.0
[eff96d63] Measurements v2.3.0
[b98c9c47] Pipe v1.3.0
[54e16d92] PrettyPrinting v0.2.1
[2913bbd2] StatsBase v0.33.2
[ade2ca70] Dates
[44cfe95a] Pkg
[de0858da] Printf
[9a3f8284] Random
[10745b16] Statistics
[8dfed614] Test
I still cannot reproduce it. I have the same versions of the packages as you and have Julia 1.5.3, which is what you use, I think. Can you send me the output of
eltype.(eachcol(d.df))
There should be no Int64. If it is, it could be the reason for the error.
If there is no Int64, can you try modifying the Thermobench.jl
source around the line 333 as follows (uncommenting and modifying the @show line)?
for i in valid_row + 1 : row - 1
@show i, col
df[i, col] = v₀ + (v₁ - v₀)*(df[i, 1] - t₀)/(t₁ - t₀)
end
Then run the interpolation again and send me the last printed numbers before the error.
I tried the eltype
, and there seem to be several Int64 columns:
julia> answ = eltype.(eachcol(d.df))
30-element Array{Type,1}:
Float64
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
⋮
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
julia> for i in answ
println(i)
end
Float64
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Int64}
Union{Missing, Int64}
Union{Missing, Int64}
Union{Missing, Int64}
Missing
Missing
Missing
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Union{Missing, Float64}
Interesting. In your case, the CPUX_work_done columns are stored as Int64. In my case these are floats:
julia> DataFrame(name=names(d.df), type=eltype.(eachcol(d.df)))
30×2 DataFrame
Row │ name type
│ String Type
─────┼────────────────────────────────────────────
1 │ time Float64
2 │ CPU_0_temp Union{Missing, Float64}
3 │ CPU_1_temp Union{Missing, Float64}
4 │ GPU_0_temp Union{Missing, Float64}
5 │ GPU_1_temp Union{Missing, Float64}
6 │ DRC_temp Union{Missing, Float64}
7 │ PMIC_temp Union{Missing, Float64}
8 │ Cortex_A53_0_freq Union{Missing, Float64}
9 │ Cortex_A53_1_freq Union{Missing, Float64}
10 │ Cortex_A53_2_freq Union{Missing, Float64}
11 │ Cortex_A53_3_freq Union{Missing, Float64}
12 │ Cortex_A72_0_freq Union{Missing, Float64}
13 │ Cortex_A72_1_freq Union{Missing, Float64}
14 │ ambient Union{Missing, Float64}
15 │ cam_cpu Union{Missing, Float64}
16 │ cam_mem Union{Missing, Float64}
17 │ CPU0_work_done Union{Missing, Float64}
18 │ CPU1_work_done Union{Missing, Float64}
19 │ CPU2_work_done Union{Missing, Float64}
20 │ CPU3_work_done Union{Missing, Float64}
21 │ CPU4_work_done Missing
22 │ CPU5_work_done Missing
23 │ work_done Missing
24 │ Power_mW Union{Missing, Float64}
25 │ CPU0_load_ Union{Missing, Float64}
26 │ CPU1_load_ Union{Missing, Float64}
27 │ CPU2_load_ Union{Missing, Float64}
28 │ CPU3_load_ Union{Missing, Float64}
29 │ CPU4_load_ Union{Missing, Float64}
30 │ CPU5_load_ Union{Missing, Float64}
Having Int64 there should never happen, because Thermobench.read
passes typemap=Dict(Int64 => Float64)
to CSV.File and this should convert all Int64 to Float64.
Can you experiment a bit with manual invovation of CSV.File
on your file? Use the parameters used by Thermobench.jl and try to play with typemap
:
CSV.File("file.csv"; comment="#", normalizenames=true,
silencewarnings=true,
typemap=Dict(Int64 => Float64),
)
I have tried CSV.File()
- for a simple file (data_2.csv
) typemap works, but for more complicated file (data.csv
) typemap does not seem to work. I tried, e.g., Int64 => String - the result is shown in the following picture:
It's weird. Probably CSV.jl bug. I cannot reproduce it both on my laptop (NixOS, Julia 1.5.3) and on the ritchie server (Debian, Julia 1.4.2). Where did you get Julia from? Distribution package, or binaries from https://julialang.org/downloads/, or something else?
I have downloaded Julia from https://julialang.org/downloads/ - Generic Linux on x86, 64-bit.
Downgrading to LTS (1.0.5) seemingly helped for CSV loading, but probably cannot be used with Thermobench since it is too old - e.g., Unable to use OpenSpecFun_jll on Julia versions older than 1.3!
I have also tried downloading v1.3 and 1.4 from https://julialang.org/downloads/ but with no success.
Later I might try it on a different laptop.
Which distribution do you have? Can you delete ~/.julia
and try again? Or run Julia as
env -i $(which julia)
which should eliminate influence of all environment variables.
I am running Ubuntu 18. I have deleted ~/.julia
and tried again. The problem seems to be somewhere in Atom
editor or Atom-julia
integration. When I run Julia directly from the command-line, the conversion works as expected. However, when I run it in Atom, the discussed error occurs. In both cases, the same julia binary should be executed.
Edit: For some instances, the error occurs even when running directly from terminal.
Yes, I can reproduce it in Atom. Do you have some minimal CSV file that could be attached to CSV.jl issue?
I would not call it minimal, but after randomly deleting some rows from data.csv
, I obtained a bit smaller csv for which the error still occurs.
I tried to randomly delete more rows, or restrict columns to,e.g., [ time_ms, CPU_0_temp_m°C, CPU_1_temp_m°C, CPU0_work_done ]
, but typemap=Dict(Int64 => Float64)
then started working.
Sequence Thermobench.read + interpolate leads to InexactError when processing file produced by Thermobench.
File.csv