Skip to content

Commit

Permalink
Merge branch 'main' of github.com:michael-petersen/PerturbPlasma
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-petersen committed Feb 28, 2024
2 parents fedb525 + 4490e12 commit 2fa9384
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 136 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

name: CI
on:
- push

jobs:
Benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: 1.6.7
arch: x64
- name: instantiate environment
run: |
julia --project=fht -e '
using Pkg
Pkg.add("BenchmarkTools")
Pkg.add("ArgParse")
Pkg.add(url="https://github.com/michael-petersen/FiniteHilbertTransform.jl.git")'
- uses: julia-actions/julia-runtest@v1
with:
project: fht
- uses: julia-actions/julia-processcoverage@v1
with:
project: fht
- uses: codecov/codecov-action@v1
with:
file: lcov.info
31 changes: 0 additions & 31 deletions .github/workflows/benchmark.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/docpreviewcleanup.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/documentation.yml

This file was deleted.

8 changes: 7 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FiniteHilbertTransform"
uuid = "68cdf181-988b-4042-8999-0b9541c1c3c2"
authors = ["Mike Petersen <petersen@iap.fr>", "Mathieu Roule <roule@iap.fr>"]
version = "0.9.0"
version = "0.10.0"

[deps]
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
Expand All @@ -14,3 +14,9 @@ Quadmath = "be4d8f0f-7fa4-5f49-b795-2f01399ab2dd"

[compat]
julia = "1.6.7"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ An introductory example is given in `examples/run_plasma.jl`. This script will r

Download the file by running:
```
wget ttps://github.com/JuliaStellarDynamics/FiniteHilbertTransform.jl/blob/main/examples/run_plasma.jl
wget https://github.com/JuliaStellarDynamics/FiniteHilbertTransform.jl/blob/main/examples/run_plasma.jl
```
Run the code with the following command:
```
Expand Down Expand Up @@ -76,4 +76,4 @@ julia -e 'using Pkg; Pkg.rm("FiniteHilbertTransform");'

[^2]: By default, packages are added to the default environment at ~/.julia/environments/v1.#. It is however easy to create other, independent, projects. If you want to install the `FiniteHilbertTransform` package in a different/test environment, first create a folder to host the environment files (Project.toml and Manifest.toml which will be created later on). Then, for every command line invoking Julia, use `julia --project=/path/to/my_env` instead of `julia` alone.

[^3]: This notebook is not maintained as a priority. We would recommand you install Julia on your machine to test the library locally.
[^3]: This notebook is not maintained as a priority. We would recommand you install Julia on your machine to test the library locally.
10 changes: 7 additions & 3 deletions docs/src/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ To invoke Julia in the Terminal, you need to make sure that the `julia` command-
See [here](https://julialang.org/downloads/platform/#optional_add_julia_to_path) for detailed instructions.

Once Julia installed, obtain the `FiniteHilbertTransform.jl` library and compile it by running:
```
julia -e 'using Pkg; Pkg.add(url="https://github.com/JuliaStellarDynamics/FiniteHilbertTransform.jl.git")'
```

```
julia -e 'using Pkg; Pkg.add(url="https://github.com/JuliaStellarDynamics/FiniteHilbertTransform.jl.git")'
```

The library is also easy to uninstall: remove the package from the environment by running

```
julia -e 'using Pkg; Pkg.rm("FiniteHilbertTransform");'
```
Expand All @@ -22,13 +24,15 @@ By default, packages are added to the default environment at ~/.julia/environmen
## From source

Alternately, you may clone the repository wherever you want and create a local environment (or project) by running:

```
$ git clone https://github.com/JuliaStellarDynamics/FiniteHilbertTransform.jl.git
$ cd FiniteHilbertTransform.jl
$ julia --project=. -e 'using Pkg; Pkg.precompile()'
```

Note: If you are using a new Julia interpreter, you might need to download additional packages. Use the following command:

```julia
using(Pkg)
Pkg.instantiate()
Expand Down
40 changes: 0 additions & 40 deletions examples/run_basetests.jl

This file was deleted.

66 changes: 66 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@




using FiniteHilbertTransform
using Test

Ku = 10
tabu,tabw,tabc,tabP = FiniteHilbertTransform.tabGLquad(Ku)
FHT = FiniteHilbertTransform.LegendreFHT(Ku)

tol = 1e-10

@testset "Legendre Initialisation" begin
@test (@allocated tabu,tabw,tabc,tabP = FiniteHilbertTransform.tabGLquad(Ku)) < 5000
@test (@allocated FHT = FiniteHilbertTransform.LegendreFHT(Ku)) < 5000
@test FHT.Ku == 10
@test FHT.tabu[1] -0.9739065285171717 atol=tol
@test FHT.tabw[1] 0.06667134430868821 atol=tol
end

# select an unstable frequency
ϖ = 0.02 + 0.02im
FiniteHilbertTransform.GettabD!(ϖ,FHT)

@testset "Unstable Frequency" begin
@test (@elapsed FiniteHilbertTransform.GettabD!(ϖ,FHT)) < 1.e-4
@test (@allocated FiniteHilbertTransform.GettabD!(ϖ,FHT)) == 0
@test real(FHT.tabDLeg[1]) -0.0399893282162609 atol=tol
@test imag(FHT.tabDLeg[1]) 3.1015819920460506 atol=tol
@test real(FHT.tabDLeg[1]) == real(FHT.tabQLeg[1])
@test imag(FHT.tabDLeg[1]) == imag(FHT.tabQLeg[1])
@test real(FHT.tabPLeg[1]) == 0.0
@test imag(FHT.tabPLeg[1]) == 0.0
end

# select an unstable frequency
ϖ = 0.00 + 0.00im
FiniteHilbertTransform.GettabD!(ϖ,FHT)

@testset "Neutral Frequency" begin
@test (@elapsed FiniteHilbertTransform.GettabD!(ϖ,FHT)) < 1.e-4
@test (@allocated FiniteHilbertTransform.GettabD!(ϖ,FHT)) == 0
@test real(FHT.tabDLeg[1]) == 0.0
@test imag(FHT.tabDLeg[1]) 3.141592653589793 atol=tol
@test real(FHT.tabQLeg[1]) == 0.0
@test imag(FHT.tabQLeg[1]) == 0.0
@test real(FHT.tabPLeg[1]) == 1.0
@test imag(FHT.tabPLeg[1]) == 0.0
end

# select a damped frequency
ϖ = 0.02 - 0.02im
FiniteHilbertTransform.GettabD!(ϖ,FHT)

@testset "Damped Frequency" begin
@test (@elapsed FiniteHilbertTransform.GettabD!(ϖ,FHT)) < 1.e-4
@test (@allocated FiniteHilbertTransform.GettabD!(ϖ,FHT)) == 0
@test real(FHT.tabDLeg[1]) -0.0399893282162609 atol=tol
@test imag(FHT.tabDLeg[1]) 3.1816033151335357 atol=tol
@test real(FHT.tabQLeg[1]) == real(FHT.tabDLeg[1])
@test imag(FHT.tabQLeg[1]) -3.1015819920460506 atol=tol
@test real(FHT.tabPLeg[1]) == 1.0
@test imag(FHT.tabPLeg[1]) == 0.0
end

0 comments on commit 2fa9384

Please sign in to comment.