Skip to content

Commit

Permalink
add Jet and badges
Browse files Browse the repository at this point in the history
  • Loading branch information
oameye committed Jun 13, 2024
1 parent ce91767 commit 75c1241
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
12 changes: 7 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,38 +34,40 @@ SteadyStateDiffEqExt = "SteadyStateDiffEq"
TimeEvolution = "OrdinaryDiffEq"

[compat]
JET = "0.9"
Aqua = "0.8"
BijectiveHilbert = "0.3.0"
DSP = "0.7.4"
DelimitedFiles = "1"
Distances = "0.10.7"
DocStringExtensions = "0.9"
ExplicitImports = "1.6"
FFTW = "1.5.0"
HomotopyContinuation = "2.6.4"
JLD2 = "0.4.24"
Latexify = "0.15.16, 0.16"
ModelingToolkit = "9"
NonlinearSolve = "3.12"
OrderedCollections = "1.4.1"
OrdinaryDiffEq = "v6.33.1"
Peaks = "0.4.0, 0.5"
Peaks = "0.4"
Plots = "1.35.0"
ProgressMeter = "1.7.2"
SteadyStateDiffEq = "1, 2"
SymbolicUtils = "2.0"
Symbolics = "5.0.0"
julia = "1.10.0"
NonlinearSolve = "3.12"
ExplicitImports = "1.6"
Aqua = "0.8"

[extras]
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SteadyStateDiffEq = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"

[targets]
test = ["Pkg", "Test", "OrdinaryDiffEq", "ModelingToolkit", "SteadyStateDiffEq", "NonlinearSolve", "ExplicitImports", "Aqua"]
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
[![docs](https://img.shields.io/badge/docs-online-blue.svg)](https://nonlinearoscillations.github.io/HarmonicBalance.jl/stable/)
[![Downloads](https://shields.io/endpoint?url=https://pkgs.genieframework.com/api/v1/badge/HarmonicBalance)](https://pkgs.genieframework.com?packages=HarmonicBalance)

[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
[![JET](https://img.shields.io/badge/%E2%9C%88%EF%B8%8F%20tested%20with%20-%20JET.jl%20-%20red)](https://github.com/aviatesk/JET.jl)


**HarmonicBalance.jl** is a Julia package for solving nonlinear differential equations using the method of harmonic balance.

## Installation
Expand Down
2 changes: 1 addition & 1 deletion src/modules/FFTWExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function FFT_analyze(fft_u::Vector{ComplexF64}, fft_f)
This correction works for a rectangular window."

# retaining more sigdigits gives more ''spurious'' peaks
max_indices, mxval = Peaks.peakprom(round.(abs.(fft_u), sigdigits=3); minprom=1)
max_indices, mxval = Peaks.peakproms(round.(abs.(fft_u), sigdigits=3); minprom=1)
Del = fft_f[2] - fft_f[1] # frequency spacing
A1 = abs.(fft_u)[max_indices]
df = zeros(length(max_indices))
Expand Down
2 changes: 1 addition & 1 deletion src/solve_homotopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function _get_raw_solution(
end
for i in eachindex(parameter_values) # do NOT thread this
p = parameter_values[i]
show_progress ? next!(bar) : nothing
show_progress ? ProgressMeter.next!(bar) : nothing
result_full[i] = [
HC.solve(
problem.system;
Expand Down
4 changes: 2 additions & 2 deletions src/sorting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function sort_1D(solns::Vector{Vector{SteadyState}}; show_progress=true)
)
end
for i in eachindex(solns[1:(end - 1)])
show_progress ? next!(bar) : nothing
show_progress ? ProgressMeter.next!(bar) : nothing
matched_indices = align_pair(sorted_solns[i], solns[i + 1]) # pairs of matching indices
next_indices = getindex.(matched_indices, 2) # indices of the next solution
sorted_solns[i + 1] = (solns[i + 1])[next_indices]
Expand Down Expand Up @@ -185,7 +185,7 @@ function sort_2D(
)
end
for i in 1:(length(idx_pairs) - 1)
show_progress ? next!(bar) : nothing
show_progress ? ProgressMeter.next!(bar) : nothing
neighbors = get_nn_2D(idx_pairs[i + 1], size(solns, 1), size(solns, 2))
reference = [sorted_solns[ind...] for ind in neighbors]
matched_indices = align_pair(reference, solns[idx_pairs[i + 1]...]) # pairs of matching indices
Expand Down
11 changes: 9 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using Random
const SEED = 0xd8e5d8df
Random.seed!(SEED)

@testset "Package health" begin
@testset "Code quality" begin
using ExplicitImports, Aqua
ignore_deps = [:Random, :LinearAlgebra, :Printf, :Test, :Pkg]

Expand All @@ -21,10 +21,13 @@ Random.seed!(SEED)
),
piracies=(treat_as_own=[HarmonicBalance.Num],),
ambiguities=false,
persistent_tasks=false,
)
end

@testset "Code linting" begin
JET.test_package(HarmonicBalance; target_defined_modules=true)
end

@testset "Symbolics customised" begin
include("powers.jl")
include("harmonics.jl")
Expand Down Expand Up @@ -65,3 +68,7 @@ end
include("ModelingToolkitExt.jl")
include("SteadyStateDiffEqExt.jl")
end

@testset "Doctests" begin
Documenter.doctest(HiddenMarkovModels)
end

0 comments on commit 75c1241

Please sign in to comment.