Code Monkey home page Code Monkey logo

ellipsesampling.jl's People

Contributors

joeltrent avatar

Stargazers

 avatar  avatar

Watchers

 avatar

ellipsesampling.jl's Issues

`calculate_ellipse_parameters` fails to calculate the correct values for `a` and `b` when the ellipse rotation approaches 0.25 or 1.25

Minimum working example (for version 0.1.1):

using EllipseSampling
import Distributions
using Plots
gr()

N=8

a, b = 2.0, 1.0 
α = 0.25*π
Cx, Cy= 2.0, 2.0
points=generate_N_equally_spaced_points(N, a, b, α, Cx, Cy, start_point_shift=0.0)
plt=scatter(points[1,:], points[2,:], label=nothing, mw=0, ms=8, aspect_ratio=:equal)

Hw11 = (cos(α)^2 / a^2 + sin(α)^2 / b^2)
Hw22 = (sin(α)^2 / a^2 + cos(α)^2 / b^2)
Hw12 = cos(α)*sin(α)*(1/a^2 - 1/b^2)
Hw_norm = [Hw11 Hw12; Hw12 Hw22]

confidence_level=0.95
Hw = Hw_norm ./ (0.5 ./ (Distributions.quantile(Distributions.Chisq(2), confidence_level)*0.5))
Γ = inv(Hw)

points2 = generate_N_equally_spaced_points(N, Γ, [Cx, Cy], 1, 2, confidence_level=confidence_level, start_point_shift=0.0)
scatter!(points2[1, :], points2[2, :], label=nothing, markeralpha=0.5, mw=0, ms=4)

display(plt)

precision_issue

If we modify the rotation slightly away from 0.25pi the problem goes away:

a, b = 2.0, 1.0 
α = 0.251*π
Cx, Cy= 2.0, 2.0
points=generate_N_equally_spaced_points(N, a, b, α, Cx, Cy, start_point_shift=0.0)
plt=scatter(points[1,:], points[2,:], label=nothing, mw=0, ms=8, aspect_ratio=:equal)

Hw11 = (cos(α)^2 / a^2 + sin(α)^2 / b^2)
Hw22 = (sin(α)^2 / a^2 + cos(α)^2 / b^2)
Hw12 = cos(α)*sin(α)*(1/a^2 - 1/b^2)
Hw_norm = [Hw11 Hw12; Hw12 Hw22]

confidence_level=0.95
Hw = Hw_norm ./ (0.5 ./ (Distributions.quantile(Distributions.Chisq(2), confidence_level)*0.5))
Γ = inv(Hw)

points2 = generate_N_equally_spaced_points(N, Γ, [Cx, Cy], 1, 2, confidence_level=confidence_level, start_point_shift=0.0)
scatter!(points2[1, :], points2[2, :], label=nothing, markeralpha=0.5, mw=0, ms=4)

display(plt)

precision_issue_0 251pi

We can confirm this issue by inspecting the ellipse values returned by calculate_ellipse_parameters:

# for α = 0.25*π
a_calc, b_calc, _, _, α_calc = EllipseSampling.calculate_ellipse_parameters(Γ, 1, 2, confidence_level)

println("a=", a_calc); println("b=", b_calc); println("α/pi=", α_calc/pi)
a=1.7994708216848752
b=1.0307764064044151
α=0.24999999999999992

Patch version to 0.1.1

@JuliaRegistrator register branch=main

Release notes:

This patch contains minor performance improvements, documentation updates and fixes, Tagbot update and logo addition in the documentation page. No changes to api or results.

The images folder in docs has been renamed to assets per standard practice. The installation guide has been updated now the package is registered. StaticArrays has been added as a dependency and is used in function E_inverse to pass in parameter values to the function to find the zero of (ellipse_zero), instead of the previous anonymous function.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Minor release to v0.2.0

@JuliaRegistrator register branch=main

Release notes:

Added integer dof argument to calculate_ellipse_parameters and generate_N_clustered_points (when calculated from a covariance matrix). By default it is set to 2, which gives the same behaviour as before this release. Setting it to below 2 will return an error. The ability to set higher values is useful when e.g. calculating ellipses for multiple sets of pairwise indexes simultaneously.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.