Updates to structure, particularly: removing run folder, this is obsolote, as all analysis files will be stored on the server in dedicated files.

This commit is contained in:
tschan_d committed 2026-07-21 09:56:32 +02:00
1 parent d18753e3a1
commit 1ab5362d2b
7 files changed
+13 -249

No files matched your search

+7
View File
@@ -2,6 +2,8 @@
font.size: 10
text.usetex: True
text.latex.preamble: "\usepackage{arev}\usepackage{siunitx}\usepackage{mhchem}\newcommand{\der}[1]{\ensuremath{\textnormal{d}\,{#1}}}"
lines.linewidth: 0.75 # line width in points
lines.linestyle: - # solid line
# AXES AND BOX
axes.facecolor: white # axes background color
@@ -91,6 +93,11 @@ legend.handletextpad: 0.8 # the space between the legend line and legend text
legend.borderaxespad: 1.4 # the border between the axes and legend edge
legend.columnspacing: 1.0 # column separation
## PGF OUTPUTTING
#pgf.texsystem: lualatex
#pgf.rcfonts: False
#pgf.preamble: "\usepackage{unicode-math}\setmainfont{STIX Two Text}\setmathfont{STIX Two Math}\usepackage{siunitx}\usepackage{mhchem}\newcommand{\der}[1]{\ensuremath{\textnormal{d}\,{#1}}}"
#### MATPLOTLIBRC FORMAT
## DO NOT EDIT THIS FILE, MAKE A COPY FIRST
+2 -2
View File
@@ -34,7 +34,6 @@
"chat.useAgentsMdFile": false,
"chat.useClaudeMdFile": false,
"chat.useHooks": false,
"chat.sendElementsToChat.attachImages": false,
"inlineChat.askInChat": false,
"inlineChat.fixDiagnostics": false,
"python.defaultInterpreterPath": "C:/Users/tschan_d/AppData/Local/miniforge3/envs/MA/python",
@@ -55,5 +54,6 @@
"editor.rulers": [145],
"notebook.editorOptionsCustomizations": {"editor.rulers":[]},
"editor.fontSize": 16,
"jupiter.notebookFileRoot": "${workspaceFolder}/"
"jupiter.notebookFileRoot": "${workspaceFolder}/",
"workbench.browser.sendElementsToChat.attachImages": false
}
+4 -3
View File
@@ -4,10 +4,11 @@ import numpy as np
from pathlib import Path
# Path to the source file
source_file = Path(r"C:\Users\tschan_d\Documents\data_local\20260612_SET02_EXP01_full.txt")
flows_source_file = Path(r"C:\Users\tschan_d\Documents\data_local\20260612_SET02_EXP01_full_flows.txt")
source_file = Path(r"Z:\People\David_Tschan\data\OFR_SMPS\2026\processed\07_July\20260709\20260709_aPinene_SOA_full.txt")
flows_source_file = Path(r"Z:\People\David_Tschan\data\OFR_SMPS\2026\processed\07_July\20260709\20260709_aPinene_SOA_flows.txt")
# Code to debug
analyser = OFRAnalyser(data_source_file=source_file, flows_source_file=flows_source_file, sample_number_list=[33, 35])
sample_number_list = range(1, 609)
analyser = OFRAnalyser(data_source_file=source_file, flows_source_file=flows_source_file, sample_number_list=sample_number_list, data_separator=',')
analyser.GetData()
print(analyser.data)
@@ -1,244 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "36f6dc0f",
"metadata": {},
"source": [
"# OFR Analysis: File `20260723_OFR_Analysis_01.ipynb`"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8769766b",
"metadata": {},
"outputs": [],
"source": [
"# Imports\n",
"\n",
"from defs.OFR import OFRSample, OFRAnalyser\n",
"import numpy as np\n",
"from pathlib import Path\n",
"import matplotlib.pyplot as plt\n",
"plt.style.use('../../../.mplstyle')\n",
"from matplotlib.ticker import MultipleLocator\n",
"import pandas as pd\n",
"\n",
"# Specify the source file for this analysis\n",
"source_file = Path(r\"C:\\Users\\tschan_d\\Documents\\data_local\\20260612_SET02_EXP01_full.txt\")\n",
"flows_source_file = Path(r\"C:\\Users\\tschan_d\\Documents\\data_local\\20260612_SET02_EXP01_full_flows.txt\")"
]
},
{
"cell_type": "markdown",
"id": "ee2e9af5",
"metadata": {},
"source": [
"### First we plot a sample spectrum to get a feeling of what the data looks like: Careful: All Plotting requires having a functional LaTeX installation!"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "76a9b026",
"metadata": {},
"outputs": [],
"source": [
"# First load and get the data of sample 33 (arbitrary) and create a sample object\n",
"sample_number = 33\n",
"sample = OFRSample(source_file = source_file, sample_number = sample_number)\n",
"\n",
"#Plotting and saying the data\n",
"fig = plt.figure(figsize=(10,6), constrained_layout = True)\n",
"ax = fig.add_subplot(111)\n",
"ax.set_xscale('log')\n",
"ax_2 = plt.twinx(ax)\n",
"\n",
"ax.plot(np.power(10, sample.Count.var), sample.Count.fct, color='red', label=r'$\\der{N}/\\der{\\log_{10}D}$')\n",
"ax_2.plot(np.power(10, sample.Mass.var), sample.Mass.fct / 1E12, color='blue', label=r'$\\der{m}/\\der{\\log_{10}D}$')\n",
"\n",
"ax.set_title('2026-06-12 SET02/EXP01: Number- and Mass Spectra of Sample Nr. ' + str(sample_number))\n",
"ax.set_xlabel(r'Particle Diameter $D$ $(\\unit{\\meter})$')\n",
"ax.set_ylabel(r'Log Number Denisty $\\der{N}/\\der{\\log_{10}D}$ $(\\unit{\\per\\meter})$')\n",
"ax_2.set_ylabel(r'Mass Denisty $\\der{m}/\\der{\\log_{10}D}$ $(\\unit{\\kilo\\gram\\per\\cubic\\meter})$')\n",
"\n",
"#ax.set_xlim([20, 1100])\n",
"#ax.set_ylim([0, 1200000])\n",
"#ax_2.set_ylim([0, 18])\n",
"\n",
"lines_1, labels_1 = ax.get_legend_handles_labels()\n",
"lines_2, labels_2 = ax_2.get_legend_handles_labels()\n",
"\n",
"ax.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper left')\n",
"\n",
"plt.savefig(\"20260723_OFR_Analysis_01_Spectrum_Sample_\" + str(sample_number) + \".svg\", format='svg', dpi=400)"
]
},
{
"cell_type": "markdown",
"id": "041fc7b6",
"metadata": {},
"source": [
"## Now let's load the data for the entire sampling experiment and process it!"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8db19b57",
"metadata": {},
"outputs": [],
"source": [
"sample_number_list = [int(i) for i in range(1, 157)]\n",
"\n",
"analyser = OFRAnalyser(data_source_file = source_file, flows_source_file = flows_source_file, sample_number_list = sample_number_list)\n",
"analyser.GetData()\n",
"#analyser.data.to_csv(path_or_buf=r\"C:\\Users\\tschan_d\\Documents\\data_local\\data.csv\", index=False)"
]
},
{
"cell_type": "markdown",
"id": "3a2ae595",
"metadata": {},
"source": [
"We first plot the overall timeseries of total aerosol count and mass:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a4477003",
"metadata": {},
"outputs": [],
"source": [
"fig = plt.figure(figsize=(10,4), constrained_layout = True)\n",
"ax = fig.add_subplot(111)\n",
"ax_2 = plt.twinx(ax)\n",
"\n",
"ax.plot(analyser.data['Sample (-)'], analyser.data['Number (#/m^3)'], color='red', label='Number')\n",
"ax_2.plot(analyser.data['Sample (-)'], analyser.data['Mass (kg/m^3)'], color='blue', label='Mass')\n",
"\n",
"ax.set_title('2026-06-12 SET02/EXP01: Time Series of Number- and Mass Densities')\n",
"ax.set_xlabel(r'Sample $(-)$')\n",
"ax.set_ylabel(r'Number Density $N$ $(\\unit{\\per\\cubic\\meter})$')\n",
"ax_2.set_ylabel(r'Mass Density $m$ $(\\unit{\\kilo\\gram\\per\\cubic\\meter})$')\n",
"ax.xaxis.set_minor_locator(MultipleLocator(base=1, offset=0))\n",
"ax.xaxis.set_major_locator(MultipleLocator(base=10, offset=0))\n",
"\n",
"ax.set_xlim([1, 156])\n",
"#ax.set_ylim([0, 1.2E6])\n",
"#ax_2.set_ylim([0, 15])\n",
"\n",
"lines_1, labels_1 = ax.get_legend_handles_labels()\n",
"lines_2, labels_2 = ax_2.get_legend_handles_labels()\n",
"\n",
"ax.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper left')\n",
"plt.savefig(\"20260723_OFR_Analysis_01_Experiment_Timeseries_of_Densities.svg\", format='svg', dpi=400)"
]
},
{
"cell_type": "markdown",
"id": "9555beb6",
"metadata": {},
"source": [
"Clearly, something is happening at samples 25, 67, and after 105. This corresponds to shifts in the flow rates... These are read from disk and depicted below:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a5af245c",
"metadata": {},
"outputs": [],
"source": [
"fig = plt.figure(figsize=(10,2.5), constrained_layout = True)\n",
"ax = fig.add_subplot(111)\n",
"ax_2 = plt.twinx(ax=ax)\n",
"\n",
"ax.step(analyser.data['Sample (-)'], analyser.data['Ozone Flow (m^3/s)'], color='forestgreen', linestyle='-', label='Ozone')\n",
"ax_2.step(analyser.data['Sample (-)'], analyser.data['Species Flow (m^3/s)'], color='magenta', linestyle='-', label=r'$\\alpha$-Pinene')\n",
"\n",
"ax.set_title('2026-06-12 SET02/EXP01: Time Series of Flow Rates')\n",
"ax.set_xlabel(r'Sample $(-)$')\n",
"ax.set_ylabel(r'Ozone Flow Rate $(\\unit{\\cubic\\meter\\per\\second})$')\n",
"ax_2.set_ylabel(r'$\\alpha$-Pinene Flow Rate $(\\unit{\\cubic\\meter\\per\\second})$')\n",
"ax.xaxis.set_minor_locator(MultipleLocator(base=1, offset=0))\n",
"ax.xaxis.set_major_locator(MultipleLocator(base=10, offset=0))\n",
"\n",
"ax.set_xlim([1, 156])\n",
"#ax.set_ylim([0.6, 2.4])\n",
"#ax_2.set_ylim([0.0, 0.05])\n",
"\n",
"lines_1, labels_1 = ax.get_legend_handles_labels()\n",
"lines_2, labels_2 = ax_2.get_legend_handles_labels()\n",
"\n",
"ax.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper left')\n",
"\n",
"plt.savefig(\"20260723_OFR_Analysis_01_Experiment_Timeseries_of_Flow_Rates.svg\", format='svg', dpi=400)"
]
},
{
"cell_type": "markdown",
"id": "e6212394",
"metadata": {},
"source": [
"To refine the analysis, we may also consider the production rates of SOA using the integral of the SOA production rate, obtained by multiplying the concentration with the flow rate with the sampling time for each sample:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e2ae6dbb",
"metadata": {},
"outputs": [],
"source": [
"fig = plt.figure(figsize=(10,4), constrained_layout = True)\n",
"ax = fig.add_subplot(111)\n",
"ax_2 = plt.twinx(ax=ax)\n",
"\n",
"ax.step(analyser.data['Sample (-)'], analyser.data['Mass Production Rate (kg/s)'], color='blue', linestyle='-', label='Mass Production Rate')\n",
"ax_2.step(analyser.data['Sample (-)'], analyser.data['Cumulative Mass Produced (kg)'], color='magenta', linestyle='-', label=r'Cumulative Mass Produced')\n",
"\n",
"ax.set_title('2026-06-12 SET02/EXP01: Timesseries of Mass Production')\n",
"ax.set_xlabel(r'Sample $(-)$')\n",
"ax.set_ylabel(r'Mass Production Rate $(\\unit{\\kilo\\gram\\per\\second})$')\n",
"ax_2.set_ylabel(r'Cumulative Mass Produced $(\\unit{\\kilo\\gram})$')\n",
"ax.xaxis.set_minor_locator(MultipleLocator(base=1, offset=0))\n",
"ax.xaxis.set_major_locator(MultipleLocator(base=10, offset=0))\n",
"\n",
"ax.set_xlim([1, 156])\n",
"#ax.set_ylim([0.6, 2.4])\n",
"#ax_2.set_ylim([0.0, 0.05])\n",
"\n",
"lines_1, labels_1 = ax.get_legend_handles_labels()\n",
"lines_2, labels_2 = ax_2.get_legend_handles_labels()\n",
"\n",
"ax.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper left')\n",
"\n",
"plt.savefig(\"20260723_OFR_Analysis_01_Experiment_Timeseries_of_Mass_Production.svg\", format='svg', dpi=400)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "MA",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
View File
Whitespace-only changes.
Binary file not shown.
Binary file not shown.