https://github.com/jw3126/phasespaceio.jl
Read and write IAEA phase space files
https://github.com/jw3126/phasespaceio.jl
io julia monte-carlo
Last synced: 10 months ago
JSON representation
Read and write IAEA phase space files
- Host: GitHub
- URL: https://github.com/jw3126/phasespaceio.jl
- Owner: jw3126
- License: other
- Created: 2018-01-01T15:13:03.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-07-26T21:11:15.000Z (over 4 years ago)
- Last Synced: 2025-03-24T06:11:47.446Z (10 months ago)
- Topics: io, julia, monte-carlo
- Language: Julia
- Homepage:
- Size: 142 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# PhaseSpaceIO

[](http://codecov.io/github/jw3126/PhaseSpaceIO.jl?branch=master)
## Usage
```julia
julia> using PhaseSpaceIO
julia> path = joinpath(dirname(pathof(PhaseSpaceIO)), "..", "test", "assets","some_file.IAEAphsp");
julia> ps = iaea_iterator(collect,path)
1-element Array{Particle{0,1},1}:
Particle(typ=photon, E=1.0, weight=2.0, x=3.0, y=4.0, z=5.0, u=0.53259337, v=0.3302265, w=-0.7792912, new_history=true, extra_floats=(), extra_ints=(13,))
julia> dir = mkpath(tempname())
"/tmp/julia7uigbI"
julia> readdir(dir)
0-element Array{String,1}
julia> path = joinpath(dir, "hello")
"/tmp/julia7uigbI/hello"
julia> iaea_writer(path, RecordContents{0,1}()) do w
for p in ps
write(w,p)
end
end
julia> readdir(dir)
2-element Array{String,1}:
"hello.IAEAheader"
"hello.IAEAphsp"
```