Maintainer triage (June 29, 2026)
- Status: Verified bug against the current
master source in this fork.
- Severity: Medium.
- Area labels: area:phases.
- Tackle batch: P5 - medium-scope correctness defects.
The source review confirmed that the cited code path and failure mode are still present. The original audit details are preserved below for reproduction notes and suggested fixes.
Original audit details
Finding
SolidPhase documents distrib_type='mass_frac', but the implementation checks for 'mass_perc'; even that branch omits density and bin-width terms.
Evidence
- Docstring says valid options are
'mass_frac' or 'vol_perc' at PharmaPy/Phases.py:836-838.
- Code checks
elif self.distrib_type == 'mass_perc' at PharmaPy/Phases.py:1015-1019.
- The
mass_perc conversion uses self.mass * distrib / x_distrib**3 / self.kv * 1e18, unlike the volume path at PharmaPy/Phases.py:985-987, which accounts for density and self.dx.
Impact
Documented mass-fraction CSD input either leaves distr undefined or produces a number distribution with incorrect units.
Likely fix
Use one documented spelling and convert mass fractions through mass -> solid volume -> bin number density, including density, kv, L^3, and bin width.
Maintainer triage (June 29, 2026)
mastersource in this fork.The source review confirmed that the cited code path and failure mode are still present. The original audit details are preserved below for reproduction notes and suggested fixes.
Original audit details
Finding
SolidPhasedocumentsdistrib_type='mass_frac', but the implementation checks for'mass_perc'; even that branch omits density and bin-width terms.Evidence
'mass_frac'or'vol_perc'atPharmaPy/Phases.py:836-838.elif self.distrib_type == 'mass_perc'atPharmaPy/Phases.py:1015-1019.mass_percconversion usesself.mass * distrib / x_distrib**3 / self.kv * 1e18, unlike the volume path atPharmaPy/Phases.py:985-987, which accounts for density andself.dx.Impact
Documented mass-fraction CSD input either leaves
distrundefined or produces a number distribution with incorrect units.Likely fix
Use one documented spelling and convert mass fractions through mass -> solid volume -> bin number density, including density,
kv,L^3, and bin width.