Skip to content
Snippets Groups Projects
Commit 5c8fd4c8 authored by Schwandt, Dr. Jörn's avatar Schwandt, Dr. Jörn
Browse files

Merge branch 'NumpyWarning' into 'main'

Suppress warning about ndarray from ragged nested sequences

See merge request !1
parents 9fef6c29 dfb4b3bd
Branches
No related tags found
1 merge request!1Suppress warning about ndarray from ragged nested sequences
from LightSimtastic import SiPMSimulation from LightSimtastic import SiPMSimulation
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np
################################# #################################
# THE SIMULATION TOOL TAKES A DICTIONARY AS AN INPUT, WITH EACH OF THE VARIABLES AS KEYS. # THE SIMULATION TOOL TAKES A DICTIONARY AS AN INPUT, WITH EACH OF THE VARIABLES AS KEYS.
...@@ -80,14 +80,14 @@ Qs = df.iloc[0]["ChargeSpectrum"] ...@@ -80,14 +80,14 @@ Qs = df.iloc[0]["ChargeSpectrum"]
# PLOT # PLOT
################################# #################################
plt.figure(figsize=(15.5,10.5)) plt.figure(figsize=(15.5,10.5))
plt.hist(Qs, label="Simulated Charge Spectrum", bins=1000) H, edges = np.histogram(Qs, bins=1000)
edges = edges[:-1]+(edges[1]-edges[0])
plt.plot(edges, H)
plt.title("Simulated Charge Spectrum")
plt.yscale("log") plt.yscale("log")
plt.xticks(fontsize=25) plt.xticks(fontsize=25)
plt.yticks(fontsize=25) plt.yticks(fontsize=25)
plt.xlabel("# GD", fontsize=25), plt.xlabel("# GD", fontsize=25),
plt.savefig("./Example.png") plt.savefig("./Example.png")
plt.legend(fontsize=25)
...@@ -21,6 +21,9 @@ from copy import deepcopy ...@@ -21,6 +21,9 @@ from copy import deepcopy
np.set_printoptions(suppress=True) np.set_printoptions(suppress=True)
# evil but works: just suppress the numpy nested ragged array warning
import warnings
warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)
class SiPMSimulation: class SiPMSimulation:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment