Files

668 lines
31 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta name="generator" content="pdoc3 0.11.1">
<title>defs.SMPS API documentation</title>
<meta name="description" content="The docstring for this submodule">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/typography.min.css" integrity="sha512-Y1DYSb995BAfxobCkKepB1BqJJTPrOp3zPL74AWFugHHmmdcvO+C48WLrUOlhGMc0QG7AE3f7gmvvcrmX2fDoA==" crossorigin>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" crossorigin>
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:1.5em;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:2em 0 .50em 0}h3{font-size:1.4em;margin:1.6em 0 .7em 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .2s ease-in-out}a:visited{color:#503}a:hover{color:#b62}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900;font-weight:bold}pre code{font-size:.8em;line-height:1.4em;padding:1em;display:block}code{background:#f3f3f3;font-family:"DejaVu Sans Mono",monospace;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em 1em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul ul{padding-left:1em}.toc > ul > li{margin-top:.5em}}</style>
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
<script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], processEscapes: true } });</script>
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS_CHTML" integrity="sha256-kZafAc6mZvK3W3v1pHOcUix30OHQN6pU/NO2oFkqZVw=" crossorigin></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity="sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" crossorigin></script>
<script>window.addEventListener('DOMContentLoaded', () => {
hljs.configure({languages: ['bash', 'css', 'diff', 'graphql', 'ini', 'javascript', 'json', 'plaintext', 'python', 'python-repl', 'rust', 'shell', 'sql', 'typescript', 'xml', 'yaml']});
hljs.highlightAll();
})</script>
</head>
<body>
<main>
<article id="content">
<header>
<h1 class="title">Module <code>defs.SMPS</code></h1>
</header>
<section id="section-intro">
<p>The docstring for this submodule</p>
</section>
<section>
</section>
<section>
</section>
<section>
</section>
<section>
<h2 class="section-title" id="header-classes">Classes</h2>
<dl>
<dt id="defs.SMPS.Distribution"><code class="flex name class">
<span>class <span class="ident">Distribution</span></span>
<span>(</span><span>variable_array, function_array, form='log10')</span>
</code></dt>
<dd>
<div class="desc"><p>Object representing a distribution.</p>
<h2 id="description">Description</h2>
<p>Bla Bla Bla</p>
<h2 id="attributes">Attributes</h2>
<dl>
<dt><strong><code>var</code></strong> :&ensp;<code>np.ndarray</code></dt>
<dd>A 1D array containing the (independent) variable, for instance the diameter $D$.</dd>
<dt><strong><code>fct</code></strong> :&ensp;<code>np.ndarray</code></dt>
<dd>rA 1D array containing the dependent functional value, for instance count density $\frac{d\log_{10}N}{d\log_{10}D}$</dd>
</dl></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class Distribution():
r&#34;&#34;&#34;Object representing a distribution.
Description
-----------
Bla Bla Bla
Attributes
----------
var: np.ndarray
A 1D array containing the (independent) variable, for instance the diameter $D$.
fct: np.ndarray
rA 1D array containing the dependent functional value, for instance count density $\frac{d\log_{10}N}{d\log_{10}D}$
&#34;&#34;&#34;
def __init__(self, variable_array, function_array, form = &#39;log10&#39;):
self.var = variable_array
self.fct = function_array
self.__form = form
def transform(self, to = &#39;linear&#39;):
&#34;&#34;&#34;A method to transform distributions between different representations
Description
-----------
Bla bla bla
Parameters
----------
to: str
Indicating into which representation the distribution should be transformed. Possible values are: `linear`, `ln` or `log10`
&#34;&#34;&#34;
if self.__form == to:
warnings.warn(&#34;Already in desired format. Transformation has no effect.&#34;)
return
# TODO: check the transformations!
# TODO: check the order of the transformation (first variable, then function, or vice versa) to avoid having a mess!
match to:
case &#39;linear&#39;:
if self.__form == &#39;ln&#39;:
self.var = np.exp(self.var)
self.fct = np.divide(self.fct, self.var)
self.__form = &#39;linear&#39;
elif self.__form == &#39;log10&#39;:
self.var = np.power(10, self.var)
self.fct = np.divide(self.fct, self.var * np.log(10))
self.__form = &#39;linear&#39;
case &#39;ln&#39;:
if self.__form == &#39;linear&#39;:
self.var = np.log(self.var)
self.fct = np.multiply(self.var, self.fct)
self.__form = &#39;ln&#39;
elif self.__form == &#39;log10&#39;:
self.var = np.log(np.power(10, self.var))
self.fct = np.divide(self.fct, np.log(10))
self.__form = &#39;ln&#39;
case &#39;log10&#39;:
if self.__form == &#39;linear&#39;:
self.fct = np.multiply(self.var, self.fct * np.log(10))
self.var = np.log10(self.var)
self.__form = &#39;log10&#39;
elif self.__form == &#39;ln&#39;:
self.var = np.log10(np.exp(self.var))
self.fct = np.multiply(self.fct, np.log(10))
self.__form = &#39;log10&#39;
def update_units(self, new_var_units, new_fct_units):
&#34;&#34;&#34;A method to update the units of the distribution
Description
-----------
Bla Bla Bla
Parameters
----------
new_var_units: float
The SI factor used to transform the independent variable `self.var`
new_fct_units: float
The SI factor used to transform the dependent variable `self.fct`
&#34;&#34;&#34;
old_from = self.__form
self.transform(to=&#39;linear&#39;)
self.var = self.var * new_var_units
self.fct = self.fct * new_fct_units
self.transform(to=old_from)
def integrate(self) -&gt; np.float64:
&#34;&#34;&#34;A method to integrate over the spectrum $dN/d f(D)$
Description
-----------
Bla Bla Bla
&#34;&#34;&#34;
return np.trapezoid(y = self.fct, x = self.var)
def median():
# TODO: implement that method
pass
def mode():
# TODO: implement that method
pass
def mean():
# TODO: implement that method
pass
def variance():
# TODO: implement that method
pass</code></pre>
</details>
<h3>Methods</h3>
<dl>
<dt id="defs.SMPS.Distribution.integrate"><code class="name flex">
<span>def <span class="ident">integrate</span></span>(<span>self) ‑> numpy.float64</span>
</code></dt>
<dd>
<div class="desc"><p>A method to integrate over the spectrum $dN/d f(D)$</p>
<h2 id="description">Description</h2>
<p>Bla Bla Bla</p></div>
</dd>
<dt id="defs.SMPS.Distribution.mean"><code class="name flex">
<span>def <span class="ident">mean</span></span>(<span>)</span>
</code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="defs.SMPS.Distribution.median"><code class="name flex">
<span>def <span class="ident">median</span></span>(<span>)</span>
</code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="defs.SMPS.Distribution.mode"><code class="name flex">
<span>def <span class="ident">mode</span></span>(<span>)</span>
</code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="defs.SMPS.Distribution.transform"><code class="name flex">
<span>def <span class="ident">transform</span></span>(<span>self, to='linear')</span>
</code></dt>
<dd>
<div class="desc"><p>A method to transform distributions between different representations</p>
<h2 id="description">Description</h2>
<p>Bla bla bla</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>to</code></strong> :&ensp;<code>str</code></dt>
<dd>Indicating into which representation the distribution should be transformed. Possible values are: <code>linear</code>, <code>ln</code> or <code>log10</code></dd>
</dl></div>
</dd>
<dt id="defs.SMPS.Distribution.update_units"><code class="name flex">
<span>def <span class="ident">update_units</span></span>(<span>self, new_var_units, new_fct_units)</span>
</code></dt>
<dd>
<div class="desc"><p>A method to update the units of the distribution</p>
<h2 id="description">Description</h2>
<p>Bla Bla Bla</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>new_var_units</code></strong> :&ensp;<code>float</code></dt>
<dd>The SI factor used to transform the independent variable <code>self.var</code></dd>
<dt><strong><code>new_fct_units</code></strong> :&ensp;<code>float</code></dt>
<dd>The SI factor used to transform the dependent variable <code>self.fct</code></dd>
</dl></div>
</dd>
<dt id="defs.SMPS.Distribution.variance"><code class="name flex">
<span>def <span class="ident">variance</span></span>(<span>)</span>
</code></dt>
<dd>
<div class="desc"></div>
</dd>
</dl>
</dd>
<dt id="defs.SMPS.OFRAnalyser"><code class="flex name class">
<span>class <span class="ident">OFRAnalyser</span></span>
<span>(</span><span>data_source_file, flow_source_file, smpl_number_list, on_time_interval, data_separator=',')</span>
</code></dt>
<dd>
<div class="desc"><p>An object representing an OFR experiment</p>
<h2 id="description">Description</h2>
<p>Bla Bla Bla</p>
<h2 id="attributes">Attributes</h2>
<dl>
<dt><strong><code>data_source_file</code></strong> :&ensp;<code>str</code></dt>
<dd>A string pointing to the data source file</dd>
<dt><strong><code>flow_source_file</code></strong> :&ensp;<code>str</code></dt>
<dd>A string pointing to the flow data source file</dd>
<dt><strong><code>sample_number_list</code></strong> :&ensp;<code>[int]</code></dt>
<dd>A list of integers indicating which samples to consider</dd>
<dt><strong><code>on_time_interval</code></strong> :&ensp;<code>[pd.Timestamp]</code></dt>
<dd>A list with two elements containing the pd.Timestamp objects when the VOC flow was switched on and off, respectively.</dd>
<dt><strong><code>max_samples</code></strong> :&ensp;<code>int</code></dt>
<dd>The highest sample available in the data</dd>
<dt><strong><code>data</code></strong> :&ensp;<code>pandas.DataFrame</code></dt>
<dd>A dataframe containing all the data</dd>
</dl></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class OFRAnalyser:
&#34;&#34;&#34;An object representing an OFR experiment
Description
-----------
Bla Bla Bla
Attributes
----------
data_source_file: str
A string pointing to the data source file
flow_source_file: str
A string pointing to the flow data source file
sample_number_list: [int]
A list of integers indicating which samples to consider
on_time_interval: [pd.Timestamp]
A list with two elements containing the pd.Timestamp objects when the VOC flow was switched on and off, respectively.
max_samples: int
The highest sample available in the data
data: pandas.DataFrame
A dataframe containing all the data
&#34;&#34;&#34;
def __init__(self, data_source_file, flow_source_file, smpl_number_list, on_time_interval, data_separator = &#39;,&#39;) -&gt; None:
self.data_source_file = data_source_file
self.flow_source_file = flow_source_file
self.smpl_number_list = smpl_number_list
self.on_time_interval = on_time_interval
self.__data_separator = data_separator
with open(self.data_source_file, &#39;r&#39;, errors = &#39;ignore&#39;) as file:
for i, line in enumerate(file.readlines()):
if i == 17:
items = line.split(&#39;,&#39;)
max_sample_number = int(len(items) / 2)
else:
continue
self.max_samples = max_sample_number
self.data = None
def __smpl_number_list_check(self, smpl_number_list) -&gt; None:
# TODO: implement a similar check for the flow data file!
last_sample = smpl_number_list[-1]
if last_sample &gt; self.max_samples:
raise IndexError(&#34;The last sample(s) are out of range of the number of recorded samples&#34;)
def GetData(self) -&gt; None:
&#34;&#34;&#34;Method to get the data
Description
-----------
Bla Bla Bla
&#34;&#34;&#34;
# TODO make this work also for a specific sample!
# TODO convert everything is SI units, making live a lot easier...
self.__smpl_number_list_check(self.smpl_number_list)
# Quantities of interest:
numbers_of_sample = [] # (-)
starting_times = [] # (timestamp)
sampling_times = [] # (s)
number_concentrations = [] # (#/m^3)
length_concentrations = [] # (m/m^3)
surface_concentrations = [] # (m^2/m^3)
volume_concentrations = [] # (m^3/m^3)
aerosol_densities = [] # (kg/m^3)
mass_concentrations = [] # (kg/m^3)
filter_flows = [] # (m^3/s)
mass_production_rate = None # (kg/s)
mass_produced = None # (kg)
cumulative_mass_produced = None # (kg)
for sample_number in self.smpl_number_list:
sample = OFRSample(source_file=self.data_source_file, sample_number = sample_number, data_separator = self.__data_separator)
numbers_of_sample.append(sample_number)
starting_times.append(sample.start_time)
number_concentrations.append(sample.Count.integrate())
length_concentrations.append(sample.Length.integrate())
surface_concentrations.append(sample.Surface.integrate())
volume_concentrations.append(sample.Volume.integrate())
aerosol_densities.append(sample.SOA_density)
mass_concentrations.append(sample.Mass.integrate())
sampling_times.append(sample.sampling_time)
out_flag = False
with open(self.flow_source_file, &#39;r&#39;, errors=&#39;ignore&#39;) as file:
j = 1
for line_counter, line in enumerate(file.readlines()):
if out_flag == True:
continue
if line_counter &gt;= 6:
if line.startswith(&#39;-&#39;):
out_flag = True
continue
i = 0
items = line.split()
while i &lt; int(items[-1]):
if j in self.smpl_number_list:
filter_flows.append(float(items[0]) * (1E-3) / 60)
i += 1
j += 1
else:
continue
mass_production_rate = [(mass * flow) for mass, flow in zip(mass_concentrations, filter_flows)]
mass_produced = [(mpr * duration) for mpr, duration in zip(mass_production_rate, sampling_times)]
cumulative_mass_produced = np.cumsum(np.array(mass_produced)).tolist()
self.data = pd.DataFrame({&#39;Sample (-)&#39;: numbers_of_sample,
&#39;Starting Time (-)&#39;: starting_times,
&#39;Sampling Time (s)&#39;: sampling_times,
&#39;Number (#/m^3)&#39;: number_concentrations,
&#39;Length (m/m^3)&#39;: length_concentrations,
&#39;Surface (m^2/m^3)&#39;: surface_concentrations,
&#39;Volume (m^3/m^3)&#39;: volume_concentrations,
&#39;Density (kg/m^3)&#39;: aerosol_densities,
&#39;Mass (kg/m^3)&#39;: mass_concentrations,
&#39;Filter Flow (m^3/s)&#39;: filter_flows,
&#39;Mass Production Rate (kg/s)&#39;: mass_production_rate,
&#39;Mass Produced (kg)&#39;: mass_produced,
&#39;Cumulative Mass Produced (kg)&#39;: cumulative_mass_produced})</code></pre>
</details>
<h3>Methods</h3>
<dl>
<dt id="defs.SMPS.OFRAnalyser.GetData"><code class="name flex">
<span>def <span class="ident">GetData</span></span>(<span>self) ‑> None</span>
</code></dt>
<dd>
<div class="desc"><p>Method to get the data</p>
<h2 id="description">Description</h2>
<p>Bla Bla Bla</p></div>
</dd>
</dl>
</dd>
<dt id="defs.SMPS.OFRSample"><code class="flex name class">
<span>class <span class="ident">OFRSample</span></span>
<span>(</span><span>source_file, sample_number, data_separator=',')</span>
</code></dt>
<dd>
<div class="desc"><p>Object to represent a single sample from the OFR</p>
<h2 id="description">Description</h2>
<p>Bla bla bla</p>
<h2 id="attributes">Attributes</h2>
<dl>
<dt><strong><code>number</code></strong> :&ensp;<code>int</code></dt>
<dd>The sample number</dd>
<dt><strong><code>start_time</code></strong> :&ensp;<code>pd.datetime</code></dt>
<dd>The starting time of the sample recording</dd>
<dt><strong><code>sourcefile</code></strong> :&ensp;<code>str</code></dt>
<dd>The path to the data file</dd>
<dt><strong><code>headlines</code></strong> :&ensp;<code>int</code></dt>
<dd>The number of lines in the data file until raw data is reached</dd>
<dt><strong><code>lower_bound</code></strong> :&ensp;<code>float</code></dt>
<dd>The lower bound diameter (nm) of the SMPS</dd>
<dt><strong><code>upper_bound</code></strong> :&ensp;<code>float</code></dt>
<dd>The upper bound diameter (nm) of the SMPS</dd>
<dt><strong><code>scan_up</code></strong> :&ensp;<code>float</code></dt>
<dd>The time (s) to ramp up voltage in SMPS</dd>
<dt><strong><code>scan_down</code></strong> :&ensp;<code>float</code></dt>
<dd>The time (s) to ramp voltage back down in SMPS</dd>
<dt><strong><code>delta_time</code></strong> :&ensp;<code>float</code></dt>
<dd>The time interval (s) between two measured data points of the raw count density</dd>
<dt><strong><code>SOA_density</code></strong> :&ensp;<code>float</code></dt>
<dd>The density (kg/m3) of the SOA produced in the OFR</dd>
</dl></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class OFRSample:
&#34;&#34;&#34;Object to represent a single sample from the OFR
Description
-----------
Bla bla bla
Attributes
----------
number: int
The sample number
start_time: pd.datetime
The starting time of the sample recording
sourcefile: str
The path to the data file
headlines: int
The number of lines in the data file until raw data is reached
lower_bound: float
The lower bound diameter (nm) of the SMPS
upper_bound: float
The upper bound diameter (nm) of the SMPS
scan_up: float
The time (s) to ramp up voltage in SMPS
scan_down: float
The time (s) to ramp voltage back down in SMPS
delta_time: float
The time interval (s) between two measured data points of the raw count density
SOA_density: float
The density (kg/m3) of the SOA produced in the OFR
&#34;&#34;&#34;
def __get_data(self) -&gt; np.float64:
footer_flag = False
footer_start_index = 0
data_flag = False
data_lines = []
midpoints = []
counts = []
date_line = None
time_line = None
with open(self.source_file, &#39;r&#39;, errors = &#39;ignore&#39;) as file:
for i, line in enumerate(file.readlines()):
if i == 18:
date_line = line
continue
if i == 19:
time_line = line
continue
if i == 20:
data_flag = True
continue
if data_flag == True:
data_lines.append(line)
if line.split(self.__data_separator)[0] == &#39;Scan Up Time(s)&#39;:
data_flag = False
footer_flag = True
footer_start_index = i
self.scan_up_time = float(line.split(self.__data_separator)[1])
continue
if footer_flag == False:
continue
else:
if i == footer_start_index + 1:
self.scan_down_time = float(line.split(self.__data_separator)[1])
continue
elif i == footer_start_index + 6:
self.aerosol_flow = float(line.split(self.__data_separator)[1])
continue
elif i == footer_start_index + 11:
self.lower_diameter_bound = float(line.split(self.__data_separator)[1])
continue
elif i == footer_start_index + 12:
self.upper_diameter_bound = float(line.split(self.__data_separator)[1])
continue
elif i == footer_start_index + 13:
self.SOA_density = float(line.split(self.__data_separator)[1])
continue
self.sampling_time = self.scan_up_time + self.scan_down_time
data_lines.pop(-1)
# obtaining the starting time
raw_date_items = date_line.split(self.__data_separator)
raw_time_items = time_line.split(self.__data_separator)
del raw_date_items[0]
del raw_time_items[0]
raw_date = raw_date_items[(self.sample_number - 1) * 2].splitlines()[0]
raw_time = raw_time_items[(self.sample_number - 1) * 2].splitlines()[0]
self.start_time = pd.to_datetime(raw_date + &#39; &#39; + raw_time, format=r&#39;%m/%d/%y %H:%M:%S&#39;)
for line in data_lines:
items = line.split(self.__data_separator)
local_diameter_midpoint = float(items[0])
if self.lower_diameter_bound &lt;= local_diameter_midpoint and local_diameter_midpoint &lt;= self.upper_diameter_bound:
midpoints.append(local_diameter_midpoint)
items.pop(0)
counts.append(float(items[(self.sample_number - 1) * 2]))
else:
continue
self.aerosol_flow = self.aerosol_flow * 6E-4
self.SOA_density = self.SOA_density * 1E3
self.lower_diameter_bound = self.lower_diameter_bound * 1E-9
self.upper_diameter_bound = self.upper_diameter_bound * 1E-9
# Input data from file is in (nm)
return [np.array(midpoints), np.array(counts)]
def __init__(self, source_file, sample_number, data_separator = &#39;,&#39;):
## VALUES READ IN FROM DISK
#--------------------------
# Sample information
self.source_file = source_file # where the data is stored, i.e. &#34;C:/Users/tschan_d/...&#34;
self.sample_number = sample_number # sample number, i.e. 33
self.start_time = None
self.__data_separator = data_separator
self.scan_up_time = None # Time to scan up the voltage range in DMA, in (s)
self.scan_down_time = None # Time to scan down the voltage range in DMA, in(s)
self.sampling_time = None # Total time to scan voltage up and back down in DMA, in (s)
self.lower_diameter_bound = None # Lower Diameter bound of CPC, in (nm)
self.upper_diameter_bound = None # Upper Diameter bound of CPC, in (nm)
self.aerosol_flow = None # Aerosol flow, in (L/min)
self.SOA_density = None # Expected density of SOA, in (g/cm3)
# Distributions of the relevant quantities (all relative to nanometer)
data = self.__get_data()
# Getting Distribution objects
self.Count = Distribution(variable_array = np.log10(data[0]), function_array = data[1], form=&#39;log10&#39;)
self.Count.update_units(new_fct_units=1E15, new_var_units=1E-9)
self.Length = Distribution(variable_array = np.log10(data[0]), function_array = data[0]*data[1], form = &#39;log10&#39;)
self.Length.update_units(new_fct_units=1E6, new_var_units=1E-9)
self.Surface = Distribution(variable_array = np.log(data[0]), function_array = ((math.pi)* data[0] ** 2) * data[1], form = &#39;log10&#39;)
self.Surface.update_units(new_fct_units=1E-3, new_var_units=1E-9)
self.Volume = Distribution(variable_array = np.log10(data[0]),function_array = ((math.pi / 6) * data[0] ** 3) * data[1], form = &#39;log10&#39;)
self.Volume.update_units(new_fct_units=1E-12, new_var_units=1E-9)
self.Mass = Distribution(variable_array = self.Volume.var, function_array = self.Volume.fct * self.SOA_density, form=&#39;log10&#39;)</code></pre>
</details>
</dd>
</dl>
</section>
</article>
<nav id="sidebar">
<div class="toc">
<ul></ul>
</div>
<ul id="index">
<li><h3>Super-module</h3>
<ul>
<li><code><a title="defs" href="index.html">defs</a></code></li>
</ul>
</li>
<li><h3><a href="#header-classes">Classes</a></h3>
<ul>
<li>
<h4><code><a title="defs.SMPS.Distribution" href="#defs.SMPS.Distribution">Distribution</a></code></h4>
<ul class="two-column">
<li><code><a title="defs.SMPS.Distribution.integrate" href="#defs.SMPS.Distribution.integrate">integrate</a></code></li>
<li><code><a title="defs.SMPS.Distribution.mean" href="#defs.SMPS.Distribution.mean">mean</a></code></li>
<li><code><a title="defs.SMPS.Distribution.median" href="#defs.SMPS.Distribution.median">median</a></code></li>
<li><code><a title="defs.SMPS.Distribution.mode" href="#defs.SMPS.Distribution.mode">mode</a></code></li>
<li><code><a title="defs.SMPS.Distribution.transform" href="#defs.SMPS.Distribution.transform">transform</a></code></li>
<li><code><a title="defs.SMPS.Distribution.update_units" href="#defs.SMPS.Distribution.update_units">update_units</a></code></li>
<li><code><a title="defs.SMPS.Distribution.variance" href="#defs.SMPS.Distribution.variance">variance</a></code></li>
</ul>
</li>
<li>
<h4><code><a title="defs.SMPS.OFRAnalyser" href="#defs.SMPS.OFRAnalyser">OFRAnalyser</a></code></h4>
<ul class="">
<li><code><a title="defs.SMPS.OFRAnalyser.GetData" href="#defs.SMPS.OFRAnalyser.GetData">GetData</a></code></li>
</ul>
</li>
<li>
<h4><code><a title="defs.SMPS.OFRSample" href="#defs.SMPS.OFRSample">OFRSample</a></code></h4>
</li>
</ul>
</li>
</ul>
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.1</a>.</p>
</footer>
</body>
</html>