dhhagan / opcsim

opcsim is a python package for simulating low-cost optical particle sensors
MIT License
14 stars 2 forks source link

Bin assignments via probability distribution #96

Open drewmee opened 3 years ago

drewmee commented 3 years ago

Hi @dhhagan,

I'd like to contribute an enhancement which will enable bin assignment via a probability distribution. I saw you mentioned this in Hagan et al. 2020 and cited Walser et al. 2017 as a potential model for how this could be done. I'm still working my way through the Walser paper. Do you have any thoughts on how you imagine something like this being implemented in opcsim?

Hagan, David H., and Jesse H. Kroll. "Assessing the accuracy of low-cost optical particle sensors using a physics-based approach." Atmospheric Measurement Techniques Discussions (2020): 1-36.

Walser, Adrian, et al. "On the parametrization of optical particle counter response including instrument-induced broadening of size spectra and a self-consistent evaluation of calibration measurements." Atmospheric Measurement Techniques (AMT) 10.11 (2017): 4341-4361.

dhhagan commented 3 years ago

Hey @drewmee - yes, please! I think in terms of how it's implemented, it should take place at OPC definition stage - in other words, when you create an OPC, you should be able to set a parameter for how you allocate particles to bins. We can brainstorm some ideas for what this parameter should be called, but should default to what is used now. If there are other arguments/parameters that need to be set in order to make it work, then we can just add another kwarg such as prob_kwargs or something like that...make sense?

drewmee commented 3 years ago

Thanks that makes sense. From my understanding the probability distribution used for bin assignment should bake in uncertainties in particle properties as well as the instrument-specific relationship between scattering signal amplitude and particle scattering cross section. The latter seems like the easiest place to start. As for the former, have you thought about how one might assign probability distributions for particle density, hygroscopic growth, and refractive index to each lognormal mode within an aerosol distribution, for example for an externally mixed sample? Correct me if I'm wrong but those properties are currently held constant for each mode in opcsim? Perhaps implementing a way to represent modes with heterogeneous properties should be addressed prior to any attempt at a bin-assignment algorithm. Maybe that should be raised/tracked in a whole different GH issue...

Please let me know if any of that made sense.

dhhagan commented 3 years ago

Hey @drewmee I don't think that is necessarily the case, though I could see that being useful. I think the first step would be to just assign them probabilities based on whether the Cscat value was in a region where there is large uncertainty in the correct bin assignment. I think the composition and other uncertainty is next level!

You are correct that currently, each mode is treated separately, though you could create two identical modes of different composition. It shouldn't be too hard to build in core-shell model functionality, and there are examples (py-mie) that do this already and can be looked to for inspiration/code examples.