Starting to replace ipynb files with py files for batch script execution of figures once they are set... mainly this is to be sure to push an actual verion to the server...
This commit is contained in:
1 parent
67c74359ec
commit
3fe4d86367
19 files changed
+2475
-551
No files matched your search
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Debug Current File",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"console": "integratedTerminal",
|
||||
"env": {"PYTHONPATH": "${workspaceFolder}/"}
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"chat.disableAIFeatures": true,
|
||||
"chat.agent.enabled": false,
|
||||
"chat.commandCenter.enabled": false,
|
||||
"inlineChat.accessibleDiffView": "off",
|
||||
"terminal.integrated.initialHint": false,
|
||||
"terminal.integrated.env.windows": {"PYTHONPATH": "${workspaceFolder}/"},
|
||||
"chat.checkpoints.enabled": false,
|
||||
"chat.undoRequests.restoreInput": false,
|
||||
"chat.agent.sandbox.allowAutoApprove": false,
|
||||
"chat.agent.sandbox.allowUnsandboxedCommands": false,
|
||||
"chat.agent.sandbox.retryWithAllowNetworkRequests": false,
|
||||
"chat.agent.codeBlockProgress": false,
|
||||
"chat.agent.thinking.generateTitles": false,
|
||||
"chat.agent.thinking.terminalTools": false,
|
||||
"chat.math.enabled": false,
|
||||
"chat.editor.localAgent.enabled": false,
|
||||
"chat.extensionUnification.enabled": false,
|
||||
"chat.viewSessions.enabled": false,
|
||||
"chat.extensionTools.enabled": false,
|
||||
"chat.tools.autoExpandFailures": false,
|
||||
"chat.tools.confirmationCarousel.enabled": false,
|
||||
"chat.tools.terminal.enableAutoApprove": false,
|
||||
"chat.tools.terminal.preventShellHistory": false,
|
||||
"chat.tools.todos.showWidget": false,
|
||||
"chat.tools.terminal.autoApproveWorkspaceNpmScripts": false,
|
||||
"chat.tools.terminal.enforceTimeoutFromModel": false,
|
||||
"chat.tools.terminal.simpleCollapsible": false,
|
||||
"chat.mcp.apps.enabled": false,
|
||||
"chat.detectParticipant.enabled": false,
|
||||
"chat.implicitContext.suggestedContext": false,
|
||||
"chat.includeApplyingInstructions": false,
|
||||
"chat.useAgentSkills": false,
|
||||
"chat.useAgentsMdFile": false,
|
||||
"chat.useClaudeMdFile": false,
|
||||
"chat.useHooks": false,
|
||||
"inlineChat.askInChat": false,
|
||||
"inlineChat.fixDiagnostics": false,
|
||||
"python.defaultInterpreterPath": "C:/Users/tschan_d/AppData/Local/miniforge3/envs/MA/python",
|
||||
"python.terminal.activateEnvInCurrentTerminal": true,
|
||||
"python.terminal.activateEnvironment": true,
|
||||
"python-envs.defaultEnvManager": "ms-python.python:conda",
|
||||
"python-envs.defaultPackageManager": "ms-python.python:conda",
|
||||
"python.envFile": "${workspaceFolder}/.env",
|
||||
"python.terminal.useEnvFile": true,
|
||||
"editor.quickSuggestions": {
|
||||
"other": "on",
|
||||
"comments": "off",
|
||||
"strings": "off"
|
||||
},
|
||||
"editor.suggestOnTriggerCharacters": false,
|
||||
"window.zoomLevel": -1,
|
||||
"editor.wordWrap": "on",
|
||||
"editor.rulers": [145],
|
||||
"notebook.editorOptionsCustomizations": {"editor.rulers":[]},
|
||||
"editor.fontSize": 16,
|
||||
"jupiter.notebookFileRoot": "${workspaceFolder}/",
|
||||
"workbench.browser.sendElementsToChat.attachImages": false
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
# 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()
|
||||
|
||||
# Specify the source file paths to for SMPS data
|
||||
smps_analyser = OFRAnalyser(data_source_file = Path(r"Z:\Data\SMPS\processed\2026\09_September\20260902\20260902_aPinene_SOA.txt"),
|
||||
flow_source_file = Path(r"Z:\People\David_Tschan\OFR_SMPS\flow_files\20260902_SET02_EXP13_flow_file.txt"),
|
||||
smpl_number_list = range(1, 60),
|
||||
on_time_interval = [pd.Timestamp('2026-09-02 09:52:00'), pd.Timestamp('2026-09-02 10:52: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-02_09.01.11_PC14750_API_O3.dat"), data_name = 'ozone'),
|
||||
on_time_interval = [pd.Timestamp('2026-09-02 09:08:00'), pd.Timestamp('2026-09-02 11:22: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=(9/ 2.54, 6 / 2.54))
|
||||
ax_1 = plt.axes([0.15, 0.15, 0.7, 0.7], frameon=True)
|
||||
ax_2 = plt.twinx(ax=ax_1)
|
||||
ax_1.set_zorder(0)
|
||||
ax_2.set_zorder(ax_1.get_zorder())
|
||||
|
||||
# Plotting ozone data
|
||||
ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth = 0.5, linestyle = '-',label=r'$\chi_{\ce{O3}}$')
|
||||
|
||||
# Plotting SMPS data
|
||||
ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='blue', linestyle='-', label=r'$\accentset{*}{m}$')
|
||||
|
||||
# Adding lines indicating when the different components were switched on and off, respectively
|
||||
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)
|
||||
|
||||
# Axes labels
|
||||
ax_1.set_xlabel(r'Time $(-)$')
|
||||
ax_1.set_ylabel(r'\ce{O3} mole fraction $\chi_{\ce{O3}}$ $(\text{ppb})$')
|
||||
ax_2.set_ylabel(r'Mass flux $\accentset{*}{m}$ $(\unit{\kilo\gram\per\second})$')
|
||||
|
||||
# Axes formats
|
||||
ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))
|
||||
ax_1.xaxis.set_major_locator(HourLocator())
|
||||
|
||||
# Axes limits
|
||||
ax_1.set_xlim([pd.Timestamp('2026-09-02 08:45:00'), pd.Timestamp('2026-09-02 11:45:00')])
|
||||
ax_1.set_ylim([0, 120000])
|
||||
ax_2.set_ylim([0, 5E-09])
|
||||
|
||||
# Legend
|
||||
lines_1, labels_1 = ax_1.get_legend_handles_labels()
|
||||
lines_2, labels_2 = ax_2.get_legend_handles_labels()
|
||||
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)
|
||||
|
||||
# Exporting
|
||||
plt.savefig('figure' + format, dpi=400)
|
||||
plt.close()
|
||||
Binary file not shown.
@@ -0,0 +1,94 @@
|
||||
# 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()
|
||||
|
||||
# Specify the source file paths to for SMPS data
|
||||
smps_analyser = 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')])
|
||||
|
||||
# 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-03_14.23.44_PC14750_API_O3.dat"), data_name = 'ozone'),
|
||||
on_time_interval = [pd.Timestamp('2026-09-03 14:35:00'), pd.Timestamp('2026-09-03 16:50: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=(9/ 2.54, 6 / 2.54))
|
||||
ax_1 = plt.axes([0.15, 0.15, 0.7, 0.7], frameon=True)
|
||||
ax_2 = plt.twinx(ax=ax_1)
|
||||
ax_1.set_zorder(0)
|
||||
ax_2.set_zorder(ax_1.get_zorder())
|
||||
|
||||
# Plotting ozone data
|
||||
ax_1.plot(ozon_analyser.file.data['timestamp'], ozon_analyser.file.data['ozone'], color = 'black', linewidth=0.5, linestyle = '-',label=r'$\chi_{\ce{O3}}$')
|
||||
|
||||
# Plotting SMPS data
|
||||
ax_2.step(smps_analyser.data['Starting Time (-)'], smps_analyser.data['Mass Production Rate (kg/s)'], color='red', linestyle='-', label=r'$\accentset{*}{m}$')
|
||||
|
||||
# Adding lines indicating when the different components were switched on and off, respectively
|
||||
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)
|
||||
|
||||
# Axes labels
|
||||
ax_1.set_xlabel(r'Time $(-)$')
|
||||
ax_1.set_ylabel(r'\ce{O3} mole fraction $\chi_{\ce{O3}}$ $(\text{ppb})$')
|
||||
ax_2.set_ylabel(r'Mass flux $\accentset{*}{m}$ $(\unit{\kilo\gram\per\second})$')
|
||||
|
||||
# Axes formats
|
||||
ax_1.xaxis.set_major_formatter(DateFormatter(r'%H:%M'))
|
||||
ax_1.xaxis.set_major_locator(HourLocator())
|
||||
|
||||
# Axes limits
|
||||
ax_1.set_xlim([pd.Timestamp('2026-09-03 14:15:00'), pd.Timestamp('2026-09-03 17:15:00')])
|
||||
ax_1.set_ylim([0, 120000])
|
||||
ax_2.set_ylim([0, 5E-09])
|
||||
|
||||
# Legend
|
||||
lines_1, labels_1 = ax_1.get_legend_handles_labels()
|
||||
lines_2, labels_2 = ax_2.get_legend_handles_labels()
|
||||
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)
|
||||
|
||||
# Export
|
||||
plt.savefig('figure' + format, dpi=400)
|
||||
plt.close()
|
||||
Binary file not shown.
@@ -130,7 +130,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.14"
|
||||
"version": "3.12.13"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@@ -5,7 +5,15 @@
|
||||
"execution_count": 1,
|
||||
"id": "1cc3c304",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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",
|
||||
@@ -20,8 +28,8 @@
|
||||
"# 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()"
|
||||
"from defs.Helper import final_plot_setup\n",
|
||||
"format = final_plot_setup()"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Binary file not shown.
@@ -1,27 +0,0 @@
|
||||
METADATA
|
||||
----------------------------------------------------------------------
|
||||
Standard 2.00
|
||||
Unit mg/L
|
||||
Prepared 10.06.2026
|
||||
Measured 10.09.2026
|
||||
|
||||
CALIBRATION DATA
|
||||
conc. STD Dilution A1 A2 A3
|
||||
(mg / L) (-) (-) (-) (-)
|
||||
0.05 40.00 0.4019 0.9061 0.6915
|
||||
0.10 20.00 1.264 1.230 1.249
|
||||
0.20 10.00 1.909 2.049 2.005
|
||||
0.50 4.000 5.410 5.482 5.887
|
||||
0.70 2.857 7.544 8.078 7.808
|
||||
1.00 2.000 10.83 10.76 10.53
|
||||
2.00 1.000 21.69 21.67 0.03210
|
||||
|
||||
CALIBRATION RESULTS
|
||||
----------------------------------------------------------------------
|
||||
Slope 0.0928
|
||||
Intercept -0.0084
|
||||
R2 0.9983
|
||||
EXCLUDED 7
|
||||
FROM 0.0500
|
||||
TO 1.0000
|
||||
COMPUTED 11.09.2026 17:45:52
|
||||
@@ -1,27 +0,0 @@
|
||||
METADATA
|
||||
----------------------------------------------------------------------
|
||||
Standard 2.00
|
||||
Unit mg/L
|
||||
Prepared 10.06.2026
|
||||
Measured 10.09.2026
|
||||
|
||||
CALIBRATION DATA
|
||||
conc. STD Dilution A1 A2 A3
|
||||
(mg / L) (-) (-) (-) (-)
|
||||
0.05 40.00 0.4019 0.9061 0.6915
|
||||
0.10 20.00 1.264 1.230 1.249
|
||||
0.20 10.00 1.909 2.049 2.005
|
||||
0.50 4.000 5.410 5.482 5.887
|
||||
0.70 2.857 7.544 8.078 7.808
|
||||
1.00 2.000 10.83 10.76 10.53
|
||||
2.00 1.000 21.69 21.67 0.03210
|
||||
|
||||
CALIBRATION RESULTS
|
||||
----------------------------------------------------------------------
|
||||
Slope 0.0928
|
||||
Intercept -0.0084
|
||||
R2 0.9983
|
||||
EXCLUDED 7
|
||||
FROM 0.0500
|
||||
TO 1.0000
|
||||
COMPUTED 15.09.2026 14:26:46
|
||||
@@ -1,27 +0,0 @@
|
||||
METADATA
|
||||
----------------------------------------------------------------------
|
||||
Standard 2.00
|
||||
Unit mg/L
|
||||
Prepared 10.06.2026
|
||||
Measured 10.09.2026
|
||||
|
||||
CALIBRATION DATA
|
||||
conc. STD Dilution A1 A2 A3
|
||||
(mg / L) (-) (-) (-) (-)
|
||||
0.05 40.00 0.4019 0.9061 0.6915
|
||||
0.10 20.00 1.264 1.230 1.249
|
||||
0.20 10.00 1.909 2.049 2.005
|
||||
0.50 4.000 5.410 5.482 5.887
|
||||
0.70 2.857 7.544 8.078 7.808
|
||||
1.00 2.000 10.83 10.76 10.53
|
||||
2.00 1.000 21.69 21.67 0.03210
|
||||
|
||||
CALIBRATION RESULTS
|
||||
----------------------------------------------------------------------
|
||||
Slope 0.0928
|
||||
Intercept -0.0084
|
||||
R2 0.9983
|
||||
EXCLUDED 7
|
||||
FROM 0.0500
|
||||
TO 1.0000
|
||||
COMPUTED 15.09.2026 15:07:09
|
||||
@@ -1,27 +0,0 @@
|
||||
METADATA
|
||||
----------------------------------------------------------------------
|
||||
Standard 2.00
|
||||
Unit mg/L
|
||||
Prepared 10.06.2026
|
||||
Measured 10.09.2026
|
||||
|
||||
CALIBRATION DATA
|
||||
conc. STD Dilution A1 A2 A3
|
||||
(mg / L) (-) (-) (-) (-)
|
||||
0.05 40.00 0.4019 0.9061 0.6915
|
||||
0.10 20.00 1.264 1.230 1.249
|
||||
0.20 10.00 1.909 2.049 2.005
|
||||
0.50 4.000 5.410 5.482 5.887
|
||||
0.70 2.857 7.544 8.078 7.808
|
||||
1.00 2.000 10.83 10.76 10.53
|
||||
2.00 1.000 21.69 21.67 0.03210
|
||||
|
||||
CALIBRATION RESULTS
|
||||
----------------------------------------------------------------------
|
||||
Slope 0.0928
|
||||
Intercept -0.0084
|
||||
R2 0.9983
|
||||
EXCLUDED 7
|
||||
FROM 0.0500
|
||||
TO 1.0000
|
||||
COMPUTED 15.09.2026 15:15:18
|
||||
@@ -1,27 +0,0 @@
|
||||
METADATA
|
||||
----------------------------------------------------------------------
|
||||
Standard 2.00
|
||||
Unit mg/L
|
||||
Prepared 10.06.2026
|
||||
Measured 10.09.2026
|
||||
|
||||
CALIBRATION DATA
|
||||
conc. STD Dilution A1 A2 A3
|
||||
(mg / L) (-) (-) (-) (-)
|
||||
0.05 40.00 0.4019 0.9061 0.6915
|
||||
0.10 20.00 1.264 1.230 1.249
|
||||
0.20 10.00 1.909 2.049 2.005
|
||||
0.50 4.000 5.410 5.482 5.887
|
||||
0.70 2.857 7.544 8.078 7.808
|
||||
1.00 2.000 10.83 10.76 10.53
|
||||
2.00 1.000 21.69 21.67 0.03210
|
||||
|
||||
CALIBRATION RESULTS
|
||||
----------------------------------------------------------------------
|
||||
Slope 0.0928
|
||||
Intercept -0.0084
|
||||
R2 0.9983
|
||||
EXCLUDED 7
|
||||
FROM 0.0500
|
||||
TO 1.0000
|
||||
COMPUTED 15.09.2026 15:24:31
|
||||
@@ -1,27 +0,0 @@
|
||||
METADATA
|
||||
----------------------------------------------------------------------
|
||||
Standard 2.00
|
||||
Unit mg/L
|
||||
Prepared 10.06.2026
|
||||
Measured 10.09.2026
|
||||
|
||||
CALIBRATION DATA
|
||||
conc. STD Dilution A1 A2 A3
|
||||
(mg / L) (-) (-) (-) (-)
|
||||
0.05 40.00 0.4019 0.9061 0.6915
|
||||
0.10 20.00 1.264 1.230 1.249
|
||||
0.20 10.00 1.909 2.049 2.005
|
||||
0.50 4.000 5.410 5.482 5.887
|
||||
0.70 2.857 7.544 8.078 7.808
|
||||
1.00 2.000 10.83 10.76 10.53
|
||||
2.00 1.000 21.69 21.67 0.03210
|
||||
|
||||
CALIBRATION RESULTS
|
||||
----------------------------------------------------------------------
|
||||
Slope 0.0928
|
||||
Intercept -0.0084
|
||||
R2 0.9983
|
||||
EXCLUDED 7
|
||||
FROM 0.0500
|
||||
TO 1.0000
|
||||
COMPUTED 15.09.2026 16:26:25
|
||||
@@ -1,152 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "393a8a7f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from defs.TOC import Calibration\n",
|
||||
"from pathlib import Path\n",
|
||||
"\n",
|
||||
"# Importing libraries required for plotting and exporting\n",
|
||||
"import matplotlib.pyplot as plt\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\\.mplstyle')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "3151288f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Configuring backend\n",
|
||||
"\n",
|
||||
"matplotlib.rcParams.update({'text.usetex': True,\n",
|
||||
" 'pgf.rcfonts': False,\n",
|
||||
" 'font.family': 'serif',\n",
|
||||
" 'font.serif': [],\n",
|
||||
" 'font.sans-serif': [],\n",
|
||||
" 'font.size': 6,\n",
|
||||
" 'legend.fontsize': 6,\n",
|
||||
" 'legend.handlelength': 2,\n",
|
||||
" 'xtick.labelsize': 6,\n",
|
||||
" 'ytick.labelsize': 6,\n",
|
||||
" 'pgf.texsystem': r'lualatex',\n",
|
||||
" 'pgf.preamble': r'\\usepackage{scrextend}' + \n",
|
||||
" r'\\usepackage{unicode-math}' + \n",
|
||||
" r'\\usepackage{accents}' + \n",
|
||||
" r'\\usepackage{fontspec}' + \n",
|
||||
" r'\\usepackage[T1]{fontenc}' +\n",
|
||||
" r'\\usepackage{unicode-math}' +\n",
|
||||
" r'\\setmainfont{STIX Two Text}' +\n",
|
||||
" r'\\setmathfont{STIX Two Math}' + \n",
|
||||
" r'\\usepackage{siunitx}' + \n",
|
||||
" r'\\usepackage{mhchem}' + \n",
|
||||
" r'\\newcommand{\\der}[1]{\\ensuremath{\\textnormal{d}\\,{#1}}}'})"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "ea0c4325",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"C:\\Users\\tschan_d\\Documents\\code\\defs\\TOC.py:156: UserWarning: Calibration alreadyt exists, will be overwritten...\n",
|
||||
" warnings.warn(\"Calibration alreadyt exists, will be overwritten...\")\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"cal_01 = Calibration(cal_file = Path(r\"C:\\Users\\tschan_d\\Documents\\analysis\\TOC_Analysis\\20260909\\IC_Calibration.cal\"))\n",
|
||||
"cal_02 = Calibration(cal_file = Path(r\"C:\\Users\\tschan_d\\Documents\\analysis\\TOC_Analysis\\20260909\\IC_Calibration.cal\"))\n",
|
||||
"cal_02.calibrate(excluded_points=[7], write_to_new_file=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "00b59d82",
|
||||
"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.15, 0.7, 0.7], frameon=True)\n",
|
||||
"\n",
|
||||
"# calibration curve with outliers\n",
|
||||
"ax_1.scatter(cal_01.calibrant_data['area_average'],\n",
|
||||
" cal_01.calibrant_data['concentration'],\n",
|
||||
" color = 'red',\n",
|
||||
" marker = 'o',\n",
|
||||
" s = 10,\n",
|
||||
" facecolor = 'None',\n",
|
||||
" edgecolor = 'red',\n",
|
||||
" linewidth = 0.75)\n",
|
||||
"ax_1.plot([0, 17], cal_01.compute([0, 17]), linestyle = '-.', color = 'red', linewidth = 0.75, label = r'Some entry $a+b$ into the legend')\n",
|
||||
"\n",
|
||||
"# calibration curve without outliers\n",
|
||||
"ax_1.scatter(cal_02.calibrant_data['area_average'][cal_02.mask],\n",
|
||||
" cal_02.calibrant_data['concentration'][cal_02.mask],\n",
|
||||
" color = 'black',\n",
|
||||
" marker = '.',\n",
|
||||
" s = 5,\n",
|
||||
" facecolor = 'black')\n",
|
||||
"ax_1.plot([0, 17], cal_02.compute([0, 17]), linestyle = '-', color = 'black', linewidth = 0.75, label = str(f\"$c={cal_01.curve.slope:1.3f}-{abs(cal_01.curve.intercept):1.3f}$\"))\n",
|
||||
"ax_1.set_xlabel(r'Area $A$ $(-)$')\n",
|
||||
"ax_1.set_ylabel(r'Concentration $c$ $(\\unit{\\milli\\gram\\per\\liter})$')\n",
|
||||
"\n",
|
||||
"ax_1.set_xlim([0, 15])\n",
|
||||
"ax_1.set_ylim([0, 2.5])\n",
|
||||
"\n",
|
||||
"lines_1, labels_1 = ax_1.get_legend_handles_labels()\n",
|
||||
"ax_1.legend(loc = 'upper left', fontsize=6)\n",
|
||||
"\n",
|
||||
"#plt.show()\n",
|
||||
"plt.savefig(\"figure.pgf\", format='pgf', dpi=400)\n",
|
||||
"plt.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "0a5d7e8e",
|
||||
"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,76 @@
|
||||
# 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.TOC import Calibration
|
||||
from defs.Helper import final_plot_setup, quick_plot_setup
|
||||
|
||||
# Imports from other modueles
|
||||
from pathlib import Path
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.dates import DateFormatter, HourLocator
|
||||
|
||||
### ----------------------------------------------------------------------------------------------------------------------------------- ###
|
||||
### analysis.py
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
# Setting the output format
|
||||
format = final_plot_setup()
|
||||
|
||||
# Obtaining the calibrations
|
||||
cal_01 = Calibration(cal_file = Path(r"C:\Users\tschan_d\Documents\analysis\TOC_Analysis\20260909\IC_Calibration.cal"))
|
||||
cal_02 = Calibration(cal_file = Path(r"C:\Users\tschan_d\Documents\analysis\TOC_Analysis\20260909\IC_Calibration.cal"))
|
||||
cal_02.calibrate(excluded_points=[7], write_to_new_file=True)
|
||||
|
||||
# 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)
|
||||
|
||||
# Calibration curve with outliers
|
||||
ax_1.scatter(cal_01.calibrant_data['area_average'],
|
||||
cal_01.calibrant_data['concentration'],
|
||||
color = 'red',
|
||||
marker = 'o',
|
||||
s = 10,
|
||||
facecolor = 'None',
|
||||
edgecolor = 'red',
|
||||
linewidth = 0.75)
|
||||
ax_1.plot([0, 17], cal_01.compute([0, 17]), linestyle = '-.', color = 'red', linewidth = 0.75, label = str(f"$c={cal_01.curve.slope:1.3f}A-{abs(cal_01.curve.intercept):1.3f}$"))
|
||||
|
||||
# Calibration curve without outliers
|
||||
ax_1.scatter(cal_02.calibrant_data['area_average'][cal_02.mask],
|
||||
cal_02.calibrant_data['concentration'][cal_02.mask],
|
||||
color = 'black',
|
||||
marker = '.',
|
||||
s = 5,
|
||||
facecolor = 'black')
|
||||
ax_1.plot([0, 17], cal_02.compute([0, 17]), linestyle = '-', color = 'black', linewidth = 0.75, label = str(f"$c={cal_02.curve.slope:1.3f}A-{abs(cal_02.curve.intercept):1.3f}$"))
|
||||
|
||||
# Axes labels
|
||||
ax_1.set_xlabel(r'Area $A$ $(-)$')
|
||||
ax_1.set_ylabel(r'Concentration $c$ $(\unit{\milli\gram\per\liter})$')
|
||||
|
||||
# Axes limits
|
||||
ax_1.set_xlim([0, 15])
|
||||
ax_1.set_ylim([0, 2.5])
|
||||
|
||||
# Legend
|
||||
lines_1, labels_1 = ax_1.get_legend_handles_labels()
|
||||
ax_1.legend(loc = 'upper left')
|
||||
|
||||
# Export
|
||||
plt.savefig('figure' + format, dpi=400)
|
||||
plt.close()
|
||||
Binary file not shown.
+2126
-233
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user