Adapting the formatting of the figures to be consistent.
This commit is contained in:
1 parent
6e1893db82
commit
5283997dfd
8 files changed
+4734
-7335
No files matched your search
@@ -2,14 +2,15 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 17,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.OFR import OFRSample, OFRAnalyser\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",
|
||||
@@ -18,18 +19,17 @@
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from matplotlib.dates import DateFormatter\n",
|
||||
"from matplotlib.ticker import MultipleLocator\n",
|
||||
"from matplotlib.dates import DateFormatter, HourLocator\n",
|
||||
"\n",
|
||||
"# Setting style of figures and backend\n",
|
||||
"import matplotlib\n",
|
||||
"matplotlib.use('pgf')\n",
|
||||
"plt.style.use(r'C:\\Users\\tschan_d\\Documents\\code\\Master_Thesis\\.mplstyle')"
|
||||
"plt.style.use(r'C:\\Users\\tschan_d\\Documents\\code\\.mplstyle')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 18,
|
||||
"id": "a67c15f2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -60,7 +60,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 20,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -70,15 +70,17 @@
|
||||
"# 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",
|
||||
" 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 = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-02_09.01.11_PC14750_API_O3.dat\"), data_name = 'ozone')"
|
||||
"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": 5,
|
||||
"execution_count": 21,
|
||||
"id": "26333625",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -88,43 +90,42 @@
|
||||
"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.read()\n",
|
||||
"ozon_analyser.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
"ozon_analyser.GetData()\n",
|
||||
"ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 22,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54), constrained_layout = True)\n",
|
||||
"ax_1 = fig.add_subplot(111)\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax_1 = plt.axes([0.2, 0.2, 0.6, 0.6], frameon=True)\n",
|
||||
"ax_2 = plt.twinx(ax=ax_1)\n",
|
||||
"\n",
|
||||
"ax_1.plot(ozon_analyser.data['timestamp'], ozon_analyser.data['ozone'], color = 'red', linestyle = '-.',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'red', linestyle = '-.',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.set_ylabel(r'Ozone 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",
|
||||
"ozone_on_times = [pd.Timestamp('2026-09-02 09:08:00'), pd.Timestamp('2026-09-02 11:22:00')]\n",
|
||||
"voc_on_times = [pd.Timestamp('2026-09-02 09:52:00'), pd.Timestamp('2026-09-02 10:52:00')]\n",
|
||||
"ax_1.vlines(ozone_on_times, ymin=0, ymax=70000, colors='k', linestyles='--', linewidth=0.5)\n",
|
||||
"ax_2.vlines(voc_on_times, ymin=0, ymax=2E-7, colors='k', linestyles='-.', linewidth=0.5)\n",
|
||||
"ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=70000, colors='k', linestyles='--', linewidth=0.5)\n",
|
||||
"ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=2E-07, 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 12: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, 70000])\n",
|
||||
"ax_2.set_ylim([0, 2E-7])\n",
|
||||
"ax_2.set_ylim([0, 2E-07])\n",
|
||||
"\n",
|
||||
"ax_1.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')\n",
|
||||
"\n",
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,14 +2,15 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 8,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.OFR import OFRSample, OFRAnalyser\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",
|
||||
@@ -18,18 +19,17 @@
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from matplotlib.dates import DateFormatter\n",
|
||||
"from matplotlib.ticker import MultipleLocator\n",
|
||||
"from matplotlib.dates import DateFormatter, HourLocator\n",
|
||||
"\n",
|
||||
"# Setting style of figures and backend\n",
|
||||
"import matplotlib\n",
|
||||
"matplotlib.use('pgf')\n",
|
||||
"plt.style.use(r'C:\\Users\\tschan_d\\Documents\\code\\Master_Thesis\\.mplstyle')"
|
||||
"plt.style.use(r'C:\\Users\\tschan_d\\Documents\\code\\.mplstyle')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 9,
|
||||
"id": "a67c15f2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -60,7 +60,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 10,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -70,15 +70,17 @@
|
||||
"# 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",
|
||||
" 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 = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-03_14.23.44_PC14750_API_O3.dat\"), data_name = 'ozone')"
|
||||
"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": 4,
|
||||
"execution_count": 11,
|
||||
"id": "26333625",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -88,36 +90,35 @@
|
||||
"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.read()\n",
|
||||
"ozon_analyser.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
"ozon_analyser.GetData()\n",
|
||||
"ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 12,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54), constrained_layout = True)\n",
|
||||
"ax_1 = fig.add_subplot(111)\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax_1 = plt.axes([0.2, 0.2, 0.6, 0.6], frameon=True)\n",
|
||||
"ax_2 = plt.twinx(ax=ax_1)\n",
|
||||
"\n",
|
||||
"ax_1.plot(ozon_analyser.data['timestamp'], ozon_analyser.data['ozone'], color = 'red', linestyle = '-.',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'red', linestyle = '-.',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.set_ylabel(r'Ozone 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",
|
||||
"ozone_on_times = [pd.Timestamp('2026-09-03 14:35:00'), pd.Timestamp('2026-09-03 16:50:00')]\n",
|
||||
"voc_on_times = [pd.Timestamp('2026-09-03 15:20:00'), pd.Timestamp('2026-09-03 16:20:00')]\n",
|
||||
"ax_1.vlines(ozone_on_times, ymin=0, ymax=70000, colors='k', linestyles='--', linewidth=0.5)\n",
|
||||
"ax_2.vlines(voc_on_times, ymin=0, ymax=2E-7, colors='k', linestyles='-.', linewidth=0.5)\n",
|
||||
"ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=70000, colors='k', linestyles='--', linewidth=0.5)\n",
|
||||
"ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=2E-07, 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:45:00')])\n",
|
||||
"\n",
|
||||
"lines_1, labels_1 = ax_1.get_legend_handles_labels()\n",
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,14 +2,15 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 14,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.OFR import OFRSample, OFRAnalyser\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",
|
||||
@@ -18,18 +19,17 @@
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from matplotlib.dates import DateFormatter\n",
|
||||
"from matplotlib.ticker import MultipleLocator\n",
|
||||
"from matplotlib.dates import DateFormatter, HourLocator\n",
|
||||
"\n",
|
||||
"# Setting style of figures and backend\n",
|
||||
"import matplotlib\n",
|
||||
"matplotlib.use('pgf')\n",
|
||||
"plt.style.use(r'C:\\Users\\tschan_d\\Documents\\code\\Master_Thesis\\.mplstyle')"
|
||||
"plt.style.use(r'C:\\Users\\tschan_d\\Documents\\code\\.mplstyle')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 15,
|
||||
"id": "a67c15f2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -60,7 +60,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 16,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -70,15 +70,17 @@
|
||||
"# 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",
|
||||
" 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 = DATFile(file = Path(r\"Z:\\Data\\API_O3\\2026\\09_September\\2026-09-04_12.28.13_PC14750_API_O3.dat\"), data_name = 'ozone')"
|
||||
"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": 4,
|
||||
"execution_count": 17,
|
||||
"id": "26333625",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -88,43 +90,42 @@
|
||||
"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.read()\n",
|
||||
"ozon_analyser.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
"ozon_analyser.GetData()\n",
|
||||
"ozon_analyser.file.data.to_csv(path_or_buf = 'ozone_data.csv', index = False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 18,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54), constrained_layout = True)\n",
|
||||
"ax_1 = fig.add_subplot(111)\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax_1 = plt.axes([0.2, 0.2, 0.6, 0.6], frameon=True)\n",
|
||||
"ax_2 = plt.twinx(ax=ax_1)\n",
|
||||
"\n",
|
||||
"ax_1.plot(ozon_analyser.data['timestamp'], ozon_analyser.data['ozone'], color = 'red', linestyle = '-.',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'red', linestyle = '-.',label=r'$\\chi_{\\ce{O3}}$')\n",
|
||||
"ax_1.set_ylabel(r'Ozone 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",
|
||||
"ozone_on_times = [pd.Timestamp('2026-09-04 12:37:00'), pd.Timestamp('2026-09-04 14:52:00')]\n",
|
||||
"voc_on_times = [pd.Timestamp('2026-09-04 13:22:00'), pd.Timestamp('2026-09-04 14:22:00')]\n",
|
||||
"ax_1.vlines(ozone_on_times, ymin=0, ymax=70000, colors='k', linestyles='--', linewidth=0.5)\n",
|
||||
"ax_2.vlines(voc_on_times, ymin=0, ymax=2E-7, colors='k', linestyles='-.', linewidth=0.5)\n",
|
||||
"ax_1.vlines(ozon_analyser.on_time_interval, ymin=0, ymax=70000, colors='k', linestyles='--', linewidth=0.5)\n",
|
||||
"ax_2.vlines(smps_analyser.on_time_interval, ymin=0, ymax=2E-07, 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: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, 70000])\n",
|
||||
"ax_2.set_ylim([0, 2E-7])\n",
|
||||
"ax_2.set_ylim([0, 2E-07])\n",
|
||||
"\n",
|
||||
"ax_1.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper right')\n",
|
||||
"\n",
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,14 +2,15 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 59,
|
||||
"execution_count": 21,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Importing custom code\n",
|
||||
"from defs.OFR import OFRSample, OFRAnalyser\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",
|
||||
@@ -18,18 +19,16 @@
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from matplotlib.dates import DateFormatter\n",
|
||||
"from matplotlib.ticker import MultipleLocator\n",
|
||||
"\n",
|
||||
"# Setting style of figures and backend\n",
|
||||
"import matplotlib\n",
|
||||
"matplotlib.use('pgf')\n",
|
||||
"plt.style.use(r'C:\\Users\\tschan_d\\Documents\\code\\Master_Thesis\\.mplstyle')"
|
||||
"plt.style.use(r'C:\\Users\\tschan_d\\Documents\\code\\.mplstyle')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 75,
|
||||
"execution_count": 22,
|
||||
"id": "a67c15f2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -62,7 +61,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 23,
|
||||
"id": "429e1aed",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -72,127 +71,90 @@
|
||||
"# 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\\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",
|
||||
" 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",
|
||||
"smps_analyser_02 = 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",
|
||||
" 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_03 = 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",
|
||||
" 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 for the different filters used\n",
|
||||
"ozon_analyser_01 = 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",
|
||||
"ozon_analyser_02 = 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",
|
||||
"ozon_analyser_03 = 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",
|
||||
"\n",
|
||||
"voc_on_times_01 = [pd.Timestamp('2026-09-02 09:52:00'), pd.Timestamp('2026-09-02 10:52:00')]\n",
|
||||
"voc_on_times_02 = [pd.Timestamp('2026-09-03 15:20:00'), pd.Timestamp('2026-09-03 16:20:00')]\n",
|
||||
"voc_on_times_03 = [pd.Timestamp('2026-09-04 13:22:00'), pd.Timestamp('2026-09-04 14:22:00')]"
|
||||
"ozon_analyser_01 = 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=None)\n",
|
||||
"ozon_analyser_02 = 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_03 = 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)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"id": "39ca7d2b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Defining function to average O3 data over timespans of each SMPS sample\n",
|
||||
"\n",
|
||||
"def ozone_averager(ozon_analyser: DATFile, smps_analyser: OFRAnalyser, voc_on_times, cut_edges = True, subtract_5min_baseline = True) -> np.ndarray:\n",
|
||||
"\n",
|
||||
" average_ozon_values = []\n",
|
||||
" mass_production_rates = []\n",
|
||||
"\n",
|
||||
" local_smps_data = smps_analyser.data[(smps_analyser.data['Starting Time (-)'] >= voc_on_times[0]) & (smps_analyser.data['Starting Time (-)'] >= voc_on_times[0])].reset_index()\n",
|
||||
"\n",
|
||||
" baseline = None\n",
|
||||
"\n",
|
||||
" for index, data in local_smps_data.iterrows():\n",
|
||||
"\n",
|
||||
" start = data['Starting Time (-)']\n",
|
||||
"\n",
|
||||
" if index == 0:\n",
|
||||
"\n",
|
||||
" if subtract_5min_baseline == True:\n",
|
||||
" baseline_start = start - pd.Timedelta(minutes=5)\n",
|
||||
" baseline_ozone_data = ozon_analyser.data[(ozon_analyser.data['timestamp'] >= baseline_start) & (ozon_analyser.data['timestamp'] <= start)]\n",
|
||||
" baseline = np.average(baseline_ozone_data['ozone'])\n",
|
||||
"\n",
|
||||
" if cut_edges == True:\n",
|
||||
" continue\n",
|
||||
"\n",
|
||||
" stop = start + pd.Timedelta(seconds = data['Sampling Time (s)'])\n",
|
||||
"\n",
|
||||
" mass_production_rates.append(data['Mass Production Rate (kg/s)'])\n",
|
||||
"\n",
|
||||
" local_ozone_data = ozon_analyser.data[(ozon_analyser.data['timestamp'] >= start) & (ozon_analyser.data['timestamp'] <= stop)]\n",
|
||||
" average_ozon_values.append(np.average(local_ozone_data['ozone']))\n",
|
||||
"\n",
|
||||
" if cut_edges == True:\n",
|
||||
" del average_ozon_values[-1]\n",
|
||||
" del mass_production_rates[-1]\n",
|
||||
"\n",
|
||||
" if subtract_5min_baseline == True:\n",
|
||||
" output_average_ozone_values = [baseline - value for value in average_ozon_values]\n",
|
||||
" elif subtract_5min_baseline == False:\n",
|
||||
" output_average_ozone_values = [value for value in average_ozon_values]\n",
|
||||
"\n",
|
||||
" return output_average_ozone_values, mass_production_rates\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": 24,
|
||||
"id": "f090dba3",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Reading in SMPS data\n",
|
||||
"for smps_analyser in [smps_analyser_01, smps_analyser_02, smps_analyser_03]:\n",
|
||||
"for smps_analyser, ozon_analyser in zip([smps_analyser_01, smps_analyser_02, smps_analyser_03], [ozon_analyser_01, ozon_analyser_02, ozon_analyser_03]):\n",
|
||||
"\n",
|
||||
" smps_analyser.GetData()\n",
|
||||
" ozon_analyser.GetData()\n",
|
||||
"\n",
|
||||
"# Reading in the O3 data\n",
|
||||
"for ozon_analyser in [ozon_analyser_01, ozon_analyser_02, ozon_analyser_03]:\n",
|
||||
" ozon_analyser.read()"
|
||||
" ozon_analyser.AverageWithSMPS(smps_analyser = smps_analyser, cut_edges = 2, subtract_baseline = ['yes', 1])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 45,
|
||||
"id": "26333625",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"ozone_average_01, mass_production_rates_01 = ozone_averager(ozon_analyser=ozon_analyser_01, smps_analyser=smps_analyser_01, voc_on_times=voc_on_times_01, cut_edges=True, subtract_5min_baseline=True)\n",
|
||||
"\n",
|
||||
"ozone_average_02, mass_production_rates_02 = ozone_averager(ozon_analyser=ozon_analyser_02, smps_analyser=smps_analyser_02, voc_on_times=voc_on_times_02, cut_edges=True, subtract_5min_baseline=True)\n",
|
||||
"\n",
|
||||
"ozone_average_03, mass_production_rates_03 = ozone_averager(ozon_analyser=ozon_analyser_03, smps_analyser=smps_analyser_03, voc_on_times=voc_on_times_03, cut_edges=True, subtract_5min_baseline=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 76,
|
||||
"execution_count": 25,
|
||||
"id": "99c569ff",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Creating figure\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54), constrained_layout = True)\n",
|
||||
"ax = fig.add_subplot(111)\n",
|
||||
"fig = plt.figure(figsize=(8.8 / 2.54, 5 / 2.54))\n",
|
||||
"ax = plt.axes([0.2, 0.2, 0.6, 0.6], frameon=True)\n",
|
||||
"\n",
|
||||
"ax.plot(np.array(ozone_average_01) / 1000, mass_production_rates_01, color='red', linewidth=0.5, linestyle = ':', marker='o', markersize=2.5, markerfacecolor='red', label=r'Filter 1')\n",
|
||||
"ax.plot(np.array(ozone_average_02) / 1000, mass_production_rates_02, color='blue', linewidth=0.5, linestyle = ':', marker='d', markersize=4, markerfacecolor='blue', label='Filter 2')\n",
|
||||
"ax.plot(np.array(ozone_average_03) / 1000, mass_production_rates_03, color='green', linewidth=0.5, linestyle = ':', marker='s', markersize=2.5, markerfacecolor='green', label='Filter 3')\n",
|
||||
"ax.plot(ozon_analyser_01.averaged_data['Ozone (ppb)'] / 1000,\n",
|
||||
" ozon_analyser_01.averaged_data['Mass Production Rate (kg/s)'],\n",
|
||||
" color = 'red',\n",
|
||||
" linewidth = 0.5,\n",
|
||||
" linestyle = ':',\n",
|
||||
" marker = 'o',\n",
|
||||
" markersize = 2.5,\n",
|
||||
" markerfacecolor = 'red',\n",
|
||||
" label = r'Filter 1')\n",
|
||||
"\n",
|
||||
"ax.set_yscale('log')\n",
|
||||
"ax.plot(ozon_analyser_02.averaged_data['Ozone (ppb)'] / 1000,\n",
|
||||
" ozon_analyser_02.averaged_data['Mass Production Rate (kg/s)'],\n",
|
||||
" color = 'blue',\n",
|
||||
" linewidth = 0.5,\n",
|
||||
" linestyle = ':',\n",
|
||||
" marker = 'd',\n",
|
||||
" markersize = 4,\n",
|
||||
" markerfacecolor = 'blue',\n",
|
||||
" label = 'Filter 2')\n",
|
||||
"\n",
|
||||
"ax.plot(ozon_analyser_03.averaged_data['Ozone (ppb)'] / 1000,\n",
|
||||
" ozon_analyser_03.averaged_data['Mass Production Rate (kg/s)'],\n",
|
||||
" color = 'green',\n",
|
||||
" linewidth = 0.5,\n",
|
||||
" linestyle = ':',\n",
|
||||
" marker = 's',\n",
|
||||
" markersize = 2.5,\n",
|
||||
" markerfacecolor = 'green',\n",
|
||||
" label = 'Filter 3')\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.legend(loc='upper right')\n",
|
||||
"ax.legend(loc='lower left')\n",
|
||||
"\n",
|
||||
"#plt.show()\n",
|
||||
"plt.savefig(\"figure.pgf\", format='pgf', dpi=400)\n",
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user