Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Bazdresch committed Apr 25, 2023
2 parents 5e8dc8e + 9d5ffb9 commit 6a3559b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ version = "0.1.0"
[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LsqFit = "2fda8390-95c7-5789-9bda-21331edee243"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
LsqFit = "0.13"
PrecompileTools = "1"
RecipesBase = "1"
SnoopPrecompile = "1"
Zygote = "0.6"
julia = "1.8"

[extras]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[![CI](https://github.com/mbaz/SinusoidalRegressions.jl/actions/workflows/ci.yml/badge.svg)](https://github.com/mbaz/SinusoidalRegressions.jl/actions/workflows/ci.yml)

[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

SinusoidalRegressions.jl aims to provide a set of functions for conveniently fitting noisy data to a variety of sinusoidal models, with or without initial estimates of the parameters. The package is quite usable in its current state, but is still in development. Support for more sinusoidal models will be added in the future, and API changes cannot be ruled out.

Its documentation is found [here](https://mbaz.github.io/SinusoidalRegressions.jl/stable/).
Expand Down
35 changes: 22 additions & 13 deletions src/SinusoidalRegressions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module SinusoidalRegressions

using LsqFit
using RecipesBase
using SnoopPrecompile
using PrecompileTools
using Zygote
using LinearAlgebra

Expand Down Expand Up @@ -63,7 +63,7 @@ Sinusoidal parameters SinusoidP{Float64}:
See the documentation for more details.
"""
sinfit(p::Problem, a::Algorithm) = sinfit(p, a)
sinfit(p::Problem, a::Algorithm) = "Not implemented."

function sinfit(p::Sin3Problem, ::IEEE1057)
ieee1057(p)
Expand Down Expand Up @@ -146,21 +146,30 @@ Convert polar coordinates to rectangular coordinates `(y, x)` where ``x = M\\cos
``y = -M\\sin(θ)``
"""
torect(M, θ) = (-M*sin(θ), M*cos(θ))
#=

## Precompilation
@precompile_setup begin
@setup_workload begin
x = [-1.983, -1.948, -1.837, -1.827, -1.663, -0.815, -0.778, -0.754, -0.518, 0.322, 0.418, 0.781,
0.931, 1.510, 1.607]
y = [ 0.936, 0.810, 0.716, 0.906, 0.247, -1.513, -1.901, -1.565, -1.896, 0.051, 0.021, 1.069,
0.862, 0.183, 0.311]
@precompile_all_calls begin
t2 = ieee1057(x, y)
t1 = ieee1057(x, y, 1.5)
t3 = sinfit_j(x, y)
t4 = sinfit(x, y, initialguess = t3)
t5 = mixlinsinfit_j(x, y)
t6 = mixlinsinfit(x, y, t5)
0.862, 0.183, 0.311]
@compile_workload begin
p1 = Sin3Problem(x, y, 1.5)
t2 = sinfit(p1, IEEE1057())
t3 = sinfit(p1, LevMar())

p2 = Sin4Problem(x, y, f = 1.5)
t4 = sinfit(p2, IEEE1057())
t5 = sinfit(p2, IntegralEquations())
t6 = sinfit(p2, LevMar())
t7 = sinfit(p2, Liang())

p3 = MixedLinSin4Problem(x, y, 1.5)
t8 = sinfit(p3, LevMar())

p4 = MixedLinSin5Problem(x, y)
t9 = sinfit(p3, IntegralEquations())
end
end
=#

end # module

0 comments on commit 6a3559b

Please sign in to comment.