Question: Part 1: Plotting star charts This project will use Pythons turtle graphics package to draw your star chart and constellations. You will need to include

Part 1: Plotting star charts

This project will use Pythons turtle graphics package to draw your star chart and constellations. You will need to include the statement import turtle at the top of your project. Turtle graphics can be a little slow, you can turn off the tracing to make your drawing appear much faster by using the command tur-tle.tracer(0).

If you still want to see the progress of the drawing, you can also just speed up the turtle by using the command turtle.speed(10).

You must implement the functions described below and your lab report should include your output from both plotting functions (i.e., plot_plain_stars() and plot_by_magnitude()).

Function name:

read_coords(file)

Description: Given an open text file that contains a star catalog as specified above, return three dictionaries using a tuple. The first is keyed on the Henry Draper number and the values are tuples containing the x and y coordinates of each star. The second dictionary is also keyed on the Henry Draper numbers and contains the magnitudes (float) of the stars. The third dictionary is keyed on the names of the stars and the values are the Henry Draper numbers. If a star has more than one name, each name will appear as a key in the third dictionary. If a star does not have a name it will not be represented in the third dictionary.

HINTS:

(1) You can return multiple dictionaries by using a tuple.

(2) Star names may contain spaces, thus they are separated using semicolons.

Function name:

plot_plain_stars(picture_size, coordinates_dict)

Description:

Given the size of the picture in pixels, and a dictionary containing the x,y coordinates of stars as values in the dictionary, plot the stars and have turtle draw the picture. Be sure to map the coordinate values (i.e., -1 to 1)appropriately based on the picture size you plan to use. The middle of the picture is considered(0,0). If you plot x,y values without an appropriate value all starts will appear in the very middle of the screen.Set the picture background to black. The stars are plotted as 2x2pixel white-filled rectangles. (The fill color() function in the turtle module will help you out.)This function is to help you get started and it will be replaced with the plot_by_magnitude function below.

Function name:

plot_by_magnitude(picture_size,coordinates_dict,magnitudes_dict)

Description:

Given the size of the picture in pixels, a dictionary containing the x,y coordinates, and a dictionary containing the magnitudes, plot the stars and have turtle draw the picture. Set the picture background to black. In this case, the stars are plotted as white-filled rectangles, but the size of the rectangle is a function of the magnitude of the stars. Since brighter stars have smaller magnitude values, you will calculate the size of the rectangle as follows: star_size = round(10.0(magnitude+2)). Limit the size of the star to 8pixels or the scaled value whichever is smaller

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!