"""Plotting The temperature data obtained from any number of temperature sensors over time. The data should be stored in a list, with each element of the list representing the data collected by one sensor. The data from each sensor must include uncertainty, so each element of the list should be an numpy.ndarray of size (2,n), with n meaning the number of data collected by that sensor.
"""Plots temperature data over time with error bars for multiple datasets.
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
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
`file_name`. Defaults to False.
file_name (str, optional): The path and filename where the plot image will be saved if
`is_save` is True. Defaults to "image.svg".
Args:
data (list[np.ndarray]): temprature data, each element of the list must be a numpy.ndarray with size (2,n), n means number of data.
time (list[np.ndarray]): time step.
legend (list[str]): label of sensors
x_label (str): label of x axis.
y_label (str): label of y axis.
is_save (bool, optional): if the plot should be saved. Defaults to False.
file_name (str, optional): name of the image file be saved. Defaults to "image.svg".
x_log (bool, optional): Turn on x-axis logarithmic.
y_log (bool, optional): Turn on y-axis logarithmic.
"""
pass
# TODO:
# This line of code throws an exception. This is just to make sure you can see
# all the code you need to refine. If you already know how to implement the program
# or have done so, then you can safely delete the three lines of code below, as well
# as this comment.
raiseNotImplementedError(
"Delete these 3 lines if you have finished the code or want to test it.".upper()
"""Calculating mean and standard_deviation for raw data.
Args:
data (np.ndarray): raw data in a 2 dimensional array, the first dimension should not be 1 if statistical uncertainty is to be calculated, i.e. there are multiple measurements of the same time (space).
sys_uncert (float): system uncertainty in absolute value.
data (np.ndarray): raw data in a 2 dimensional array (m, n), the first dimension should not be 1 if
there are multiple (m) measurements of the same time (and place).
Returns:
np.ndarray: raw data with uncertainty in a 2D ndarray.
np.ndarray: raw data with uncertainty in a 2D ndarray with shape (2, n).
"""
pass
# TODO:
# This line of code throws an exception. This is just to make sure you can see
# all the code you need to refine. If you already know how to implement the program
# or have done so, then you can safely delete the three lines of code below, as well
# as this comment.
raiseNotImplementedError(
"Delete these 3 lines if you have finished the code or want to test it.".upper()
)
## DONE ##
defget_start_end_temprature(
temprature_data:np.ndarray,threshold:float
)->Tuple[float,float]:
"""The sensor values at the beginning and end of the experiment are obtained from the maximum and minimum values in the data set and a threshold. The uncertainty of the values is also output.
"""Calculates the average high and low temperatures from a dataset.
This function computes the average of the highest temperatures and the average of the lowest temperatures
within a given threshold from the maximum and minimum temperatures recorded in the dataset. These are
considered as the ending and starting temperatures respectively.
Args:
temprature (np.ndarray): dataset, muss be a numpy.ndarray with 2 dimension.
threshold (float): Threshold for deciding whether the data will be counted as a value before the start of the experiment.
temperature_data (np.ndarray): The temperature dataset as a 2D numpy array.
threshold (float): The threshold percentage used to identify temperatures close to the maximum
and minimum values as high and low temperatures respectively.
Returns:
tuple[float, float]: high temprature, low temprature.
Tuple[float, float]: A tuple containing the average high temperature first and the average low
temperature second.
"""
pass
# TODO:
# Hint: thetemprature_data should contain the raw data of the sensors.
# numpy.ndarray.flatten() function may be useful for multidimensionale arrays.
# This line of code throws an exception. This is just to make sure you can see
# all the code you need to refine. If you already know how to implement the program
# or have done so, then you can safely delete the three lines of code below, as well
# as this comment.
raiseNotImplementedError(
"Delete these 3 lines if you have finished the code or want to test it.".upper()