Skip to content

Commit

Permalink
Change argument order for ProportionalBandSpectrumWithTime
Browse files Browse the repository at this point in the history
  • Loading branch information
dingraha committed May 3, 2024
1 parent 5a287e8 commit 5e825c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
11 changes: 5 additions & 6 deletions src/proportional_bands.jl
Original file line number Diff line number Diff line change
Expand Up @@ -826,16 +826,16 @@ end
Representation of a proportional band spectrum with octave fraction `NO` and `eltype` `TF`, but with an observer time.
"""
struct ProportionalBandSpectrumWithTime{NO,TF,TPBS<:AbstractVector{TF},TBandsC<:AbstractProportionalBands{NO,:center},TTime,TDTime} <: AbstractProportionalBandSpectrum{NO,TF}
t::TTime
dt::TDTime
struct ProportionalBandSpectrumWithTime{NO,TF,TPBS<:AbstractVector{TF},TBandsC<:AbstractProportionalBands{NO,:center},TDTime,TTime} <: AbstractProportionalBandSpectrum{NO,TF}
pbs::TPBS
cbands::TBandsC
dt::TDTime
t::TTime

function ProportionalBandSpectrumWithTime(t, dt, cbands::AbstractProportionalBands{NO,:center}, pbs) where {NO}
function ProportionalBandSpectrumWithTime(pbs, cbands::AbstractProportionalBands{NO,:center}, dt, t) where {NO}
length(pbs) == length(cbands) || throw(ArgumentError("length(pbs) must match length(cbands)"))

return new{NO,eltype(pbs),typeof(pbs),typeof(cbands),typeof(t),typeof(dt)}(t, dt, pbs, cbands)
return new{NO,eltype(pbs),typeof(pbs),typeof(cbands),typeof(dt),typeof(t)}(pbs, cbands, dt, t)
end
end

Expand All @@ -848,7 +848,6 @@ function lazy_pbs(pbs::ProportionalBandSpectrumWithTime, cbands::AbstractProport
return LazyPBSProportionalBandSpectrum(pbs, cbands)
end


struct LazyPBSProportionalBandSpectrum{NO,TF,TPBS<:AbstractProportionalBandSpectrum,TBandsC<:AbstractProportionalBands{NO,:center}} <: AbstractProportionalBandSpectrum{NO,TF}
pbs::TPBS
cbands::TBandsC
Expand Down
16 changes: 8 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3841,7 +3841,7 @@ end
ubands1 = upper_bands(cbands1)
t1 = 2.0
dt1 = 0.2
pbs1 = ProportionalBandSpectrumWithTime(t1, dt1, cbands1, rand(length(cbands1)))
pbs1 = ProportionalBandSpectrumWithTime(rand(length(cbands1)), cbands1, dt1, t1)
@test has_observer_time(pbs1) == true
@test observer_time(pbs1) t1
@test timestep(pbs1) dt1
Expand All @@ -3852,7 +3852,7 @@ end
ubands2 = upper_bands(cbands2)
t2 = 2.1
dt2 = 0.2
pbs2 = ProportionalBandSpectrumWithTime(t2, dt2, cbands2, rand(length(cbands2)))
pbs2 = ProportionalBandSpectrumWithTime(rand(length(cbands2)), cbands2, dt2, t2)
@test has_observer_time(pbs2) == true
@test observer_time(pbs2) t2
@test timestep(pbs2) dt2
Expand All @@ -3863,7 +3863,7 @@ end
ubands3 = upper_bands(cbands3)
t3 = 2.3
dt3 = 0.2
pbs3 = ProportionalBandSpectrumWithTime(t3, dt3, cbands3, rand(length(cbands3)))
pbs3 = ProportionalBandSpectrumWithTime(rand(length(cbands3)), cbands3, dt3, t3)
@test has_observer_time(pbs3) == true
@test observer_time(pbs3) t3
@test timestep(pbs3) dt3
Expand Down Expand Up @@ -3981,7 +3981,7 @@ end
ubands1 = upper_bands(cbands1)
t1 = 2.0
dt1 = 0.2
pbs1 = ProportionalBandSpectrumWithTime(t1, dt1, cbands1, rand(length(cbands1)))
pbs1 = ProportionalBandSpectrumWithTime(rand(length(cbands1)), cbands1, dt1, t1)
@test has_observer_time(pbs1) == true
@test observer_time(pbs1) t1

Expand All @@ -3991,7 +3991,7 @@ end
ubands2 = upper_bands(cbands2)
t2 = 2.1
dt2 = 0.3
pbs2 = ProportionalBandSpectrumWithTime(t2, dt2, cbands2, rand(length(cbands2)))
pbs2 = ProportionalBandSpectrumWithTime(rand(length(cbands2)), cbands2, dt2, t2)
@test has_observer_time(pbs2) == true
@test observer_time(pbs2) t2

Expand All @@ -4001,7 +4001,7 @@ end
ubands3 = upper_bands(cbands3)
t3 = 2.3
dt3 = 0.4
pbs3 = ProportionalBandSpectrumWithTime(t3, dt3, cbands3, rand(length(cbands3)))
pbs3 = ProportionalBandSpectrumWithTime(rand(length(cbands3)), cbands3, dt3, t3)
@test has_observer_time(pbs3) == true
@test observer_time(pbs3) t3

Expand Down Expand Up @@ -4118,7 +4118,7 @@ end
ubands1 = upper_bands(cbands1)
t1 = 2.0
dt1 = 0.2
pbs1 = ProportionalBandSpectrumWithTime(t1, dt1, cbands1, rand(length(cbands1)))
pbs1 = ProportionalBandSpectrumWithTime(rand(length(cbands1)), cbands1, dt1, t1)
@test has_observer_time(pbs1) == true
@test observer_time(pbs1) t1

Expand All @@ -4138,7 +4138,7 @@ end
ubands3 = upper_bands(cbands3)
t3 = 2.3
dt3 = 0.4
pbs3 = ProportionalBandSpectrumWithTime(t3, dt3, cbands3, rand(length(cbands3)))
pbs3 = ProportionalBandSpectrumWithTime(rand(length(cbands3)), cbands3, dt3, t3)
@test has_observer_time(pbs3) == true
@test observer_time(pbs3) t3

Expand Down

0 comments on commit 5e825c0

Please sign in to comment.