联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2020-06-01 11:20

SCIE1000 Theory and Practice in Science

Python and Communication Assignment

Semester One, 2020

1 The scenario

A public science museum in St Lucia is planning to update its exhibit. A feature of the museum

is that each exhibit item is accompanied by two explanations, each written for a different audience.

One explanation is pitched to the “science rookie” and the other to the “science enthusiast”. Patrons

read the explanation tailored to the level at which they feel most comfortable. Some characteristics

of a typical audience member in each category are described in Table 1.

Table 1: Characteristics of different patrons

Patron Type Typical characteristics

Science Rookie Not familiar with scientific terminology or notation;

will need terminology explained using a simple vocabulary;

is unfamiliar with graphs;

may be a younger person, possibly 10+ years of age;

likes to press buttons.

Science Enthusiast Familiar with common scientific terminology and notation (not overly technical);

will need terminology explained using somewhat sophisticated vocabulary;

is prepared to read longer passages of moderate complexity;

is familiar with graphs;

likes to press buttons.

The planned exhibition is called “Exploring Our Galaxy”. The topic is exoplanets (planets found

orbiting distant stars) and the aim is summarised in the following exhibition prospectus:

With this exhibition we aim to instil in our patrons a sense of wonder at the vastness of

our galaxy and the potential for finding other forms of life with whom it may be possible

to communicate. Patrons will marvel at the challenge of searching for exoplanets and

they will speculate about the number of potential civilisations in our galaxy with whom we

could theoretically communicate.

The museum director has asked the SCIE1000 teaching team for help in finding skilled volunteers

to develop exhibit items. Once developed, the items will be maintained and potentially modified

by museum staff, each of whom has a strong background in high-school mathematics, together with

at least a beginners level of Python experience. We assured the director that SCIE1000 students

are skilled at: making mathematical models using a mathematical toolkit familiar to any student of

Maths B (or equivalent); writing Python programs, including those which use arrays, loops, plots

and new functions; and communicating scientific information to various audiences.

Based on this boasting by the SCIE1000 teaching team, you have been asked to develop an exhibit

item. You will develop an interactive (command-line) Python program which engenders in museum

patrons a sense of wonder at the vastness of our galaxy and the potential for communicating with

other forms of life.

1

2 An overview of the task

You will write an interactive Python program to guide a user through some speculation about

civilisations in our galaxy (see Section 4) as well as whether a potential exoplanet could be detected

from Earth given its size and distance from its star (see Section 5).

Your program will follow the logical flow laid out in the flow chart provided in Figure 2.

A detailed list of program requirements is provided in Section 6 of this document.

Your assignment will be separately be graded on two aspects, each on a 1–7 scale. The first aspect

will be your use of Python to represent the underlying mathematical models. This will include the

quality of your code and the accuracy with which you represent the models. The second aspect will

be on the communication that you use. This covers both the communication within your program

(for staff at the exhibit) and the communication you use with the patrons of the exhibit.

Your submitted code will be run and tested as part of this grading process. A rubric (marking

criteria) for this assignment is on the last page of this document. This assignment has an advanced

section which must be attempted by students aiming for grades of 6 or 7 (see the grading criteria

for more explanation). The shaded section of the flow chart indicates this advanced section, and the

corresponding modelling information is in Section 5.6. If you have any questions, please contact the

course staff.

Your code file must be uploaded via the Blackboard submission link by 2pm on 1 June, 2020.

Late submissions without an approved extension will be penalised; consult Section 5.3 of the Electronic

Course Profile for more information concerning late submissions.

3 About getting help

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 does not mean that you cannot receive help in regards to this assignment, but that help must

be limited to general advice about Python and modelling - not specific to how to do this particular

assignment. Your teaching team, the SLC tutors, your classmates, your friends, and anyone else for

that matter, can answer as many general questions about Python and modelling as you care to ask.

They can even help you understand what particular error messages may mean. They should not,

however, tell you what to write or correct your code. You should type or create every character in

the files you submit. The files that you submit will be checked using software which is

specially designed to detect plagiarism in code. Consult Section 6.1 of the Electronic Course

Profile for more information and procedures concerning plagiarism.

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. Any

questions you have about the assignment task should be posted on the course Piazza site as a public

post (visible to all students). This is the only place where you can receive authoritative answers to

questions. In this way, all students will have access to the same information. Sometimes the answer

to a question on Piazza will be “See the assignment task sheet”. Such answers are simply to avoid

restating information, and indicate that you will need to decide how to use the supplied information.

2

4 Imagining potential civilisations in the Milky Way

The Drake equation, named after the astronomer and astrophysicist Dr. Frank Drake, is a formalisation

to guide speculation about the probability of finding civilisations in our galaxy (the Milky

Way) with whom it may be possible to communicate. This equation is often quoted with seven

parameters (see [1]). We will use the following simplified version:

N = R · p · n · c · L (1)

where

N = number of civilisations in the galaxy that can communicate with Earth

R = average rate of star formation (per year) in the galaxy

p = proportion of stars with planetary systems

n = number of planets per system with conditions suitable for life

c = proportion of potentially habitable planets on which a technological civilisation develops

L = average lifetime (in years) of such a civilisation within the detection window

Table 2, adapted from [1], includes recent estimates (ie “best known estimates”) for the parameters

in the Drake equation, as well as historical estimates which were used in the 1960’s.

Table 2: Parameters of the Drake equation and their estimates

Parameter R p n c L

1960’s estimation 10 per year 0.5 2 0.0001 10,000 years

Recent estimation 7 per year 0.5 1 0.02 10,000 years

Before you plan your communication to the user about this information (see the flow chart in Figure

2 for details) you should carefully think about how estimates for N are made and how reliable you

think those estimates are.

5 Exoplanets

5.1 Detecting exoplanets using the Kepler space telescope

Extraterrestrial planets, or exoplanets, are planets that orbit around stars other than our Sun. Since

the nearest star is around 4 light-years away (the distance light travels in 4 years), exoplanets are

extremely difficult to detect. However, in recent years, a number of different techniques have been

developed which are capable of directly or indirectly inferring the existence of an exoplanet around

another star in our galaxy (the Milky Way).

One very successful method for detecting exoplanets is to observe the intensity of the light emitted

by the star as a function of time. If an exoplanet passes in front of this star, it partially blocks the star

as viewed from the Earth, and the measured intensity of the star will (slightly) decrease. Multiple

measurements at regular intervals (at least three passes in front of its star) can be used to confirm

the existence of an exoplanet.

3

A telescope that has been used extensively for the detection of exoplanets using this approach

is the Kepler space telescope. Its goal was to detect smaller exoplanets in the range from the size

of Earth to the size of Jupiter. This telescope, recently retired, was launched in 2009, and has

successfully detected several thousand exoplanets [2].

5.2 Modelling exoplanet detection

The model we will develop here will be a very simplified model of the physical process in which a

planet transits in front of a star. In particular, we will make the following assumptions when building

our model:

? We will be detecting exoplanets that are orbiting a star which has the same size and mass as

the Sun. The star mass impacts on the speed of the exoplanet as it moves around its star, and

hence the time to complete a full orbit around the star, while the mass and size of the star

influence the time the exoplanet takes to pass in front of the star.

? There is a “perfect” alignment of the exoplanet between our observation point on Earth, and

the star around which it orbits. This maximises the time that the exoplanet is in front of its

star.

? The light emitted by the star is uniform across the width of the star. This simplifies our

calculation of intensity as the exoplanet transits in front of the star.

? The radius of the exoplanet is small compared to the radius of its star. This allows us to choose

a simple model of the transit.

Note: there will be some constants relevant to our solar system that you will need to research and

find values for. Exercise care with units!

5.3 Choosing input parameters

To model the transit of the exoplanet in front of its star, we first need to specify the the size of the

