Skip to content

Commit

Permalink
Change the python invocation command in all the run script to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthieuSchaller committed Apr 24, 2022
1 parent 02da2f2 commit cad866b
Show file tree
Hide file tree
Showing 86 changed files with 174 additions and 174 deletions.
2 changes: 1 addition & 1 deletion INSTALL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ before you can build it.
documentation.

- python:
Examples and solution script use python and rely on the numpy
Examples and solution script use python 3 and rely on the numpy
library version 1.8.2 or higher.


Expand Down
4 changes: 2 additions & 2 deletions examples/Cooling/CoolingBox/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
if [ ! -e coolingBox.hdf5 ]
then
echo "Generating initial conditions for the cooling box example..."
python makeIC.py
python3 makeIC.py
fi

# Get the Grackle cooling table
Expand All @@ -24,4 +24,4 @@ fi
../../swift --hydro --cooling --threads=4 -n 1000 coolingBox.yml

# Check energy conservation and cooling rate
python plotEnergy.py
python3 plotEnergy.py
2 changes: 1 addition & 1 deletion examples/Cooling/CoolingHalo/makeIC.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import random

# Generates N particles in a spherically symmetric distribution with density profile ~r^(-2)
# usage: python makeIC.py 1000: generate 1000 particles
# usage: python3 makeIC.py 1000: generate 1000 particles

# Some constants

Expand Down
2 changes: 1 addition & 1 deletion examples/Cooling/CoolingHalo/makeIC_random_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import random

# Generates N particles in a spherically symmetric distribution with density profile ~r^(-2)
# usage: python makeIC.py 1000: generate 1000 particles
# usage: python3 makeIC.py 1000: generate 1000 particles

# Some constants

Expand Down
8 changes: 4 additions & 4 deletions examples/Cooling/CoolingHalo/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

# Generate the initial conditions if they are not present.
echo "Generating initial conditions for the isothermal potential box example..."
python makeIC.py 10000
python3 makeIC.py 10000

../../swift --external-gravity --hydro --cooling --threads=16 cooling_halo.yml 2>&1 | tee output.log

python radial_profile.py 2. 200 100
python3 radial_profile.py 2. 200 100

python internal_energy_profile.py 2. 200 100
python3 internal_energy_profile.py 2. 200 100

python test_energy_conservation.py 2. 200 100
python3 test_energy_conservation.py 2. 200 100
2 changes: 1 addition & 1 deletion examples/Cooling/CoolingHaloWithSpin/makeIC.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import random

# Generates N particles in a spherically symmetric distribution with density profile ~r^(-2)
# usage: python makeIC.py 1000: generate 1000 particles
# usage: python3 makeIC.py 1000: generate 1000 particles

# Some constants

Expand Down
2 changes: 1 addition & 1 deletion examples/Cooling/CoolingHaloWithSpin/makeIC_random_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import random

# Generates N particles in a spherically symmetric distribution with density profile ~r^(-2)
# usage: python makeIC.py 1000: generate 1000 particles
# usage: python3 makeIC.py 1000: generate 1000 particles

# Some constants

Expand Down
8 changes: 4 additions & 4 deletions examples/Cooling/CoolingHaloWithSpin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

# Generate the initial conditions if they are not present.
echo "Generating initial conditions for the isothermal potential box example..."
python makeIC.py 10000
python3 makeIC.py 10000

# Run SWIFT with external potential, SPH and cooling
../../swift --external-gravity --hydro --cooling --threads=1 cooling_halo.yml 2>&1 | tee output.log

# python radial_profile.py 10
# python3 radial_profile.py 10

# python internal_energy_profile.py 10
# python3 internal_energy_profile.py 10

# python test_energy_conservation.py
# python3 test_energy_conservation.py
4 changes: 2 additions & 2 deletions examples/Cooling/CoolingRates/README
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ rate from each of the elements depending on internal energy, density
and redshift based on the EAGLE tables. To do so, the function in
src/cooling/EAGLE returning the cooling rate is run for multiple
values of the internal energy. The resulting cooling rates are written
to files and plotted with a python script (cooling_rates_plot.py).
to files and plotted with a python3 script (cooling_rates_plot.py).

The test may be run by:
./getCoolingTables.sh
./cooling_rates -z X -d Y
python plot_cooling_rates.py
python3 plot_cooling_rates.py

