Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This Stars Project data project aims to build one big program that enables users

ID: 3821265 • Letter: T

Question

This Stars Project data project aims to build one big program that enables users to create star charts (pictures) from star catalog files. The project is divided into multiple parts, where each part requires functions to be written and tested. work should be done in a python filecalled stars py.As build on top of each other, it is imperative that each part be completed correctly. The Big Picture Download the starstxt file and open it in notepad++. It is a comma separated file full of data on stars. Each line has the form: 0.010128,0.007897,0.999918,889 1.97,424,POLARIS Throughout this project, we will refer to this as a star string.Each star string contains the following items (bolded if used in this project) l. The x coordinate of the star. 2. The y coordinate of the star. 3. The z coordinate of the star. 4. The Henry Draper number, which is simply a unique identifier for the star. 5. The magnitude or brightness of the star. 6. The Harvard Revised number, another identifier 7. The common name (if it has a name) The goal of the assignment is to produce the image below:

Explanation / Answer

f = open(sys.argv[1], 'rt')

Each row of our input data file will be parsed and stored as a list of strings, just like this

['0.010128', '0.007897', '0.999918','8890', '1.97','424','POLARIS']

['0.056679', '0.006755', '0.556788,'7656','1.67','675','SIRIUS']

['0.056679', '0.006755', '0.556788,'7656','1.67','675','REGEL']

We can handle the data in .csv file like this.But, we need to split our star string in our function get_star_pixel_x().

So,we will start writing our functions from now on, to be used in our final program.

def get_star_pixel_x() function

xcoord=250+(250 * x)

return xcoord

2)

def get_star_pixel_y(starstring):

ycoord=250-(250 * y)

return ycoord

3)

def get_star_size(starstring):

size=10.0/( y+2)

return size

4)

def get_star_name(starstring):

else:

print str(y)

5) For this function, we require the input file as stars.csv to be able to manipulate the star strings in the file and draw them by using the draw_star() function.

def draw_all_stars():

f = open(sys.argv[1], 'rt')

return

6)

def get_star_string(starname):

f = open(sys.argv[1], 'rt')

7)

def draw_star( starname):

x=get_star_pixel_x(starname)

y=get_star_pixel_y(starname)

size=get_star_size(starname)

top_y=y

bottom_y=top_y+size/2

right_x=left_x+size/2

canvas.create_rectangle(left_x,top_y,right_x,bottom_y, fill="white", width=0)

8)

def draw_star_by_name( starname):

f = open(sys.argv[1], 'rt')

if (starname==row.get_star_string(starname):

9)

def draw_constellation_line(starname1,starname2):

f = open(sys.argv[1], 'rt')

if (starname1==row.get_star_string(starname1):

  

if (starname2==row.get_star_string(starname2):

finally:

canvas.create_line(x1,y1,x2,y2,fill="yellow")

return

10)

def draw_constellation_file(filename):

f = open(filename, 'rt')

row.draw_constellation_line()

finally:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote