IAP GITLAB

Skip to content
Snippets Groups Projects
Commit eac7f6c0 authored by ralfulrich's avatar ralfulrich
Browse files

fix this with version from master branch

parent 1ed81430
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
import os
import sys, getopt
import re
# (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
#
# This software is distributed under the terms of the GNU General Public
# Licence version 3 (GPL Version 3). See file LICENSE for a full version of
# the license.
# with this script you can plot an animation of output of TrackWriter
tracks_dat="$1"
if [ -z "$tracks_dat" ]; then
echo "usage: $0 <tracks.dat> [output.gif]" >&2
exit 1
fi
directory=$(dirname "$tracks_dat")
hadrons_dat="$directory/hadrons.dat"
muons_dat="$directory/muons.dat"
electrons_dat="$directory/electrons.dat"
gammas_dat="$directory/gammas.dat"
#if [ "$muons_dat" -ot "$tracks_dat" -o "$hadrons_dat" -ot "$muons_dat" ]; then
echo "splitting $tracks_dat into $muons_dat and $hadrons_dat."
cat "$tracks_dat" | egrep '^\s+-*13\s' > "$muons_dat"
cat "$tracks_dat" | egrep '^\s+-*11\s' > "$electrons_dat"
cat "$tracks_dat" | egrep '^\s+-*22\s' > "$gammas_dat"
cat "$tracks_dat" | egrep -v '^\s+-*13\s' | egrep -v '^\s+-*11\s' | egrep -v '^\s+-*22\s' > "$hadrons_dat"
#fi
output="$2"
if [ -z "$output" ]; then
output="$tracks_dat.gif"
fi
echo "creating $output..."
cat <<EOF | gnuplot
set term gif animate size 900,900
set output "$output"
#set zrange [0:40e3]
#set xrange [-10:10]
#set yrange [-10:10]
set xlabel "x / m"
set ylabel "y / m"
set zlabel "z / m"
set title "CORSIKA 8 preliminary"
do for [t=0:359:1] {
# for separate file per angle:
# set output sprintf("%03d_$output", t)
set view 80, t
splot "$gammas_dat" u 3:4:5:6:7:8 w vectors nohead lt rgb "orange" t "", "$electrons_dat" u 3:4:5:6:7:8 w vectors nohead lt rgb "blue" t "", "$muons_dat" u 3:4:5:6:7:8 w vectors nohead lt rgb "red" t "", "$hadrons_dat" u 3:4:5:6:7:8 w vectors nohead lc rgb "black" t ""
}
EOF
exit $?
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu # (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
# #
# See file AUTHORS for a list of contributors.
#
# This software is distributed under the terms of the GNU General Public # This software is distributed under the terms of the GNU General Public
# Licence version 3 (GPL Version 3). See file LICENSE for a full version of # Licence version 3 (GPL Version 3). See file LICENSE for a full version of
# the license. # the license.
...@@ -17,8 +19,6 @@ fi ...@@ -17,8 +19,6 @@ fi
directory=$(dirname "$tracks_dat") directory=$(dirname "$tracks_dat")
hadrons_dat="$directory/hadrons.dat" hadrons_dat="$directory/hadrons.dat"
muons_dat="$directory/muons.dat" muons_dat="$directory/muons.dat"
electrons_dat="$directory/electrons.dat"
gammas_dat="$directory/gammas.dat"
if [ ! -e "$tracks_dat" ]; then if [ ! -e "$tracks_dat" ]; then
echo "$tracks_dat does not exist" >&2 echo "$tracks_dat does not exist" >&2
...@@ -28,10 +28,8 @@ fi ...@@ -28,10 +28,8 @@ fi
if [ "$muons_dat" -ot "$tracks_dat" ] || [ "$hadrons_dat" -ot "$tracks_dat" ]; then if [ "$muons_dat" -ot "$tracks_dat" ] || [ "$hadrons_dat" -ot "$tracks_dat" ]; then
echo "splitting $tracks_dat into $muons_dat and $hadrons_dat." echo "splitting $tracks_dat into $muons_dat and $hadrons_dat."
cat "$tracks_dat" | egrep '^\s+-*13\s' > "$muons_dat" cat "$tracks_dat" | egrep '^\s+-*13\s' > "$muons_dat"
cat "$tracks_dat" | egrep '^\s+-*11\s' > "$electrons_dat" cat "$tracks_dat" | egrep -v '^\s+-*13\s' > "$hadrons_dat"
cat "$tracks_dat" | egrep '^\s+-*22\s' > "$gammas_dat" fi
cat "$tracks_dat" | egrep -v '^\s+-*13\s' | egrep -v '^\s+-*11\s' | egrep -v '^\s+-*22\s' > "$hadrons_dat"
#fi
output="$2" output="$2"
if [ -z "$output" ]; then if [ -z "$output" ]; then
...@@ -57,7 +55,7 @@ do for [t=0:359:1] { ...@@ -57,7 +55,7 @@ do for [t=0:359:1] {
# set output sprintf("%03d_$output", t) # set output sprintf("%03d_$output", t)
set view 80, t set view 80, t
splot "$gammas_dat" u 3:4:5:6:7:8 w vectors nohead lt rgb "orange" t "", "$electrons_dat" u 3:4:5:6:7:8 w vectors nohead lt rgb "blue" t "", "$muons_dat" u 3:4:5:6:7:8 w vectors nohead lt rgb "red" t "", "$hadrons_dat" u 3:4:5:6:7:8 w vectors nohead lc rgb "black" t "" splot "$muons_dat" u 3:4:5:6:7:8 w vectors nohead lt rgb "red" t "", "$hadrons_dat" u 3:4:5:6:7:8 w vectors nohead lc rgb "black" t ""
} }
EOF EOF
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment