Crates.io | beamdpr |
lib.rs | beamdpr |
version | 1.0.7 |
source | src |
created_at | 2016-10-23 03:26:42.85463 |
updated_at | 2024-07-16 19:20:39.517073 |
description | Combine and transform egsphsp (EGS phase space) files for use with BEAMnrc |
homepage | https://github.com/henrybaxter/beamdpr |
repository | https://github.com/henrybaxter/beamdpr |
max_upload_size | |
id | 6947 |
size | 1,756,292 |
Combine and transform egsphsp (EGS phase space) files.
$ beamdpr translate -i first.egsphsp1 -x 2.3
Now first.egsphsp1
has been translated 2.3 cm in the positive x direction.
Homebrew:
brew tap henrybaxter/tap
brew install beamdpr
Anything else:
Install rust for your system
Install beamdpr
using cargo
cargo install beamdpr
All done. beamdpr
should work. If not, please file an issue!
Start by typing beamdpr
at the terminal/command line. If that does not work, go back to the installation step. Still no dice? Please file an issue!
Assume these are your files:
$ ls
first.egsphsp1 second.egsphsp1
Make a combined version:
$ beamdpr combine *.egsphsp1 -o combined.egsphsp1
And there it is:
$ ls
combined.egsphsp1 first.egsphsp1 second.egsphsp1
NOTE: This will work with any number of files, as long as their mode matches. That means either they all have ZLAST or none of them do.
$ ls
first.egsphsp1 second.egsphsp1
Take a sampling of 1 in 10 particles from each file
$ beamdpr sample-combine *.egsphsp1 -o combined.egsphsp1 --rate 10
$ du -sh *
256K first.egsphsp1
256K second.egsphsp1
52K combined.egsphsp1
Notice that we have divided the total space by 10.
Let's assume this is your file:
$ ls
first.egsphsp1
Now translate it 23 in the x direction and -5.7 in the y:
$ beamdpr translate first.egsphsp1 translated.egsphsp1 -x 23 -y -5.7
And there you have it:
$ ls
first.egsphsp1 translated.egsphsp1
NOTE: You may omit an argument if you only want to translate in one direction.
Let's assume this is your file:
$ ls first.egsphsp1
first.egsphsp1
Now rotate .9 radians in the counter-clockwise direction:
$ beamdpr rotate first.egsphsp1 rotated.egsphsp1 --angle .9
It's all done!
$ ls
first.egsphsp1 rotated.egsphsp1
NOTE: If you rotate by 2π (6.28318530718) the file should be unchanged right? Not quite. Due to floating point vagaries there will be minor binary differences, but the value differences will be negligible.
Let's assume this is your file:
$ ls first.egsphsp1
first.egsphsp1
Now reflect around the vector (1, 0):
$ beamdpr rotate first.egsphsp1 reflected.egsphsp1 -x 1
$ ls
first.egsphsp1 reflected.egsphsp1
NOTE: This effectively changed the sign of all y values and y directions.
Any of these transform operations can be done in-place - that is, by modifying the input file, rather than creating a new one:
$ ls first.egsphsp1
first.egsphsp1
Reflect in the vector (-1, 0) in-place:
$ beamdpr rotate first.egsphsp1 -i -x -1
NOTE: The flag -i
is the same as --in-place
.
During a combine operation you may worry about disk space (10x10gb of phase space files could add another 100gb of combined phase space files). Let's delete as we go:
$ ls
first.egsphsp1 second.egsphsp1
So make a combined version:
$ beamdpr combine *.egsphsp1 -o combined.egsphsp1 -d
$ ls
combined.egsphsp1
Stuck? Please file an issue