exoplanet and the distance the exoplanet is from its star. Your program will ask the patron to choose

these. However, most rookies (and many enthusiasts) will not have a good feel for what values would

be appropriate. Hence, you will need to think carefully about how this is posed to the patrons. We

recommend thinking about how to use relative values compared to similar values for the Earth/Sun.

5.4 Model - calculating the velocity of the exoplanet

The velocity of the exoplanet is dependent on how far it is from its star, and the gravitational

attraction of the star. We can relate these back to values for Earth using

velocity of exoplanet

velocity of Earth =

s

distance of Earth from the Sun

distance of exoplanet from its star

4

5.5 Model - calculating the key output parameters

We can now begin calculating the relevant output parameters. These are:

? Minimum relative intensity. When the exoplanet is fully between the Earth and the exoplanet’s

star, the intensity of the star observed from the Earth will be decreased as the exoplanet

blocks some of the light from the star. We can define a relative intensity as the ratio of the

observed intensity when the exoplanet is in front of the star to the observed intensity when the

exoplanet is not in front of the star. This intensity depends on the ratio of the cross sectional

area of the exoplanet to the cross-sectional area of its star. The cross-sectional area of a sphere

is the area of a circle with a radius which is equal to the radius of the sphere. We can thus

write an equation for the observed relative intensity of the star when the exoplanet is in front

of the star as

Relative intensity = 1 ?

cross-sectional area of the planet

cross-sectional area of the star

This equation gives the minimum observed relative intensity. The maximum relative intensity,

when the exoplanet is not in front of the star, is equal to 1.

Note that we have ignored the short period of time when the exoplanet is only partially in

front of the star (i.e. across one edge of the star). We will explore this further in the advanced

section below.

? Transit time. The velocity of the exoplanet and the diameter of its star will determine the

transit time. The faster the exoplanet is moving, the shorter the transit time and, likewise, the

larger the diameter of the star, the longer the transit time. The transit time can be written as

Transit time = diameter of the star

velocity of the exoplanet

? Period of orbit. The period of the orbit of the exoplanet is the time for the exoplanet to make

one complete orbit around its star (this is 1 year for Earth). The period of orbit is determined

by the exoplanet’s speed, and the distance the exoplanet is from its star. The period can thus

be written as

Period = circumference of the orbit

velocity of the exoplanet

Your program should output values for these parameters, accompanied with appropriate explanations

for what each means.

? Detection. The detection limit for Kepler to observe a planet is an intensity decrease of 1

part in 10,000 (or 0.01%) as the exoplanet transits the star. You should inform the patron

whether their chosen exoplanet could be detected or not. You might also like to comment on

how long the star needs to be observed to confirm detection of the exoplanet.

5

vexoplanet

rstar -rstar

t5 t4 t3 t2 t1

x5 x4 x3 x2 x1

xout_L xin_L

Star

Exoplanet

(a) (b)

x x 0 x

xin_R xout_R

(c)

Figure 1: For the advanced section. Diagram of the motion of the exoplanet across the face of the

star. (a) Stepping the position of the exoplanet (x) as the time is varied (t); (b) Limits for the

exoplanet crossing the border of the star on the left side; (c) and limits for the right side.

5.6 Advanced section

The science enthusiast should be provided with further information including a graph of the intensity

and a paragraph of accompanying text. The graph should show how the relative intensity varies as

the exoplanet transits its star over time. The accompanying text should briefly (but clearly) explain

one limitation of the model that has been used.

To create the graph, there are a number of approaches that you could use

? Develop a time step approach. This will involve using a loop in your program which steps

through time as the planet transits in front of the star. This is shown in Fig. 1(a), with a

very coarse time step. At each time step, you will need to calculate the position of the planet.

Time, t and position, x, are related via

x = x0 + vt

where x0 is some starting position (t = 0), and v is the velocity of the planet. At each time

step, you will need to calculate the observed relative intensity which will be

– equal to 1 if the planet is not in front of the star (positions 1 and 5 in the figure).

– equal to the minimum intensity, Imin, that you previously calculated if the planet is fully

in front of the star (position 3 in the figure).

– between the minimum intensity and 1 when the planet overlaps the edge of the star

(positions 2 and 4 in the figure). We will use a linear interpolation to approximate the

intensity

Relative intensity = 1 ?

x ? xout

xin ? xout

× (1 ? Imin)

where x is the position of the planet, and xin and xout are the positions of the planet when

it is just inside and just outside the star, respectively (see Fig. 1b and Fig. 1c).

6

? Determine the times of specific events, and join using straight lines. As noted in the previous

approach, the intensity if equal to 1 when the planet is outside the star, and equal to Imin when

the planet is fully in front of the star. The transition between these intensities occurs as the

planet crosses the border of the star. In this approach, you will need to determine the time

(relative to some starting time) when the planet is just inside the star, and just outside the

star, on each side of the star. These positions are shown in Fig. 1(b) and Fig. 1(c).

If you are unsure of what your graph should look like, then we recommend that you do some research

on the Kepler mission.

Some extra notes on Python graphing:

? Python sometimes plots a graph using an offset. For example, for an axis with limits of 0.999 -

1.000, Python may create a graph with the axis running from 0 - 0.001 with an offset of +0.999.

To avoid this use the Python command: ticklabel_format(useOffset=False)

? If you want to specify the horizontal axis limits, use the command xlim(lowerlimit,upperlimit)

and if you want to specify the vertical axis limits, use the command ylim(lowerlimit,upperlimit),

where you choose lowerlimit and upperlimit yourself (put some numbers in to see how it works).

6 Specifications for your submitted file

The file you submit for this assignment must be an interactive Python program which models certain

aspects of the search for exoplanets and other civilisations in our galaxy.

Specifications about the Python:

? Museum staff have supplied a flowchart describing how the program should run (Figure 2).

Your code must be an implementation of the flowchart provided.

? Your code must be well-structured and follow the guidelines for programming practice, as

introduced in SCIE1000.

? Whenever you prompt the user for information, you may assume they enter a number, and you

can store their answer as a float.

? You may only use Python commands introduced in SCIE1000. Recall that museum staff

must be able to maintain and modify the code, so you may only use commands that they

understand. Museum staff have a beginner’s level of experience using Python, which you may

regard as the equivalent of a student who has taken SCIE1000. The Python commands you

have covered in this course should be more than sufficient to complete the assignment.

? Museum staff have identified several functions that they think will be useful in possible modi-

fications and extensions of the code. You must define these functions in your code, with

the exact names specified below and which take the same arguments in the order specified. You

should call these functions in your code as appropriate. You may define other new functions

as needed.

7

(a) You must define a function called get_period_of_planet which takes two arguments, the

distance from the exoplanet to its star and the velocity of the exoplanet (in that order),

and returns the period of the orbit of that exoplanet around its star.

(b) You must define a function called get_transit_time which takes two arguments, the

velocity of the exoplanet and the radius of the star (in that order), and returns the time

taken for the exoplanet to transit across the front of its star.

(c) You must define a function called get_min_rel_intensity which takes two arguments,

the radius of the exoplanet and the radius of the star (in that order), and returns the

minimum relative intensity of the light from that star during the exoplanet’s transit across

the star.

Specifications about the communication:

? All messages to the user, including prompts to enter data, should communicate in a manner

appropriate for the level of patron and should serve the purpose of the program.

? You should write no more than a couple of 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 lecture book. Be precise, clear and concise!

? You should use units appropriately in your communication with the user. Make sure you are

aware of the units of values being passed into functions and the units of values being returned

from functions.

? You should include useful and appropriate comments in your code to help the museum staff

who may need to maintain and modify the code. Any variable names and function names you

define should be chosen with communication in mind.

? Whenever you produce a graph you should provide appropriate labels and explanatory text.

File type and file name:

