-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplot.sh
187 lines (156 loc) · 4.86 KB
/
plot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/bin/bash -l
# Bash function that provides plotting and analysis ability for a specific run
# Parameters are as follows:
# 1. Run directory - location of the run. E.g. Run/Run1
# 2. Run name - symbolic name for this run. E.g. MyRun
# 3. Plot directory - where the plots should be stored. E.g. Plots
# 4. Snapshot name - name of the snapshot. E.g. eagle_0036.hdf5
# 5. Catalogue name - name of the halo properties. E.g. stf/stf.properties
#
# For the above, this will assume that:
# + There is a directory Run/Run1
# + The snapshot lives at Run/Run1/eagle_0036.hdf5
# + The halo catalogue lives at Run/Run1/stf/stf.properties
# + You want the plots to be saved in Plots/MyRun
# + You want the run to be called MyRun on the summary plot.
#
plot_run () {
run_directory=$1
run_name=$2
plot_directory=$3
snapshot_name=$4
catalogue_name=$5
catalogue_path=$run_directory/$catalogue_name
output_path=$plot_directory/$run_name
velociraptor-plot \
-c auto_plotter/*.yml \
-r registration.py \
-p $catalogue_path \
-o $output_path \
-f png \
-m $output_path/data.yml \
-s mnras.mplstyle > /dev/null
python3 plotting/star_formation_history.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path
python3 plotting/sn1a_rate.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path
python3 plotting/density_temperature.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path
python3 plotting/density_internal_energy.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path
python3 plotting/density_pressure.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path
python3 plotting/density_temperature_metals.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path
python3 plotting/birth_density_f_E.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path \
python3 plotting/birth_density_metallicity.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path \
python3 plotting/birth_density_distribution.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path
python3 plotting/metallicity_distribution.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path \
python3 performance/number_of_steps_simulation_time.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path
python3 performance/particle_updates_step_cost.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path
python3 performance/wallclock_number_of_steps.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path
python3 performance/wallclock_simulation_time.py \
$run_name \
$run_directory \
$snapshot_name \
$output_path
}
# Creates a summary plot based on the above created figures, and converts
# sub-grid parameters to a text file to be plotted.
# Also converts data to Ian Vernon's specific format. Assumes that this parameter
# file is called eagle_*.yml
create_summary_plot () {
run_directory=$1
run_name=$2
plot_directory=$3
snapshot_name=$4
catalogue_name=$5
output_path=$plot_directory/$run_name
old_directory=$(pwd)
cd $output_path
# Copy in the index.html file for summary web viewing
parameter_file_name=$(basename $(ls $run_directory/{colibre,eagle}_*.yml 2>/dev/null))
cp $run_directory/$parameter_file_name .
chmod a+r $parameter_file_name
cp $old_directory/data_conversion/index.html .
python3 $old_directory/data_conversion/parameters.py $parameter_file_name
python3 $old_directory/data_conversion/catalogue.py
python3 $old_directory/data_conversion/description.py $run_directory/$snapshot_name $parameter_file_name
sed -i -e "/RUN_DESCRIPTION/r description.html" -e "/RUN_DESCRIPTION/d" index.html
boxsize=$(cat boxsize_integer.txt)
sed -i "s/BOX_SIZE/${boxsize}/g" index.html
magick montage -geometry +4+4 \
stellar_mass_function_100.png \
stellar_mass_halo_mass_centrals_100.png \
stellar_mass_galaxy_size_100.png \
stellar_mass_projected_galaxy_size_100.png \
stellar_mass_black_hole_mass_100.png \
stellar_mass_specific_sfr_100.png \
stellar_mass_passive_fraction_100.png \
stellar_mass_gas_sf_metallicity_100.png \
stellar_mass_star_metallicity_100.png \
stellar_veldisp_black_hole_mass_10.png \
density_temperature_metals.png \
star_formation_history.png \
montage.png
convert montage.png \
-pointsize 32 -background White label:"$(cat parameters.txt)" +swap \
-gravity Center \
-append temp.png
convert temp.png \
-pointsize 64 -background White label:"${run_name}" +swap \
-gravity Center \
-bordercolor White \
-border 0x25 \
-append "SummaryPlot.png"
rm temp*.png
rm montage*.png
cd $old_directory
}
export -f plot_run create_summary_plot