Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev (#16) #17

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MetidaNCA"
uuid = "097c2839-c7bc-4c4b-a5f2-b4167c1b4e7c"
authors = ["PharmCat <[email protected]>"]
version = "0.5.7"
version = "0.5.8"


[deps]
Expand Down
6 changes: 6 additions & 0 deletions change.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.5.8
- plots minor changing

0.5.7
- fix partials

0.5.6
- extend partials

Expand Down
8 changes: 6 additions & 2 deletions src/nca.jl
Original file line number Diff line number Diff line change
Expand Up @@ -833,8 +833,12 @@ end
function maxconc(subj::T) where T <: PKSubject
maximum(subj.obs)
end
function minconc(subj::T) where T <: PKSubject
minimum(subj.obs)
function minconc(subj::T, pos = false) where T <: PKSubject
if pos
return minimum(Iterators.filter(x-> x > zero(x), subj.obs))
else
return minimum(subj.obs)
end
end

function exrate(time::AbstractVector{Tuple{S, E}}, conc::AbstractVector{C}, vol::AbstractVector{V}) where S where E where C where V
Expand Down
16 changes: 11 additions & 5 deletions src/plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,14 @@ function pkplot(subj::AbstractSubject; ls = false, elim = false, xticksn = :auto
elseif kwargs[:yscale] == :ln || kwargs[:yscale] == :log
b = ℯ
end

t = collect(floor(log(b, minimum(obs))):ceil(log(b, maximum(obs))))
pushfirst!(t, first(t) - 1)
kwargs[:yticks] = b .^ t

end
if !(:ylims in k)
kwargs[:ylims] = (b ^ floor(log(b, minimum(obs)*0.8)), maximum(obs)*1.3)
kwargs[:ylims] = (minimum(obs)*0.5, maximum(obs)*2.)
end
end
else
Expand Down Expand Up @@ -280,10 +281,9 @@ function pkplot!(subj; ls = false, elim = false, xticksn = :auto, yticksn = :aut
t = collect(floor(log(b, minimum(obs))):ceil(log(b, maximum(obs))))
pushfirst!(t, first(t) - 1)
kwargs[:yticks] = b .^ t

end
if !(:ylims in k)
kwargs[:ylims] = (b ^ floor(log(b, minimum(obs)*0.8)), maximum(obs)*1.3)
kwargs[:ylims] = (minimum(obs)*0.5, maximum(obs)*2.)
end
end
else
Expand Down Expand Up @@ -320,7 +320,13 @@ function pageplot(data, id, ulist; kwargs...)
# Y lims

if !(:ylims in k) && length(subdata) > 1
kwargs[:ylims] = (findmin(x->minconc(x), getdata(subdata))[1], findmax(x->maxconc(x), getdata(subdata))[1]*1.15)
ysc = :yscale in k
ylmin = findmin(x->minconc(x, ysc), getdata(subdata))[1]
ylmax = findmax(x->maxconc(x), getdata(subdata))[1]*1.15
if ysc
ylmax *= 5
end
kwargs[:ylims] = (ylmin, ylmax)
end
# Plotting subdata
if length(subdata) > 1 kwargs[:elim] = false end
Expand Down
Loading