From 75c1241ecec96806082ef5b712f0daa73b9dc77c Mon Sep 17 00:00:00 2001 From: oameye Date: Thu, 13 Jun 2024 19:41:07 +0200 Subject: [PATCH] add Jet and badges --- Project.toml | 12 +++++++----- README.md | 5 +++++ src/modules/FFTWExt.jl | 2 +- src/solve_homotopy.jl | 2 +- src/sorting.jl | 4 ++-- test/runtests.jl | 11 +++++++++-- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Project.toml b/Project.toml index 941b7f80..51845482 100644 --- a/Project.toml +++ b/Project.toml @@ -34,30 +34,33 @@ 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" @@ -65,7 +68,6 @@ 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"] diff --git a/README.md b/README.md index 06a248d6..e9accd52 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/modules/FFTWExt.jl b/src/modules/FFTWExt.jl index 7b417107..e9ae3c76 100644 --- a/src/modules/FFTWExt.jl +++ b/src/modules/FFTWExt.jl @@ -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)) diff --git a/src/solve_homotopy.jl b/src/solve_homotopy.jl index 41317a42..2a5eb43b 100644 --- a/src/solve_homotopy.jl +++ b/src/solve_homotopy.jl @@ -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; diff --git a/src/sorting.jl b/src/sorting.jl index 982566cb..10694a58 100644 --- a/src/sorting.jl +++ b/src/sorting.jl @@ -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] @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index b952b6ce..c3f42b19 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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] @@ -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") @@ -65,3 +68,7 @@ end include("ModelingToolkitExt.jl") include("SteadyStateDiffEqExt.jl") end + +@testset "Doctests" begin + Documenter.doctest(HiddenMarkovModels) +end