Finishing to copy all the code to .py files, now cleaning them up remains...
This commit is contained in:
1 parent
3fe4d86367
commit
29306efab7
14 files changed
+561
-1177
No files matched your search
@@ -1,159 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.SMPS import OFRAnalyser, OFRSample\n",
|
||||
"from defs.Helper import DATFile\n",
|
||||
"from defs.OzoneMonitor import OzoneAnalyser\n",
|
||||
"\n",
|
||||
"# Importing required libraries\n",
|
||||
"import numpy as np\n",
|
||||
"from pathlib import Path\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from matplotlib.dates import DateFormatter, HourLocator\n",
|
||||
"from defs.Helper import quick_plot_setup, final_plot_setup\n",
|
||||
"format = quick_plot_setup()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "0dc0db4a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"2.2289322694874717e-05\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Running some test\n",
|
||||
"\n",
|
||||
"sample = OFRSample(source_file=Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260902\\20260902_aPinene_SOA.txt\"), sample_number=20)\n",
|
||||
"print(sample.Mass.integrate())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Linking to the data\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to for SMPS data\n",
|
||||
"smps_analyser = OFRAnalyser(data_source_file = Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260902\\20260902_aPinene_SOA.txt\"),\n",
|
||||
" flow_source_file = Path(r\"Z:\\People\\David_Tschan\\OFR_SMPS\\flow_files\\20260902_SET02_EXP13_flow_file.txt\"),\n",
|
||||
" smpl_number_list = range(1, 60),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-02 09:52:00'), pd.Timestamp('2026-09-02 10:52:00')])\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to the API O3 monitor data\n",
|
||||
"ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-02_09.01.11_PC14750_API_O3.dat\"), data_name = 'ozone'),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-02 09:08:00'), pd.Timestamp('2026-09-02 11:22:00')])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "26333625",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Reading in SMPS data and writing it to disk as a csv\n",
|
||||
"smps_analyser.GetData()\n",
|
||||
"smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)\n",
|
||||
"\n",
|
||||
"# Reading in the O3 data and writing it to disk as a csv\n",
|
||||
"ozon_analyser.GetData()\n",
|
||||
"ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)\n",
|
||||
"ax_2 = plt.twinx(ax=ax_1)\n",
|
||||
"ax_1.set_zorder(0)\n",
|
||||
"ax_2.set_zorder(ax_1.get_zorder())\n",
|
||||
"\n",
|
||||
"ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth = 0.5, linestyle = '-',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.set_ylabel(r'\\ce{O3} mole fraction $\\chi_{\\ce{O3}}$ $(\\text{ppb})$')\n",
|
||||
"\n",
|
||||
"ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='blue', linestyle='-', label=r'$\\accentset{*}{m}$')\n",
|
||||
"ax_2.set_ylabel(r'Mass flux $\\accentset{*}{m}$ $(\\unit{\\kilo\\gram\\per\\second})$')\n",
|
||||
"\n",
|
||||
"ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=120000, colors='k', linestyles='--', linewidth=0.5)\n",
|
||||
"ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5)\n",
|
||||
"\n",
|
||||
"ax_1.set_xlabel(r'Time $(-)$')\n",
|
||||
"ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))\n",
|
||||
"ax_1.xaxis.set_major_locator(HourLocator())\n",
|
||||
"ax_1.set_xlim([pd.Timestamp('2026-09-02 08:45:00'), pd.Timestamp('2026-09-02 11:45:00')])\n",
|
||||
"\n",
|
||||
"lines_1, labels_1 = ax_1.get_legend_handles_labels()\n",
|
||||
"lines_2, labels_2 = ax_2.get_legend_handles_labels()\n",
|
||||
"\n",
|
||||
"ax_1.set_ylim([0, 120000])\n",
|
||||
"ax_2.set_ylim([0, 5E-09])\n",
|
||||
"\n",
|
||||
"legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')\n",
|
||||
"legend.get_frame().set_alpha(None)\n",
|
||||
"legend.get_frame().set_facecolor('white')\n",
|
||||
"legend.set_zorder(100)\n",
|
||||
"\n",
|
||||
"#plt.show()\n",
|
||||
"plt.savefig('figure' + format, dpi=400)\n",
|
||||
"plt.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "89951350",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.SMPS import OFRAnalyser, OFRSample\n",
|
||||
"from defs.Helper import DATFile\n",
|
||||
"from defs.OzoneMonitor import OzoneAnalyser\n",
|
||||
"\n",
|
||||
"# Importing required libraries\n",
|
||||
"import numpy as np\n",
|
||||
"from pathlib import Path\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from matplotlib.dates import DateFormatter, HourLocator\n",
|
||||
"from defs.Helper import quick_plot_setup, final_plot_setup\n",
|
||||
"format = quick_plot_setup()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Linking to the data\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to for SMPS data\n",
|
||||
"smps_analyser = OFRAnalyser(data_source_file = Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260903\\20260903_aPinene_SOA.txt\"),\n",
|
||||
" flow_source_file = Path(r\"Z:\\People\\David_Tschan\\OFR_SMPS\\flow_files\\20260903_SET02_EXP14_flow_file.txt\"),\n",
|
||||
" smpl_number_list = range(1, 60),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-03 15:20:00'), pd.Timestamp('2026-09-03 16:20:00')])\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to the API O3 monitor data\n",
|
||||
"ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-03_14.23.44_PC14750_API_O3.dat\"), data_name = 'ozone'),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-03 14:35:00'), pd.Timestamp('2026-09-03 16:50:00')])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "26333625",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Reading in SMPS data and writing it to disk as a csv\n",
|
||||
"smps_analyser.GetData()\n",
|
||||
"smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)\n",
|
||||
"\n",
|
||||
"# Reading in the O3 data and writing it to disk as a csv\n",
|
||||
"ozon_analyser.GetData()\n",
|
||||
"ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)\n",
|
||||
"ax_2 = plt.twinx(ax=ax_1)\n",
|
||||
"ax_1.set_zorder(0)\n",
|
||||
"ax_2.set_zorder(ax_1.get_zorder())\n",
|
||||
"\n",
|
||||
"ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth=0.5, linestyle = '-',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.set_ylabel(r'\\ce{O3} mole fraction $\\chi_{\\ce{O3}}$ $(\\text{ppb})$')\n",
|
||||
"\n",
|
||||
"ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='red', linestyle='-', label=r'$\\accentset{*}{m}$')\n",
|
||||
"ax_2.set_ylabel(r'Mass flux $\\accentset{*}{m}$ $(\\unit{\\kilo\\gram\\per\\second})$')\n",
|
||||
"\n",
|
||||
"ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=120000, colors='k', linestyles='--', linewidth=0.5)\n",
|
||||
"ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5)\n",
|
||||
"\n",
|
||||
"ax_1.set_xlabel(r'Time $(-)$')\n",
|
||||
"ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))\n",
|
||||
"ax_1.xaxis.set_major_locator(HourLocator())\n",
|
||||
"ax_1.set_xlim([pd.Timestamp('2026-09-03 14:15:00'), pd.Timestamp('2026-09-03 17:15:00')])\n",
|
||||
"\n",
|
||||
"lines_1, labels_1 = ax_1.get_legend_handles_labels()\n",
|
||||
"lines_2, labels_2 = ax_2.get_legend_handles_labels()\n",
|
||||
"\n",
|
||||
"ax_1.set_ylim([0, 120000])\n",
|
||||
"ax_2.set_ylim([0, 5E-09])\n",
|
||||
"\n",
|
||||
"legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')\n",
|
||||
"legend.get_frame().set_alpha(None)\n",
|
||||
"legend.get_frame().set_facecolor('white')\n",
|
||||
"legend.set_zorder(100)\n",
|
||||
"\n",
|
||||
"#plt.show()\n",
|
||||
"plt.savefig('figure' + format, dpi=400)\n",
|
||||
"plt.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "89951350",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.14"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.SMPS import OFRAnalyser, OFRSample\n",
|
||||
"from defs.Helper import DATFile\n",
|
||||
"from defs.OzoneMonitor import OzoneAnalyser\n",
|
||||
"\n",
|
||||
"# Importing required libraries\n",
|
||||
"import numpy as np\n",
|
||||
"from pathlib import Path\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from matplotlib.dates import DateFormatter, HourLocator\n",
|
||||
"from defs.Helper import quick_plot_setup, final_plot_setup\n",
|
||||
"format = quick_plot_setup()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Linking to the data\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to for SMPS data\n",
|
||||
"smps_analyser = OFRAnalyser(data_source_file = Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260904\\20260904_aPinene_SOA.txt\"),\n",
|
||||
" flow_source_file = Path(r\"Z:\\People\\David_Tschan\\OFR_SMPS\\flow_files\\20260904_SET02_EXP15_flow_file.txt\"),\n",
|
||||
" smpl_number_list = range(1, 60),\n",
|
||||
" on_time_interval=[pd.Timestamp('2026-09-04 13:22:00'), pd.Timestamp('2026-09-04 14:22:00')])\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to the API O3 monitor data\n",
|
||||
"ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-04_12.28.13_PC14750_API_O3.dat\"), data_name = 'ozone'),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-04 12:37:00'), pd.Timestamp('2026-09-04 14:52:00')])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "26333625",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Reading in SMPS data and writing it to disk as a csv\n",
|
||||
"smps_analyser.GetData()\n",
|
||||
"smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)\n",
|
||||
"\n",
|
||||
"# Reading in the O3 data and writing it to disk as a csv\n",
|
||||
"ozon_analyser.GetData()\n",
|
||||
"ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)\n",
|
||||
"ax_2 = plt.twinx(ax=ax_1)\n",
|
||||
"ax_1.set_zorder(0)\n",
|
||||
"ax_2.set_zorder(ax_1.get_zorder())\n",
|
||||
"\n",
|
||||
"ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth = 0.5, linestyle = '-',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.set_ylabel(r'\\ce{O3} mole fraction $\\chi_{\\ce{O3}}$ $(\\text{ppb})$')\n",
|
||||
"\n",
|
||||
"ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='blue', linestyle='-', label=r'$\\accentset{*}{m}$')\n",
|
||||
"ax_2.set_ylabel(r'Mass flux $\\accentset{*}{m}$ $(\\unit{\\kilo\\gram\\per\\second})$')\n",
|
||||
"\n",
|
||||
"ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=120000, colors='k', linestyles='--', linewidth=0.5)\n",
|
||||
"ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5)\n",
|
||||
"\n",
|
||||
"ax_1.set_xlabel(r'Time $(-)$')\n",
|
||||
"ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))\n",
|
||||
"ax_1.xaxis.set_major_locator(HourLocator())\n",
|
||||
"ax_1.set_xlim([pd.Timestamp('2026-09-04 12:15:00'), pd.Timestamp('2026-09-04 15:15:00')])\n",
|
||||
"\n",
|
||||
"lines_1, labels_1 = ax_1.get_legend_handles_labels()\n",
|
||||
"lines_2, labels_2 = ax_2.get_legend_handles_labels()\n",
|
||||
"\n",
|
||||
"ax_1.set_ylim([0, 120000])\n",
|
||||
"ax_2.set_ylim([0, 5E-09])\n",
|
||||
"\n",
|
||||
"legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')\n",
|
||||
"legend.get_frame().set_alpha(None)\n",
|
||||
"legend.get_frame().set_facecolor('white')\n",
|
||||
"legend.set_zorder(100)\n",
|
||||
"\n",
|
||||
"#plt.show()\n",
|
||||
"plt.savefig('figure' + format, dpi=400)\n",
|
||||
"plt.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "89951350",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.14"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
# Author: David Tschan
|
||||
# Institute: Paul-Scherrer Institute, Laboratory for Atmospheric Chemistry, Multiphase Chemistry Group,
|
||||
# Forschungsstrasse 111, 5232 Villigen PSI, Switzerland
|
||||
# Role: Master Student
|
||||
# License: n/a
|
||||
# Date: 2026
|
||||
|
||||
### ----------------------------------------------------------------------------------------------------------------------------------- ###
|
||||
### IMPORTS AND CONFIGURATIONS
|
||||
|
||||
# Bookkeeping to store figure in correct place
|
||||
import pathlib
|
||||
import os
|
||||
os.chdir(pathlib.Path(__file__).parents[0])
|
||||
|
||||
# Imports from own modules
|
||||
from defs.SMPS import OFRAnalyser, OFRSample
|
||||
from defs.Helper import DATFile, quick_plot_setup, final_plot_setup
|
||||
from defs.OzoneMonitor import OzoneAnalyser
|
||||
|
||||
# Imports from other modueles
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.dates import DateFormatter, HourLocator
|
||||
|
||||
### ----------------------------------------------------------------------------------------------------------------------------------- ###
|
||||
### analysis.py
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
# Setting the output format
|
||||
format = final_plot_setup()
|
||||
|
||||
# Linking to the data
|
||||
|
||||
# Specify the source file paths to for SMPS data
|
||||
smps_analyser = OFRAnalyser(data_source_file = Path(r"Z:\Data\SMPS\processed\2026\09_September\20260904\20260904_aPinene_SOA.txt"),
|
||||
flow_source_file = Path(r"Z:\People\David_Tschan\OFR_SMPS\flow_files\20260904_SET02_EXP15_flow_file.txt"),
|
||||
smpl_number_list = range(1, 60),
|
||||
on_time_interval=[pd.Timestamp('2026-09-04 13:22:00'), pd.Timestamp('2026-09-04 14:22:00')])
|
||||
|
||||
# Specify the source file paths to the API O3 monitor data
|
||||
ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r"Z:\Data\API_O3\2026\09_September\2026-09-04_12.28.13_PC14750_API_O3.dat"), data_name = 'ozone'),
|
||||
on_time_interval = [pd.Timestamp('2026-09-04 12:37:00'), pd.Timestamp('2026-09-04 14:52:00')])
|
||||
|
||||
# Reading in SMPS data and writing it to disk as a csv
|
||||
smps_analyser.GetData()
|
||||
smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)
|
||||
|
||||
# Reading in the O3 data and writing it to disk as a csv
|
||||
ozon_analyser.GetData()
|
||||
ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)
|
||||
|
||||
# Creating figure
|
||||
|
||||
fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))
|
||||
ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)
|
||||
ax_2 = plt.twinx(ax=ax_1)
|
||||
ax_1.set_zorder(0)
|
||||
ax_2.set_zorder(ax_1.get_zorder())
|
||||
|
||||
ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth = 0.5, linestyle = '-',label=r'$\chi_{\ce{O3}}$')
|
||||
ax_1.set_ylabel(r'\ce{O3} mole fraction $\chi_{\ce{O3}}$ $(\text{ppb})$')
|
||||
|
||||
ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='blue', linestyle='-', label=r'$\accentset{*}{m}$')
|
||||
ax_2.set_ylabel(r'Mass flux $\accentset{*}{m}$ $(\unit{\kilo\gram\per\second})$')
|
||||
|
||||
ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=120000, colors='k', linestyles='--', linewidth=0.5)
|
||||
ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5)
|
||||
|
||||
ax_1.set_xlabel(r'Time $(-)$')
|
||||
ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))
|
||||
ax_1.xaxis.set_major_locator(HourLocator())
|
||||
ax_1.set_xlim([pd.Timestamp('2026-09-04 12:15:00'), pd.Timestamp('2026-09-04 15:15:00')])
|
||||
|
||||
lines_1, labels_1 = ax_1.get_legend_handles_labels()
|
||||
lines_2, labels_2 = ax_2.get_legend_handles_labels()
|
||||
|
||||
ax_1.set_ylim([0, 120000])
|
||||
ax_2.set_ylim([0, 5E-09])
|
||||
|
||||
legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')
|
||||
legend.get_frame().set_alpha(None)
|
||||
legend.get_frame().set_facecolor('white')
|
||||
legend.set_zorder(100)
|
||||
|
||||
#plt.show()
|
||||
plt.savefig('figure' + format, dpi=400)
|
||||
plt.close()
|
||||
@@ -1,181 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.SMPS import OFRAnalyser\n",
|
||||
"from defs.Helper import DATFile\n",
|
||||
"from defs.OzoneMonitor import OzoneAnalyser\n",
|
||||
"\n",
|
||||
"# Importing required libraries\n",
|
||||
"import numpy as np\n",
|
||||
"from pathlib import Path\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from defs.Helper import quick_plot_setup\n",
|
||||
"format = quick_plot_setup()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Linking to the data\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to for SMPS data for the different filters used\n",
|
||||
"smps_analyser_01 = OFRAnalyser(data_source_file = Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260903\\20260903_aPinene_SOA.txt\"),\n",
|
||||
" flow_source_file = Path(r\"Z:\\People\\David_Tschan\\OFR_SMPS\\flow_files\\20260903_SET02_EXP14_flow_file.txt\"),\n",
|
||||
" smpl_number_list = range(1, 60),\n",
|
||||
" on_time_interval=[pd.Timestamp('2026-09-03 15:20:00'), pd.Timestamp('2026-09-03 16:20:00')])\n",
|
||||
"smps_analyser_02 = OFRAnalyser(data_source_file = Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260904\\20260904_aPinene_SOA.txt\"),\n",
|
||||
" flow_source_file = Path(r\"Z:\\People\\David_Tschan\\OFR_SMPS\\flow_files\\20260904_SET02_EXP15_flow_file.txt\"),\n",
|
||||
" smpl_number_list = range(1, 60),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-04 13:22:00'), pd.Timestamp('2026-09-04 14:22:00')])\n",
|
||||
"smps_analyser_03 = OFRAnalyser(data_source_file = Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260910\\20260910_aPinene_SOA.txt\"),\n",
|
||||
" flow_source_file = Path(r\"Z:\\People\\David_Tschan\\OFR_SMPS\\flow_files\\20260910_SET02_EXP16_flow_file.txt\"),\n",
|
||||
" smpl_number_list = range(1, 60),\n",
|
||||
" on_time_interval=[pd.Timestamp('2026-09-10 15:42:00'), pd.Timestamp('2026-09-10 16:42:00')])\n",
|
||||
"# Specify the source file paths to for SMPS data\n",
|
||||
"smps_analyser_04 = OFRAnalyser(data_source_file = Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260914\\20260914_aPinene_SOA.txt\"),\n",
|
||||
" flow_source_file = Path(r\"Z:\\People\\David_Tschan\\OFR_SMPS\\flow_files\\20260914_SET02_EXP17_flow_file.txt\"),\n",
|
||||
" smpl_number_list = range(1, 60),\n",
|
||||
" on_time_interval=[pd.Timestamp('2026-09-14 09:45:00'), pd.Timestamp('2026-09-14 10:45:00')])\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to the API O3 monitor data for the different filters used\n",
|
||||
"ozon_analyser_01 = OzoneAnalyser(file = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-03_14.23.44_PC14750_API_O3.dat\"), data_name = 'ozone'),\n",
|
||||
" on_time_interval=None)\n",
|
||||
"ozon_analyser_02 = OzoneAnalyser(file = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-04_12.28.13_PC14750_API_O3.dat\"), data_name = 'ozone'),\n",
|
||||
" on_time_interval=None)\n",
|
||||
"ozon_analyser_03 = OzoneAnalyser(file = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-10_14.43.47_PC14750_API_O3.dat\"), data_name = 'ozone'),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-10 15:00:00'), pd.Timestamp('2026-09-04 17:12:00')])\n",
|
||||
"ozon_analyser_04 = OzoneAnalyser(file = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-14_08.48.31_PC14750_API_O3.dat\"), data_name = 'ozone'),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-14 09:00:00'), pd.Timestamp('2026-09-14 11:15:00')])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "f090dba3",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Reading in SMPS data\n",
|
||||
"\n",
|
||||
"for smps_analyser, ozon_analyser in zip([smps_analyser_01, smps_analyser_02, smps_analyser_03, smps_analyser_04], [ozon_analyser_01, ozon_analyser_02, ozon_analyser_03, ozon_analyser_04]):\n",
|
||||
"\n",
|
||||
" smps_analyser.GetData()\n",
|
||||
" ozon_analyser.GetData()\n",
|
||||
"\n",
|
||||
" ozon_analyser.AverageWithSMPS(smps_analyser = smps_analyser, cut_edges = 2, subtract_baseline = ['yes', 1], normalise_flow=False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"# space for figure: 18 cm (text width), therefore we can use 9 cm for a figure.\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)\n",
|
||||
"\n",
|
||||
"ax.plot(ozon_analyser_01.averaged_data.values[:, 0] / 1000,\n",
|
||||
" ozon_analyser_01.averaged_data.values[:, 1],\n",
|
||||
" color = 'red',\n",
|
||||
" linewidth = 0.5,\n",
|
||||
" linestyle = ':',\n",
|
||||
" marker = 'o',\n",
|
||||
" markersize = 2.5,\n",
|
||||
" markerfacecolor = 'red',\n",
|
||||
" label = r'Set 2 Exp. 14')\n",
|
||||
"\n",
|
||||
"ax.plot(ozon_analyser_02.averaged_data.values[:, 0] / 1000,\n",
|
||||
" ozon_analyser_02.averaged_data.values[:, 1],\n",
|
||||
" color = 'blue',\n",
|
||||
" linewidth = 0.5,\n",
|
||||
" linestyle = ':',\n",
|
||||
" marker = 'd',\n",
|
||||
" markersize = 4,\n",
|
||||
" markerfacecolor = 'blue',\n",
|
||||
" label = 'Set 2 Exp. 15')\n",
|
||||
"\n",
|
||||
"ax.plot(ozon_analyser_03.averaged_data.values[:, 0] / 1000,\n",
|
||||
" ozon_analyser_03.averaged_data.values[:, 1],\n",
|
||||
" color = 'green',\n",
|
||||
" linewidth = 0.5,\n",
|
||||
" linestyle = ':',\n",
|
||||
" marker = 's',\n",
|
||||
" markersize = 2.5,\n",
|
||||
" markerfacecolor = 'green',\n",
|
||||
" label = 'Set 2 Exp. 16')\n",
|
||||
"ax.plot(ozon_analyser_04.averaged_data.values[:, 0] / 1000,\n",
|
||||
" ozon_analyser_04.averaged_data.values[:, 1],\n",
|
||||
" color = 'darkorange',\n",
|
||||
" linewidth = 0.5,\n",
|
||||
" linestyle = ':',\n",
|
||||
" marker = '^',\n",
|
||||
" markersize = 4,\n",
|
||||
" markerfacecolor = 'darkorange',\n",
|
||||
" label = 'Set 2 Exp. 17')\n",
|
||||
"\n",
|
||||
"#ax.set_yscale('log')\n",
|
||||
"\n",
|
||||
"ax.set_xlabel(r'Deviation from $\\ce{O3}$ baseline $\\Delta\\chi_{\\ce{O3}}$ $(\\unit{\\ppm})$')\n",
|
||||
"ax.set_ylabel(r'Mass flux $\\accentset{*}{m}$ $(\\unit{\\kilo\\gram\\per\\second})$')\n",
|
||||
"\n",
|
||||
"#ax.set_ylim([0, 70000])\n",
|
||||
"ax.set_ylim([1E-9, 5E-09])\n",
|
||||
"#ax.set_xscale('log')\n",
|
||||
"ax.set_xlim([2, 14])\n",
|
||||
"\n",
|
||||
"ax.legend(loc='upper right')\n",
|
||||
"\n",
|
||||
"#plt.show()\n",
|
||||
"plt.savefig('figure' + format, dpi=400)\n",
|
||||
"plt.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "89951350",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.14"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
# Author: David Tschan
|
||||
# Institute: Paul-Scherrer Institute, Laboratory for Atmospheric Chemistry, Multiphase Chemistry Group,
|
||||
# Forschungsstrasse 111, 5232 Villigen PSI, Switzerland
|
||||
# Role: Master Student
|
||||
# License: n/a
|
||||
# Date: 2026
|
||||
|
||||
### ----------------------------------------------------------------------------------------------------------------------------------- ###
|
||||
### IMPORTS AND CONFIGURATIONS
|
||||
|
||||
# Importing custom code
|
||||
from defs.SMPS import OFRAnalyser
|
||||
from defs.Helper import DATFile
|
||||
from defs.OzoneMonitor import OzoneAnalyser
|
||||
|
||||
# Importing required libraries
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
|
||||
# Importing libraries required for plotting and exporting
|
||||
import matplotlib.pyplot as plt
|
||||
from defs.Helper import quick_plot_setup
|
||||
format = quick_plot_setup()
|
||||
|
||||
# Linking to the data
|
||||
|
||||
# Specify the source file paths to for SMPS data for the different filters used
|
||||
smps_analyser_01 = OFRAnalyser(data_source_file = Path(r"Z:\Data\SMPS\processed\2026\09_September\20260903\20260903_aPinene_SOA.txt"),
|
||||
flow_source_file = Path(r"Z:\People\David_Tschan\OFR_SMPS\flow_files\20260903_SET02_EXP14_flow_file.txt"),
|
||||
smpl_number_list = range(1, 60),
|
||||
on_time_interval=[pd.Timestamp('2026-09-03 15:20:00'), pd.Timestamp('2026-09-03 16:20:00')])
|
||||
smps_analyser_02 = OFRAnalyser(data_source_file = Path(r"Z:\Data\SMPS\processed\2026\09_September\20260904\20260904_aPinene_SOA.txt"),
|
||||
flow_source_file = Path(r"Z:\People\David_Tschan\OFR_SMPS\flow_files\20260904_SET02_EXP15_flow_file.txt"),
|
||||
smpl_number_list = range(1, 60),
|
||||
on_time_interval = [pd.Timestamp('2026-09-04 13:22:00'), pd.Timestamp('2026-09-04 14:22:00')])
|
||||
smps_analyser_03 = OFRAnalyser(data_source_file = Path(r"Z:\Data\SMPS\processed\2026\09_September\20260910\20260910_aPinene_SOA.txt"),
|
||||
flow_source_file = Path(r"Z:\People\David_Tschan\OFR_SMPS\flow_files\20260910_SET02_EXP16_flow_file.txt"),
|
||||
smpl_number_list = range(1, 60),
|
||||
on_time_interval=[pd.Timestamp('2026-09-10 15:42:00'), pd.Timestamp('2026-09-10 16:42:00')])
|
||||
# Specify the source file paths to for SMPS data
|
||||
smps_analyser_04 = OFRAnalyser(data_source_file = Path(r"Z:\Data\SMPS\processed\2026\09_September\20260914\20260914_aPinene_SOA.txt"),
|
||||
flow_source_file = Path(r"Z:\People\David_Tschan\OFR_SMPS\flow_files\20260914_SET02_EXP17_flow_file.txt"),
|
||||
smpl_number_list = range(1, 60),
|
||||
on_time_interval=[pd.Timestamp('2026-09-14 09:45:00'), pd.Timestamp('2026-09-14 10:45:00')])
|
||||
|
||||
# Specify the source file paths to the API O3 monitor data for the different filters used
|
||||
ozon_analyser_01 = OzoneAnalyser(file = DATFile(file = Path(r"Z:\Data\API_O3\2026\09_September\2026-09-03_14.23.44_PC14750_API_O3.dat"), data_name = 'ozone'),
|
||||
on_time_interval=None)
|
||||
ozon_analyser_02 = OzoneAnalyser(file = DATFile(file = Path(r"Z:\Data\API_O3\2026\09_September\2026-09-04_12.28.13_PC14750_API_O3.dat"), data_name = 'ozone'),
|
||||
on_time_interval=None)
|
||||
ozon_analyser_03 = OzoneAnalyser(file = DATFile(file = Path(r"Z:\Data\API_O3\2026\09_September\2026-09-10_14.43.47_PC14750_API_O3.dat"), data_name = 'ozone'),
|
||||
on_time_interval = [pd.Timestamp('2026-09-10 15:00:00'), pd.Timestamp('2026-09-04 17:12:00')])
|
||||
ozon_analyser_04 = OzoneAnalyser(file = DATFile(file = Path(r"Z:\Data\API_O3\2026\09_September\2026-09-14_08.48.31_PC14750_API_O3.dat"), data_name = 'ozone'),
|
||||
on_time_interval = [pd.Timestamp('2026-09-14 09:00:00'), pd.Timestamp('2026-09-14 11:15:00')])
|
||||
|
||||
# Reading in SMPS data
|
||||
|
||||
for smps_analyser, ozon_analyser in zip([smps_analyser_01, smps_analyser_02, smps_analyser_03, smps_analyser_04], [ozon_analyser_01, ozon_analyser_02, ozon_analyser_03, ozon_analyser_04]):
|
||||
|
||||
smps_analyser.GetData()
|
||||
ozon_analyser.GetData()
|
||||
|
||||
ozon_analyser.AverageWithSMPS(smps_analyser = smps_analyser, cut_edges = 2, subtract_baseline = ['yes', 1], normalise_flow=False)
|
||||
|
||||
# Creating figure
|
||||
# space for figure: 18 cm (text width), therefore we can use 9 cm for a figure.
|
||||
|
||||
fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))
|
||||
ax = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)
|
||||
|
||||
ax.plot(ozon_analyser_01.averaged_data.values[:, 0] / 1000,
|
||||
ozon_analyser_01.averaged_data.values[:, 1],
|
||||
color = 'red',
|
||||
linewidth = 0.5,
|
||||
linestyle = ':',
|
||||
marker = 'o',
|
||||
markersize = 2.5,
|
||||
markerfacecolor = 'red',
|
||||
label = r'Set 2 Exp. 14')
|
||||
|
||||
ax.plot(ozon_analyser_02.averaged_data.values[:, 0] / 1000,
|
||||
ozon_analyser_02.averaged_data.values[:, 1],
|
||||
color = 'blue',
|
||||
linewidth = 0.5,
|
||||
linestyle = ':',
|
||||
marker = 'd',
|
||||
markersize = 4,
|
||||
markerfacecolor = 'blue',
|
||||
label = 'Set 2 Exp. 15')
|
||||
|
||||
ax.plot(ozon_analyser_03.averaged_data.values[:, 0] / 1000,
|
||||
ozon_analyser_03.averaged_data.values[:, 1],
|
||||
color = 'green',
|
||||
linewidth = 0.5,
|
||||
linestyle = ':',
|
||||
marker = 's',
|
||||
markersize = 2.5,
|
||||
markerfacecolor = 'green',
|
||||
label = 'Set 2 Exp. 16')
|
||||
ax.plot(ozon_analyser_04.averaged_data.values[:, 0] / 1000,
|
||||
ozon_analyser_04.averaged_data.values[:, 1],
|
||||
color = 'darkorange',
|
||||
linewidth = 0.5,
|
||||
linestyle = ':',
|
||||
marker = '^',
|
||||
markersize = 4,
|
||||
markerfacecolor = 'darkorange',
|
||||
label = 'Set 2 Exp. 17')
|
||||
|
||||
#ax.set_yscale('log')
|
||||
|
||||
ax.set_xlabel(r'Deviation from $\ce{O3}$ baseline $\Delta\chi_{\ce{O3}}$ $(\unit{\ppm})$')
|
||||
ax.set_ylabel(r'Mass flux $\accentset{*}{m}$ $(\unit{\kilo\gram\per\second})$')
|
||||
|
||||
#ax.set_ylim([0, 70000])
|
||||
ax.set_ylim([1E-9, 5E-09])
|
||||
#ax.set_xscale('log')
|
||||
ax.set_xlim([2, 14])
|
||||
|
||||
ax.legend(loc='upper right')
|
||||
|
||||
#plt.show()
|
||||
plt.savefig('figure' + format, dpi=400)
|
||||
plt.close()
|
||||
@@ -1,138 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.SMPS import OFRAnalyser, OFRSample\n",
|
||||
"from defs.Helper import DATFile\n",
|
||||
"from defs.OzoneMonitor import OzoneAnalyser\n",
|
||||
"\n",
|
||||
"# Importing required libraries\n",
|
||||
"import numpy as np\n",
|
||||
"from pathlib import Path\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from matplotlib.dates import DateFormatter, HourLocator\n",
|
||||
"from defs.Helper import quick_plot_setup, final_plot_setup\n",
|
||||
"format = quick_plot_setup()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Linking to the data\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to for SMPS data\n",
|
||||
"smps_analyser = OFRAnalyser(data_source_file = Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260910\\20260910_aPinene_SOA.txt\"),\n",
|
||||
" flow_source_file = Path(r\"Z:\\People\\David_Tschan\\OFR_SMPS\\flow_files\\20260910_SET02_EXP16_flow_file.txt\"),\n",
|
||||
" smpl_number_list = range(1, 60),\n",
|
||||
" on_time_interval=[pd.Timestamp('2026-09-10 15:42:00'), pd.Timestamp('2026-09-10 16:42:00')])\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to the API O3 monitor data\n",
|
||||
"ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-10_14.43.47_PC14750_API_O3.dat\"), data_name = 'ozone'),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-10 15:00:00'), pd.Timestamp('2026-09-04 17:12:00')])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "26333625",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Reading in SMPS data and writing it to disk as a csv\n",
|
||||
"smps_analyser.GetData()\n",
|
||||
"smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)\n",
|
||||
"\n",
|
||||
"# Reading in the O3 data and writing it to disk as a csv\n",
|
||||
"ozon_analyser.GetData()\n",
|
||||
"ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)\n",
|
||||
"ax_2 = plt.twinx(ax=ax_1)\n",
|
||||
"ax_1.set_zorder(0)\n",
|
||||
"ax_2.set_zorder(ax_1.get_zorder())\n",
|
||||
"\n",
|
||||
"ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth = 0.5, linestyle = '-',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.set_ylabel(r'\\ce{O3} mole fraction $\\chi_{\\ce{O3}}$ $(\\text{ppb})$')\n",
|
||||
"\n",
|
||||
"ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='green', linestyle='-', label=r'$\\accentset{*}{m}$')\n",
|
||||
"ax_2.set_ylabel(r'Mass flux $\\accentset{*}{m}$ $(\\unit{\\kilo\\gram\\per\\second})$')\n",
|
||||
"\n",
|
||||
"ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=120000, colors='k', linestyles='--', linewidth=0.5)\n",
|
||||
"ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5)\n",
|
||||
"\n",
|
||||
"ax_1.set_xlabel(r'Time $(-)$')\n",
|
||||
"ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))\n",
|
||||
"ax_1.xaxis.set_major_locator(HourLocator())\n",
|
||||
"ax_1.set_xlim([pd.Timestamp('2026-09-10 14:45:00'), pd.Timestamp('2026-09-10 17:45:00')])\n",
|
||||
"\n",
|
||||
"lines_1, labels_1 = ax_1.get_legend_handles_labels()\n",
|
||||
"lines_2, labels_2 = ax_2.get_legend_handles_labels()\n",
|
||||
"\n",
|
||||
"ax_1.set_ylim([0, 120000])\n",
|
||||
"ax_2.set_ylim([0, 5E-09])\n",
|
||||
"\n",
|
||||
"legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')\n",
|
||||
"legend.get_frame().set_alpha(None)\n",
|
||||
"legend.get_frame().set_facecolor('white')\n",
|
||||
"legend.set_zorder(100)\n",
|
||||
"\n",
|
||||
"#plt.show()\n",
|
||||
"plt.savefig('figure' + format, dpi=400)\n",
|
||||
"plt.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "89951350",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.14"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
# Author: David Tschan
|
||||
# Institute: Paul-Scherrer Institute, Laboratory for Atmospheric Chemistry, Multiphase Chemistry Group,
|
||||
# Forschungsstrasse 111, 5232 Villigen PSI, Switzerland
|
||||
# Role: Master Student
|
||||
# License: n/a
|
||||
# Date: 2026
|
||||
|
||||
### ----------------------------------------------------------------------------------------------------------------------------------- ###
|
||||
### IMPORTS AND CONFIGURATIONS
|
||||
|
||||
# Importing custom code
|
||||
from defs.SMPS import OFRAnalyser, OFRSample
|
||||
from defs.Helper import DATFile
|
||||
from defs.OzoneMonitor import OzoneAnalyser
|
||||
|
||||
# Importing required libraries
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
|
||||
# Importing libraries required for plotting and exporting
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.dates import DateFormatter, HourLocator
|
||||
from defs.Helper import quick_plot_setup, final_plot_setup
|
||||
format = quick_plot_setup()
|
||||
|
||||
# Linking to the data
|
||||
|
||||
# Specify the source file paths to for SMPS data
|
||||
smps_analyser = OFRAnalyser(data_source_file = Path(r"Z:\Data\SMPS\processed\2026\09_September\20260910\20260910_aPinene_SOA.txt"),
|
||||
flow_source_file = Path(r"Z:\People\David_Tschan\OFR_SMPS\flow_files\20260910_SET02_EXP16_flow_file.txt"),
|
||||
smpl_number_list = range(1, 60),
|
||||
on_time_interval=[pd.Timestamp('2026-09-10 15:42:00'), pd.Timestamp('2026-09-10 16:42:00')])
|
||||
|
||||
# Specify the source file paths to the API O3 monitor data
|
||||
ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r"Z:\Data\API_O3\2026\09_September\2026-09-10_14.43.47_PC14750_API_O3.dat"), data_name = 'ozone'),
|
||||
on_time_interval = [pd.Timestamp('2026-09-10 15:00:00'), pd.Timestamp('2026-09-04 17:12:00')])
|
||||
|
||||
# Reading in SMPS data and writing it to disk as a csv
|
||||
smps_analyser.GetData()
|
||||
smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)
|
||||
|
||||
# Reading in the O3 data and writing it to disk as a csv
|
||||
ozon_analyser.GetData()
|
||||
ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)
|
||||
|
||||
# Creating figure
|
||||
|
||||
fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))
|
||||
ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)
|
||||
ax_2 = plt.twinx(ax=ax_1)
|
||||
ax_1.set_zorder(0)
|
||||
ax_2.set_zorder(ax_1.get_zorder())
|
||||
|
||||
ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth = 0.5, linestyle = '-',label=r'$\chi_{\ce{O3}}$')
|
||||
ax_1.set_ylabel(r'\ce{O3} mole fraction $\chi_{\ce{O3}}$ $(\text{ppb})$')
|
||||
|
||||
ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='green', linestyle='-', label=r'$\accentset{*}{m}$')
|
||||
ax_2.set_ylabel(r'Mass flux $\accentset{*}{m}$ $(\unit{\kilo\gram\per\second})$')
|
||||
|
||||
ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=120000, colors='k', linestyles='--', linewidth=0.5)
|
||||
ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5)
|
||||
|
||||
ax_1.set_xlabel(r'Time $(-)$')
|
||||
ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))
|
||||
ax_1.xaxis.set_major_locator(HourLocator())
|
||||
ax_1.set_xlim([pd.Timestamp('2026-09-10 14:45:00'), pd.Timestamp('2026-09-10 17:45:00')])
|
||||
|
||||
lines_1, labels_1 = ax_1.get_legend_handles_labels()
|
||||
lines_2, labels_2 = ax_2.get_legend_handles_labels()
|
||||
|
||||
ax_1.set_ylim([0, 120000])
|
||||
ax_2.set_ylim([0, 5E-09])
|
||||
|
||||
legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')
|
||||
legend.get_frame().set_alpha(None)
|
||||
legend.get_frame().set_facecolor('white')
|
||||
legend.set_zorder(100)
|
||||
|
||||
#plt.show()
|
||||
plt.savefig('figure' + format, dpi=400)
|
||||
plt.close()
|
||||
@@ -1,138 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.SMPS import OFRAnalyser, OFRSample\n",
|
||||
"from defs.Helper import DATFile\n",
|
||||
"from defs.OzoneMonitor import OzoneAnalyser\n",
|
||||
"\n",
|
||||
"# Importing required libraries\n",
|
||||
"import numpy as np\n",
|
||||
"from pathlib import Path\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from matplotlib.dates import DateFormatter, HourLocator\n",
|
||||
"from defs.Helper import quick_plot_setup, final_plot_setup\n",
|
||||
"format = quick_plot_setup()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Linking to the data\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to for SMPS data\n",
|
||||
"smps_analyser = OFRAnalyser(data_source_file = Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260914\\20260914_aPinene_SOA.txt\"),\n",
|
||||
" flow_source_file = Path(r\"Z:\\People\\David_Tschan\\OFR_SMPS\\flow_files\\20260914_SET02_EXP17_flow_file.txt\"),\n",
|
||||
" smpl_number_list = range(1, 60),\n",
|
||||
" on_time_interval=[pd.Timestamp('2026-09-14 09:45:00'), pd.Timestamp('2026-09-14 10:45:00')])\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to the API O3 monitor data\n",
|
||||
"ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-14_08.48.31_PC14750_API_O3.dat\"), data_name = 'ozone'),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-14 09:00:00'), pd.Timestamp('2026-09-14 11:15:00')])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "26333625",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Reading in SMPS data and writing it to disk as a csv\n",
|
||||
"smps_analyser.GetData()\n",
|
||||
"smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)\n",
|
||||
"\n",
|
||||
"# Reading in the O3 data and writing it to disk as a csv\n",
|
||||
"ozon_analyser.GetData()\n",
|
||||
"ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)\n",
|
||||
"ax_2 = plt.twinx(ax=ax_1)\n",
|
||||
"ax_1.set_zorder(0)\n",
|
||||
"ax_2.set_zorder(ax_1.get_zorder())\n",
|
||||
"\n",
|
||||
"ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linestyle = '-', linewidth = 0.5,label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.set_ylabel(r'\\ce{O3} mole fraction $\\chi_{\\ce{O3}}$ $(\\text{ppb})$')\n",
|
||||
"\n",
|
||||
"ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='darkorange', linestyle='-', label=r'$\\accentset{*}{m}$')\n",
|
||||
"ax_2.set_ylabel(r'Mass flux $\\accentset{*}{m}$ $(\\unit{\\kilo\\gram\\per\\second})$')\n",
|
||||
"\n",
|
||||
"ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=120000, colors='k', linestyles='--', linewidth=0.5)\n",
|
||||
"ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5)\n",
|
||||
"\n",
|
||||
"ax_1.set_xlabel(r'Time $(-)$')\n",
|
||||
"ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))\n",
|
||||
"ax_1.xaxis.set_major_locator(HourLocator())\n",
|
||||
"ax_1.set_xlim([pd.Timestamp('2026-09-14 08:45:00'), pd.Timestamp('2026-09-14 11:45:00')])\n",
|
||||
"\n",
|
||||
"lines_1, labels_1 = ax_1.get_legend_handles_labels()\n",
|
||||
"lines_2, labels_2 = ax_2.get_legend_handles_labels()\n",
|
||||
"\n",
|
||||
"ax_1.set_ylim([0, 120000])\n",
|
||||
"ax_2.set_ylim([0, 5E-09])\n",
|
||||
"\n",
|
||||
"legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')\n",
|
||||
"legend.get_frame().set_alpha(None)\n",
|
||||
"legend.get_frame().set_facecolor('white')\n",
|
||||
"legend.set_zorder(100)\n",
|
||||
"\n",
|
||||
"#plt.show()\n",
|
||||
"plt.savefig('figure' + format, dpi=400)\n",
|
||||
"plt.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "89951350",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
# Author: David Tschan
|
||||
# Institute: Paul-Scherrer Institute, Laboratory for Atmospheric Chemistry, Multiphase Chemistry Group,
|
||||
# Forschungsstrasse 111, 5232 Villigen PSI, Switzerland
|
||||
# Role: Master Student
|
||||
# License: n/a
|
||||
# Date: 2026
|
||||
|
||||
### ----------------------------------------------------------------------------------------------------------------------------------- ###
|
||||
### IMPORTS AND CONFIGURATIONS
|
||||
|
||||
# Importing custom code
|
||||
from defs.SMPS import OFRAnalyser, OFRSample
|
||||
from defs.Helper import DATFile
|
||||
from defs.OzoneMonitor import OzoneAnalyser
|
||||
|
||||
# Importing required libraries
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
|
||||
# Importing libraries required for plotting and exporting
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.dates import DateFormatter, HourLocator
|
||||
from defs.Helper import quick_plot_setup, final_plot_setup
|
||||
format = quick_plot_setup()
|
||||
|
||||
# Linking to the data
|
||||
|
||||
# Specify the source file paths to for SMPS data
|
||||
smps_analyser = OFRAnalyser(data_source_file = Path(r"Z:\Data\SMPS\processed\2026\09_September\20260914\20260914_aPinene_SOA.txt"),
|
||||
flow_source_file = Path(r"Z:\People\David_Tschan\OFR_SMPS\flow_files\20260914_SET02_EXP17_flow_file.txt"),
|
||||
smpl_number_list = range(1, 60),
|
||||
on_time_interval=[pd.Timestamp('2026-09-14 09:45:00'), pd.Timestamp('2026-09-14 10:45:00')])
|
||||
|
||||
# Specify the source file paths to the API O3 monitor data
|
||||
ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r"Z:\Data\API_O3\2026\09_September\2026-09-14_08.48.31_PC14750_API_O3.dat"), data_name = 'ozone'),
|
||||
on_time_interval = [pd.Timestamp('2026-09-14 09:00:00'), pd.Timestamp('2026-09-14 11:15:00')])
|
||||
# Reading in SMPS data and writing it to disk as a csv
|
||||
smps_analyser.GetData()
|
||||
smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)
|
||||
|
||||
# Reading in the O3 data and writing it to disk as a csv
|
||||
ozon_analyser.GetData()
|
||||
ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)
|
||||
|
||||
# Creating figure
|
||||
|
||||
fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))
|
||||
ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)
|
||||
ax_2 = plt.twinx(ax=ax_1)
|
||||
ax_1.set_zorder(0)
|
||||
ax_2.set_zorder(ax_1.get_zorder())
|
||||
|
||||
ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linestyle = '-', linewidth = 0.5,label=r'$\chi_{\ce{O3}}$')
|
||||
ax_1.set_ylabel(r'\ce{O3} mole fraction $\chi_{\ce{O3}}$ $(\text{ppb})$')
|
||||
|
||||
ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='darkorange', linestyle='-', label=r'$\accentset{*}{m}$')
|
||||
ax_2.set_ylabel(r'Mass flux $\accentset{*}{m}$ $(\unit{\kilo\gram\per\second})$')
|
||||
|
||||
ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=120000, colors='k', linestyles='--', linewidth=0.5)
|
||||
ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5)
|
||||
|
||||
ax_1.set_xlabel(r'Time $(-)$')
|
||||
ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))
|
||||
ax_1.xaxis.set_major_locator(HourLocator())
|
||||
ax_1.set_xlim([pd.Timestamp('2026-09-14 08:45:00'), pd.Timestamp('2026-09-14 11:45:00')])
|
||||
|
||||
lines_1, labels_1 = ax_1.get_legend_handles_labels()
|
||||
lines_2, labels_2 = ax_2.get_legend_handles_labels()
|
||||
|
||||
ax_1.set_ylim([0, 120000])
|
||||
ax_2.set_ylim([0, 5E-09])
|
||||
|
||||
legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')
|
||||
legend.get_frame().set_alpha(None)
|
||||
legend.get_frame().set_facecolor('white')
|
||||
legend.set_zorder(100)
|
||||
|
||||
#plt.show()
|
||||
plt.savefig('figure' + format, dpi=400)
|
||||
plt.close()
|
||||
@@ -1,146 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Bad value in file 'C:\\\\Users\\\\tschan_d\\\\Documents\\\\code\\\\.plotstyle\\\\final.mplstyle', line 84 ('legend.fontsize: None'): Key legend.fontsize: none is not a valid font size. Valid font sizes are xx-small, x-small, small, medium, large, x-large, xx-large, smaller, larger.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.SMPS import OFRAnalyser, OFRSample\n",
|
||||
"from defs.Helper import DATFile\n",
|
||||
"from defs.OzoneMonitor import OzoneAnalyser\n",
|
||||
"\n",
|
||||
"# Importing required libraries\n",
|
||||
"import numpy as np\n",
|
||||
"from pathlib import Path\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from matplotlib.dates import DateFormatter, HourLocator\n",
|
||||
"from defs.Helper import final_plot_setup\n",
|
||||
"format = final_plot_setup()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Linking to the data\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to for SMPS data\n",
|
||||
"smps_analyser = OFRAnalyser(data_source_file = Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260914\\20260914_Limonene_SOA.txt\"),\n",
|
||||
" flow_source_file = Path(r\"Z:\\People\\David_Tschan\\OFR_SMPS\\flow_files\\20260914_SET02_EXP18_flow_file.txt\"),\n",
|
||||
" smpl_number_list = range(1, 60),\n",
|
||||
" on_time_interval=[pd.Timestamp('2026-09-14 15:13:00'), pd.Timestamp('2026-09-14 16:13:00')])\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to the API O3 monitor data\n",
|
||||
"ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-14_14.21.46_PC14750_API_O3.dat\"), data_name = 'ozone'),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-14 14:28:00'), pd.Timestamp('2026-09-14 16:43:00')])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "26333625",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Reading in SMPS data and writing it to disk as a csv\n",
|
||||
"smps_analyser.GetData()\n",
|
||||
"smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)\n",
|
||||
"\n",
|
||||
"# Reading in the O3 data and writing it to disk as a csv\n",
|
||||
"ozon_analyser.GetData()\n",
|
||||
"ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)\n",
|
||||
"ax_2 = plt.twinx(ax=ax_1)\n",
|
||||
"ax_1.set_zorder(0)\n",
|
||||
"ax_2.set_zorder(ax_1.get_zorder())\n",
|
||||
"\n",
|
||||
"ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth = 0.5, linestyle = '-',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.set_ylabel(r'\\ce{O3} mole fraction $\\chi_{\\ce{O3}}$ $(\\text{ppb})$')\n",
|
||||
"\n",
|
||||
"ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='red', linestyle='-', label=r'$\\accentset{*}{m}$')\n",
|
||||
"ax_2.set_ylabel(r'Mass flux $\\accentset{*}{m}$ $(\\unit{\\kilo\\gram\\per\\second})$')\n",
|
||||
"\n",
|
||||
"ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=120000, colors='k', linestyles='--', linewidth=0.5, zorder=0)\n",
|
||||
"ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5, zorder=0)\n",
|
||||
"\n",
|
||||
"ax_1.set_xlabel(r'Time $(-)$')\n",
|
||||
"ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))\n",
|
||||
"ax_1.xaxis.set_major_locator(HourLocator())\n",
|
||||
"ax_1.set_xlim([pd.Timestamp('2026-09-14 14:15:00'), pd.Timestamp('2026-09-14 17:15:00')])\n",
|
||||
"\n",
|
||||
"lines_1, labels_1 = ax_1.get_legend_handles_labels()\n",
|
||||
"lines_2, labels_2 = ax_2.get_legend_handles_labels()\n",
|
||||
"\n",
|
||||
"ax_1.set_ylim([0, 120000])\n",
|
||||
"ax_2.set_ylim([0, 5E-09])\n",
|
||||
"\n",
|
||||
"legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')\n",
|
||||
"legend.get_frame().set_alpha(None)\n",
|
||||
"legend.get_frame().set_facecolor('white')\n",
|
||||
"legend.set_zorder(100)\n",
|
||||
"\n",
|
||||
"#plt.show()\n",
|
||||
"plt.savefig('figure' + format, dpi=400)\n",
|
||||
"plt.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "89951350",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.14"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
# Author: David Tschan
|
||||
# Institute: Paul-Scherrer Institute, Laboratory for Atmospheric Chemistry, Multiphase Chemistry Group,
|
||||
# Forschungsstrasse 111, 5232 Villigen PSI, Switzerland
|
||||
# Role: Master Student
|
||||
# License: n/a
|
||||
# Date: 2026
|
||||
|
||||
### ----------------------------------------------------------------------------------------------------------------------------------- ###
|
||||
### IMPORTS AND CONFIGURATIONS
|
||||
|
||||
# Importing custom code
|
||||
from defs.SMPS import OFRAnalyser, OFRSample
|
||||
from defs.Helper import DATFile
|
||||
from defs.OzoneMonitor import OzoneAnalyser
|
||||
|
||||
# Importing required libraries
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
|
||||
# Importing libraries required for plotting and exporting
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.dates import DateFormatter, HourLocator
|
||||
from defs.Helper import quick_plot_setup, final_plot_setup
|
||||
format = quick_plot_setup()
|
||||
|
||||
# Linking to the data
|
||||
|
||||
# Specify the source file paths to for SMPS data
|
||||
smps_analyser = OFRAnalyser(data_source_file = Path(r"Z:\Data\SMPS\processed\2026\09_September\20260914\20260914_Limonene_SOA.txt"),
|
||||
flow_source_file = Path(r"Z:\People\David_Tschan\OFR_SMPS\flow_files\20260914_SET02_EXP18_flow_file.txt"),
|
||||
smpl_number_list = range(1, 60),
|
||||
on_time_interval=[pd.Timestamp('2026-09-14 15:13:00'), pd.Timestamp('2026-09-14 16:13:00')])
|
||||
|
||||
# Specify the source file paths to the API O3 monitor data
|
||||
ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r"Z:\Data\API_O3\2026\09_September\2026-09-14_14.21.46_PC14750_API_O3.dat"), data_name = 'ozone'),
|
||||
on_time_interval = [pd.Timestamp('2026-09-14 14:28:00'), pd.Timestamp('2026-09-14 16:43:00')])
|
||||
|
||||
# Reading in SMPS data and writing it to disk as a csv
|
||||
smps_analyser.GetData()
|
||||
smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)
|
||||
|
||||
# Reading in the O3 data and writing it to disk as a csv
|
||||
ozon_analyser.GetData()
|
||||
ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)
|
||||
|
||||
# Creating figure
|
||||
|
||||
fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))
|
||||
ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)
|
||||
ax_2 = plt.twinx(ax=ax_1)
|
||||
ax_1.set_zorder(0)
|
||||
ax_2.set_zorder(ax_1.get_zorder())
|
||||
|
||||
ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth = 0.5, linestyle = '-',label=r'$\chi_{\ce{O3}}$')
|
||||
ax_1.set_ylabel(r'\ce{O3} mole fraction $\chi_{\ce{O3}}$ $(\text{ppb})$')
|
||||
|
||||
ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='red', linestyle='-', label=r'$\accentset{*}{m}$')
|
||||
ax_2.set_ylabel(r'Mass flux $\accentset{*}{m}$ $(\unit{\kilo\gram\per\second})$')
|
||||
|
||||
ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=120000, colors='k', linestyles='--', linewidth=0.5, zorder=0)
|
||||
ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5, zorder=0)
|
||||
|
||||
ax_1.set_xlabel(r'Time $(-)$')
|
||||
ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))
|
||||
ax_1.xaxis.set_major_locator(HourLocator())
|
||||
ax_1.set_xlim([pd.Timestamp('2026-09-14 14:15:00'), pd.Timestamp('2026-09-14 17:15:00')])
|
||||
|
||||
lines_1, labels_1 = ax_1.get_legend_handles_labels()
|
||||
lines_2, labels_2 = ax_2.get_legend_handles_labels()
|
||||
|
||||
ax_1.set_ylim([0, 120000])
|
||||
ax_2.set_ylim([0, 5E-09])
|
||||
|
||||
legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')
|
||||
legend.get_frame().set_alpha(None)
|
||||
legend.get_frame().set_facecolor('white')
|
||||
legend.set_zorder(100)
|
||||
|
||||
#plt.show()
|
||||
plt.savefig('figure' + format, dpi=400)
|
||||
plt.close()
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.SMPS import OFRAnalyser\n",
|
||||
"from defs.Helper import DATFile\n",
|
||||
"from defs.OzoneMonitor import OzoneAnalyser\n",
|
||||
"\n",
|
||||
"# Importing required libraries\n",
|
||||
"import numpy as np\n",
|
||||
"from pathlib import Path\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from matplotlib.dates import DateFormatter, HourLocator\n",
|
||||
"import matplotlib\n",
|
||||
"from defs.Helper import quick_plot_setup\n",
|
||||
"format = quick_plot_setup()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Linking to the data\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to for SMPS data\n",
|
||||
"smps_analyser = OFRAnalyser(data_source_file = Path(r\"Z:\\Data\\SMPS\\processed\\2026\\09_September\\20260915\\20260915_Limonene_01_SOA.txt\"),\n",
|
||||
" flow_source_file = Path(r\"Z:\\People\\David_Tschan\\OFR_SMPS\\flow_files\\20260915_SET02_EXP19_flow_file.txt\"),\n",
|
||||
" smpl_number_list = range(1, 60),\n",
|
||||
" on_time_interval=[pd.Timestamp('2026-09-14 15:13:00'), pd.Timestamp('2026-09-14 16:13:00')])\n",
|
||||
"\n",
|
||||
"# Specify the source file paths to the API O3 monitor data\n",
|
||||
"ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-15_08.56.00_PC14750_API_O3.dat\"), data_name = 'ozone'),\n",
|
||||
" on_time_interval = [pd.Timestamp('2026-09-14 14:28:00'), pd.Timestamp('2026-09-14 16:43:00')])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"id": "26333625",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Reading in SMPS data and writing it to disk as a csv\n",
|
||||
"smps_analyser.GetData()\n",
|
||||
"smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)\n",
|
||||
"\n",
|
||||
"# Reading in the O3 data and writing it to disk as a csv\n",
|
||||
"ozon_analyser.GetData()\n",
|
||||
"ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)\n",
|
||||
"ax_2 = plt.twinx(ax=ax_1)\n",
|
||||
"ax_1.set_zorder(0)\n",
|
||||
"ax_2.set_zorder(ax_1.get_zorder())\n",
|
||||
"\n",
|
||||
"ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth = 0.5, linestyle = '-',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.set_ylabel(r'\\ce{O3} mole fraction $\\chi_{\\ce{O3}}$ $(\\text{ppb})$')\n",
|
||||
"\n",
|
||||
"ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='darkorange', linestyle='-', label=r'$\\accentset{*}{m}$')\n",
|
||||
"ax_2.set_ylabel(r'Mass flux $\\accentset{*}{m}$ $(\\unit{\\kilo\\gram\\per\\second})$')\n",
|
||||
"\n",
|
||||
"ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=100000, colors='k', linestyles='--', linewidth=0.5, zorder=0)\n",
|
||||
"ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5, zorder=0)\n",
|
||||
"\n",
|
||||
"ax_1.set_xlabel(r'Time $(-)$')\n",
|
||||
"ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))\n",
|
||||
"ax_1.xaxis.set_major_locator(HourLocator())\n",
|
||||
"ax_1.set_xlim([pd.Timestamp('2026-09-14 14:13:00'), pd.Timestamp('2026-09-14 17:13:00')])\n",
|
||||
"\n",
|
||||
"lines_1, labels_1 = ax_1.get_legend_handles_labels()\n",
|
||||
"lines_2, labels_2 = ax_2.get_legend_handles_labels()\n",
|
||||
"\n",
|
||||
"ax_1.set_ylim([0, 100000])\n",
|
||||
"ax_2.set_ylim([0, 5E-09])\n",
|
||||
"\n",
|
||||
"legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')\n",
|
||||
"legend.get_frame().set_alpha(None)\n",
|
||||
"legend.get_frame().set_facecolor('white')\n",
|
||||
"legend.set_zorder(100)\n",
|
||||
"\n",
|
||||
"#plt.show()\n",
|
||||
"plt.savefig('figure' + format, dpi=400)\n",
|
||||
"plt.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "89951350",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
# Author: David Tschan
|
||||
# Institute: Paul-Scherrer Institute, Laboratory for Atmospheric Chemistry, Multiphase Chemistry Group,
|
||||
# Forschungsstrasse 111, 5232 Villigen PSI, Switzerland
|
||||
# Role: Master Student
|
||||
# License: n/a
|
||||
# Date: 2026
|
||||
|
||||
### ----------------------------------------------------------------------------------------------------------------------------------- ###
|
||||
### IMPORTS AND CONFIGURATIONS
|
||||
|
||||
# Importing custom code
|
||||
from defs.SMPS import OFRAnalyser, OFRSample
|
||||
from defs.Helper import DATFile
|
||||
from defs.OzoneMonitor import OzoneAnalyser
|
||||
|
||||
# Importing required libraries
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
|
||||
# Importing libraries required for plotting and exporting
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.dates import DateFormatter, HourLocator
|
||||
from defs.Helper import quick_plot_setup, final_plot_setup
|
||||
format = quick_plot_setup()
|
||||
|
||||
# Importing custom code
|
||||
from defs.SMPS import OFRAnalyser
|
||||
from defs.Helper import DATFile
|
||||
from defs.OzoneMonitor import OzoneAnalyser
|
||||
|
||||
# Importing required libraries
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
|
||||
# Importing libraries required for plotting and exporting
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.dates import DateFormatter, HourLocator
|
||||
import matplotlib
|
||||
from defs.Helper import quick_plot_setup
|
||||
format = quick_plot_setup()
|
||||
|
||||
# Linking to the data
|
||||
|
||||
# Specify the source file paths to for SMPS data
|
||||
smps_analyser = OFRAnalyser(data_source_file = Path(r"Z:\Data\SMPS\processed\2026\09_September\20260915\20260915_Limonene_01_SOA.txt"),
|
||||
flow_source_file = Path(r"Z:\People\David_Tschan\OFR_SMPS\flow_files\20260915_SET02_EXP19_flow_file.txt"),
|
||||
smpl_number_list = range(1, 60),
|
||||
on_time_interval=[pd.Timestamp('2026-09-14 15:13:00'), pd.Timestamp('2026-09-14 16:13:00')])
|
||||
|
||||
# Specify the source file paths to the API O3 monitor data
|
||||
ozon_analyser = OzoneAnalyser(file = DATFile(file = Path(r"Z:\Data\API_O3\2026\09_September\2026-09-15_08.56.00_PC14750_API_O3.dat"), data_name = 'ozone'),
|
||||
on_time_interval = [pd.Timestamp('2026-09-14 14:28:00'), pd.Timestamp('2026-09-14 16:43:00')])
|
||||
|
||||
# Reading in SMPS data and writing it to disk as a csv
|
||||
smps_analyser.GetData()
|
||||
smps_analyser.data.to_csv(path_or_buf = 'smps_data.csv', index = False)
|
||||
|
||||
# Reading in the O3 data and writing it to disk as a csv
|
||||
ozon_analyser.GetData()
|
||||
ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)
|
||||
|
||||
# Creating figure
|
||||
|
||||
fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))
|
||||
ax_1 = plt.axes([0.15, 0.2, 0.7, 0.6], frameon=True)
|
||||
ax_2 = plt.twinx(ax=ax_1)
|
||||
ax_1.set_zorder(0)
|
||||
ax_2.set_zorder(ax_1.get_zorder())
|
||||
|
||||
ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth = 0.5, linestyle = '-',label=r'$\chi_{\ce{O3}}$')
|
||||
ax_1.set_ylabel(r'\ce{O3} mole fraction $\chi_{\ce{O3}}$ $(\text{ppb})$')
|
||||
|
||||
ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='darkorange', linestyle='-', label=r'$\accentset{*}{m}$')
|
||||
ax_2.set_ylabel(r'Mass flux $\accentset{*}{m}$ $(\unit{\kilo\gram\per\second})$')
|
||||
|
||||
ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=100000, colors='k', linestyles='--', linewidth=0.5, zorder=0)
|
||||
ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=5E-09, colors='k', linestyles='-.', linewidth=0.5, zorder=0)
|
||||
|
||||
ax_1.set_xlabel(r'Time $(-)$')
|
||||
ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))
|
||||
ax_1.xaxis.set_major_locator(HourLocator())
|
||||
ax_1.set_xlim([pd.Timestamp('2026-09-14 14:13:00'), pd.Timestamp('2026-09-14 17:13:00')])
|
||||
|
||||
lines_1, labels_1 = ax_1.get_legend_handles_labels()
|
||||
lines_2, labels_2 = ax_2.get_legend_handles_labels()
|
||||
|
||||
ax_1.set_ylim([0, 100000])
|
||||
ax_2.set_ylim([0, 5E-09])
|
||||
|
||||
legend = plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')
|
||||
legend.get_frame().set_alpha(None)
|
||||
legend.get_frame().set_facecolor('white')
|
||||
legend.set_zorder(100)
|
||||
|
||||
#plt.show()
|
||||
plt.savefig('figure' + format, dpi=400)
|
||||
plt.close()
|
||||
|
||||
Reference in new issue
Block a user