random-forest/star.py
2019-04-23 03:51:09 +02:00

15 lines
519 B
Python

class Star(object):
def __init__(self, label, display_name, data, fields):
self.label = label
self.name = display_name
data_list = []
for field in fields:
data_list.append(data[field])
self.data = data_list
def __str__(self):
if len(self.label) > 1:
classification = ' or '.join(self.label)
else:
classification = self.label
return 'Star {} {} of spectral type {}'.format(self.name, self.data, classification)