0% found this document useful (0 votes)
18 views

Python Study Group 1

Uploaded by

Rafalel Jupio
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Python Study Group 1

Uploaded by

Rafalel Jupio
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

BIOE97142 – Computation and Statistical Methods for Research

Study Session 2: Introduction to Python and NumPy

Lecturers: Dr. Rylie Green, Dr. Christopher Chapman


GTAs: Martina Genta, Hendrick Beck, Mikolaj Kegler, Sergio Mena, Alexey Novikov, Frederik Puffel

Problem:
You are running a process on a vacuum oven like the
one pictured in Figure 1. This process requires the
oven to be maintained at 200 C for 3 days. Any
deviation from this temperature will result in the
failure of your process.

?
After two attempts you see that your process is
continually failing. However, you are not sure if the
temperature of the oven is causing this. Therefore, you
set-up a temperature monitor that will record the
temperature in one-hour intervals for the entire three-
day process.

This temperature monitor produces a text file named


Figure 1 - Vacuum oven for annealing process
‘tempdata.txt’ that has all the temperature recordings
for each hour timepoint for each day. You are tasked
with analyzing this temperature data in order to determine if the process temperature remains
within an acceptable range of  3 C.

Set-up:
In order to solve this problem you must write a program in python that imports the data into a
NumPy array from the ‘tempdata.txt’ file, returns the daily average temperature along with its
standard deviation, and creates an alert if the  3 C threshold is crossed during any of the hours
of the process.

To do this you will need to utilize NumPy arrays for data storage, for loops to iterate through the
array, and if statements to determine if the threshold is met.

Helpful Hint:
Using NumPy you can read a text file into an array using the numpy.genfromtxt() function.
This function needs two arguments: the first argument is the path of the text file, and the second
is the delimiter of the text file.

For this example, you can use:


array_name = numpy.genfromtxt(‘filepath\filename.txt’,delimiter = ‘,’)

You might also like