Skip to content

Commit

Permalink
Merge pull request #24 from ajkeller34/unitful
Browse files Browse the repository at this point in the history
Rewrite two methods to use user-facing Unitful type aliases.
  • Loading branch information
timholy authored Nov 16, 2018
2 parents 62ca6dc + 56a7139 commit b92e60c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/ImagineFormat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,9 @@ function writefield(io, fn, dct::Dict)
end

writeum(io,x) = print(io, x/μm, " um")
writeus(io,x::Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Time}(1//1),)}}) where {T} =
print(io, x/μs, " us")
writeus(io,x::Unitful.Time) = print(io, x/μs, " us")
writeus(io,x) = nothing
writeMHz(io,x::Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Time}(-1//1),)}}) where {T} =
print(io, x/MHz, " MHz")
writeMHz(io,x::Unitful.Frequency) = print(io, x/MHz, " MHz")
writeMHz(io,x) = nothing
const write_dict = Dict{String,Function}(
"bidirectional" => (io,x)->x ? print(io, 1) : print(io, 0),
Expand Down

0 comments on commit b92e60c

Please sign in to comment.