Skip to content

Commit

Permalink
deprecated warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Perez committed Apr 2, 2020
1 parent 0120d7f commit d319b65
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 27 deletions.
24 changes: 21 additions & 3 deletions src/Python/pyinit.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,30 @@ def _fillObjectAndAddToList(self, cls, obj, **kwargs):
# add all kwargs as internal class variables
if kwargs is not None:
deprecated = {
"chipa_radiation_threshold":"minimum_chi_continuous",
"chipa_disc_min_threshold":"minimum_chi_discontinuous",
"output_format":"See documentation for radiation reaction",
"h_chipa_min":"See documentation for radiation reaction",
"h_chipa_max":"See documentation for radiation reaction",
"h_dim":"See documentation for radiation reaction",
"h_computation_method":"See documentation for radiation reaction",
"integfochi_chipa_min":"See documentation for radiation reaction",
"integfochi_chipa_max":"See documentation for radiation reaction",
"integfochi_dim":"See documentation for radiation reaction",
"xip_chipa_min":"See documentation for radiation reaction",
"xip_chipa_max":"See documentation for radiation reaction",
"xip_power":"See documentation for radiation reaction or Breit-Wheeler",
"xip_threshold":"See documentation for radiation reaction or Breit-Wheeler",
"xip_chipa_dim":"See documentation for radiation reaction or Breit-Wheeler",
"xip_chiph_dim":"See documentation for radiation reaction or Breit-Wheeler",
"compute_table":"See documentation for Breit-Wheeler",
"T_chiph_min":"See documentation for Breit-Wheeler",
"T_chiph_max":"See documentation for Breit-Wheeler",
"T_dim":"See documentation for Breit-Wheeler",
"xip_chiph_min":"See documentation for Breit-Wheeler",
"xip_chiph_max":"See documentation for Breit-Wheeler",
}
for key, value in kwargs.items():
if key in deprecated:
raise Exception("Deprecated `"+key+"` parameter should be replaced by `"+deprecated[key]+"`")
raise Exception("Deprecated `"+key+"` parameter. "+deprecated[key])
if key=="_list":
print("Python warning: in "+cls.__name__+": cannot have argument named '_list'. Discarding.")
elif not hasattr(cls, key):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ def g(chi):
Prad_MC = np.sum(integrand)

# Compare
print "chi0 = ", chi0
print "g(chi0) = ", g(chi0)
print "Prad (theory) = ", Prad_tot
print "Prad (noRR) = ", Prad_noRR
print "Prad (LL) = ", Prad_LL
print "Prad (cLL) = ", Prad_cLL
print "Prad (FP) = ", Prad_FP
print "Prad (MC) = ", Prad_MC
print( "chi0 = ", chi0)
print( "g(chi0) = ", g(chi0))
print( "Prad (theory) = ", Prad_tot)
print( "Prad (noRR) = ", Prad_noRR)
print( "Prad (LL) = ", Prad_LL)
print( "Prad (cLL) = ", Prad_cLL)
print( "Prad (FP) = ", Prad_FP)
print( "Prad (MC) = ", Prad_MC)

Validate("Prad (noRR)",Prad_noRR, 1.e-6*Prad_noRR)
Validate("Prad (LL)", Prad_LL, 1.e-6*Prad_LL )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
ntot_positron = np.array(S.Scalar("Ntot_positron").get()["data"])
ntot_photon = np.array(S.Scalar("Ntot_photon").get()["data"])

print ' Final electron energy / total energy: ',ukin_electron[-1] / utot[0]
print ' Final positron energy / total energy: ',ukin_positron[-1] / utot[0]
print ' Final photon energy / total energy: ',ukin_photon[-1] / utot[0]
print ' Maximal relative error total energy: ', max(abs(utot[:] - utot[0]))/utot[0]

print ' Final number of electrons:',ntot_electron[-1]
print ' Final number of positrons: ',ntot_positron[-1]
print ' Final number of photons: ',ntot_photon[-1]
print( ' Final electron energy / total energy: ',ukin_electron[-1] / utot[0] )
print( ' Final positron energy / total energy: ',ukin_positron[-1] / utot[0] )
print( ' Final photon energy / total energy: ',ukin_photon[-1] / utot[0] )
print( ' Maximal relative error total energy: ', max(abs(utot[:] - utot[0]))/utot[0] )

print( ' Final number of electrons:',ntot_electron[-1] )
print( ' Final number of positrons: ',ntot_positron[-1] )
print( ' Final number of photons: ',ntot_photon[-1] )

Validate("Electron kinetic energy evolution: ", ukin_electron/utot[0], 1e-2 )
Validate("Positron kinetic energy evolution: ", ukin_positron/utot[0], 2e-2 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
ntot_positron = np.array(S.Scalar("Ntot_positron").get()["data"])
ntot_photon = np.array(S.Scalar("Ntot_photon").get()["data"])

print ' Final electron energy / total energy: ',ukin_electron[-1] / utot[0]
print ' Final positron energy / total energy: ',ukin_positron[-1] / utot[0]
print ' Final photon energy / total energy: ',ukin_photon[-1] / utot[0]
print ' Maximal relative error total energy: ', max(abs(utot[:] - utot[0]))/utot[0]

print ' Final number of electrons:',ntot_electron[-1]
print ' Final number of positrons: ',ntot_positron[-1]
print ' Final number of photons: ',ntot_photon[-1]
print( ' Final electron energy / total energy: ',ukin_electron[-1] / utot[0] )
print( ' Final positron energy / total energy: ',ukin_positron[-1] / utot[0] )
print( ' Final photon energy / total energy: ',ukin_photon[-1] / utot[0] )
print( ' Maximal relative error total energy: ', max(abs(utot[:] - utot[0]))/utot[0] )

print( ' Final number of electrons:',ntot_electron[-1] )
print( ' Final number of positrons: ',ntot_positron[-1] )
print( ' Final number of photons: ',ntot_photon[-1] )

Validate("Electron kinetic energy evolution: ", ukin_electron/utot[0], 1e-2 )
Validate("Positron kinetic energy evolution: ", ukin_positron/utot[0], 2e-2 )
Expand Down

0 comments on commit d319b65

Please sign in to comment.