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

test: enable JET #284

Merged
merged 7 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/HarmonicEquation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ end

"Simplify the equations in HarmonicEquation."
function simplify!(eom::HarmonicEquation)
return eom.equations = [simplify(eq) for eq in eom.equations]
return eom.equations = [Symbolics.simplify(eq) for eq in eom.equations]
end

"""
Expand Down
4 changes: 3 additions & 1 deletion src/HarmonicVariable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ end

# when HV is used for substitute, substitute its symbol
function ExprUtils.substitute_all(eq::Union{Num,Equation}, rules::Dict{HarmonicVariable})
return substitute(eq, Dict(zip(getfield.(keys(rules), :symbol), values(rules))))
return Symbolics.substitute(
eq, Dict(zip(getfield.(keys(rules), :symbol), values(rules)))
)
end

function ExprUtils.substitute_all(var::HarmonicVariable, rules)
Expand Down
2 changes: 1 addition & 1 deletion src/KrylovBogoliubov/KrylovEquation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function van_der_Pol(eom::DifferentialEquation, t::Num)
D = Differential(t)
nvar_t = diff2term(D(unwrap(nvar)))
vdP_rules = Dict(D(hvar_u.symbol) => 0, D(hvar_v.symbol) => 0)
rules[nvar_t] = substitute(expand_derivatives(D(rule)), vdP_rules)
rules[nvar_t] = Symbolics.substitute(expand_derivatives(D(rule)), vdP_rules)

uv_idx += 1
push!(vars, hvar_u, hvar_v)
Expand Down
2 changes: 1 addition & 1 deletion src/LinearResponse/LinearResponse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using Plots: heatmap, theme_palette, scatter, RGB, cgrad
using Latexify: Latexify, latexify, @L_str
using Latexify.LaTeXStrings: LaTeXStrings

using Symbolics: Num, Equation, substitute, unwrap
using Symbolics: Symbolics, Num, Equation, unwrap
using LinearAlgebra: norm, eigvals, eigen, eigvecs
using OrderedCollections: OrderedDict

Expand Down
3 changes: 2 additions & 1 deletion src/LinearResponse/Lorentzian_spectrum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ function JacobianSpectrum(res::Result; index::Int, branch::Int, force=false)
for pair in _get_uv_pairs(hvars)
u, v = hvars[pair]
eigvec_2d = eigvec[pair] # fetch the relevant part of the Jacobian eigenvector
ωnum = real(unwrap(substitute(u.ω, solution_dict))) # the harmonic (numerical now) associated to this harmonic variable
ωnum = real(unwrap(Symbolics.substitute(u.ω, solution_dict)))
# ^ the harmonic (numerical now) associated to this harmonic variable

# eigvec_2d is associated to a natural variable -> this variable gets Lorentzian peaks
peaks = norm(eigvec_2d) * _pair_to_peaks(λ, eigvec_2d; ω=ωnum)
Expand Down
8 changes: 4 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using Random
const SEED = 0xd8e5d8df
Random.seed!(SEED)

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

@testset "Code quality" begin
using ExplicitImports, Aqua
Expand Down
Loading