Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Science 1920 A51 your first assignment! The Astronomy Webstore Learning Objectives: 0 Design classes in the Python 3 programming language 0 Implement accessor (getter)

imageimageimageimageimageimageimageimage
Computer Science 1920 A51 your first assignment! The Astronomy Webstore Learning Objectives: 0 Design classes in the Python 3 programming language 0 Implement accessor (getter) and mutator (setter) methods that allow access to your class data (which is protected by mangl'ing) 0 Create dunder (double-underscore) methods for your classes 0 Express your own creativity in deciding how to implement the look-and-feel of the textual interface (that is, the printed display representation of information from the objects), in particular through dunder methods like _str Scenario You are starting a new business on the web! BeginnerAstro.ca, a website dedicated to beginner astronomy, but also serving intermediate and advanced users, needs a "backend" design (that is, the logic that runs the website) that will allow a package to be built (that is, a combination of parts) by the customer, and ultimately, the system will check after each item is added to be sure that it is actually usable. No pesky returns from customers who bought the wrong thing! Initially, you're going to deal only with a generic telescope OTA (optical tube assembly) and EP (eyepiece). Later, we'll get into the different types of telescopes, and add more accessories and options. Yes, there will be math! But we'll give you references to what you'll need to look up to do the math so you will have to do some reading and research beyond what is presented in this (and other assignments') documentation. What are you Ieaming? As a programmer, you will often be called on to create programs for things you are unfamiliar with. You'll have to learn about those things that is, analyze them in order to be able to write the software. The vast majority of students will not be familiar with the details of astronomical telescopes, so this will be a challenge for you. Class: OTA This class will represent an Optical Tube Assembly, the body of the telescope and the part that is the optical instrument. An OTA has the following characteristics: 0 an aperture (the opening at the front of the telescope that points towards the object you want to view). It is given as a diameter, measured in millimetres (mm). o a focal length (the distance from where light enters the telescope, to where it reaches focus after passing through lenses, or bouncing off of parabolic mirrors). This distance is also measured in millimetres. o A type. For our purposes, we will use a very limited subset of the wide range oftypes available. We will use letter codes for the type, as follows: 0 G Gallilean (Refractor) o N Newtonian (Reflector) o S Schmidt-Cassegrain (Catadioptric) o M Maksutov-Cassegrain (Catadioptric) Hint: you can create an instance dictionary that will hold these codes and text explanations, to make it easy to process later. You should include the scientific type in parentheses. You are given a data file, otas.txt, that contains records of the format: type, aperture, focal length Example: G,70,350 So, the file will contain a number of lines, each one corresponding to a telescope design and parameters. You will need to read this data, line by line, and for each line, create an instance of the OTA class, which you must design. Your OTA class should have a constructor that accepts these three parameters and stores them. Additionally, it should have accessors and mutators for each ofthese parameters, so that they can be altered or updated if needed. Your OTA class should be stored in a file called 0TA.py Read more about OTAs here: https://en.wikipedia.org/wiki/OpticaL telescope Class: EP This class will represent an eyepiece, a lens unit that is inserted into the viewport of an OTA, and which allows the user to vary the field of view and effective magnification ofwhat is being viewed. (Later on, we'll learn how to make sure that an EP suits a particular OTA.) An EP has the following characteristics: 0 an apparent field of view (a range of the sky that will appear in an eyepiece were there no telescope attached just the eyepiece viewing the sky, which is a reference number, because nobody looks at the sky with just an eyepiece). This is an angle. 0 a focal length (the distance from the focal point ofthe eyepiece to the lens assembly of the eyepiece), measured in millimetres. The operation of using afocuser on a telescope is to move either the eyepiece position, or the lenses or mirrors of the telescope, to match the focal point of the telescope to the focal point of the eyepiece. o A type. For our purposes, we will again use a very limited subset of the wide range of types available. We will use letter codes for the type, as follows: 0 K Kellner (Achromat) o P Plossl (Symmetric) o O Orthoscopic (Abbe) o N Nagler (a complex, but excellent, multielement design) Hint: you can create an instance dictionary that will hold these codes and text explanations, to make it easy to process later. You should not include the explanatory information in parentheses. You are given a data file, eps.txt,that contains records of the format: type, afov, focal length Example: N,110,35 So, the file will contain a number of lines, each one corresponding to an eyepiece design and associated parameters. You will need to read this data, line by line, and for each line, create an instance of the EP class, which you must design. Your EP class should have a constructor that accepts these three parameters and stores them. Additionally, it should have accessors and mutators for each ofthese pa rameters, so that they can be altered or updated if needed. Your EP class should be stored in a file called EP.py Read more about eyepieces here: httpsenwikipediaorg/wiki/Eyepiece Dunder Method: _str You will write a __str__ dunder method in each of the preceding two classes, which will provide the data from that class in a readable format. For example: double the aperture in mm is the eyepiece usable with that telescope. Thus, this is a Boolean return value. 0 true_fov[ota,ep} the true field of view is found by first computing the effective magnification then, divide the eyepiece apparent field of view (AFOV) by this number to get the FOV (the true field of view of the system), which will be in degrees. This tells you the actual angle from a centreline that the telescope will be able to display in the sky (remember, the sky can be considered as three concentric circles, mutually orthogonal, providing a "spherical" view of the sky. The telescope's axis would point to a location on this sphere, and the FOV would therefore describe an apparent circle of view at some arbitrary distance.) Again, the true FOV should be expressed to a maximum of 1 decimal place, as above. Hint: you've noted that there are some cases where you are presenting information to a maximum of .'t decimai place. You could use a mangled function to do this for you internaiiy, which would not be caiiabie easiiy from outside the toolbox. This is an ejj'icient way to avoid repeating code kind of iike how we use the effective magnification tooibox function in two other functions! Putting it all together your "driver" or unit test You will write a driver, which is the "main" code ofyour program. This will be responsible, in this assignment, for opening the files specified, and for making instances of the objects in the files, which will be stored in list structures. The starting iines of each fiie are comments each starts with at, and aiiows us to show a user what the fiie format is or expiaih encodings. You shouid read and discard any iine that starts with # as its first character. For example, for our otas.txt file: ll FORMAT: # type, aperture, focal length # where: type is G (Galilean), N (Newtonian), # S (SchmidtCassegrain), and M (MaksutovCassegrain) # and aperture and focal length are given in millimetres (mm) G, 70, 350 Read the data from the file, as specified, and generate a list of OTA objects from it. Do the same for the eyepieces. Program Output First, print out the two lists (via the dunder method _str_) (For each part, use appropriate "titles" so that people know what you're printing.) Second, use this set oftuples which specify OTA and EP combinations, by index within each file. (0.2): (2:18):(2:19): (0:5)r(3r0)r(7r18) r(3r16)r(0r12) Using this list, in the order specified, print out the following: 0 effective magnification ofthe system 0 f-ratio of the OTA 0 the true FOV ofthe system Third, check all OTA/EP combinations that are UNUSABLE. To do this, take an OTA, and then check every eyepiece with it for usability. Do this for every OTA in the list. When you find an unusable eyepiece, add its focal length to a list but do not add it if it already exists in the list. Sort the list using the built-in list sort function for some list lst, you use Ist.sort(). Print the list (no fancy format required). This would be used to advise sales staff to watch out when someone purchases one of these eyepieces, to check what telescope they're using it with, because it could create an unusable configuration. Thus, your printout would look like the following pages (just showing the first entry from each ofthese three categories, of course you have to show them all). I've added colour to distinguish the two sections of the first part, the second part, and the third part you won't have any colour in your printout, of course. Your printout should resemble this, but it does not have to replicate it down to the character. (See the pages after this one for details.) GRADING RUBRIC FOR THIS (and all) ASSIGNMENTS. This assignment is graded out of 10 points, because it has one program. An assignment with two programs would have 20 points, to allow for each program to be graded sensibly. All assignments have equal value so this assignment will have the same value as Assignment 4. As mentioned online, you may wonder at this, because A54 will be harder than A51. True. But you will have learned more and practiced more these are graded in the context of where you are in the course at the time they're being evaluated. Make sure you submit your assignment on time! Late assignments are penalized as per the course syllabus. For a given program: 5 points are assigned to producing correct output. If your output is incorrect, you lose marks from this. If your output bears no resemblance to the requirement, or if your code doesn't work, you've lost half your points. 3 points are assigned to correct design elements. If you are told to create objects, or to create specific methods, then these points cover that part ofthe design. 3 is "your design is good, you've got all the elements we'd expect." 2 is "you've got some of the elements we require, but a lot are missing." 1 is "you have very little of what is required." 0 is "this looks nothing like the structure described in the assignment. 2 points are assigned to neatness and appropriate commentary. You know from (251910 that every .py file you submit must have a header on it describing its purpose, as well as your name, the date, and the associated assignment identifier (A51 in this case). You will submit a ZIP archive of your PyCharm project. In an assignment with two separate problems, you will ZIP two project folders together. You will not put two programs in one project unless you are specifically told to do so. Your submitted file should be named thus: as 1_firstname_lastname . zip For example, if it were my assignment, it would say: as 1_Chris_Vessey . zip Remember, ZIP format is the only format accepted. RAR and other compression formats will be rejected (unuploadable so if a ZIP is not used then there will be no submission - graded as 0). Your grader will grade your work via Moodle. If you have questions about your grading, contact me, not the grader

Computer Science 1920 AS1- your first assignment! The Astronomy Webstore Learning Objectives: Design classes in the Python 3 programming language Implement accessor (getter) and mutator (setter) methods that allow access to your class data (which is protected by mangling) Create dunder (double-underscore) methods for your classes Express your own creativity in deciding how to implement the look-and-feel of the textual interface (that is, the printed display representation of information from the objects), in particular through dunder methods like Scenario SON str You are starting a new business on the web! BeginnerAstro.ca, a website dedicated to beginner astronomy, but also serving intermediate and advanced users, needs a "backend" design (that is, the logic that runs the website) that will allow a package to be built (that is, a combination of parts) by the customer, and ultimately, the system will check after each item is added to be sure that it is actually usable. No pesky returns from customers who bought the wrong thing! Initially, you're going to deal only with a generic telescope OTA (optical tube assembly) and EP (eyepiece). Later, we'll get into the different types of telescopes, and add more accessories and options. Class: OTA Yes, there will be math! But we'll give you references to what you'll need to look up to do the math - so you will have to do some reading and research beyond what is presented in this (and other assignments') documentation. What are you learning? As a programmer, you will often be called on to create programs for things you are unfamiliar with. You'll have to learn about those things that is, analyze them - in order to be able to write the software. The vast majority of students will not be familiar with the details of astronomical telescopes, so this will be a challenge for you. This class will represent an Optical Tube Assembly, the body of the telescope and the part that is the optical instrument.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Auditing and Assurance services an integrated approach

Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley

14th Edition

133081605, 132575957, 9780133081602, 978-0132575959

More Books

Students also viewed these Programming questions

Question

What is one example of a lack of orthogonality in the design of C?

Answered: 1 week ago

Question

25 (base 10) if written in base 26 would be what

Answered: 1 week ago