You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have used the GenericParticleSizer function to integrate across data taken from an APS. I believe that the bin sizes were inputted correctly, and I'm okay with any weirdness from density assumptions for the moment. I am getting very high numbers, even though I specified "mass" as the weight.
What unit is the end result supposed to be? I have applied a natural log to the end result but that doesn't seem right either.
APS_original = pd.read_csv('/content/drive/MyDrive/APS Data/APS_Merged_Data.csv')
APS_original['Start_Hour'] = pd.to_datetime(APS_original['Start_Hour'])
APS_original = APS_original.set_index('Start_Hour')
non_bin_original_names = ['Median(µm)', 'Mean(µm)', 'Geo. Mean(µm)', 'Mode(µm)', 'Geo. Std. Dev.', 'Date', 'Aerodynamic Diameter', 'Side Scatter Channel', 'Status Flags', 'Aerodynamic Diameter Raw Data']
original_bin_names = [col for col in APS_original.columns if col not in non_bin_original_names and col != APS_original.index.name]
rename_dict = {}
numerical_right_edges_list = []
for col in original_bin_names:
if col == '<0.523':
rename_dict[col] = 0.523
numerical_right_edges_list.append(0.523)
else:
numerical_value = float(col)
rename_dict[col] = numerical_value
numerical_right_edges_list.append(numerical_value)
except ValueError:
print(f"Warning: Could not convert original column name '{col}' to float. Excluding from bins.")
pass
numerical_right_edges = np.array(sorted(numerical_right_edges_list))
left_edges = np.insert(numerical_right_edges[:-1], 0, 0.0)
midpoints = np.sqrt(left_edges * numerical_right_edges)
if left_edges[0] == 0.0:
midpoints[0] = numerical_right_edges[0] / 2.0 # Use half of the right edge for the first bin
smps_bins = np.vstack([left_edges, midpoints, numerical_right_edges]).T
reverse_rename_dict = {v: k for k, v in rename_dict.items()}
original_bin_names_ordered = [reverse_rename_dict[edge] for edge in numerical_right_edges]
APS_data_for_smps = APS_original[original_bin_names_ordered]
bin_column_names = [f'bin{i}' for i in range(len(original_bin_names_ordered))]
APS_data_for_smps.columns = bin_column_names
obj_APS = smps.models.GenericParticleSizer(data=APS_data_for_smps, bins=smps_bins)
def custom_density(dp):
"""Calculate density as a function of particle diameter in µm.
Parameters
----------
dp : float
Particle diameter in microns.
"""
return 1.65 if dp < 3 else 2.5
PM25 = obj_APS.integrate(weight="mass", dmin=0., dmax=2.5, rho=custom_density)
PMc = obj_APS.integrate(weight="mass", dmin=2.5, dmax=10, rho=custom_density)
PM10 = obj_APS.integrate(weight="mass", dmin=0, dmax=10, rho=custom_density)
PMsc = obj_APS.integrate(weight="mass", dmin=10, dmax=30, rho=custom_density)
display(PM25.head())
display(PMc.head())
display(PM10.head())
display(PMsc.head())
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I have used the GenericParticleSizer function to integrate across data taken from an APS. I believe that the bin sizes were inputted correctly, and I'm okay with any weirdness from density assumptions for the moment. I am getting very high numbers, even though I specified "mass" as the weight.
What unit is the end result supposed to be? I have applied a natural log to the end result but that doesn't seem right either.
APS_Merged_Data.csv
Beta Was this translation helpful? Give feedback.
All reactions