Skip to content
Snippets Groups Projects
Commit 9414bba1 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Applied python code formatting script

parent 94147269
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ deg_ncdm = [1]
m_ncdm = [0.06]
# Maximum wavenumber and redshift
kmax = 30.
kmax = 30.0
zmax = 1e3
amin = 1.0 / (zmax + 1)
......@@ -55,7 +55,8 @@ params = {
"reio_parametrization": "reio_none",
"YHe": "BBN",
"k_output_values": kmax,
"k_per_decade_for_pk": 100}
"k_per_decade_for_pk": 100,
}
print("Running CLASS")
......
......@@ -12,9 +12,9 @@ import sys
# Usage: ./spawn_neutrinos.py filename
# Constants
Mpc_cgs = 3.08567758e+24
Mpc_cgs = 3.08567758e24
Default_N_nu_per100Mpc = 72 # 72^3 neutrinos for a (100 Mpc)^3 box
Default_nr_neutrinos_per_Mpc3 = (Default_N_nu_per100Mpc / 100.)**3
Default_nr_neutrinos_per_Mpc3 = (Default_N_nu_per100Mpc / 100.0) ** 3
# Read command line arguments
if len(sys.argv) <= 1 or sys.argv[1] == "--help" or sys.argv[1] == "-h":
......@@ -47,20 +47,31 @@ if nparts[6] != 0 or "PartType6" in f.keys():
raise IOError("This file already has neutrinos.")
# Compute the default number of neutrinos (round to nearest cubic number)
Default_N_nu = round((Default_nr_neutrinos_per_Mpc3 * V)**(1./3.))
Default_N_nu = round((Default_nr_neutrinos_per_Mpc3 * V) ** (1.0 / 3.0))
Default_Nr_neutrinos = int(Default_N_nu ** 3)
print("The box dimensions are " + str(L) + " Mpc.")
print("The default number of neutrinos is " +
"%g" % Default_N_nu_per100Mpc + "^3 per (100 Mpc)^3.")
print("The default number of neutrinos is " +
"%g" % Default_N_nu + "^3 = " + str(Default_Nr_neutrinos) + ".")
print(
"The default number of neutrinos is "
+ "%g" % Default_N_nu_per100Mpc
+ "^3 per (100 Mpc)^3."
)
print(
"The default number of neutrinos is "
+ "%g" % Default_N_nu
+ "^3 = "
+ str(Default_Nr_neutrinos)
+ "."
)
print("")
# Request the number of neutrino particles to be spawned (with default option)
Nr_neutrinos = int(input("Enter the number of neutrinos (default " +
"%d" % Default_Nr_neutrinos + "): ")
or "%d" % Default_Nr_neutrinos)
Nr_neutrinos = int(
input(
"Enter the number of neutrinos (default " + "%d" % Default_Nr_neutrinos + "): "
)
or "%d" % Default_Nr_neutrinos
)
nparts[6] = Nr_neutrinos
......@@ -80,7 +91,7 @@ print("The first particle ID of the first neutrino will be: " + str(firstID))
print("")
confirm = input("Enter y to confirm: ")
if (confirm != "y"):
if confirm != "y":
print("Not confirmed. Done for now.")
exit(0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment