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

Ensure robustness to integer vs. floating-point numbers #13

Closed
ajkeller34 opened this issue May 19, 2017 · 2 comments
Closed

Ensure robustness to integer vs. floating-point numbers #13

ajkeller34 opened this issue May 19, 2017 · 2 comments
Labels

Comments

@ajkeller34
Copy link
Contributor

e.g. sometimes CellReference(c, Point(0,0)) will fail with an InexactError.

@ajkeller34 ajkeller34 added the bug label May 19, 2017
@ajkeller34
Copy link
Contributor Author

Minimal reproducible example:

julia> c2 = Cell("c2", nm);

julia> render!(c2, Rectangle(1μm, 1μm));

julia> const c2ref = CellReference(c2, Point(0μm,0μm)); # 0μm (not 0.0μm) required to cause the error

julia> c = Cell("c", nm);

julia> ro = Path(μm, α0 = 180°); # nonzero angle is also important to cause the error

julia> straight!(ro, 10μm, Paths.Trace(1μm));

julia> attach!(ro, c2ref, pathlength(ro));

julia> render!(c, ro)
ERROR: InexactError()
Stacktrace:
 [1] convert(::Type{Int64}, ::Float64) at ./float.jl:679
 [2] convert at /Users/ajkeller/.julia/v0.6/Unitful/src/conversion.jl:91 [inlined]
 [3] Devices.Points.Point{Quantity{Int64, Dimensions:{𝐋}, Units:{μm}}}(::Quantity{Float64, Dimensions:{𝐋}, Units:{μm}}, ::Quantity{Float64, Dimensions:{𝐋}, Units:{μm}}) at /Users/ajkeller/.julia/v0.6/Devices/src/points.jl:20
 [4] convert(::Type{Devices.Points.Point{Quantity{Int64, Dimensions:{𝐋}, Units:{μm}}}}, ::Devices.Points.Point{Quantity{Float64, Dimensions:{𝐋}, Units:{μm}}}) at /Users/ajkeller/.julia/v0.6/StaticArrays/src/convert.jl:7
 [5] #render!#56(::Array{Any,1}, ::Function, ::Devices.Cells.Cell{Quantity{Float64, Dimensions:{𝐋}, Units:{nm}},Devices.GDSMeta}, ::Devices.Paths.Straight{Quantity{Float64, Dimensions:{𝐋}, Units:{μm}}}, ::Devices.Paths.DecoratedStyle{Quantity{Float64, Dimensions:{𝐋}, Units:{μm}}}, ::Devices.GDSMeta) at /Users/ajkeller/.julia/v0.6/Devices/src/render/decorated.jl:19
 [6] render!(::Devices.Cells.Cell{Quantity{Float64, Dimensions:{𝐋}, Units:{nm}},Devices.GDSMeta}, ::Devices.Paths.Straight{Quantity{Float64, Dimensions:{𝐋}, Units:{μm}}}, ::Devices.Paths.DecoratedStyle{Quantity{Float64, Dimensions:{𝐋}, Units:{μm}}}, ::Devices.GDSMeta) at /Users/ajkeller/.julia/v0.6/Devices/src/render/decorated.jl:11
 [7] #render!#7(::Array{Any,1}, ::Function, ::Devices.Cells.Cell{Quantity{Float64, Dimensions:{𝐋}, Units:{nm}},Devices.GDSMeta}, ::Devices.Paths.Path{Quantity{Float64, Dimensions:{𝐋}, Units:{μm}}}, ::Devices.GDSMeta) at /Users/ajkeller/.julia/v0.6/Devices/src/render/paths.jl:24
 [8] render!(::Devices.Cells.Cell{Quantity{Float64, Dimensions:{𝐋}, Units:{nm}},Devices.GDSMeta}, ::Devices.Paths.Path{Quantity{Float64, Dimensions:{𝐋}, Units:{μm}}}) at /Users/ajkeller/.julia/v0.6/Devices/src/render/paths.jl:6

@ajkeller34
Copy link
Contributor Author

Fixed. Problem was likely that render! attempted to add a fraction of a micron to the origin of the cell reference, which had integer micron coordinates. Now references and arrays always have floating-point coordinates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant