您的位置: 首页 > 科技

代写SCIE1000、Python设计程序代做

2024-05-11 来源:互联网


SCIE1000 Semester 1, 2024
Python and Communication Assignment
1 The scenario
UQ is developing a Science Experience exhibit on the Pitch Drop experiment [2]. The exhibit will
include an interactive Python program that will run on a machine next to the Pitch Drop experiment
in the Parnell building. Once developed, the exhibit items will be maintained and potentially modified
by future science students who have programming experience from SCIE1000. The exhibit will
include explanations of the science involved, and these will be written for two different audiences.
One explanation is pitched to the “science rookie” and the other to the “science enthusiast”. Some
characteristics of a typical member in each category are described in Table 1.
User Type Typical characteristics
Science Rookie No specialist knowledge;
not familiar with scientific terminology or notation;
will need terminology explained using a simple vocabulary;
is unfamiliar with graphs;
likes to press buttons.
Science Enthusiast Scientific background and interest, but no assumed specialist knowledge;
familiar with common scientific terminology and notation (not overly technical);
can handle terminology explained using somewhat sophisticated vocabulary;
is prepared to read longer passages of moderate complexity;
likes to know about modelling assumptions and limitations;
is familiar with graphs;
likes to press buttons.
Table 1: Characteristics of different users of the exhibit
2 An overview of the task
You will write an interactive Python program, intended for this exhibit, that will guide users to a
better understanding of viscosity, fluid flow through a pipe, and the complexity of making predictions.
A description of the relevant models is provided in Section 6 of this document, and a high-level
overview of how to complete the task is provided in Section 7.
This assignment has a main section for grades 1–5 and an advanced section which must be attempted by students aiming for grades of 6 or 7 (see the grading criteria for more explanation).
This assignment requires you to produce two deliverables, (D1) and (D2), as outlined below:
(D1) A Python code file that satisfies the specifications in Section 8. This includes following the
logical flow laid out in the flowchart provided in Figure 3 (see Page 9).
(D2) An audio-video screen capture file in which you show your code and give an overview of your
approaches to modelling and code structure aimed at future students who will need to maintain
1
your code. The audio must be in your own voice and you are welcome to also use a camera
so that you appear in the video (but the latter is not a requirement). One way to create such
a file is by recording with Zoom (open a Zoom meeting, share your screen, and select Record
→ Record to this computer). The length of the screen capture file must be no longer than
three minutes for the main section of the assignment along with a further two minutes for the
advanced section. Staff grading your work will not watch any content that extends beyond
these limits.
3 Submission and grading
Both deliverables (D1) and (D2) are to be uploaded via the Blackboard submission links by 1:00 pm
on 10 May 2024. If your video file is large, or if there are many other Blackboard users, it can take
time for your video file to load, and you need to wait for your browser to complete the submission.
The UQ guidelines on Blackboard assignment submissions recommend submitting at least 3 hours
before the deadline, in case of any internet/computer/technical issues.
Late submissions without an approved extension will be penalised according to the
policy in the Course Profile. If you have technical issues while submitting, you should contact
the student IT service “AskUs” at the library. Note that computer or internet problems are considered
unacceptable reasons for applying for an extension.
Your submitted code will be run and tested as part of this grading process. A rubric (grading criteria)
for this assignment is on Page 10. The file that you submit will be checked using software which is
specially designed to detect plagiarism in code. If you work closely with others or share code, this
software will likely detect the issue, potentially leading to a misconduct allegation.
4 Academic integrity
This assignment is a piece of summative assessment, designed to let you demonstrate your level of
mastery of several learning objectives in this course. As such, it is very important that the work you
submit is all your own. This means that you must not look at anyone else’s code and you must not
show your code to anyone. Both of these actions are examples of behaviour that may be considered
academic misconduct. Likewise, no code from your assignment attempt can be posted on the course
discussion board, or any other site, at any time. Using regression software within applications such
as Excel, Desmos, or similar to develop any of the models is not permitted. You should instead use
approaches developed in SCIE1000.
5 Getting help
This task sheet has been carefully constructed, and part of your job is to interpret the information
it contains. Some choices have been left to your judgement, and this is intentional. This
does not mean that you cannot receive help in regards to this assignment, but that help must be
limited to general advice about modelling, Python, and communication.
2
You may post questions on the Ed discussion board of a general nature but these must not include
any aspects that could assist others in completing the assignment. All such posts must be made visible to all students. Please note that private posts to the discussion board related to the assignment
content will not be answered.
A common issue faced by students in completing this assignment is debugging. The course Blackboard site has useful resources under Learning Resources → Python programming resources → Python
Contact Resources. Please check these resources before posting questions on the discussion board.
If you have problems with your code, you should develop some generic sample code that demonstrates
the issue that you are having (but does not relate to the assignment). A good starting point might
be to see if you can find a similar question in one of the workshops, practicals, or on ShiFoo to ask
about.
6 Modelling
6.1 An introduction to viscosity
Honey is sticky and flows more slowly than water. This type of “stickiness” is a resistance to flow
and is more formally known as viscosity (also called absolute viscosity or dynamic viscosity). The SI
units of viscosity are pascal-seconds. The viscosity of a fluid also varies with temperature; viscosity
decreases as temperature increases. At around 20◦C, water has a viscosity of 0.001 Pa·s, homogenized
milk has a viscosity of 0.002 Pa·s, and cottonseed oil has a viscosity of 0.07 Pa·s (see for example
[3]). At around 25◦C, orange honey has a viscosity between 3 Pa·s and 18 Pa·s, depending on its
moisture content [4].
6.2 History of the Pitch Drop Experiment
Pitch, also known as bitumen or asphalt, appears solid at room temperature. However, the Pitch
Drop experiment demonstrates that pitch is indeed a fluid, albeit an incredibly viscous one. The
density of pitch is assumed to be 1100 kg/m3
. The Pitch Drop experiment can be used to estimate
the viscosity of the pitch. A reasonable range for this value is between 7.3 × 105 Pa·s and 2.4 × 109
Pa·s, depending on temperature (see [1] for example).
Professor Parnell started the Pitch Drop experiment in 1927 (see for example [2]). He heated some
pitch, poured it into a glass funnel (with a sealed stem) and allowed the pitch to cool. In October
1930, he cut the stem of the funnel, allowing pitch to slowly drip out of the funnel and into a beaker
below. A record of the drops that have fallen thus far is given in Table 2.
After the sixth drop fell, the volume of the pitch in the collection beaker was determined (by comparing the volume of water required to fill the beaker with the pitch to the beaker without the pitch
[1]). Making the assumption that each drop had the same volume, the volume of a single drop is
calculated to be 7.8 ml. We will assume that each drop in this experiment has this volume. Note
that 1 ml is equivalent to 10−6 m3
.
The Pitch Drop is housed in a glass casing (see Figure 1) near the lecture theatres in the Parnell building. It was not originally kept in a temperature controlled environment [1], however air
3
Drop number Date Years since 01/01/1930
1 Dec 1938 8.95
2 Feb 1947 17.12
3 Apr 1954 24.28
4 May 1962 32.37
5 Aug 1970 40.62
6 Apr 1979 49.28
7 Jul 1988 58.54
8 Nov 2000 70.91
9 April 2014 84.29
Table 2: Recorded data for drops fallen
conditioning was introduced into the Parnell building some time after the seventh drop fell.
The wall behind the Pitch Drop experiment contains some information about the history of the
experiment (see Figure 1), including the dates for when the 9 drops fell as per the first two columns
of Table 2. If we plot the volume of pitch that has dropped over time, one can check that a single
linear model could be used to fit the data but that a piecewise linear model can provide a better fit
to the data - see Section 7 for a detailed overview of how to approach such modelling.
Figure 1: The Pitch Drop Experiment
h
l
d
Vd
Figure 2: Schematic of the pitch drop
6.3 Fluid flow through a pipe
The flow rate, Q, of a fluid is given by the volume that flows past a particular location per unit time.
Poiseuille’s Law for a fluid flowing along a horizontal pipe, describes how this flow rate (in m3
·s
−1
)
depends on the length ℓ of the pipe (in m), the diameter d of the pipe (in m), the pressure difference
4
∆P between each end of the pipe (in Pa) and the viscosity µ (in Pa·s). The equation is:
Q =
∆P πd4
128µℓ .
In the configuration for the Pitch Drop experiment, the flow is through a vertical pipe, and is driven
by gravitational effects due to the fluid above, within and below the pipe [1]. Here, we will ignore the
effects of the droplet at the bottom. The fluid above the entrance to the narrow part of the funnel
(of height, h) generates a pressure difference ρgh while the fluid within the narrow part of the funnel
(of length, ℓ) generates a further pressure difference of ρgℓ, where ρ is the density of the fluid (in
kg·m−3
) and g = 9.8 m ·s
−2
is the acceleration due to gravity. See Figure 2 for a visual of the height
h and length ℓ. The sum h + ℓ is the total height of pitch in the funnel apparatus. Thus, for the
Pitch Drop experiment,
∆P = ρg(h + ℓ).
Some measurements of the funnel apparatus have been taken for the Pitch Drop experiment [1] are
given in Table 3.
parameter value (in cm)
h 7.5
ℓ 2.9
d 0.94
Table 3: Measured parameters of the funnel apparatus
6.4 Model limitations and a non-linear model (Advanced section)
Some factors that affect fluid flow have either been ignored or treated as a constant (even though
they would in fact change slowly with time). The volume of pitch in the funnel will decrease over
time, and thus we expect the rate of change of the total volume dropped over time to be decreasing.
Hence is not likely to be well-modelled by a linear equation over long spans of time.
One could model the volume of pitch that remains in the apparatus as an exponential decay function,
A = A0e
−kt, where A0 is the initial volume of pitch in the funnel apparatus at the start of the
experiment. Note that A0 will be an estimate and k can to be calculated based on other known
measurements or estimates. Then the volume of pitch that has dropped is modelled by
V = A0 − A0e
−kt
.
One way to estimate A0 is to sum estimates of the volume of pitch that has dropped and the volume
of pitch that is still in the apparatus. To estimate the latter, note that the diameter of the funnel at
the very top is about 7.5 cm. Note the following volume formulae.
ˆ The volume of a cylinder with radius r and height h is πr2h.
ˆ The volume of a cone with radius r and height h is 1
3
πr2h.
ˆ The volume of a sphere with radius r is 4
3
πr3
.
5
7 A detailed overview of the task
Your assignment submission must follow the specifications listed in Section 8. Below, we first give a
high-level overview of how to approach the main section and the advanced section.
To complete the main section, you will need to:
ˆ Provide an introductory explanation of viscosity to users at a level appropriate for the audience.
ˆ Provide an explanation of the factors affecting fluid flow, according to Poiseuille’s Law, at a
level appropriate for the audience.
ˆ Develop a “piecewise” linear model for the volume of pitch that has fallen over time, since the
start of the experiment. It is “piecewise” in that different linear models are used for different
sections of the data. This will be a phenomenological approach using available measurements,
and should consist of 2 or 3 linear models, each used for an appropriate section of the data.
The fit must be done using the approaches developed in SCIE1000 - the use of curve fitting
software is not permitted. Display a graph of the data and your piecewise linear model to a
science enthusiast user. Describe your approach in the screen capture video.
ˆ Allow the user to select a drop number (in the future) and use a model you have developed to
predict the time a future drop is expected to fall.
ˆ Allow users to estimate both the time taken for a single drop of pitch to fall in the Pitch Drop
Experiment, and the total height of pitch in the funnel apparatus. Use these to calculate the
flow rate of pitch and an estimate of the viscosity of pitch. Explain the outcome to the user.
ˆ Create your own user-defined Python functions to perform the relevant calculations in your
code.
ˆ Include a description of how you approached this section of your code in your screen capture
video (D2). Specifically, as indicated above, you will need to describe how you made your
piecewise linear model, how you structured your code, and how you handled units in calculations
and in communication.
To complete the advanced section, you will need to:
ˆ Communicate appropriately with a science enthusiast user about some of the limitations of the
modelling done thus far, and how to model over longer time spans. Remember that this is the
advanced section and grading will reflect your use of approaches to communication covered in
SCIE1000 that best inform the patron.
ˆ Develop a model of the volume of pitch that has dropped by modelling the amount that remains
in the funnel apparatus as an exponential decay function (see Section 6.4). Display a graph of
the data and your new model to a science enthusiast user, using a time span that should see
the experiment to its final drop of pitch.
ˆ Include a description of how you approached this section of the assignment in your screen
capture video (D2).
6
8 Specifications for your submitted file
Specifications about the Python:
ˆ You have been supplied a flowchart describing how the program should run (Figure 3 on Page
9). The shaded section of the flowchart indicates the advanced section. Your code must be
an implementation of the flowchart provided.
ˆ You may only use Python commands introduced in SCIE1000. Recall that future
science students (who have taken SCIE1000) must be able to maintain and modify the code, so
you may only use commands that they understand. The Python commands you have covered
in this course should be more than sufficient to complete the assignment.
ˆ All inputs must be in the form of a number (we have not covered string inputs in SCIE1000).
Whenever you prompt the user for information, you may assume they enter a suitable number,
and you can store their answer as an integer or as a floating point number as appropriate. You
do not need to check for incorrect inputs.
ˆ Your code must be well-structured and follow the guidelines for programming practice, as
introduced in SCIE1000. Ensure that you demonstrate all course coding capabilities
(inputs, conditionals, loops, arrays, user-defined functions and graphs).
ˆ Your code must accurately represent the modelling described in Section 6.
Specifications about the communication:
ˆ All messages to the user, including prompts to enter data, should be communicated in a manner
appropriate for the level of user and should serve the purpose of the program.
ˆ You should write no more than one paragraph (several sentences) for each piece of information
you explain to the user. Follow the principles for communication in science as described in
Appendix B of the SCIE1000 workbook. Be precise, clear and concise!
ˆ You should use units appropriately in your communication with the user. Make sure you
(and anybody reading your code) are aware of the units of values being passed into user-defined
functions and the units of values being returned from these functions.
ˆ You should include useful and appropriate comments in your code to help those who may
need to maintain and modify the code. Any variable names and user-defined function names
you define should be chosen with communication in mind.
ˆ Whenever you produce a graph you should provide appropriate labels and accompanying
explanatory text.
ˆ Your screen capture video should provide a clear overview of your approaches to modelling (including a brief overview of any calculations), the code structure and why
you made the choices you did. This does not replace excellent commenting in the code.
7
ˆ If you wish to use sources other than this task sheet (or references cited in this task sheet),
you should include a bibliography at the end of your code (as a comment) to reference these.
This allows the people maintaining your code to be aware of where you obtained any relevant
information you used. Any referencing style is fine - the UQ Library website contains examples
if you are unsure.
File type and file name:
ˆ Your assignment (D1) should be saved as a .py file called PitchDropCode********.py
with the string ******** replaced by your (8-digit) student number.
ˆ Your screen capture audio/video file (D2) should be saved as a .mp4 file called Explanation********.mp4 with the string ******** replaced by your student number.
Important: In preparing and submitting your files:
ˆ First clear the kernel or exit and then re-enter your programming environment (Jupyter/Spyder/other) and then run your program. This ensures that all variables previously used will be
cleared before your program is run. Correct any errors that appear. This replicates how your
program will be tested.
ˆ If you are using Jupyter, ensure that you save your file as a .py file. The command to do this
is File → Download as → Python .py. After saving, open the file using a text editor (such as
Microsoft Word) and check that all of your code appears in the exported file. Do NOT make
any changes or save the code again from the text editor. If you need to make changes then go
back to the version that you have in Jupyter.
ˆ Check that your screen capture file plays properly and that the audio is clear.
ˆ After you upload your files to Blackboard, check that both the Python file and the screen
capture file have been uploaded. Ensure that you submit the files (not Save Draft). If your
screen capture file is large, then your browser may appear to not be responding after you press
the submit button. Wait for the files to upload (this could even take minutes if your internet
is slow). Failing to submit either of these files will impact your grade.
ˆ It is your responsibility to ensure the files are submitted on time in the correct format.
Failure to do so can result in late penalties or no grade being awarded if staff are unable to
open files submitted in the wrong format.
References
[1] Edgeworth, R., Dalton, B.J., and Parnell, T. (1984). The pitch drop experiment. Eur. J. Phys. 5, pp 198–200.
[2] https://smp.uq.edu.au/pitch-drop-experiment, accessed 22 February 2024.
[3] The Engineering ToolBox (2012). Food Products - Viscosities. (online) Available at:
https://www.engineeringtoolbox.com/absolute-viscosity-foods-d 1827.html, Accessed 27 February 2024.
[4] Yanniotis, S., Skaltsi, S., and Karaburnioti, S. (2006). Effect of moisture content on the viscosity of honey at
different temperatures. J. Food Engin. 72, 372–377.
8
.
Prompt the user to enter their user type.
Print a farewell message.
Print an introduction to viscosity.
No
Enthusiast?
Yes
Prompt the user to guess the total height of pitch in the funnel apparatus
(not including the droplet).
Display a graph of the data on volume of pitch dropped over time
together with a piecewise linear model that you have developed.
Print a description of the Pitch Drop experiment and how Poiseuille’s law applies.
Prompt the user to enter a future drop number. Use the model to predict when it will
fall and inform the user of the prediction.
Prompt the user to estimate the time taken for a single drop to fall.
Ask the user if they wish to predict another drop.
Advanced
Explain at least one limitation in the modelling that has
been done thus far.
Develop a model of volume of pitch dropped over time of the
form

[ 编辑: code ]