Skip to content

Commit

Permalink
Merge pull request #37 from bmad-sim/dcs16/01
Browse files Browse the repository at this point in the history
Changed project name SimUtils -> AcceleratorSimUtils.
  • Loading branch information
DavidSagan authored Jan 10, 2025
2 parents ef1fbb4 + 24bca54 commit d509a87
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 41 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ jobs:
shell: julia --project=docs --color=yes {0}
run: |
using Documenter: DocMeta, doctest
using SimUtils
DocMeta.setdocmeta!(SimUtils, :DocTestSetup, :(using SimUtils); recursive=true)
doctest(SimUtils)
using AcceleratorSimUtils
DocMeta.setdocmeta!(AcceleratorSimUtils, :DocTestSetup, :(using AcceleratorSimUtils); recursive=true)
doctest(AcceleratorSimUtils)
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "SimUtils"
uuid = "042f21a8-4046-4c2b-b9ed-b6e14110b343"
name = "AcceleratorSimUtils"
uuid = "8b14b3b2-39c5-4be4-bdc0-0b322e577224"
authors = ["mattsignorelli <[email protected]> and contributors"]
version = "0.4.0"

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SimUtils
# AcceleratorSimUtils

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://bmad-sim.github.io/SimUtils.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://bmad-sim.github.io/SimUtils.jl/dev/)
[![Build Status](https://github.com/bmad-sim/SimUtils.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/bmad-sim/SimUtils.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://bmad-sim.github.io/AcceleratorSimUtils.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://bmad-sim.github.io/AcceleratorSimUtils.jl/dev/)
[![Build Status](https://github.com/bmad-sim/AcceleratorSimUtils.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/bmad-sim/AcceleratorSimUtils.jl/actions/workflows/CI.yml?query=branch%3Amain)

A package of utility routines used by the SciBmad project for the simulation of high energy accelerators and storage rings.

Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[deps]
AtomicAndPhysicalConstants = "5c0d271c-5419-4163-b387-496237733d8b"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
SimUtils = "042f21a8-4046-4c2b-b9ed-b6e14110b343"
AcceleratorSimUtils = "8b14b3b2-39c5-4be4-bdc0-0b322e577224"
12 changes: 6 additions & 6 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using SimUtils
using AcceleratorSimUtils
using Documenter

DocMeta.setdocmeta!(SimUtils, :DocTestSetup, :(using SimUtils); recursive=true)
DocMeta.setdocmeta!(AcceleratorSimUtils, :DocTestSetup, :(using AcceleratorSimUtils); recursive=true)

makedocs(;
modules=[SimUtils],
modules=[AcceleratorSimUtils],
authors="DavidSagan <[email protected]> and contributors",
sitename="SimUtils.jl",
sitename="AcceleratorSimUtils.jl",
format=Documenter.HTML(;
canonical="https://bmad-sim.github.io/SimUtils.jl",
canonical="https://bmad-sim.github.io/AcceleratorSimUtils.jl",
edit_link="main",
assets=String[],
),
Expand All @@ -18,6 +18,6 @@ makedocs(;
)

deploydocs(;
repo="github.com/bmad-sim/SimUtils.jl",
repo="github.com/bmad-sim/AcceleratorSimUtils.jl",
devbranch="main",
)
8 changes: 4 additions & 4 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
```@meta
CurrentModule = SimUtils
CurrentModule = AcceleratorSimUtils
```

# SimUtils
# AcceleratorSimUtils

Documentation for [SimUtils](https://github.com/bmad-sim/SimUtils.jl).
Documentation for [AcceleratorSimUtils](https://github.com/bmad-sim/AcceleratorSimUtils.jl).

```@index
```

```@autodocs
Modules = [SimUtils]
Modules = [AcceleratorSimUtils]
```
4 changes: 2 additions & 2 deletions src/SimUtils.jl → src/AcceleratorSimUtils.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module SimUtils
module AcceleratorSimUtils

using FFTW, Random
using AtomicAndPhysicalConstants

@APCdef

export gen_pinknoise
export one_cos, modulo2, un_sinc, un_cosc
export one_cos, modulo2, sincu, coscu
export calc_E_tot, calc_E_kinetic, calc_pc, calc_β, calc_1β, calc_γ, calc_changed_energy

include("math.jl")
Expand Down
20 changes: 10 additions & 10 deletions src/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ function modulo2(x, amp)
end

#---------------------------------------------------------------------------------------------------
# un_sinc
# sincu

"""
un_sinc(x, nd::Int = 0)
sincu(x, nd::Int = 0)
Returns the unnormalized `sinc(x)` (equal to `sin(x)/x`, no factors of pi here) for `nd = 0`
or the `nd`th derivative for `nd > 0`.
Note: Currently, only `nd = 0` or `1` are implemented
""" un_sinc(x)
""" sincu(x)

function un_sinc(x, nd::Int = 0)
function sincu(x, nd::Int = 0)
if nd == 0
return sinc(x/pi)
elseif nd == 1
Expand All @@ -62,22 +62,22 @@ function un_sinc(x, nd::Int = 0)
end

#---------------------------------------------------------------------------------------------------
# un_cosc
# coscu

"""
un_cosc(x, nd::Int = 0)
coscu(x, nd::Int = 0)
Returns, to machine precision, the `nd`th derivative of `(1 - cos(x)) / x^2`.
If `nd = 0`, returns the function itself.
Note: Currently, only `nd = 0` or `1` are implemented
""" un_cosc
""" coscu

function un_cosc(x, nd::Int = 0)
function coscu(x, nd::Int = 0)
if nd == 0
return 0.5 * un_sinc(x/2)^2
return 0.5 * sincu(x/2)^2
elseif nd == 1
return 0.5 * un_sinc(x/2) * un_sinc(x/2, 1)
return 0.5 * sincu(x/2) * sincu(x/2, 1)
else
error("nd = $nd not yet implemented.")
end
Expand Down
10 changes: 5 additions & 5 deletions test/math_test.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using SimUtils, Test
using AcceleratorSimUtils, Test

@testset "math_test" begin
@test one_cos(1e-4) 4.999999995833334e-9 rtol = 1e-15
@test one_cos(1) 0.4596976941318603 rtol = 1e-15
@test un_sinc(1.0) 0.8414709848078965 rtol = 1e-15
@test abs(0.5e6 * (un_sinc(1.0+1e-6) - un_sinc(1.0-1e-6)) - un_sinc(1.0, 1)) < 1.0e-12
@test un_cosc(1.0) 0.4596976941318603 rtol = 1e-15
@test abs(0.5e6 * (un_cosc(1.0+1e-6) - un_cosc(1.0-1e-6)) - un_cosc(1.0, 1)) < 1.0e-10
@test sincu(1.0) 0.8414709848078965 rtol = 1e-15
@test abs(0.5e6 * (sincu(1.0+1e-6) - sincu(1.0-1e-6)) - sincu(1.0, 1)) < 1.0e-12
@test coscu(1.0) 0.4596976941318603 rtol = 1e-15
@test abs(0.5e6 * (coscu(1.0+1e-6) - coscu(1.0-1e-6)) - coscu(1.0, 1)) < 1.0e-10
@test modulo2(2, 2) == -2
@test modulo2(8, 3) == 2
@test modulo2(9.0, 3.0) -3.0 rtol = 1e-15
Expand Down
2 changes: 1 addition & 1 deletion test/particle_test.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using SimUtils, AtomicAndPhysicalConstants
using AcceleratorSimUtils, AtomicAndPhysicalConstants
using Test

s = Species("electron")
Expand Down
2 changes: 1 addition & 1 deletion test/pink_test.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using SimUtils
using AcceleratorSimUtils
using Test

# Pink noise test here
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using SimUtils
using AcceleratorSimUtils
using Test

@testset verbose = true "SimUtils.jl" begin
@testset verbose = true "AcceleratorSimUtils.jl" begin

@testset "math_test" begin
include("math_test.jl")
Expand Down

0 comments on commit d509a87

Please sign in to comment.