Note
Go to the end to download the full example code.
Example on plotting particle concentration data timeseries#
/home/runner/work/PySP2/PySP2/pysp2/util/peak_fit.py:470: RuntimeWarning: divide by zero encountered in divide
peak2area = np.max(data2, axis=1)/denominator
Processing record 0
/home/runner/work/PySP2/PySP2/pysp2/util/peak_fit.py:384: OptimizeWarning: Covariance of the parameters could not be estimated
coeff, var_matrix = curve_fit(_gaus, bins_fit, data_fit, p0=p0, method='lm', maxfev=40, ftol=1e-3)
/home/runner/work/PySP2/PySP2/pysp2/util/peak_fit.py:564: OptimizeWarning: Covariance of the parameters could not be estimated
coeff, var_matrix = curve_fit(_gaus, bins_fit, temp1_fit, p0=p0, method='lm', maxfev=50, ftol=1e-3)
Processing record 1000
Processing record 2000
Processing record 3000
Processing record 4000
Processing record 5000
/home/runner/work/PySP2/PySP2/pysp2/util/peak_fit.py:78: RuntimeWarning: Mean of empty slice
ratio = np.nanmean(
5877 records processed in 5.879107475280762 s
/home/runner/work/PySP2/PySP2/pysp2/util/particle_properties.py:38: RuntimeWarning: All-NaN slice encountered
PkHt_ch0 = np.nanmax(np.stack([input_ds['PkHt_ch0'].values, input_ds['FtAmp_ch0'].values]), axis=0)
/home/runner/work/PySP2/PySP2/pysp2/util/particle_properties.py:39: RuntimeWarning: All-NaN slice encountered
PkHt_ch4 = np.nanmax(np.stack([input_ds['PkHt_ch4'].values, input_ds['FtAmp_ch4'].values]), axis=0)
Number of scattering particles accepted = 4799
Number of scattering particles rejected for min. peak height = 11
Number of scattering particles rejected for peak width = 16
Number of scattering particles rejected for fat peak = 0
Number of scattering particles rejected for peak pos. = 91
import matplotlib.pyplot as plt
import pysp2
my_sp2b = pysp2.io.read_sp2(pysp2.testing.EXAMPLE_SP2B)
my_ini = pysp2.io.read_config(pysp2.testing.EXAMPLE_INI)
my_binary = pysp2.util.gaussian_fit(my_sp2b, my_ini)
my_hk = pysp2.io.read_hk_file(pysp2.testing.EXAMPLE_HK)
my_binary = pysp2.util.calc_diams_masses(my_binary)
my_psds = pysp2.util.process_psds(my_binary, my_hk, my_ini)
my_psds['NumConcIncan'].plot()
plt.show()
Total running time of the script: (0 minutes 9.444 seconds)