where X is the redshift at which the cooling rates are evaluated and Y
is the base 10 logarithm of the hydrogen number density expressed in
Expand Down
4 changes: 2 additions & 2 deletions examples/Cosmology/ComovingSodShock_1D/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
if [ ! -e sodShock.hdf5 ]
then
echo "Generating initial conditions for the 1D SodShock example..."
python makeIC.py
python3 makeIC.py
fi

# Run SWIFT
../../swift --cosmology --hydro --threads=1 sodShock.yml 2>&1 | tee output.log

# Plot the result
python plotSolution.py 1
python3 plotSolution.py 1
4 changes: 2 additions & 2 deletions examples/Cosmology/ComovingSodShock_2D/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ fi
if [ ! -e sodShock.hdf5 ]
then
echo "Generating initial conditions for the Sod shock example..."
python makeIC.py
python3 makeIC.py
fi

# Run SWIFT
../../swift --cosmology --hydro --threads=4 sodShock.yml 2>&1 | tee output.log

python plotSolution.py 1
python3 plotSolution.py 1
4 changes: 2 additions & 2 deletions examples/Cosmology/ComovingSodShock_3D/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ fi
if [ ! -e sodShock.hdf5 ]
then
echo "Generating initial conditions for the Sod shock example..."
python makeIC.py
python3 makeIC.py
fi

# Run SWIFT
../../swift --cosmology --hydro --threads=4 sodShock.yml 2>&1 | tee output.log

python plotSolution.py 1
python3 plotSolution.py 1
4 changes: 2 additions & 2 deletions examples/Cosmology/ZeldovichPancake_3D/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if [ ! -e zeldovichPancake.hdf5 ]
then
echo "Generating initial conditions for the 3D Zeldovich pancake example..."
python makeIC.py
python3 makeIC.py
fi

# Run SWIFT
Expand All @@ -13,5 +13,5 @@ fi
# Plot the result
for i in {0..119}
do
python plotSolution.py $i
python3 plotSolution.py $i
done
8 changes: 4 additions & 4 deletions examples/EAGLE_low_z/EAGLE_6/testVELOCIraptor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ if [ "$RUN_DM" = "1" ]; then
echo "Running: mpirun -np $NUM_MPI_PROC $VELOCIRAPTOR_PATH/bin/stf-gas -I 2 -i eagle_dmonly_0000 -C $VELOCIRAPTOR_PATH/stf_input_$TEST.cfg -o ./$VEL_OUTPUT/vel_$TEST"
mpirun -np $NUM_MPI_PROC $VELOCIRAPTOR_PATH/bin/stf-gas -I 2 -i eagle_dmonly_0000 -C ./stf_input_$TEST.cfg -o ./$VEL_OUTPUT/vel_$TEST

# Create info file for python comparison script
# Create info file for python3 comparison script
echo -e $INFO_FILE_TEXT > infoFile_$TEST.txt
echo "vel_$TEST $VEL_OUTPUT/vel_$TEST" >> infoFile_$TEST.txt
echo "stf_$TEST $OUTPUT/stf_0000.VELOCIraptor" >> infoFile_$TEST.txt

# Run comparison script on VELOCIraptor output
if python $SCRIPT_PATH/catalogcomparisontolerancecheck.py infoFile_$TEST.txt toIfile.txt
if python3 $SCRIPT_PATH/catalogcomparisontolerancecheck.py infoFile_$TEST.txt toIfile.txt
then
echo "Catalog comparison passed: "$TEST
else
Expand Down Expand Up @@ -87,13 +87,13 @@ if [ "$RUN_GAS" = "1" ]; then
echo "Running: mpirun -np $NUM_MPI_PROC $VELOCIRAPTOR_PATH/bin/stf-gas -I 2 -i eagle_gas_0000 -C ./stf_input_$TEST.cfg -o ./$VEL_OUTPUT/vel_$TEST"
mpirun -np $NUM_MPI_PROC $VELOCIRAPTOR_PATH/bin/stf-gas -I 2 -i eagle_gas_0000 -C ./stf_input_$TEST.cfg -o ./$VEL_OUTPUT/vel_$TEST

# Create info file for python comparison script
# Create info file for python3 comparison script
echo -e $INFO_FILE_TEXT > infoFile_$TEST.txt
echo "vel_$TEST $VEL_OUTPUT/vel_$TEST" >> infoFile_$TEST.txt
echo "stf_$TEST $OUTPUT/stf_0000.VELOCIraptor" >> infoFile_$TEST.txt

# Run comparison script on VELOCIraptor output
if python $SCRIPT_PATH/catalogcomparisontolerancecheck.py infoFile_$TEST.txt toIfile.txt
if python3 $SCRIPT_PATH/catalogcomparisontolerancecheck.py infoFile_$TEST.txt toIfile.txt
then
echo "Catalog comparison passed: "$TEST
else
Expand Down
2 changes: 1 addition & 1 deletion examples/GEAR/AgoraCosmo/README
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Initial conditions for the AGORA simulation presented in Roca-Fabrega et al. 2021.
The initial conditions are generated by MUSIC (and thus the path to the binary
should be set in run.sh). The initial conditions are generated for AREPO and
then converted into SWIFT compatible IC with a python script.
then converted into SWIFT compatible IC with a python3 script.
We will use SWIFT to cancel the h- and a-factors from the ICs.

The IC consists in a halo evolving to a virial mass of ∼ 1e12 Msun at z = 0 with a relatively
Expand Down
2 changes: 1 addition & 1 deletion examples/GravityTests/DiscPatch/GravityOnly/makeIC.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# to obtain the 1/ch^2(x/b) profile from a uniform profile (a glass, say, or a uniform random variable), note that, when integrating in x
# \int 0^x dx/ch^2(x) = tanh(x)-tanh(0) = \int_0^u du = u (where the last integral refers to a uniform density distribution), so that x = atanh(u)
#
# usage: python makeIC.py 1000
# usage: python3 makeIC.py 1000

# physical constants in cgs
NEWTON_GRAVITY_CGS = 6.67430e-8
Expand Down
2 changes: 1 addition & 1 deletion examples/GravityTests/DiscPatch/GravityOnly/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if [ ! -e Disc-Patch.hdf5 ]
then
echo "Generating initial conditions for the disc-patch example..."
python makeIC.py 1000
python3 makeIC.py 1000
fi

# Run SWIFT
Expand Down
4 changes: 2 additions & 2 deletions examples/GravityTests/DiscPatch/HydroStatic/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ fi
if [ ! -e Disc-Patch.hdf5 ]
then
echo "Generating initial conditions for the disc patch example..."
python makeIC.py
python3 makeIC.py
fi

# Run SWIFT
../../../swift --external-gravity --hydro --threads=4 disc-patch-icc.yml 2>&1 | tee output.log

python plotSolution.py
python3 plotSolution.py
4 changes: 2 additions & 2 deletions examples/GravityTests/DiscPatch/HydroStatic_1D/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
if [ ! -e Disc-Patch.hdf5 ]
then
echo "Generating initial conditions for the disc patch example..."
python makeIC.py
python3 makeIC.py
fi

# Run SWIFT
../../../swift --external-gravity --hydro --threads=4 disc-patch-icc.yml 2>&1 | tee output.log

python plotSolution.py
python3 plotSolution.py
4 changes: 2 additions & 2 deletions examples/GravityTests/ExternalPointMass/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
if [ ! -e PointMass.hdf5 ]
then
echo "Generating initial conditions for the point mass potential box example..."
python makeIC.py 10000
python3 makeIC.py 10000
fi

rm -rf pointMass_*.hdf5
../../swift --external-gravity --threads=1 externalPointMass.yml 2>&1 | tee output.log

python energy_plot.py
python3 energy_plot.py
4 changes: 2 additions & 2 deletions examples/GravityTests/Hernquist_circularorbit/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ then
if command -v python3 &>/dev/null; then
python3 makeIC.py
else
python makeIC.py
python3 makeIC.py
fi

fi
Expand All @@ -19,5 +19,5 @@ echo "Save plots of the circular orbits"
if command -v python3 &>/dev/null; then
python3 plotprog.py
else
python plotprog.py
python3 plotprog.py
fi
4 changes: 2 additions & 2 deletions examples/GravityTests/Hernquist_radialinfall/makeIC.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import numpy as np

