-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
19 changed files
with
360 additions
and
32 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
on: [push, pull_request, workflow_dispatch] | ||
|
||
# 64-bit Julia only | ||
jobs: | ||
|
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,25 @@ | ||
name: ManuallyBuildDoc | ||
|
||
on: | ||
[push, pull_request, workflow_dispatch] | ||
|
||
# 64-bit Julia only | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: "contains(github.event.head_commit.message, '[doc]')" | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: julia-actions/setup-julia@latest | ||
with: | ||
version: '1.6.0' | ||
- run: julia --project=docs -e ' | ||
using Pkg; | ||
Pkg.add("Documenter"); | ||
Pkg.develop(PackageSpec(; path=pwd())); | ||
Pkg.instantiate();' | ||
- name: Build and deploy doc | ||
env: | ||
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Deploying to else where, so use SSH instead | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} | ||
run: julia --project=docs --color=yes docs/make.jl |
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,15 @@ | ||
name: TagBot | ||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
workflow_dispatch: | ||
jobs: | ||
TagBot: | ||
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: JuliaRegistries/TagBot@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ssh: ${{ secrets.DOCUMENTER_KEY }} |
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,7 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
PhysicalParticles = "78724250-4eb2-11e9-0f34-13a7aab864c5" | ||
|
||
[compat] | ||
Documenter = "0.27" | ||
PhysicalParticles = "1" |
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,55 @@ | ||
""" | ||
Compile with: | ||
julia --project=docs/ --color=yes docs/make.jl | ||
Generate key: | ||
DocumenterTools.genkeys(user="JuliaAstroSim", repo="[email protected]:JuliaAstroSim/AstroIO.jl.git") | ||
""" | ||
|
||
using Documenter | ||
|
||
using AstroIO | ||
|
||
# The DOCSARGS environment variable can be used to pass additional arguments to make.jl. | ||
# This is useful on CI, if you need to change the behavior of the build slightly but you | ||
# can not change the .travis.yml or make.jl scripts any more (e.g. for a tag build). | ||
if haskey(ENV, "DOCSARGS") | ||
for arg in split(ENV["DOCSARGS"]) | ||
(arg in ARGS) || push!(ARGS, arg) | ||
end | ||
end | ||
|
||
makedocs( | ||
modules = [AstroIO], | ||
format = Documenter.HTML( | ||
# Use clean URLs, unless built as a "local" build | ||
prettyurls = !("local" in ARGS), | ||
canonical = "https://juliaastrosims.github.io/AstroIO.jl/dev/", | ||
assets = ["assets/alpha_small.ico"], | ||
analytics = "UA-153693590-1", | ||
highlights = ["llvm", "yaml"], | ||
), | ||
clean = false, | ||
sitename = "AstroIO.jl", | ||
authors = "islent", | ||
linkcheck = !("skiplinks" in ARGS), | ||
pages = [ | ||
"Home" => "index.md", | ||
"Manual" => Any[ | ||
"manual/guide.md", | ||
"manual/gadget2.md", | ||
"manual/tools.md", | ||
], | ||
"Library" => Any[ | ||
"lib/Methods.md", | ||
], | ||
#"contributing.md", | ||
], | ||
#strict = !("strict=false" in ARGS), | ||
#doctest = ("doctest=only" in ARGS) ? :only : true, | ||
) | ||
|
||
deploydocs( | ||
repo = "github.com/JuliaAstroSim/AstroIO.jl.git", | ||
target = "build", | ||
) |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,17 @@ | ||
# AstroIO.jl | ||
|
||
*File I/O interfaces for astrophysical simulations* | ||
|
||
## Package Feature | ||
|
||
- FileIO.jl interfaces | ||
- Supported formats: | ||
- Gadget-2 | ||
- JLD2 | ||
- CSV | ||
- HDF5 (work in progress) | ||
|
||
## Manual Outline | ||
|
||
```@contents | ||
``` |
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,34 @@ | ||
# Methods | ||
|
||
## Index | ||
|
||
```@index | ||
Pages = ["Methods.md"] | ||
``` | ||
|
||
## Gadget2 | ||
|
||
```@docs | ||
read_gadget2 | ||
read_gadget2_pos | ||
write_gadget2 | ||
write_gadget2_format2 | ||
load(::Stream{format"Gadget2"}) | ||
save(::Stream{format"Gadget2"}) | ||
``` | ||
|
||
## JLD2 | ||
|
||
```@docs | ||
read_jld | ||
read_gadget2_jld | ||
write_jld | ||
write_gadget2_jld | ||
``` | ||
|
||
## Tools | ||
|
||
```@docs | ||
renamesuffixs | ||
renamereplace | ||
``` |
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,49 @@ | ||
# Gadget2 I/O | ||
|
||
The default units in Gadget-2 snapshots are collected as `uGadget2`. | ||
However, it is much more convenient to use `uAstro` in simulations: | ||
```@repl gadget2 | ||
using PhysicalParticles, AstroIO | ||
uGadget2 | ||
uAstro | ||
``` | ||
|
||
### Basic usage | ||
|
||
Units are automatedly converted during I/O: | ||
```julia | ||
# read default uGadget2 units from file and convert to uAstro | ||
header, data = read_gadget2("snapshot.gadget2", uAstro); | ||
|
||
# manually set the units in snapshot file | ||
header, data = read_gadget2("snapshot.gadget2", uAstro, uGadget2); | ||
|
||
# read default uGadget2 units from file and convert to unitless | ||
header, data = read_gadget2("snapshot.gadget2", nothing, uGadget2); | ||
|
||
# write in default uGadget2 units | ||
write_gadget2("output.Gadget2", header, data) | ||
|
||
# write in uAstro units | ||
write_gadget2("output.Gadget2", header, data, uAstro) | ||
# and read in uAstro units | ||
header, data = read_gadget2("snapshot.gadget2", uAstro, uAstro); | ||
``` | ||
Be careful with these unit conversions! | ||
|
||
In some cases (for example, visualization), it is more efficient to only read position data from file: | ||
```julia | ||
read_gadget2_pos("snapshot.gadget2", uAstro) | ||
read_gadget2_pos("snapshot.gadget2", uAstro, uGadget2) | ||
``` | ||
|
||
### FileIO interfaces | ||
|
||
FileIO provides `load` and `save` interfaces to I/O snapshots: | ||
```julia | ||
header, data = load("snapshot.gadget2") | ||
save("FileIO.gadget2", header, data) | ||
|
||
header, data = load("snapshot.gadget2", uAstro, uGadget2) | ||
save("FileIO.gadget2", header, data, uGadget2) | ||
``` |
Oops, something went wrong.