From 878e4d48d6655ad26507859ce2ab4ff744793071 Mon Sep 17 00:00:00 2001 From: MariaHei Date: Wed, 20 Sep 2023 18:24:02 +0200 Subject: [PATCH] Updated package to be compatible with newer versions of dataframes --- Manifest.toml | 50 ++++++++++++++++++++++++++++++++++---------------- src/output.jl | 23 ++++++++++++++++++----- 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index 3e414c02..4dd1ec47 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,6 +1,8 @@ # This file is machine-generated - editing it directly is not advised +julia_version = "1.9.1" manifest_format = "2.0" +project_hash = "eb8d02a8ecaea7b2d8d11a967ccc66eabc3c237d" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" @@ -46,6 +48,22 @@ git-tree-sha1 = "18d7f3e82c1a80dd38c16453b8fd3f0a7db92f23" uuid = "324d7699-5711-5eae-9e2f-1d82baa6b597" version = "0.9.7" +[[deps.ChainRulesCore]] +deps = ["Compat", "LinearAlgebra", "SparseArrays"] +git-tree-sha1 = "e30f2f4e20f7f186dc36529910beaedc60cfa644" +uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" +version = "1.16.0" + +[[deps.ChangesOfVariables]] +deps = ["LinearAlgebra", "Test"] +git-tree-sha1 = "2fba81a302a7be671aefe194f0525ef231104e7f" +uuid = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" +version = "0.1.8" +weakdeps = ["InverseFunctions"] + + [deps.ChangesOfVariables.extensions] + ChangesOfVariablesInverseFunctionsExt = "InverseFunctions" + [[deps.CodecZlib]] deps = ["TranscodingStreams", "Zlib_jll"] git-tree-sha1 = "9c209fb7536406834aa938fb149964b985de6c83" @@ -118,6 +136,12 @@ git-tree-sha1 = "9e2f36d3c96a820c678f2f1f1782582fcf685bae" uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" version = "1.9.1" +[[deps.DensityInterface]] +deps = ["InverseFunctions", "Test"] +git-tree-sha1 = "80c3e8639e3353e5d2912fb3a1916b8455e2494b" +uuid = "b429d917-457f-4dbc-8f4c-0cc954292b1d" +version = "0.4.0" + [[deps.Distributed]] deps = ["Random", "Serialization", "Sockets"] uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" @@ -127,15 +151,12 @@ deps = ["FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", " git-tree-sha1 = "c72970914c8a21b36bbc244e9df0ed1834a0360b" uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" version = "0.25.95" +weakdeps = ["ChainRulesCore", "DensityInterface"] [deps.Distributions.extensions] DistributionsChainRulesCoreExt = "ChainRulesCore" DistributionsDensityInterfaceExt = "DensityInterface" - [deps.Distributions.weakdeps] - ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" - DensityInterface = "b429d917-457f-4dbc-8f4c-0cc954292b1d" - [[deps.DocStringExtensions]] deps = ["LibGit2"] git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b" @@ -230,6 +251,12 @@ version = "1.4.0" deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +[[deps.InverseFunctions]] +deps = ["Test"] +git-tree-sha1 = "68772f49f54b479fa88ace904f6127f0a3bb2e46" +uuid = "3587e190-3f89-42d0-90ee-14403ec27112" +version = "0.1.12" + [[deps.InvertedIndices]] git-tree-sha1 = "0dc7b50b8d436461be01300fd8cd45aa0274b038" uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f" @@ -288,17 +315,13 @@ deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] git-tree-sha1 = "c3ce8e7420b3a6e071e0fe4745f5d4300e37b13f" uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" version = "0.3.24" +weakdeps = ["ChainRulesCore", "ChangesOfVariables", "InverseFunctions"] [deps.LogExpFunctions.extensions] LogExpFunctionsChainRulesCoreExt = "ChainRulesCore" LogExpFunctionsChangesOfVariablesExt = "ChangesOfVariables" LogExpFunctionsInverseFunctionsExt = "InverseFunctions" - [deps.LogExpFunctions.weakdeps] - ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" - ChangesOfVariables = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" - InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" - [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" @@ -517,13 +540,11 @@ deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_j git-tree-sha1 = "ef28127915f4229c971eb43f3fc075dd3fe91880" uuid = "276daf66-3868-5448-9aa4-cd146d93841b" version = "2.2.0" +weakdeps = ["ChainRulesCore"] [deps.SpecialFunctions.extensions] SpecialFunctionsChainRulesCoreExt = "ChainRulesCore" - [deps.SpecialFunctions.weakdeps] - ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" - [[deps.Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" @@ -546,15 +567,12 @@ deps = ["HypergeometricFunctions", "IrrationalConstants", "LogExpFunctions", "Re git-tree-sha1 = "f625d686d5a88bcd2b15cd81f18f98186fdc0c9a" uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c" version = "1.3.0" +weakdeps = ["ChainRulesCore", "InverseFunctions"] [deps.StatsFuns.extensions] StatsFunsChainRulesCoreExt = "ChainRulesCore" StatsFunsInverseFunctionsExt = "InverseFunctions" - [deps.StatsFuns.weakdeps] - ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" - InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" - [[deps.StructTypes]] deps = ["Dates", "UUIDs"] git-tree-sha1 = "ca4bccb03acf9faaf4137a9abc1881ed1841aa70" diff --git a/src/output.jl b/src/output.jl index 9b55672a..f1c917cc 100644 --- a/src/output.jl +++ b/src/output.jl @@ -427,10 +427,23 @@ JudiLing.write2df(ts) function write2df(ts::Threshold_Stat_Struct) n = ts.timestep - df = DataFrame(vcat([Int64, Float64, Float64], [Float64 for k in 1:2n]), - vcat([:utterance, :threshold, :tolerance], [Symbol("thr_prop_$k") for k in 1:n], [Symbol("tlr_prop_$k") for k in 1:n]), - 0) + + # df = DataFrame(vcat([Int64, Float64, Float64], [Float64 for k in 1:2n]), + # vcat([:utterance, :threshold, :tolerance], [Symbol("thr_prop_$k") for k in 1:n], [Symbol("tlr_prop_$k") for k in 1:n]), + # 0) + + # utterance = Vector{Int64}() + # threshold = Vector{Float64}() + # tolerance = Vector{Float64}() + # threshold_prop = Matrix{Float64}(undef, 0, 2n) + thr_prop_dict = Dict(Symbol("thr_prop_$k") => Vector{Float64}() for k in 1:n) + tlr_prop_dict = Dict(Symbol("tlr_prop_$k") => Vector{Float64}() for k in 1:n) + df = DataFrame(merge(Dict(:utterance => Vector{Int64}(), + :threshold => Vector{Float64}(), + :tolerance => Vector{Float64}()), + thr_prop_dict, tlr_prop_dict) + ) for i in 1:ts.n_rows push!(df, vcat([i, ts.threshold, ts.tolerance], ts.threshold_prop[i,:], ts.tolerance_prop[i,:])) end @@ -454,7 +467,7 @@ JudiLing.save_L_matrix(L, joinpath(@__DIR__, "L.csv")) """ function save_L_matrix(L, filename) - L_df = DataFrame(L.L) + L_df = DataFrame(L.L, :auto) insertcols!(L_df, 1, :col_names => L.i2f) CSV.write(filename, L_df, quotestrings = true, header = false) nothing @@ -508,7 +521,7 @@ JudiLing.save_S_matrix(S, joinpath(@__DIR__, "S.csv"), latin, :Word) """ function save_S_matrix(S, filename, data, target_col; sep = " ") - S_df = DataFrame(S) + S_df = DataFrame(S, :auto) insertcols!(S_df, 1, :col_names => data[:,target_col]) CSV.write(filename, S_df, quotestrings = true, header = false, delim=sep) nothing