? Your assignment should be saved as a .py file. The file should be called

InteractiveSpaceAliens********.py

with the string ******** replaced by your student number.

? When you are writing one long program as a .py file, it is usually easiest using Spyder, rather

than Jupyter. To access Spyder, simply open Anaconda and then click “Launch” under the

option for Spyder.

References

[1] Glade, N., Ballet, P. and Bastien, O. (2012) A stochastic process approach of the drake equation

parameters. International Journal of Astrobiology, Vol. 11(2), pp. 103–108.

[2] Cleary, D. (2018). Planet hunter nears its end: Kepler space telescope found trove of exoplanets.

Science, Oct 19, 2018, Vol. 362(6412), p. 274(2).

8

Print a welcome message that is appropriate for all patrons. Prompt the user to enter their Patron type

Print an intro about other planets and other potential civilisations in our galaxy

Ask the user if they want to try again with another exoplanet search

Ask the user what they think is the proportion (or percentage)

of habitable planets that develop technological civilisations

Calculate and print N using their estimates, with a useful message

Yes

No

Print a farewell message

Yes

Ask the user for the relative size of the planet they want to find (relative to Earth)

Ask the user for the distance of that planet to its star (relative to Earth’s distance from the sun)

Calculate the period for the planet’s orbit using get_period_of_planet

Calculate the transit time for the planet using get_transit_time

Calculate the minimum relative intensity of the planet using get_min_rel_intensity

Print each of these values for the user with useful messages

If user is an

“enthusiast”?

Calculate the intensity of light from the star for a

series of times and store these values in an array.

Plot a graph of the intensity of light from the star

over time as the planet transits across the star.

No

Inform the user whether their chosen planet could be detected or not

Introduce the idea of searching for planets around stars other than our own

Write a short paragraph about a limitation of the

modelling

Advanced section

Figure 2: Flowchart for the interactive program (shaded section indicates the advanced section).

9

Assignment Grading

Your grades for the Python and Communication sections of the assignment (each on a 1–7 scale) are

calculated by using the grade that best matches your answers for the main sections plus the extra

grades for the advanced sections. Your overall grade will thus be up to a maximum of 14. The table

below shows the criteria for each grade.

Grade Python (1–7) Communication (1–7)

1 The code is limited and displays little understanding

of the modelling involved.

Communication is very poor and would be

difficult to understand by any audience.

2 The code fails to run for any input, does

not meet the specifications, and/or has serious

conceptual errors in the modelling.

The communication of the relevant scientific

information (in the code and to patrons)

is generally poor.

3 The code runs for some expected inputs,

meets at least some of the specifications,

and/or may have some significant conceptual

errors in the modelling.

The communication of the relevant scientific

information (in the code and to patrons)

lacks clarity or is not at the appropriate

level for most target audiences.

4 The code runs without error for most inputs,

mostly meets the specifications, and

mostly represents the mathematical modelling

with perhaps only some conceptual

and/or mathematical errors.

The communication of the relevant scientific

information (in the code and to patrons)

is adequate for most target audiences.

The may be some limitations in the

communication within the code and/or to

patrons.

5 The code runs without error for all expected

inputs, largely meets all the specifications,

and accurately represents the

modelling with perhaps only one or two

minor errors.

The communication of the relevant scientific

information (both within the code

and to patrons) is mostly clear, fluent, and

uses a level and style appropriate for each

target audience.

Advanced Section

0 Not completed, or the advanced code has

significant conceptual errors.

Not completed, or the communication in

the advanced section is poor.

+1 The code for the advanced section runs

with only minor errors and mostly represents

the modelling with some conceptual

or calculation errors.

The level of communication is adequate

throughout the advanced section but

would require some editing before use in

an exhibit.

+2 The code for the advanced section runs

without error and accurately represents

the modelling with at most one minor error.

The level of communication is clear

throughout the advanced section and

would be suitable for use in an exhibit

with perhaps only one or two small

changes.

10


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp