Uncategorized

Python- Simulating the Movements of Cells in a Microscope

Python- Simulating the Movements of Cells in a Microscope

CS 177 – Project #1

This assignment is an individual project and should be completed on your own using only your own
personally written code. You will submit one (1) copy of the completed Python program to the
Project 1 assignment on Blackboard. The completed file will include your name, the name of the
project and a description of its functionality and purpose of in the comments header. The file should
be named ”Project-1.py”.
This project will be the foundation of future assignments this semester, so it is important that you
maximize your program’s functionality.
Problem Description: Simulating the Movements of Cells in a Microscope
==============================================================
In 2014 Virginia scientist Eric Betzig won a Nobel Prize for his research in microscope technology.
Since receiving the award, Betzig has improved the technology so that cell functions, growth and
even movements can now be seen in real time while minimizing the damage caused by prior
methods. This allows the direct study of living nerve cells forming synapses in the brain, cells
undergoing mitosis and internal cell functions like protein translation and mitochondrial movements.
Your assignment is to write a Python program that graphically simulates viewing cellular organisms,
as they might be observed using Betzig’s technology. These simulated cells will be shown in a
graphics window (representing the field of view through Betzig’s microscope) and must be
animated, exhibiting behaviors based on the “Project Specifications” below. The simulation will
terminate based on user input (a mouse click) and will include two (2) types of cells, Crete and
Laelaps, (pronounced KREET and LEE-laps).
Crete cells should be represented in this simulation as three (3) small green circles with a radius of
8 pixels. These cells move nonlinearly in steps of 1-4 graphics window pixels. This makes their
movement appear jerky and random. Crete cells cannot move outside the microscope slide, (the
‘field’), so they may bump along the borders or even wander out into the middle of the field at times.
These cells have the ability to pass “through” each other.
A single red circle with a radius of 16 pixels will represent a Laelaps cell in this simulation. Laelaps
cells move across the field straight lines, appearing to ‘bounce’ off the field boundaries. Laelaps
sometimes appear to pass through other cells, however this is an optical illusion as they are very
thin and tend to slide over or under the other cells in the field of view.
Project Specifications:
====================
Graphics Window
• 500 x 500 pixel window
• White background
• 0,0 (x,y) coordinate should be set to the lower left-hand corner
Crete Cells
• Three (3) green filled circles with radius of 8 pixels
• Move in random increments between -4 and 4 pixels per step
• Movements are not in straight lines, but appear wander aimlessly
Laelaps Cells
• One (1) red filled circle with a radius of 16 pixels
• Move more quickly than Crete cells and in straight lines
• The Laelaps cell should advance in either -10 or 10 pixels per step
TODO #1: Initialize the simulation environment
========================================
• Import any libraries needed for the simulation
• Display a welcome message in the Python Shell. Describe the program’s functionality
• Create the 500 x 500 graphics window named “Field”
• Set the Field window parameters as specified
TODO #2: Create the Crete cells – makeCrete()
========================================
• Write a function that creates three green circle objects (radius 8) and stores them in a list
• Each entry of the list represents one Crete cell
• The starting (x, y) locations of the Crete cells will be random values between 50 – 450
• The function should return the list of Crete cells
TODO #3: Create the Laelaps cell – makeLaelaps()
===========================================
• Write a function that creates a list containing a single entry; a red filled circle (radius 16)
representing the Laelaps cell
• The starting (x, y) location of these cells should be random values between 100–400
• Add two randomly selected integers to the list. They should be either -10 or 10
• The function should return the Laelaps cell list
TODO #4: Define the bounce() function
==================================
• Write a function that accepts two (2) integers as parameters
• If the first integer is either less than 10 or greater than 490, the function should return the
inverse value of the 2nd integer, (ie: multiplying it by -1)
• Otherwise, the function should return the 2nd integer unmodified
TODO #5: Define the main() function
==================================
• Using the makeCrete() function, create a list of Crete cells
• Draw the Crete cells in the Field graphics window
• Using the makeLaelaps() function, create the Laelaps list
• Draw the Laelaps cell in the Field window
• Using a while loop, animate the cells in the Field window
o Animate each Crete cell by moving it’s (x,y) position by a number of pixels specified
by a randomly selected integer between -4 and 4
o Animate the Laelaps cell by moving it’s (x,y) position by the number of pixels
specified in the integer values in it’s list (this will always be either -10 or 10 pixels)
o HINT: Use the bounce() function to make sure the change in a cell’s position doesn’t
move the cell outside the Field boundaries
o End the while loop if a mouse click is detected in the Field graphics window
• Close the Field graphics window
• Print a message that the simulation has terminated
Extra Credit Challenges: 10 points each only if TODO #1 – 5 are complete
===============================================================
• CROSSING GUARD: Laelaps cell ‘bounces’ off the Crete cells instead sliding past them
• NO PASSING ZONE: Crete cells bounce off each other instead of passing through
Project 1 Grading Rubric: Points
TODO #1: Libraries imported, message shown, graphics window created to specifications 15
TODO #2: List of three (3) circle objects is created as specified 10
TODO #2: makeCrete() function properly returns list of circle objects 5
TODO #3: List including one circle object and 2 integers is created as specified 10
TODO #3: makeLaelaps() function properly returns list 5
TODO #4: bounce() function created as specified 10
TODO #5: makeCrete() and makeLaelaps() functions called, lists created successfully 10
TODO #5: Crete and LaeLaps cells drawn in the Field window 5
TODO #5: Cells move as specified within the Field window, bouncing off boundaries 20
TODO #5: Animation loop terminates when mouse clicked in the Field window 5
TODO #5: Message is displayed indicating the simulation has terminated 5
Total Points 100
You will submit one (1) copy of the completed Python program to the Project 1 assignment on
Blackboard. The completed file will include your name, the name of the project and a description of
its functionality and purpose of in the comments header. The file should be named ”Project-1.py”.
Coding Standards and Guidelines:
=============================
In this project, you are required to follow modular coding standards, particularly with respect to
modular design, indentation and comments. Your score will be affected if your code does not
conform to these standards.
Modular Design
Divide your program into functions to improve readability and to reduce redundanct code. Your
Python code should not have repetitve copies of the same block of statements. Instead, functions
to simplify and reduce the size of your code.
For example, if you had to find the distance between two x,y coordinate points in several different
parts of your code, instead of creating the formula to calculate this distance over and over again,
create a function “def distance(x1, y1, x2, y2):” and code it to calculate and return the distance
between the point using the Pythagorean Theorum.
Indentation
Following are a few rules on how to use indentation in your program,
• Use tabs for indentations
• Pay attention to indentation in nested for loops and if-else blocks
Comments
Your code for this project must also include appropriate comments about how functions are
implemented. Comments make your code more readable and easier to understand.
• Add a comment before a function describing what it does.
• Before a nested for loop, describe what happens in the loop and what controls the
iterations.
• Before an if-else block, explain what should happen for both the true and false cases.
• Always make a priority of keeping the comments up-to-date when the code changes.
For all variables that you use in your program, use meaningful variable and function names to help
make your program more readable. Names do not have to be long, but should give a clear
indication of the intended purpose of the variable.

Module Assessment Guidance Report Specifications – Coursework one
Your report for coursework one should be a maximum of 3000 words excluding title page, references, and appendices. The case study is contained within the relevant folder on Moodle for Sustaining Organisational Performance. Sticking to a strict word limit is difficult and an important skill for you to acquire, so make sure that you write in a concise and focused manner. It should be typed font size 12 and 1.5 line spacing and must be presented in portrait format, not landscape. You should not be able to complete this task in any less than 2000 words minimum. Please provide an Executive Summary and Contents Page. This work has to be submitted by the due dates provided. Late work will incur a penalty.
Your report must answer the questions contained in the case study for Coursework one (available on Moodle).
An essential feature of the report is to illustrate how theoretical constructs or models can be critically analysed and applied to organisations in practice. You are therefore advised to read widely. In fact, unless you have read and referenced at least 20 discrete references, it is unlikely that you have done sufficient reading. Beware of sources from the Internet (no Wikipedia): apart from reputable and academic references that can be downloaded through the Internet (commonly via the library catalogue); most Internet references are not considered reliable for an academic piece of work. Academic journals generally offer a better source than textbooks.
You must use the Harvard referencing system. This requires you to state the surname of the author(s) in the text of your report, followed by a comma and year of publication e.g.: “Kraljic (1983) states that….” If you use direct quotes, then the page number should follow e.g.: Kraljic (1983: 112) “The profit impact of a given supply item can be defined in terms of volume purchased, percentage of total purchase cost or impact on product quality or business growth”. Failure to reference properly constitutes a violation of university regulations i.e. plagiarism and is a serious offence.
The full Harvard reference guidelines are also posted on the Moodle page for you to use.
5
Submission
Coursework one submission date is Friday 17th July. All work is to be submitted by 5pm local time. You must also upload a copy of your final submission to the Turnitin box in the Assessment section on Moodle. Work which is up to five days late will be capped at P1 and work received beyond this will not be marked and you will be reassessed at a later date.
Your submission must be accompanied by the front cover declaration that this is your own work being submitted for academic credit. Plagiarism is academic misconduct and any instances found will be referred to the Academic Misconduct Officer (ACO) – see section 5.4 for further details. Marking Criteria
The assessment criteria on which you are graded are shown below. It may help you to review this when preparing your submission so that you are able to check that you have covered all of the relevant areas. There are multiple resources available through the library portal and student portal which will help you develop your work. Feedback Three weeks is provided for marking to be completed and then feedback to be returned to you. All feedback will be provided in the above written format and any further feedback can be sought during the module.
5.2 General marking guidelines
Below is a schedule, to help you judge what you need to do to achieve any given mark range. Please note this is a general description of how you might achieve a certain percentage and may not apply to all elements of your coursework.
F5–F2 – a poor assignment, the student has not answered the assignment properly. There may be a number of errors including insufficient explanation of the theory, and a limited ability to interpret the ideas to practical situations.
F1–P1 – a weak assignment, the student shows partial understanding of the issues but possibly combined with errors and/or insufficient or unclear explanation of the key points. There is limited interpretation of the issues in relation to the real world.
P2 – a good assignment, with most of the key points correctly stated, the student demonstrates an ability to interpret at least some of the issues and makes a reasonable attempt at explaining the theoretical concepts.
P3–P4 – a very good assignment with minimal errors. Demonstrates an understanding of the key issues and is thorough in its analysis of the issues and theoretical concepts. The student shows strong critical and analytical ability.
P5-D1 – an excellent assignment which is well written and explained. It will demonstrate a clear understanding of the issues, using a high level of critical and analytical ability.
D2-D5 – an exceptional assignment, which is sophisticated in its approach while being correct in every particular detail. Extremely high level of critical ability is demonstrated with original thought being evident.
Note that in ALL categories above it is expected that you will provide a List of References (where applicable) of the material used in preparation of your assignment.
Coursework Assessment Feedback
Name:
Date submitted:
Matriculation No:
Date marked:
Module: Sustaining Organisational Performance
Category
Fail
Weak
Satisf
Good
Very Good
Excellent
GRADE
F5-F2
F1-P1
P2
P3-P4
P5-D1
D2-D5
Breakdown of relationships analysis (25%)
Critical analysis of supply chain processes and robustness (25%)
Importance of collaboration (25%)
Integration of sources to support argument (15%)
Presentation and References (10%)
General comments on submission
Overall Grade
Graded by 5.3 Assessment Criteria
This is the criteria by which your assessment will be marked.
5.4 Plagiarism
Plagiarism is the publication of the ideas, or the expression of the ideas of another, as one’s own (Oxford English Dictionary). Some dictionaries use the term stealing. Plagiarism is not permitted in assessments at Edinburgh Napier University. Student Disciplinary Regulations (SDR) 11.2 categorises plagiarism as Academic Misconduct. Some examples are:
Major examples of plagiarism include the following
?copying from another student (Collusion)
?copying large sections, from an academic or other source (e.g. book, internetarticle) without acknowledging that source by referencing it
Minor examples of plagiarism include
?Paraphrasing without acknowledgment
?Using original reference obtained from a textbook but not reading “original”material
OK
NOT OK
Quoting a relevant passage from a book, if the reference is given e.g. Drury C, (2004), Management and Cost Accounting, 6e, London, Thomson. The reference must be clearly linked to the body of your work by putting the Author’s name and date in brackets and the passage must be presented as a quotation.
Copying from textbooks or articles and failing to acknowledge the source – even if the words/sentences are rearranged. Or acknowledging the source, but presenting the copy as your own words, rather than as a quotation.
Comparing different authors’ ideas, with acknowledgement of source, and making your own comments.
Copying from other students – even if the words and/or sentences are rearranged.
Doing research with others in the library but writing your essay alone.
Allowing another student to copy your work
When citing from the WWW give, in the end reference, the author if possible, the entire URL and the date of access, not just the URL of the home page e.g. http://nulis.napier.ac.uk/studyskills/#Plagiarism
URL of home page alone and /or no date e.g. www.napier.ac.uk
Every time you submit any piece of work for assessment, you will be required to fill in a declaration form. By signing this form, you confirm that you have understood plagiarism as it is defined by Edinburgh Napier University. You are also confirming that you have not plagiarised.