Skip to content
Snippets Groups Projects
Commit 95e38c5d authored by Xia, Ning's avatar Xia, Ning :penguin:
Browse files

Merge branch 'main' of git.rwth-aachen.de:fst-tuda/public/lehre/calorimetry_laboratory

parents 7752d572 69cefa31
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
# Kalorimetrie Laborversuch
Author: XXXXX
Datum: XXXXX
Gruppe: XXXXX
%% Cell type:markdown id: tags:
## Forschungsfrage
Formulieren Sie eine oder mehrere Forschungsfragen zu diesem Versuch.
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Versuchsaufbau und Durchführung
Beschreiben Sie den Versuchsaufbau und die Versuchsdurchführung. Nutzen Sie hier Ihr eigenes Bild.
%% Cell type:markdown id: tags:
<img src="figures/kalorimetrie_pruefstand.jpg" width="800">
%% Cell type:markdown id: tags:
## Versuchsauswertung
%% Cell type:code id: tags:
``` python
import numpy as np
from matplotlib import pyplot as plt
import h5py as h5
import importlib
from functions import m_json
from functions import utility
# Use FST-Style, if you don't like it, you can safely delete this line.
plt.style.use("FST.mplstyle")
```
%% Cell type:markdown id: tags:
### Kalorimeterkonstante
Hinweis: Nutzen Sie die Funktionen *get_ids_from_setup* und *get_json_entry* um auf Metadaten zuzugreifen.
Sie sollten Ihr Programm zwischen TODO und DONE implementieren, und versuchen die Anweisung zu verfolgen. Das ist aber nicht erforderlich.
Die Initialisierung der Variablen in manchen Zellen bient zu den Hinweisen, welche Daten in der Zelle bekommen werden sollten.
%% Cell type:markdown id: tags:
#### (i) Messdaten einlesen
Messdaten werden in das Notebook eingelesen.
%% Cell type:code id: tags:
``` python
datafile_path_const = None
# TODO: Define the path to hdf5 file, which containing experiment data for constant.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
temperature, time, data_name = np.array([]), np.array([]), np.array([])
# TODO: Read all experimental data and associated metadata from HDF5 files for data processing.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
index_calorimeter = []
index_environment = []
# TODO: In order to be able to process data from sensors with the same position,
# it is first necessary to obtain the index of the sensors with different positions in the list.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (ii) Mittelwert und Standardabweichung für Plots bestimmen
Die Mittelwerte und Standardabweichungen der Messungen werden in der nächsten Sektion geplottet.
Nachdem die Mittelwerte und Standardabweichungen berechnet wurden, können Daten jeder Wärmequelle jeweils in einem numpy.ndarray gespeichert werden.
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
calorimeter_data = np.array([[],[]])
environment_data = np.array([[],[]])
# TODO: Calculate the average value and standard deviation of sensors.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iii) Daten ploten
Im Kalorimeter befinden sich mehrere Sensoren, deren Mittelwerte sowie Standardabweichungen der Messung an jeden Zeitpunkt bestimmt wurden. Die Messdaten bzw. ihre Mittelwerte müssen auf ein Scatter Plot eingetragen werden. Die Standardabweichungen der Sensoren sind als Errorbar im Plot zu sehen.
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
# TODO: Use the temperature and time data for plotting
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iv) Metadaten auslesen
Die notwendigen Daten bzw. Metadaten für die Berechnung der Wärmekapazität wird ausgelesen.
%% Cell type:code id: tags:
``` python
# Heat capacity of Water has been given
water_heat_capa = 4.18
water_mass = None
# TODO: Read mass of the water from the metadata of the experiment.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
current = None
heat_time = None
voltage = None
# TODO: Reading heater related data from hdf5 file, please use the same datafile_path_const variable for the HDF5 path.
# Hint: Note whether the data is stored as an array or a scalar in the hdf5 dataset.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (v) Anfangs- und Endwert der Temperatur
Die Anfangs- und Endwert der Temperatur im Kloriemeter sind notwendig, um die Wärmekapazität zu bestimmen.
Eine Möglichkeit wäre, durch das Maxium bzw. Minium und einen Schwellenwert ist ein Teil der Daten zu entnehmen.
Daraus sind Mittelwerte zu berechnen. Die entsprechenden Mittelwerte können als Anfangs- und Endtemperatur verwendet werden.
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
temperature_end = None
temperature_start = None
# TODO: Calculation of temperature data necessary to determine the specific heat capacity
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (vi) Kalorimeterkonstante bestimmen
$$
C = \frac{UI\Delta t}{(T_2 - T_1)}
$$
%% Cell type:code id: tags:
``` python
calorimeter_const = None
# TODO: Calculate heat capacity of the calorimeter
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (Vii) Ergebnis
%% Cell type:code id: tags:
``` python
calorimeter_const
```
%% Cell type:markdown id: tags:
### spezifische Wärmekapazität: erste Probe
%% Cell type:markdown id: tags:
#### (i) Messdaten einlesen
%% Cell type:code id: tags:
``` python
datafile_path_prob1 = None
# TODO: Define the path to hdf5 file, which containing experiment data for constant.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
temperature, time, data_name = np.array([]), np.array([]), np.array([])
# TODO: Read all experimental data and associated metadata from HDF5 files for data processing.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
index_calorimeter = []
index_bath = []
index_env = []
# TODO: In order to be able to process data from sensors with the same position,
# it is first necessary to obtain the index of the sensors with different positions in the list.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (ii) Mittelwert und Standardabweichung für Plots bestimmen
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
calorimeter_data_with_uncert = np.array([[],[]])
env_data_with_uncert = np.array([[],[]])
heat_data_with_uncert = np.array([[],[]])
# TODO: Calculate the average value and standard deviation of sensors.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iii) Daten ploten
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
# TODO: Use the temperature and time data for plotting.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iv) Metadaten auslesen
%% Cell type:code id: tags:
``` python
sample_mass = None
# TODO: Read mass of the sample from the metadata of the experiment.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (v) Anfangs- und Endwert der Temperatur
Die Mischungstemperatur und Anfangstemperatur des Kalorimeters sind für die Berechnung relevant.
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
temperature_mix = None
temperature_start_water = None
# TODO: Calculation of temperature data necessary to determine the specific heat capacity
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
temperature_start_sample = None
# TODO: Determine the initial temperature of the sample.
# Since the temperature of the water bath is stable, the initial temperature
# of the sample can be taken as the average of the 10 data after the start of the measurement.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (vi) spezifische Wärmekapazität bestimmen
$$
c_p = \frac{C(T_M-T_1)}{m_p(T_2-T_M)}
$$
%% Cell type:code id: tags:
``` python
sample_heat_capa = None
# TODO: Calulate specific heat capacity of the sample.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (Vii) Ergebnis
%% Cell type:code id: tags:
``` python
sample_heat_capa
```
%% Cell type:markdown id: tags:
### spezifische Wärmekapazität: zweite Probe
%% Cell type:markdown id: tags:
#### (i) Messdaten einlesen
%% Cell type:code id: tags:
``` python
datafile_path_prob2 = None
# TODO: Define the path to hdf5 file, which containing experiment data for constant.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
temperature, time, data_name = np.array([]), np.array([]), np.array([])
# TODO: Read all experimental data and associated metadata from HDF5 files for data processing.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
index_calorimeter = []
index_bath = []
index_env = []
# TODO: In order to be able to process data from sensors with the same position,
# it is first necessary to obtain the index of the sensors with different positions in the list.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (ii) Mittelwert und Standardabweichung für Plots bestimmen
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
calorimeter_data_with_uncert = np.array([[],[]])
env_data_with_uncert = np.array([[],[]])
heat_data_with_uncert = np.array([[],[]])
# TODO: Calculate the average value and standard deviation of sensors.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iii) Daten ploten
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
# TODO: Use the temperature and time data for plotting.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iv) Metadaten auslesen
%% Cell type:code id: tags:
``` python
sample_mass = None
# TODO: Read mass of the sample from the metadata of the experiment.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (v) Anfangs- und Endwert der Temperatur
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
temperature_mix = None
temperature_start_water = None
# TODO: Calculation of temperature data necessary to determine the specific heat capacity
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
temperature_start_sample = None
# TODO: Determine the initial temperature of the sample.
# Since the temperature of the water bath is stable, the initial temperature
# of the sample can be taken as the average of the 10 data after the start of the measurement.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (vi) spezifische Wärmekapazität bestimmen
%% Cell type:code id: tags:
``` python
sample_heat_capa = None
# TODO: Calulate specific heat capacity of the sample.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (Vii) Ergebnis
%% Cell type:code id: tags:
``` python
sample_heat_capa
```
%% Cell type:markdown id: tags:
### spezifische Wärmekapazität: dritte Probe
%% Cell type:markdown id: tags:
#### (i) Messdaten einlesen
%% Cell type:code id: tags:
``` python
datafile_path_prob3 = None
# TODO: Define the path to hdf5 file, which containing experiment data for constant.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
temperature, time, data_name = np.array([]), np.array([]), np.array([])
# TODO: Read all experimental data and associated metadata from HDF5 files for data processing.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
index_calorimeter = []
index_bath = []
index_env = []
# TODO: In order to be able to process data from sensors with the same position,
# it is first necessary to obtain the index of the sensors with different positions in the list.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (ii) Mittelwert und Standardabweichung für Plots bestimmen
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
calorimeter_data_with_uncert = np.array([[],[]])
env_data_with_uncert = np.array([[],[]])
heat_data_with_uncert = np.array([[],[]])
# TODO: Calculate the average value and standard deviation of sensors.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iii) Daten ploten
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
# TODO: Use the temperature and time data for plotting.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iv) Metadaten auslesen
%% Cell type:code id: tags:
``` python
sample_mass = None
# TODO: Read mass of the sample from the metadata of the experiment.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (v) Anfangs- und Endwert der Temperatur
%% Cell type:code id: tags:
``` python
importlib.reload(utility)
temperature_mix = None
temperature_start_water = None
# TODO: Calculation of temperature data necessary to determine the specific heat capacity
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
temperature_start_sample = None
# TODO: Determine the initial temperature of the sample.
# Since the temperature of the water bath is stable, the initial temperature
# of the sample can be taken as the average of the 10 data after the start of the measurement.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (vi) spezifische Wärmekapazität bestimmen
%% Cell type:code id: tags:
``` python
sample_heat_capa = None
# TODO: Calulate specific heat capacity of the sample.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (Vii) Ergebnis
%% Cell type:code id: tags:
``` python
sample_heat_capa
```
%% Cell type:markdown id: tags:
## Genutzte Daten und Metadaten
Geben Sie an welche Daten Sie verwenden und wie diese aufgebaut sind. Erklären Sie weiterhin in wenigen Sätzen das genutzte Metadaten-Konzept, sodass eine andere Person Ihre genutzten Daten versteht.
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Analyse
Analysieren Sie Ihre Ergebnisse aus wissenschaflticher Sicht. Berücksichtigen Sie dabei Ihre oben genannte Forschungsfrage. Wie wirkt sich die mit der Probe aus dem Heißwasserbad transportierte Wassermenge auf das Ergebnis aus? Welche weiteren Fehlerquellen gibt es?
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Fazit
Ziehe Sie ein persönliches Fazit zum Versuch.
%% Cell type:markdown id: tags:
......
%% Cell type:markdown id: tags:
# Kalorimetrie Laborversuch
Author: XXXXX
Datum: XXXXX
Gruppe: XXXXX
%% Cell type:markdown id: tags:
## Forschungsfrage
Formulieren Sie eine oder mehrere Forschungsfragen zu diesem Versuch.
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Versuchsaufbau und Durchführung
Beschreiben Sie den Versuchsaufbau und die Versuchsdurchführung. Nutzen Sie hier Ihr eigenes Bild.
%% Cell type:markdown id: tags:
<img src="figures/kalorimetrie_pruefstand.jpg" width="800">
%% Cell type:markdown id: tags:
## Versuchsauswertung
%% Cell type:code id: tags:
``` python
import numpy as np
from matplotlib import pyplot as plt
import h5py as h5
# If you plan to write functions in another module,
# you can use importlib.reload(module) to reload the module
# at the beginning of each cell in order to make the latest
# changes take effect without restart the kernel.
import importlib
from functions import m_json
# Use FST-Style, if you don't like it, you can safely delete this line.
plt.style.use("FST.mplstyle")
```
%% Cell type:markdown id: tags:
### Kalorimeterkonstante
Hinweis: Nutzen Sie die Funktionen *get_ids_from_setup* und *get_json_entry* um auf Metadaten zuzugreifen.
Sie sollten Ihr Programm zwischen TODO und DONE implementieren, und versuchen die Anweisung zu verfolgen. Das ist aber nicht erforderlich.
%% Cell type:markdown id: tags:
#### (i) Messdaten einlesen
Messdaten werden in das Notebook eingelesen.
%% Cell type:code id: tags:
``` python
# TODO: Define the path to hdf5 file, which containing experiment data for constant.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
# TODO: Read all experimental data and associated metadata from HDF5 files for data processing.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (ii) Mittelwert und Standardabweichung für Plots bestimmen
Die Mittelwerte und Standardabweichungen der Messungen werden in der nächsten Sektion geplottet.
Nachdem die Mittelwerte und Standardabweichungen berechnet wurden, können Daten jeder Wärmequelle jeweils in einem numpy.ndarray gespeichert werden.
%% Cell type:code id: tags:
``` python
# TODO: Calculate the average value and standard deviation of sensors.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iii) Daten ploten
Im Kalorimeter befinden sich mehrere Sensoren, deren Mittelwerte sowie Standardabweichungen der Messung an jeden Zeitpunkt bestimmt wurden. Die Messdaten bzw. ihre Mittelwerte müssen auf ein Scatter Plot eingetragen werden. Die Standardabweichungen der Sensoren sind als Errorbar im Plot zu sehen.
%% Cell type:code id: tags:
``` python
# TODO: Use the temperature and time data for plotting
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iv) Metadaten auslesen
Die notwendigen Daten bzw. Metadaten für die Berechnung der Wärmekapazität wird ausgelesen.
%% Cell type:code id: tags:
``` python
# Heat capacity of Water has been given
water_heat_capa = 4.18
# TODO: Read mass of the water from the metadata of the experiment.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
# TODO: Reading heater related data from hdf5 file, please use the same datafile_path_const variable for the HDF5 path.
# Hint: Note whether the data is stored as an array or a scalar in the hdf5 dataset.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (v) Anfangs- und Endwert der Temperatur
Die Anfangs- und Endwert der Temperatur im Kloriemeter sind notwendig, um die Wärmekapazität zu bestimmen.
Eine Möglichkeit wäre, durch das Maxium bzw. Minium und einen Schwellenwert ist ein Teil der Daten zu entnehmen.
Daraus sind Mittelwerte zu berechnen. Die entsprechenden Mittelwerte können als Anfangs- und Endtemperatur verwendet werden.
%% Cell type:code id: tags:
``` python
# TODO: Calculation of temperature data necessary to determine the specific heat capacity
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (vi) Kalorimeterkonstante bestimmen
$$
C = \frac{UI\Delta t}{(T_2 - T_1)}
$$
%% Cell type:code id: tags:
``` python
# TODO: Calculate heat capacity of the calorimeter
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (Vii) Ergebnis
%% Cell type:code id: tags:
``` python
# TODO: Print result
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
### spezifische Wärmekapazität: erste Probe
%% Cell type:markdown id: tags:
#### (i) Messdaten einlesen
%% Cell type:code id: tags:
``` python
# TODO: Define the path to hdf5 file, which containing experiment data for constant.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
# TODO: Read all experimental data and associated metadata from HDF5 files for data processing.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (ii) Mittelwert und Standardabweichung für Plots bestimmen
%% Cell type:code id: tags:
``` python
# TODO: Calculate the average value and standard deviation of sensors.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iii) Daten ploten
%% Cell type:code id: tags:
``` python
# TODO: Use the temperature and time data for plotting.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iv) Metadaten auslesen
%% Cell type:code id: tags:
``` python
# TODO: Read mass of the sample from the metadata of the experiment.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (v) Anfangs- und Endwert der Temperatur
Die Mischungstemperatur und Anfangstemperatur des Kalorimeters sind für die Berechnung relevant.
%% Cell type:code id: tags:
``` python
# TODO: Calculation of temperature data necessary to determine the specific heat capacity
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
# TODO: Determine the initial temperature of the sample.
# Since the temperature of the water bath is stable, the initial temperature
# of the sample can be taken as the average of the 10 data after the start of the measurement.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (vi) spezifische Wärmekapazität bestimmen
$$
c_p = \frac{C(T_M-T_1)}{m_p(T_2-T_M)}
$$
%% Cell type:code id: tags:
``` python
# TODO: Calulate specific heat capacity of the sample.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (Vii) Ergebnis
%% Cell type:code id: tags:
``` python
# TODO: Print result
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
### spezifische Wärmekapazität: zweite Probe
%% Cell type:markdown id: tags:
#### (i) Messdaten einlesen
%% Cell type:code id: tags:
``` python
# TODO: Define the path to hdf5 file, which containing experiment data for constant.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
# TODO: Read all experimental data and associated metadata from HDF5 files for data processing.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
# TODO: In order to be able to process data from sensors with the same position,
# it is first necessary to obtain the index of the sensors with different positions in the list.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (ii) Mittelwert und Standardabweichung für Plots bestimmen
%% Cell type:code id: tags:
``` python
# TODO: Calculate the average value and standard deviation of sensors.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iii) Daten ploten
%% Cell type:code id: tags:
``` python
# TODO: Use the temperature and time data for plotting.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iv) Metadaten auslesen
%% Cell type:code id: tags:
``` python
# TODO: Read mass of the sample from the metadata of the experiment.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (v) Anfangs- und Endwert der Temperatur
%% Cell type:code id: tags:
``` python
# TODO: Calculation of temperature data necessary to determine the specific heat capacity
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
# TODO: Determine the initial temperature of the sample.
# Since the temperature of the water bath is stable, the initial temperature
# of the sample can be taken as the average of the 10 data after the start of the measurement.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (vi) spezifische Wärmekapazität bestimmen
%% Cell type:code id: tags:
``` python
# TODO: Calulate specific heat capacity of the sample.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (Vii) Ergebnis
%% Cell type:code id: tags:
``` python
# TODO: Print Result
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
### spezifische Wärmekapazität: dritte Probe
%% Cell type:markdown id: tags:
#### (i) Messdaten einlesen
%% Cell type:code id: tags:
``` python
# TODO: Define the path to hdf5 file, which containing experiment data for constant.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
# TODO: Read all experimental data and associated metadata from HDF5 files for data processing.
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
# TODO: In order to be able to process data from sensors with the same position,
# it is first necessary to obtain the index of the sensors with different positions in the list.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (ii) Mittelwert und Standardabweichung für Plots bestimmen
%% Cell type:code id: tags:
``` python
# TODO: Calculate the average value and standard deviation of sensors.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iii) Daten ploten
%% Cell type:code id: tags:
``` python
# TODO: Use the temperature and time data for plotting.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (iv) Metadaten auslesen
%% Cell type:code id: tags:
``` python
# TODO: Read mass of the sample from the metadata of the experiment.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (v) Anfangs- und Endwert der Temperatur
%% Cell type:code id: tags:
``` python
# TODO: Calculation of temperature data necessary to determine the specific heat capacity
## DONE ##
# DONE #
```
%% Cell type:code id: tags:
``` python
# TODO: Determine the initial temperature of the sample.
# Since the temperature of the water bath is stable, the initial temperature
# of the sample can be taken as the average of the 10 data after the start of the measurement.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (vi) spezifische Wärmekapazität bestimmen
%% Cell type:code id: tags:
``` python
# TODO: Calulate specific heat capacity of the sample.
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
#### (Vii) Ergebnis
%% Cell type:code id: tags:
``` python
# TODO: Print result
## DONE ##
# DONE #
```
%% Cell type:markdown id: tags:
## Genutzte Daten und Metadaten
Geben Sie an welche Daten Sie verwenden und wie diese aufgebaut sind. Erklären Sie weiterhin in wenigen Sätzen das genutzte Metadaten-Konzept, sodass eine andere Person Ihre genutzten Daten versteht.
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Analyse
Analysieren Sie Ihre Ergebnisse aus wissenschaflticher Sicht. Berücksichtigen Sie dabei Ihre oben genannte Forschungsfrage. Wie wirkt sich die mit der Probe aus dem Heißwasserbad transportierte Wassermenge auf das Ergebnis aus? Welche weiteren Fehlerquellen gibt es?
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Fazit
Ziehe Sie ein persönliches Fazit zum Versuch.
%% Cell type:markdown id: tags:
......
......@@ -51,7 +51,7 @@ def logging_heater(path: str, uuid: str) -> dict[str, dict[str, float]]:
"Delete these 3 lines if you have finished the code or want to test it.".upper()
)
## DONE ##
# DONE #
# Initialize a dictionary to store heater data.
data_dict = {
......@@ -99,8 +99,8 @@ def logging_heater(path: str, uuid: str) -> dict[str, dict[str, float]]:
# Open the HDF5 file to write the data into the corresponding group.
with h5.File(path, "r+") as f:
# TODO: Saves the data entered by the user into the created group.
# Current, voltage and time should be saved into separate data sets
# TODO: Saves the data entered by the user into the created group.
# Current, voltage and time should be saved into separate data sets
# with the attribute being corresponding unit.
# This line of code throws an exception. This is just to make sure you can see
......@@ -110,8 +110,8 @@ def logging_heater(path: str, uuid: str) -> dict[str, dict[str, float]]:
raise NotImplementedError(
"Delete these 3 lines if you have finished the code or want to test it.".upper()
)
## DONE ##
# DONE #
# Return the dictionary containing the logged data.
return data_dict
......@@ -15,23 +15,23 @@ def plot_temp_over_time(
) -> None:
"""Plots temperature data over time with error bars for multiple datasets.
This function creates a plot representing temperature data against time
This function creates a plot representing temperature data against time
for multiple sensors or datasets. Each dataset's standard deviation is visualized
with error bars.
Args:
data (List[np.ndarray]): A list of numpy arrays where each array represents
the temperature data (with standard deviation).
Each array should have a shape of (2, n), with n
data (List[np.ndarray]): A list of numpy arrays where each array represents
the temperature data (with standard deviation).
Each array should have a shape of (2, n), with n
representing the number of data points.
time (List[np.ndarray]): A list of numpy arrays with the time data corresponding
to each dataset in `data`.
legend (List[str]): A list of strings that label each dataset in the legend.
x_label (str): The label for the x-axis (time).
y_label (str): The label for the y-axis (temperature).
is_save (bool, optional): If set to True, the plot will be saved to the path specified by
is_save (bool, optional): If set to True, the plot will be saved to the path specified by
`file_name`. Defaults to False.
file_name (str, optional): The path and filename where the plot image will be saved if
file_name (str, optional): The path and filename where the plot image will be saved if
`is_save` is True. Defaults to "image.svg".
"""
......@@ -44,7 +44,7 @@ def plot_temp_over_time(
"Delete these 3 lines if you have finished the code or want to test it.".upper()
)
## DONE ##
# DONE #
def get_plot_data_from_dataset(
......@@ -58,7 +58,7 @@ def get_plot_data_from_dataset(
Returns:
tuple[np.ndarray, np.ndarray, np.ndarray]: Data for plot in a tuple (temperature, time step, label of data).
"""
# TODO:
# This line of code throws an exception. This is just to make sure you can see
......@@ -69,7 +69,7 @@ def get_plot_data_from_dataset(
"Delete these 3 lines if you have finished the code or want to test it.".upper()
)
## DONE ##
# DONE #
def cal_main_and_standard_deviation(data: np.ndarray) -> np.ndarray:
......@@ -92,7 +92,7 @@ def cal_main_and_standard_deviation(data: np.ndarray) -> np.ndarray:
"Delete these 3 lines if you have finished the code or want to test it.".upper()
)
## DONE ##
# DONE #
def get_start_end_temprature(
......@@ -125,4 +125,4 @@ def get_start_end_temprature(
"Delete these 3 lines if you have finished the code or want to test it.".upper()
)
## DONE ##
# DONE #
......@@ -25,8 +25,7 @@ path_json = "./datasheets"
path_setup = ""
# path_setup = ""
# Ask for the type of experiment to be performed
# until the user gives a valid answer.
# Ask for the type of experiment to be performed until the user gives a valid answer.
is_log_heater = None
while is_log_heater != 0 and is_log_heater != 1:
if is_log_heater is None:
......@@ -46,22 +45,37 @@ while is_log_heater != 0 and is_log_heater != 1:
# Read the metadata necessary to control test rig from the setup file.
metadata = m_json.get_metadata_from_setup(path_setup)
# Read the sensor's serial number from the sensor's datasheets
# and add it to the dictionary that holds the metadata.
# Read the sensor's serial number from the sensor's datasheets and add it to the dictionary that holds the metadata.
m_json.add_temperature_sensor_serials(path_json, metadata)
# Reads sensor measurements and saves the data to a variable.
data = m_pck.get_meas_data_calorimetry(metadata)
# Read the name of the logging file to be created
# from stdin (standard input/output).
name_logging = input("logging file name = ")
# The folder containing the logging files will be
# created in the data folder in the root directory
# of the program.
# List of valid characters.
valued_char = "-_.() abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
# Initialize empty filename.
name_logging = ""
# Loop until the user enters a valid filename.
while name_logging == "":
# Read the name of the logging file to be created from stdin (standard input/output).
name_logging = input("logging file name = ")
# Remove spaces at the beginning and end of the filename.
name_logging = name_logging.strip()
# If the filename entered is empty then re-enter it.
if name_logging == "":
print("File name can not be empty.")
continue
# Iterate over all characters of the filename.
for c in name_logging:
# Requires retyping if invalid characters are present.
if c not in valued_char:
print("{} is not a valid name. ({} invalid)".format(name_logging, c))
name_logging = ""
break
# The folder containing the logging files will be created in the data folder in the root directory of the program.
path_logging = "{}/{}".format("data", name_logging)
# Save the datasets and datasheets used in the experiment
# to the logging directory.
# Save the datasets and datasheets used in the experiment to the logging directory.
m_pck.logging_calorimetry(data, metadata, path_logging, path_json)
if is_log_heater:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment