AeroViz 0.1.3__py3-none-any.whl → 0.1.3b0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of AeroViz might be problematic. Click here for more details.
- AeroViz/__init__.py +4 -4
- AeroViz/dataProcess/Chemistry/__init__.py +38 -38
- AeroViz/dataProcess/Chemistry/_calculate.py +15 -15
- AeroViz/dataProcess/Chemistry/_isoropia.py +69 -68
- AeroViz/dataProcess/Chemistry/_mass_volume.py +158 -158
- AeroViz/dataProcess/Chemistry/_ocec.py +109 -109
- AeroViz/dataProcess/Chemistry/_partition.py +19 -18
- AeroViz/dataProcess/Chemistry/_teom.py +8 -11
- AeroViz/dataProcess/Optical/_IMPROVE.py +40 -39
- AeroViz/dataProcess/Optical/__init__.py +35 -35
- AeroViz/dataProcess/Optical/_absorption.py +35 -35
- AeroViz/dataProcess/Optical/_extinction.py +25 -24
- AeroViz/dataProcess/Optical/_mie.py +5 -6
- AeroViz/dataProcess/Optical/_mie_sd.py +89 -90
- AeroViz/dataProcess/Optical/_scattering.py +16 -16
- AeroViz/dataProcess/SizeDistr/__init__.py +37 -37
- AeroViz/dataProcess/SizeDistr/__merge.py +159 -158
- AeroViz/dataProcess/SizeDistr/_merge.py +155 -154
- AeroViz/dataProcess/SizeDistr/_merge_v1.py +162 -161
- AeroViz/dataProcess/SizeDistr/_merge_v2.py +153 -152
- AeroViz/dataProcess/SizeDistr/_merge_v3.py +326 -326
- AeroViz/dataProcess/SizeDistr/_merge_v4.py +272 -274
- AeroViz/dataProcess/SizeDistr/_size_distr.py +51 -51
- AeroViz/dataProcess/VOC/__init__.py +7 -7
- AeroViz/dataProcess/VOC/_potential_par.py +53 -55
- AeroViz/dataProcess/__init__.py +4 -4
- AeroViz/dataProcess/core/__init__.py +59 -58
- AeroViz/plot/__init__.py +6 -1
- AeroViz/plot/bar.py +126 -0
- AeroViz/plot/box.py +68 -0
- AeroViz/plot/distribution/distribution.py +421 -427
- AeroViz/plot/meteorology/meteorology.py +240 -292
- AeroViz/plot/optical/__init__.py +0 -1
- AeroViz/plot/optical/optical.py +230 -230
- AeroViz/plot/pie.py +198 -0
- AeroViz/plot/regression.py +210 -0
- AeroViz/plot/scatter.py +99 -0
- AeroViz/plot/templates/__init__.py +0 -3
- AeroViz/plot/templates/contour.py +25 -25
- AeroViz/plot/templates/corr_matrix.py +86 -93
- AeroViz/plot/templates/diurnal_pattern.py +24 -24
- AeroViz/plot/templates/koschmieder.py +106 -106
- AeroViz/plot/templates/metal_heatmap.py +34 -34
- AeroViz/plot/timeseries/timeseries.py +53 -60
- AeroViz/plot/utils/__init__.py +2 -1
- AeroViz/plot/utils/_color.py +57 -57
- AeroViz/plot/utils/_unit.py +48 -48
- AeroViz/plot/utils/plt_utils.py +92 -0
- AeroViz/plot/utils/sklearn_utils.py +49 -0
- AeroViz/plot/violin.py +79 -0
- AeroViz/process/__init__.py +15 -15
- AeroViz/process/core/DataProc.py +9 -9
- AeroViz/process/core/SizeDist.py +81 -81
- AeroViz/process/method/PyMieScatt_update.py +488 -488
- AeroViz/process/method/mie_theory.py +231 -229
- AeroViz/process/method/prop.py +40 -40
- AeroViz/process/script/AbstractDistCalc.py +103 -103
- AeroViz/process/script/Chemical.py +166 -166
- AeroViz/process/script/IMPACT.py +40 -40
- AeroViz/process/script/IMPROVE.py +152 -152
- AeroViz/process/script/Others.py +45 -45
- AeroViz/process/script/PSD.py +26 -26
- AeroViz/process/script/PSD_dry.py +69 -70
- AeroViz/process/script/retrieve_RI.py +50 -51
- AeroViz/rawDataReader/__init__.py +57 -57
- AeroViz/rawDataReader/core/__init__.py +328 -326
- AeroViz/rawDataReader/script/AE33.py +18 -18
- AeroViz/rawDataReader/script/AE43.py +20 -20
- AeroViz/rawDataReader/script/APS_3321.py +30 -30
- AeroViz/rawDataReader/script/Aurora.py +23 -23
- AeroViz/rawDataReader/script/BC1054.py +40 -40
- AeroViz/rawDataReader/script/EPA_vertical.py +9 -9
- AeroViz/rawDataReader/script/GRIMM.py +21 -21
- AeroViz/rawDataReader/script/IGAC_TH.py +67 -67
- AeroViz/rawDataReader/script/IGAC_ZM.py +59 -59
- AeroViz/rawDataReader/script/MA350.py +39 -39
- AeroViz/rawDataReader/script/NEPH.py +74 -74
- AeroViz/rawDataReader/script/OCEC_LCRES.py +21 -21
- AeroViz/rawDataReader/script/OCEC_RES.py +16 -16
- AeroViz/rawDataReader/script/SMPS_TH.py +25 -25
- AeroViz/rawDataReader/script/SMPS_aim11.py +32 -32
- AeroViz/rawDataReader/script/SMPS_genr.py +31 -31
- AeroViz/rawDataReader/script/TEOM.py +28 -28
- AeroViz/rawDataReader/script/Table.py +12 -12
- AeroViz/rawDataReader/script/VOC_TH.py +16 -16
- AeroViz/rawDataReader/script/VOC_ZM.py +28 -28
- AeroViz/rawDataReader/script/__init__.py +20 -20
- AeroViz/rawDataReader/utils/config.py +161 -161
- AeroViz/tools/database.py +65 -65
- AeroViz/tools/dataclassifier.py +106 -106
- AeroViz/tools/dataprinter.py +51 -51
- AeroViz/tools/datareader.py +38 -38
- {AeroViz-0.1.3.dist-info → AeroViz-0.1.3b0.dist-info}/METADATA +5 -4
- AeroViz-0.1.3b0.dist-info/RECORD +110 -0
- AeroViz/config/__init__.py +0 -0
- AeroViz/plot/improve/__init__.py +0 -1
- AeroViz/plot/improve/improve.py +0 -240
- AeroViz/plot/optical/aethalometer.py +0 -77
- AeroViz/plot/templates/event_evolution.py +0 -65
- AeroViz/plot/templates/regression.py +0 -256
- AeroViz/plot/templates/scatter.py +0 -130
- AeroViz/plot/templates/templates.py +0 -398
- AeroViz/plot/utils/_decorator.py +0 -74
- AeroViz-0.1.3.dist-info/RECORD +0 -111
- {AeroViz-0.1.3.dist-info → AeroViz-0.1.3b0.dist-info}/LICENSE +0 -0
- {AeroViz-0.1.3.dist-info → AeroViz-0.1.3b0.dist-info}/WHEEL +0 -0
- {AeroViz-0.1.3.dist-info → AeroViz-0.1.3b0.dist-info}/top_level.txt +0 -0
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
from AeroViz.dataProcess.core import _union_index
|
|
2
|
-
|
|
3
1
|
from datetime import datetime as dtm
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
4
|
from pandas import DataFrame, to_datetime
|
|
5
5
|
# from scipy.interpolate import interp1d
|
|
6
6
|
from scipy.interpolate import UnivariateSpline as unvpline, interp1d
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
from AeroViz.dataProcess.core import _union_index
|
|
8
9
|
|
|
9
10
|
__all__ = ['_merge_SMPS_APS']
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def __test_plot(smpsx, smps, apsx, aps, mergex, merge, mergeox, mergeo, _sh):
|
|
13
|
-
|
|
14
|
+
from matplotlib.pyplot import subplots, close, show
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
## parameter
|
|
17
|
+
# '''
|
|
18
|
+
## plot
|
|
19
|
+
fig, ax = subplots()
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
ax.plot(smpsx, smps, c='#ff794c', label='smps', marker='o', lw=2)
|
|
22
|
+
ax.plot(apsx, aps, c='#4c79ff', label='aps', marker='o', lw=2)
|
|
23
|
+
ax.plot(mergex, merge, c='#79796a', label='merge')
|
|
24
|
+
# ax.plot(mergeox,mergeo,c='#111111',label='mergeo',marker='o',lw=.75)
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
ax.set(xscale='log', yscale='log', )
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
ax.legend(framealpha=0, )
|
|
29
|
+
ax.set_title((_sh ** 2)[0], fontsize=13)
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
show()
|
|
32
|
+
close()
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
# '''
|
|
@@ -38,78 +39,78 @@ def __test_plot(smpsx, smps, apsx, aps, mergex, merge, mergeox, mergeo, _sh):
|
|
|
38
39
|
## Create a fitting func. by smps data
|
|
39
40
|
## return : shift factor
|
|
40
41
|
def _overlap_fitting(_smps_ori, _aps_ori, _smps_lb, _aps_hb):
|
|
41
|
-
|
|
42
|
+
print(f"\t\t{dtm.now().strftime('%m/%d %X')} : \033[92moverlap range fitting\033[0m")
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
## overlap fitting
|
|
45
|
+
## parmeter
|
|
46
|
+
_dt_indx = _smps_ori.index
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
## overlap diameter data
|
|
49
|
+
_aps = _aps_ori[_aps_ori.keys()[_aps_ori.keys() < _aps_hb]].copy()
|
|
50
|
+
_smps = _smps_ori[_smps_ori.keys()[_smps_ori.keys() > _smps_lb]].copy()
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
## use SMPS data apply power law fitting
|
|
53
|
+
## y = Ax^B, A = e**coefa, B = coefb, x = logx, y = logy
|
|
54
|
+
## ref : http://mathworld.wolfram.com/LeastSquaresFittingPowerLaw.html
|
|
55
|
+
## power law fit to SMPS num conc at upper bins to log curve
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
## coefficient A, B
|
|
58
|
+
_smps_qc_cond = ((_smps != 0) & np.isfinite(_smps))
|
|
59
|
+
_smps_qc = _smps.where(_smps_qc_cond)
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
_size = _smps_qc_cond.sum(axis=1)
|
|
62
|
+
_size = _size.where(_size != 0.).copy()
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
_logx, _logy = np.log(_smps_qc.keys()._data.astype(float)), np.log(_smps_qc)
|
|
65
|
+
_x, _y, _xy, _xx = _logx.sum(), _logy.sum(axis=1), (_logx * _logy).sum(axis=1), (_logx ** 2).sum()
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
_coeB = ((_size * _xy - _x * _y) / (_size * _xx - _x ** 2.))
|
|
68
|
+
_coeA = np.exp((_y - _coeB * _x) / _size).values.reshape(-1, 1)
|
|
69
|
+
_coeB = _coeB.values.reshape(-1, 1)
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
## rebuild shift smps data by coe. A, B
|
|
72
|
+
## x_shift = (y_ori/A)**(1/B)
|
|
73
|
+
_aps_shift_x = (_aps / _coeA) ** (1 / _coeB)
|
|
74
|
+
_aps_shift_x = _aps_shift_x.where(np.isfinite(_aps_shift_x))
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
## the least squares of diameter
|
|
77
|
+
## the shift factor which the cklosest to 1
|
|
78
|
+
_shift_factor = (_aps_shift_x.keys()._data.astype(float) / _aps_shift_x)
|
|
79
|
+
_shift_factor.columns = range(len(_aps_shift_x.keys()))
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
_dropna_idx = _shift_factor.dropna(how='all').index.copy()
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
## use the target function to get the similar aps and smps bin
|
|
84
|
+
## S2 = sum( (smps_fit_line(dia) - aps(dia*shift_factor) )**2 )
|
|
85
|
+
## assumption : the same diameter between smps and aps should get the same conc.
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
## be sure they art in log value
|
|
88
|
+
_S2 = DataFrame(index=_aps_shift_x.index)
|
|
89
|
+
_dia_table = DataFrame(np.full(_aps_shift_x.shape, _aps_shift_x.keys()),
|
|
90
|
+
columns=_aps_shift_x.keys(), index=_aps_shift_x.index)
|
|
91
|
+
for _idx, _factor in _shift_factor.items():
|
|
92
|
+
_smps_fit_df = _coeA * (_dia_table / _factor.to_frame().values) ** _coeB
|
|
93
|
+
_S2[_idx] = ((_smps_fit_df - _aps) ** 2).sum(axis=1)
|
|
93
94
|
|
|
94
|
-
|
|
95
|
+
_least_squ_idx = _S2.idxmin(axis=1).loc[_dropna_idx]
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
_shift_factor_out = DataFrame(_shift_factor.loc[_dropna_idx].values[range(len(_dropna_idx)), _least_squ_idx.values],
|
|
98
|
+
index=_dropna_idx).reindex(_dt_indx)
|
|
98
99
|
|
|
99
|
-
|
|
100
|
+
return _shift_factor_out, (DataFrame(_coeA, index=_dt_indx), DataFrame(_coeB, index=_dt_indx))
|
|
100
101
|
|
|
101
102
|
|
|
102
103
|
## Remove big shift data ()
|
|
103
104
|
## Return : aps, smps, shift (without big shift data)
|
|
104
105
|
def _shift_data_process(_shift):
|
|
105
|
-
|
|
106
|
+
print(f"\t\t{dtm.now().strftime('%m/%d %X')} : \033[92mshift-data quality control\033[0m")
|
|
106
107
|
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
_rho = _shift ** 2
|
|
109
|
+
_shift = _shift.mask((~np.isfinite(_shift)) | (_rho > 2.6) | (_rho < 0.3))
|
|
109
110
|
|
|
110
|
-
|
|
111
|
+
_qc_index = _shift.mask((_rho < 0.6) | (_shift.isna())).dropna().index
|
|
111
112
|
|
|
112
|
-
|
|
113
|
+
return _qc_index, _shift
|
|
113
114
|
|
|
114
115
|
|
|
115
116
|
# return _smps.loc[~_big_shift], _aps.loc[~_big_shift], _shift[~_big_shift].reshape(-1,1)
|
|
@@ -119,136 +120,136 @@ def _shift_data_process(_shift):
|
|
|
119
120
|
## shift all smps bin and remove the aps bin which smaller than the latest old smps bin
|
|
120
121
|
## Return : merge bins, merge data, density
|
|
121
122
|
def _merge_data(_smps_ori, _aps_ori, _shift_ori, _shift_mode, _smps_lb, _aps_hb, _coe):
|
|
122
|
-
|
|
123
|
+
print(f"\t\t{dtm.now().strftime('%m/%d %X')} : \033[92mcreate merge data\033[0m")
|
|
123
124
|
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
_ori_idx = _smps_ori.index
|
|
126
|
+
_merge_idx = _smps_ori.loc[_aps_ori.dropna(how='all').index].dropna(how='all').index
|
|
126
127
|
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
_uni_idx, _count = np.unique(np.hstack((_smps_ori.dropna(how='all').index, _aps_ori.dropna(how='all').index,
|
|
129
|
+
_shift_ori.dropna(how='all').index)), return_counts=True)
|
|
129
130
|
|
|
130
|
-
|
|
131
|
+
_merge_idx = to_datetime(np.unique(_uni_idx[_count == 3]))
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
_smps, _aps, _shift = _smps_ori.loc[_merge_idx], _aps_ori.loc[_merge_idx], _shift_ori.loc[_merge_idx].values
|
|
133
134
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
## parameter
|
|
136
|
+
_coeA, _coeB = _coe[0].loc[_merge_idx], _coe[1].loc[_merge_idx]
|
|
137
|
+
_smps_key, _aps_key = _smps.keys()._data.astype(float), _aps.keys()._data.astype(float)
|
|
137
138
|
|
|
138
|
-
|
|
139
|
+
_test = 1000
|
|
139
140
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
# _cntr = (_smps_lb+_aps_hb)/2
|
|
142
|
+
_cntr = _test
|
|
143
|
+
_bin_lb = _smps_key[-1]
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
145
|
+
## make shift bins
|
|
146
|
+
_smps_bin = np.full(_smps.shape, _smps_key)
|
|
147
|
+
_aps_bin = np.full(_aps.shape, _aps_key)
|
|
148
|
+
# _std_bin = _smps_key.tolist()+_aps_key[_aps_key>_smps_key[-1]].tolist()
|
|
149
|
+
_std_bin = np.geomspace(_smps_key[0], _aps_key[-1], 230)
|
|
150
|
+
_std_bin_merge = _std_bin[(_std_bin < _cntr) & (_std_bin > _bin_lb)]
|
|
151
|
+
_std_bin_inte1 = _std_bin[_std_bin <= _bin_lb]
|
|
152
|
+
_std_bin_inte2 = _std_bin[_std_bin >= _cntr]
|
|
152
153
|
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
if _shift_mode == 'mobility':
|
|
155
|
+
_aps_bin /= _shift
|
|
155
156
|
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
elif _shift_mode == 'aerodynamic':
|
|
158
|
+
_smps_bin *= _shift
|
|
158
159
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
## merge
|
|
161
|
+
_merge_lst = []
|
|
162
|
+
for _bin_smps, _bin_aps, _dt_smps, _dt_aps, _sh in zip(_smps_bin, _aps_bin, _smps.values, _aps.values, _shift):
|
|
163
|
+
## remove
|
|
163
164
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
## keep complete smps bins and data
|
|
166
|
+
## remove the aps bin data lower than smps bin
|
|
167
|
+
_condi = _bin_aps >= _bin_smps[-1]
|
|
167
168
|
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
_merge_bin = np.hstack((_bin_smps, _bin_aps[_condi]))
|
|
170
|
+
_merge_dt = np.hstack((_dt_smps, _dt_aps[_condi]))
|
|
170
171
|
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
# _merge_fit_loc = (_merge_bin<_aps_hb)&(_merge_bin>_smps_lb)
|
|
173
|
+
_merge_fit_loc = (_merge_bin < 1500) & (_merge_bin > _smps_lb)
|
|
173
174
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
## coeA and coeB
|
|
176
|
+
_unvpl_fc = unvpline(np.log(_merge_bin[_merge_fit_loc]), np.log(_merge_dt[_merge_fit_loc]), s=50)
|
|
177
|
+
# _unvpl_fc = unvpline(_merge_bin[_merge_fit_loc],_merge_dt[_merge_fit_loc],s=150)
|
|
178
|
+
# _inte_log_fc = interp1d(n.log10(_merge_bin[_merge_fit_loc]),n.log10(_merge_dt[_merge_fit_loc]),
|
|
179
|
+
# kind='linear',fill_value='extrapolate')
|
|
180
|
+
_inte_fc = interp1d(_merge_bin, _merge_dt, kind='linear', fill_value='extrapolate')
|
|
180
181
|
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
__merge = np.exp(_unvpl_fc(np.log(_std_bin_merge)))
|
|
183
|
+
# __merge = _unvpl_fc(_std_bin_merge)
|
|
183
184
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
_merge_dt_fit = np.hstack((_inte_fc(_std_bin_inte1), __merge, _inte_fc(_std_bin_inte2)))
|
|
186
|
+
# _merge_dt_fit = __merge
|
|
187
|
+
# __test_plot(_bin_smps,_dt_smps,_bin_aps,_dt_aps,_std_bin,_merge_dt_fit,_merge_bin,_merge_dt,_sh)
|
|
187
188
|
|
|
188
|
-
|
|
189
|
+
_merge_lst.append(_merge_dt_fit)
|
|
189
190
|
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
_df_merge = DataFrame(_merge_lst, columns=_std_bin, index=_merge_idx)
|
|
192
|
+
_df_merge = _df_merge.mask(_df_merge < 0)
|
|
192
193
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
## process output df
|
|
195
|
+
## average, align with index
|
|
196
|
+
def _out_df(*_df_arg, **_df_kwarg):
|
|
197
|
+
_df = DataFrame(*_df_arg, **_df_kwarg).reindex(_ori_idx)
|
|
198
|
+
_df.index.name = 'time'
|
|
199
|
+
return _df
|
|
199
200
|
|
|
200
|
-
|
|
201
|
+
return _out_df(_df_merge), _out_df(_shift_ori ** 2)
|
|
201
202
|
|
|
202
203
|
|
|
203
204
|
## aps_fit_highbound : the diameter I choose randomly
|
|
204
205
|
def _merge_SMPS_APS(df_smps, df_aps, aps_unit, shift_mode, smps_overlap_lowbound, aps_fit_highbound):
|
|
205
|
-
|
|
206
|
+
df_smps, df_aps = _union_index(df_smps, df_aps)
|
|
206
207
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
# print(f'\nMerge data :')
|
|
209
|
+
# print(f' APS fittint higher diameter : {aps_fit_highbound:4d} nm')
|
|
210
|
+
# print(f' SMPS overlap lower diameter : {smps_overlap_lowbound:4d} nm')
|
|
211
|
+
# print(f' Average time : {self.data_freq:>4s}\n')
|
|
211
212
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
## get data, remove 'total' and 'mode'
|
|
214
|
+
## set to the same units
|
|
215
|
+
smps, aps = df_smps, df_aps
|
|
216
|
+
smps.columns = smps.keys().to_numpy(float)
|
|
217
|
+
aps.columns = aps.keys().to_numpy(float)
|
|
217
218
|
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
if aps_unit == 'um':
|
|
220
|
+
aps.columns = aps.keys() * 1e3
|
|
220
221
|
|
|
221
|
-
|
|
222
|
-
|
|
222
|
+
## shift infomation, calculate by powerlaw fitting
|
|
223
|
+
shift, coe = _overlap_fitting(smps, aps, smps_overlap_lowbound, aps_fit_highbound)
|
|
223
224
|
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
## process data by shift infomation, and average data
|
|
226
|
+
qc_cond, shift = _shift_data_process(shift)
|
|
226
227
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
## merge aps and smps..
|
|
229
|
+
merge_data, density = _merge_data(smps, aps, shift, shift_mode, smps_overlap_lowbound, aps_fit_highbound, coe)
|
|
230
|
+
density.columns = ['density']
|
|
230
231
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
## add total and mode
|
|
233
|
+
# merge_total = merge_data.sum(axis=1,min_count=1).copy()
|
|
234
|
+
# merge_mode = merge_data.idxmax(axis=1).astype(float).copy()
|
|
234
235
|
|
|
235
|
-
|
|
236
|
-
|
|
236
|
+
# merge_data['total'] = merge_total
|
|
237
|
+
# merge_data['mode'] = merge_mode
|
|
237
238
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
## out
|
|
240
|
+
out_dic = {
|
|
241
|
+
'data_all': merge_data,
|
|
242
|
+
'data_qc': merge_data.loc[qc_cond],
|
|
243
|
+
'density_all': density,
|
|
244
|
+
'density_qc': density.loc[qc_cond],
|
|
245
|
+
}
|
|
245
246
|
|
|
246
|
-
|
|
247
|
+
## process data
|
|
247
248
|
|
|
248
|
-
|
|
249
|
-
|
|
249
|
+
for _nam, _df in out_dic.items():
|
|
250
|
+
out_dic[_nam] = _df.reindex(df_aps.index).copy()
|
|
250
251
|
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
# merge_data = merge_data.reindex(df_aps.index)
|
|
253
|
+
# density = density.reindex(df_aps.index)
|
|
253
254
|
|
|
254
|
-
|
|
255
|
+
return out_dic
|