def getData(self): """ Return dictionary of object data Return: dict(name, ra, dec) for epoch 2000 """ name = self._object.getName() position = self._object.getOriginalPosition() ra, dec = rad2str(*position) return {'name': name, 'ra': ra, 'dec': dec}
def readLog(self, starName=None, startDate=None, endDate=None): """ Read log, result can be filtered by star name or logging period """ select = "SELECT l.`id`,l.`time`, s.`name`, s.`ra`,s.`dec`, m.`text`, l.`ra`, l.`dec`, l.`altitude`, l.`focus`, l.`temp_in`, l.`temp_out`, l.`status` FROM `log` l LEFT JOIN `star` s ON l.star_id=s.id LEFT JOIN `message` m ON l.msg_id=m.id" condition = self.conditionConstruct(starName, startDate, endDate) rows = self.selectAll(select, where=condition) list = [] for row in rows: data = dict() data['id'] = row[0] data['time'] = time.ctime(int(row[1])) data['name'] = row[2] data['sRa'], data['sDec'] = astronomy.rad2str(row[3], row[4]) data['msg'] = row[5] data['ra'], data['dec'] = astronomy.rad2str(row[6], row[7]) data['alt'] = str(astronomy.getDegrees(row[8])) data['focus'] = row[9] data['temp_in'], data['temp_out'] = row[10], row[11] data['status'] = row[12] #print('get from DB', data) list.append(data) self._log = list return list
def getCurrentPosition(self): """ Return current equatorial and horizontl position """ coord = self._object.getEquatorialPosition() ra, dec = rad2str(*coord) alt, az = self._object.getHorizontalPosition() return {'ra': ra, 'dec': dec, 'alt': str(alt), 'az': str(az)}
def _parseCoordinates(self, ra, dec): if ra is not None and dec is not None: position = rad2str(ra, dec) else: position = '##:##:##', '##:##:##' return {'ra': position[0], 'dec': position[1]}