# Generates N particles in a spherical distribution centred on [0,0,0], to be moved in an isothermal potential
# usage: python makeIC.py 1000 0 : generate 1000 particles on circular orbits
# python makeIC.py 1000 1 : generate 1000 particles with Lz/L uniform in [0,1]
# usage: python3 makeIC.py 1000 0 : generate 1000 particles on circular orbits
# python3 makeIC.py 1000 1 : generate 1000 particles with Lz/L uniform in [0,1]
# all particles move in the xy plane, and start at y=0

# physical constants in cgs
Expand Down
4 changes: 2 additions & 2 deletions examples/GravityTests/Hernquist_radialinfall/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ then
if command -v python3 &>/dev/null; then
python3 makeIC.py
else
python makeIC.py
python3 makeIC.py
fi
fi

Expand All @@ -20,5 +20,5 @@ echo "Make plots of the radially free falling particles"
if command -v python3 &>/dev/null; then
python3 plotprog.py
else
python plotprog.py
python3 plotprog.py
fi
2 changes: 1 addition & 1 deletion examples/GravityTests/HydrostaticHalo/makeIC.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import random

# Generates N particles in a spherically symmetric distribution with density profile ~r^(-2)
# usage: python makeIC.py 1000: generate 1000 particles
# usage: python3 makeIC.py 1000: generate 1000 particles

# Some constants

Expand Down
10 changes: 5 additions & 5 deletions examples/GravityTests/HydrostaticHalo/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if [ ! -e Hydrostatic.hdf5 ]
then
echo "Generating initial conditions for the isothermal potential box example..."
python makeIC.py 100000
python3 makeIC.py 100000
fi

# Run for 10 dynamical times
Expand All @@ -13,15 +13,15 @@ fi
echo "Plotting density profiles"
mkdir plots
mkdir plots/density_profile
python density_profile.py 2. 200 300
python3 density_profile.py 2. 200 300

echo "Plotting internal energy profiles"
mkdir plots/internal_energy
python internal_energy_profile.py 2. 200 300
python3 internal_energy_profile.py 2. 200 300

echo "Plotting radial velocity profiles"
mkdir plots/radial_velocity_profile
python velocity_profile.py 2. 200 300
python3 velocity_profile.py 2. 200 300

echo "Plotting energy as a function of time"
python test_energy_conservation.py 300
python3 test_energy_conservation.py 300
4 changes: 2 additions & 2 deletions examples/GravityTests/IsothermalPotential/makeIC.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import random

# Generates N particles in a spherical distribution centred on [0,0,0], to be moved in an isothermal potential
# usage: python makeIC.py 1000 0 : generate 1000 particles on circular orbits
# python makeIC.py 1000 1 : generate 1000 particles with Lz/L uniform in [0,1]
# usage: python3 makeIC.py 1000 0 : generate 1000 particles on circular orbits
# python3 makeIC.py 1000 1 : generate 1000 particles with Lz/L uniform in [0,1]
# all particles move in the xy plane, and start at y=0

# physical constants in cgs
Expand Down
4 changes: 2 additions & 2 deletions examples/GravityTests/IsothermalPotential/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
if [ ! -e Isothermal.hdf5 ]
then
echo "Generating initial conditions for the isothermal potential box example..."
python makeIC.py 1000 0
python3 makeIC.py 1000 0
fi

rm -rf Isothermal_*.hdf5
../../swift --external-gravity --threads=1 isothermal.yml 2>&1 | tee output.log

python energy_plot.py
python3 energy_plot.py
4 changes: 2 additions & 2 deletions examples/GravityTests/NFW_Halo/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ then
if command -v python3 &>/dev/null; then
python3 makeIC.py
else
python makeIC.py
python3 makeIC.py
fi
fi

Expand All @@ -16,5 +16,5 @@ fi
if command -v python3 &>/dev/null; then
python3 makePlots.py
else
python makePlots.py
python3 makePlots.py
fi
2 changes: 1 addition & 1 deletion examples/HydroTests/Diffusion_1D/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if [ ! -e diffusion.hdf5 ]
then
echo "Generating initial conditions for the Sedov blast example..."
python makeIC.py
python3 makeIC.py
fi

# Run SWIFT
Expand Down
Loading

0 comments on commit cad866b

Please sign in to comment.