Skip to content

Commit

Permalink
Turn-off of truncated Gaussian via standard deviations (closes #11) (#12
Browse files Browse the repository at this point in the history
)

* Turn-off of truncated Gaussian via standard deviations (closes #11)

* Version 0.1.1

Co-authored-by: Stefanos Carlström <[email protected]>
  • Loading branch information
jagot and Stefanos Carlström authored May 21, 2021
1 parent a2dc074 commit 501f969
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ElectricFields"
uuid = "2f84ce32-9bb1-11e8-0d9f-3dce90a4beca"
authors = ["Stefanos Carlström <[email protected]>"]
version = "0.1.0"
version = "0.1.1"

[deps]
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
Expand Down
7 changes: 6 additions & 1 deletion src/envelopes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,15 @@ show(io::IO, env::TruncatedGaussianEnvelope) =
function TruncatedGaussianEnvelope(field_params::Dict{Symbol,Any}, carrier)
test_field_parameters(field_params, [:T]) # Period time required to round time window up
test_field_parameters(field_params, [, ])
test_field_parameters(field_params, [:toff])
test_field_parameters(field_params, [:toff, :σoff])
test_field_parameters(field_params, [:σmax, :tmax, :Tmax])

gaussian_common!(field_params, carrier, Tmax_rounder=NoUnits)
@namespace!(field_params) do
if σoff
toff = σ*σoff
end
end

@unpack τ, σ, α, toff, tmax, Tmax = field_params
toff < tmax || throw(ArgumentError("Hard turn-off must occur before end of pulse"))
Expand Down
15 changes: 15 additions & 0 deletions test/gaussian_pulses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,19 @@ import ElectricFields: time_integral

@test time_integral(F) σ*√(2π)
end

@testset "Truncated Gaussian turn-off via standard deviations" begin
@field(F) do
I₀ = 1.0
T = 2.0
τ = 3.0
σoff = 4.0
σmax = 5.0
env = :trunc_gauss
end

σ = params(F)[]
@test params(F)[:toff] 4σ
@test params(F)[:tmax] 5σ
end
end

2 comments on commit 501f969

@jagot
Copy link
Owner Author

@jagot jagot commented on 501f969 May 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/37192

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.1 -m "<description of version>" 501f969f3bd60c1bad99ff4740d80acc06b3231c
git push origin v0.1.1

Please sign in to comment.