-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7e7630
commit 0978cb4
Showing
19 changed files
with
562 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
name: CI | ||
on: | ||
- push | ||
|
||
jobs: | ||
test: | ||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: | ||
- '1.6' | ||
- 'nightly' | ||
os: | ||
- ubuntu-latest | ||
arch: | ||
- x64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: ${{ matrix.version }} | ||
arch: ${{ matrix.arch }} | ||
- uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-artifacts | ||
with: | ||
path: ~/.julia/artifacts | ||
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-test-${{ env.cache-name }}- | ||
${{ runner.os }}-test- | ||
${{ runner.os }}- | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-runtest@v1 | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
- uses: codecov/codecov-action@v4.0.1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Functions common to all bases | ||
|
||
To seamlessly allow for switching between different bases, the bases are all organised around common functions. | ||
|
||
## Accessing potential functions | ||
```@docs | ||
AstroBasis.getUln | ||
``` | ||
|
||
```@docs | ||
AstroBasis.tabUl! | ||
``` | ||
|
||
## Accessing density functions | ||
|
||
```@docs | ||
AstroBasis.getDln | ||
``` | ||
|
||
```@docs | ||
AstroBasis.tabDl! | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Quickstart Example | ||
|
||
In this example code, we will make a figure of the radial basis elements from Clutton-Brock (1973). | ||
|
||
```julia | ||
import AstroBasis | ||
using Plots | ||
using LaTeXStrings | ||
``` | ||
|
||
Now create the basis: | ||
|
||
```julia | ||
println("Creating the basis ... ") | ||
G, rb = 1., 1. | ||
ltest, nradial = 2, 5 | ||
basis = AstroBasis.CB73Basis(lmax=ltest,nradial=nradial,G=G, rb=rb) | ||
``` | ||
|
||
Define where to make the basis points: | ||
|
||
```julia | ||
# Points (rescaled radius) | ||
println("Compute basis values ... ") | ||
nx = 200 | ||
rmin, rmax = 0., 3. | ||
tabx = collect(LinRange(rmin/basis.rb,rmax/basis.rb,nx)) | ||
``` | ||
|
||
Use the common function `tabUl!` to fill the table: | ||
|
||
```julia | ||
# Compute the values of the potential basis elements and store them | ||
tabU = zeros(nradial,nx) # Storage for the basis values | ||
for j = 1:nx | ||
# Compute all the basis elements values at a given location r (the result is stored in basis.tabUl) | ||
AstroBasis.tabUl!(basis,ltest,tabx[j]*basis.rb) | ||
# Store them in tabU | ||
for i = 1:nradial | ||
tabU[i,j] = basis.tabUl[i] | ||
end | ||
end | ||
``` | ||
|
||
And finally plot: | ||
|
||
```julia | ||
# Plot the curves | ||
println("Plotting ... ") | ||
labels = reshape(["n="*string(k) for k=1:nradial],(1,nradial)) #Need to be row | ||
plU=plot(tabx, transpose(tabU), title = "Potential basis elements: Clutton-Brock (1973)",label=labels) | ||
xlabel!(plU, L"$r / r_{\mathrm{b}}$") | ||
ylabel!(plU, L"$U^{\ell}_n (r)\quad \ell=$"*string(ltest)) | ||
savefig(plU,"CluttonBrock73.png") | ||
println("The plot has been saved in the same folder as this example script under the name 'CluttonBrock73.png'.") | ||
``` | ||
|
||
![`Clutton-Brock (1973)`](../../examples/CluttonBrock73_original.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.