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

Fix _choose #96

Merged
merged 2 commits into from
Jan 17, 2022
Merged
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
11 changes: 2 additions & 9 deletions src/EquationOfStateWorkflow/actions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,9 @@ customizer(params::Parameters, pressure::Pressure, timefmt = "Y-m-d_H:M:S") =
function _choose(possible_volumes, pressure, eos)
v0 = getparam(eos).v0
filtered = if pressure >= zero(pressure) # If pressure is greater than zero,
filter(<(v0), possible_volumes) # the volume could only be smaller than `v0`.
filter(<=(v0), possible_volumes) # the volume could only be smaller than `v0`.
else
filter(>(v0), possible_volumes)
filter(v -> 1 < v / v0 <= 3, possible_volumes)
end
return only(filtered)
end

function _interactive_choose(volumes)
options = string.(volumes)
menu = RadioMenu(options)
choice = request("Choose the desired volume:", menu)
choice == -1 ? throw(InterruptException()) : volumes[choice]
end