Skip to content
Snippets Groups Projects
Commit a5493786 authored by Alexander Böhmländer's avatar Alexander Böhmländer
Browse files

Added test.

parent b03a3a3a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 24 00:07:14 2024
@author: alex
"""
import unittest
class TestCalc(unittest.TestCase):
def test_lognormal_number_distribution_log_scale(self):
import numpy as np
from pathlib import Path
import math
import sys
sys.path.insert(0, str(Path(__file__).parents[2]))
from as_tools.Calculations import size_distribution as sd
particle_diameter = np.geomspace(1e-3, 10, 500) # µm
number_size_distribution_nucleation = sd.lognormal_number_distribution_log_scale(
number_concentration=7100,
standard_deviation=np.exp(0.232),
median_particle_diameter=0.0117,
particle_diameter=particle_diameter)
# test for the number of particles, the area under dNdlogdp should be the total
# number concentration
dlogdp = np.diff(np.log10(particle_diameter)).mean()
number_concentration_nucleation = (number_size_distribution_nucleation
* dlogdp).sum()
result = math.isclose(7100, number_concentration_nucleation)
self.assertTrue(result)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment