Skip to content

Commit fa39745

Browse files
authored
Dev (#27)
* plot update (ldict) * plotting * docs pkg * docs, minor fix * docs * show ds * show res ds * save plots * version bump * update * update * update * docs, plot output * fix plots * export, fix docs * fix plots * breaking changes in plots output * fix docs * pd tau * plot dose time * tests * minor changes * update MetidaBase minor changes
1 parent 7e2f843 commit fa39745

2 files changed

Lines changed: 35 additions & 9 deletions

File tree

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MetidaNCA"
22
uuid = "097c2839-c7bc-4c4b-a5f2-b4167c1b4e7c"
33
authors = ["PharmCat <v.s.arnautov@yandex.ru>"]
4-
version = "0.5.14"
4+
version = "0.5.15"
55

66

77

@@ -13,7 +13,7 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1313

1414
[compat]
1515

16-
MetidaBase = "0.11.2, 0.11.3, 0.12"
16+
MetidaBase = "0.11.2, 0.11.3, 0.12, 0.13, 0.14"
1717
RecipesBase = "1"
1818
Requires = "1"
1919
julia = "1"

src/import.jl

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@
22

33
nonunique(v) = [k for (k, v) in StatsBase.countmap(v) if v > 1]
44

5+
parse_gkw(s::String) = [Symbol(s)]
6+
parse_gkw(s::Symbol) = [s]
7+
parse_gkw(s::AbstractVector{<:AbstractString}) = Symbol.(s)
8+
parse_gkw(s::AbstractVector{Symbol}) = s
9+
10+
function floatparse(data::Missing, warn)
11+
warn && @warn "Value $data parsed as `NaN`"
12+
return NaN
13+
end
14+
15+
function floatparse(data::Nothing, warn)
16+
warn && @warn "Value $data parsed as `NaN`"
17+
return NaN
18+
end
19+
20+
floatparse(data::AbstractFloat, ::Any) = data
21+
22+
function floatparse(data::AbstractString, warn)
23+
tp = tryparse(Float64, data)
24+
warn && isnothing(tp) && @warn "Value $data parsed as `NaN`"
25+
floatparse(tp, false)
26+
end
27+
function floatparse(data::Int, warn)
28+
float(data)
29+
end
30+
#=
531
function floatparse(data, warn)
632
if !isa(data, AbstractFloat) && !ismissing(data)
733
if isa(data, AbstractString)
@@ -25,7 +51,7 @@ function floatparse(data, warn)
2551
return data
2652
end
2753
end
28-
54+
=#
2955

3056
#=
3157
function floatparse(data::AbstractVector)
@@ -107,8 +133,8 @@ keywords:
107133
See also: [`ElimRange`](@ref), [`DoseTime`](@ref), [`LimitRule`](@ref).
108134
"""
109135
function pkimport(data, time, conc, sort; kelauto = true, elimrange = ElimRange(), dosetime = nothing, limitrule::Union{Nothing, LimitRule} = nothing, warn = true, kwargs...)
110-
if isa(sort, String) sort = [Symbol(sort)] end
111-
if isa(sort, Symbol) sort = [sort] end
136+
137+
sort = parse_gkw(sort)
112138

113139
Tables.istable(data) || error("Data not a table!")
114140

@@ -216,8 +242,8 @@ Import urine PK data from table `data`.
216242
* `sort` - subject sorting columns.
217243
"""
218244
function upkimport(data, stime, etime, conc, vol, sort; kelauto = true, elimrange = ElimRange(), dosetime = nothing)
219-
if isa(sort, String) sort = [Symbol(sort)] end
220-
if isa(sort, Symbol) sort = [sort] end
245+
246+
sort = parse_gkw(sort)
221247

222248
cols = Tables.columns(data)
223249
cdata = Tuple(Tables.getcolumn(cols, y) for y in sort)
@@ -328,8 +354,8 @@ Keywords:
328354
329355
"""
330356
function pdimport(data, time, obs, sort; bl = 0, th = 0, dosetime::Union{Nothing, DoseTime} = nothing, limitrule::Union{Nothing, LimitRule} = nothing, warn = true)
331-
if isa(sort, String) sort = [Symbol(sort)] end
332-
if isa(sort, Symbol) sort = [sort] end
357+
358+
sort = parse_gkw(sort)
333359

334360
Tables.istable(data) || error("Data not a table!")
335361

0 commit comments

Comments
 (0)