Skip to content

Commit a932943

Browse files
committed
Update to Julia 1.10 synthax
-Range renamed AbstractRange JuliaLang/julia#23570 -squeeze renamed dropdims -immutable renamed struct JuliaLang/julia#20418
1 parent 56d1d7a commit a932943

6 files changed

+9
-8
lines changed

src/core.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ linear(g::TimeGrid, s::System, p::HilbertPath{3}) = amplitude(s,p)*linear(g, ene
55
linear(g::TimeGrid, s::System) = sum(p->linear(g, s, p), hilbert_paths(s, 1))
66
linear(t1::Real, ws::NTuple{1, Real}, ls::NTuple{1,Any}) = linear(t1, ws..., ls...)
77
linear(g::TimeGrid{<:Real,1}, ws::NTuple{1, Real}, ls::NTuple{1,Any}) = linear(first(grid(g)), ws..., ls...) # could be fed to the @eval loop.
8-
linear(g::TimeGrid, ws::NTuple{1, Real}, ls::NTuple{1,Any}) = linear(squeeze(first(grid(g))), ws..., ls...) # could be fed to the @eval loop.
8+
linear(g::TimeGrid, ws::NTuple{1, Real}, ls::NTuple{1,Any}) = linear(dropdims(first(grid(g))), ws..., ls...) # could be fed to the @eval loop.
99
linear(t1::Array{<:Real,1}, ws::Real, ls) = linear.(t1, ws, ls)
1010

1111
# Use the @eval macro to operate on R1 to R4.

src/hilbert_path.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ True if any element is identical to the next. Naive implementation
1111
consecutive(a) = any(a[2:end] .== a[1:end-1])
1212

1313
"""Hilbert Path of order N-2"""
14-
immutable HilbertPath{N}
14+
struct HilbertPath{N}
1515
p::NTuple{N,String}
1616
end
1717
HilbertPath(args::Vararg{String,N}) where {N} = HilbertPath{N}(args)

src/lineshapes.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ end
3838
function LineshapeLUT(lut::Array{Tls,1}, dx::Tx) where {Tls, Tx}
3939
LineshapeLUT{Tx, Tls}(lut, dx)
4040
end
41-
function LineshapeLUT(f, x::Range{Tx}) where {Tx}#, Tls}
41+
function LineshapeLUT(f, x::AbstractRange{Tx}) where {Tx}#, Tls}
4242
gx = f.(x)
4343
LineshapeLUT{Tx,eltype(gx)}(gx, step(x))
4444
end

src/time_correlation.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
export GriddedCF
33

44
# externally computed on a constant grid. Allow specific points only.
5-
immutable GriddedCF{Tg<:Real, Tcf<:Number}
5+
struct GriddedCF{Tg<:Real, Tcf<:Number}
66
lut::Array{Tcf,1}
77
Im::Tcf
88
dt::Tg

src/time_grid.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Base.size(tg::TimeGrid) = map(length, tg.times)
1616
# to find a greater common divisor (gcd) for floats:
1717
# https://www.geeksforgeeks.org/program-find-gcd-floating-point-numbers/
1818

19-
t_to_f(t::Range) = fftshift(fftfreq(length(t), 1/step(t)))
19+
t_to_f(t::AbstractRange) = fftshift(fftfreq(length(t), 1/step(t)))
2020
# use mean step. Hopefully doesn't matter.
2121
t_to_f(t::AbstractArray{<:Real, 1}) = fftshift(fftfreq(length(t), 1/mean(diff(t))))
2222
"""

src/utils.jl

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ function simps(y, h::Number)
1313
s = sum(y[1:2:n] + 4y[2:2:n]+y[3:2:n+1])
1414
h/3*s + tail
1515
end
16-
#simps(y, h::Base.TwicePrecision{T}) where {T<:AbstractFloat} = simps(y, h.hi)
17-
simps(y, x::Range{T}) where {T} = simps(y, step(x))
16+
#simps(y, h::Base.TwicePrecision{T}) where {T<:AbstractFloat} = simps(y, h.hi)
17+
18+
simps(y, x::AbstractRange{T}) where {T} = simps(y, step(x))
1819

1920
"""
2021
Sum a series until convergence.
@@ -36,4 +37,4 @@ end
3637

3738
# convenience
3839
"""Squeeze all dimensions of length 1"""
39-
Base.squeeze(A::AbstractArray) = squeeze(A, tuple(find(size(A).==1)...))
40+
Base.dropdims(A::AbstractArray) = dropdims(A, tuple(find(size(A).==1)...))

0 commit comments

Comments
 (0)