def __init__(self, tjd_ut, flag, names, obl): self.data = [] i = 0 for k in names.iterkeys(): self.data.append(['', '', 0.0, 0.0, 0.0, 0.0]) ret, name, dat, serr = astrology.swe_fixstar_ut(','+k, tjd_ut, flag) nam = name[0].strip() nomnam = '' DELIMITER = ',' if nam.find(DELIMITER) != -1: snam = nam.split(DELIMITER) nam = snam[0].strip() nomnam = snam[1].strip() self.data[i][FixStars.NAME] = nam self.data[i][FixStars.NOMNAME] = nomnam self.data[i][FixStars.LON] = dat[0] self.data[i][FixStars.LAT] = dat[1] ra, decl, dist = astrology.swe_cotrans(dat[0], dat[1], 1.0, -obl) self.data[i][FixStars.RA] = ra self.data[i][FixStars.DECL] = decl i += 1 self.sort()
def __init__(self, tjd_ut, flag, names, obl): self.data = [] i = 0 for k in names.iterkeys(): self.data.append(['', '', 0.0, 0.0, 0.0, 0.0]) ret, name, dat, serr = astrology.swe_fixstar_ut( ',' + k, tjd_ut, flag) nam = name[0].strip() nomnam = '' DELIMITER = ',' if nam.find(DELIMITER) != -1: snam = nam.split(DELIMITER) nam = snam[0].strip() nomnam = snam[1].strip() self.data[i][FixStars.NAME] = nam self.data[i][FixStars.NOMNAME] = nomnam self.data[i][FixStars.LON] = dat[0] self.data[i][FixStars.LAT] = dat[1] ra, decl, dist = astrology.swe_cotrans(dat[0], dat[1], 1.0, -obl) self.data[i][FixStars.RA] = ra self.data[i][FixStars.DECL] = decl i += 1 self.sort()
def read(self, names): for n in names: ret, name, dat, serr = astrology.swe_fixstar_ut(','+n, self.jd, 0) nam = name[0].strip() nomnam = '' DELIMITER = ',' if nam.find(DELIMITER) != -1: snam = nam.split(DELIMITER) nam = snam[0].strip() nomnam = snam[1].strip() self.data.append(FixStars.FixStar(nam, nomnam)) return True #!?
def read(self, names): for n in names: ret, name, dat, serr = astrology.swe_fixstar_ut( ',' + n, self.jd, 0) nam = name[0].strip() nomnam = '' DELIMITER = ',' if nam.find(DELIMITER) != -1: snam = nam.split(DELIMITER) nam = snam[0].strip() nomnam = snam[1].strip() self.data.append(FixStars.FixStar(nam, nomnam)) return True #!?
def read(self): res = True try: f = open(self.fname, 'r') lines = f.readlines() f.close() #Count non-comment lines cnt = 0 for ln in lines: if ln[0] == FixStars.COMMENT and ln.find('example') != -1: break if ln[0] != FixStars.COMMENT: cnt += 1 for i in range(1, cnt+1): ret, name, dat, serr = astrology.swe_fixstar_ut(str(i), self.jd, 0) d, m, s = util.decToDeg(dat[0]) sign = d/chart.Chart.SIGN_DEG lon = d%chart.Chart.SIGN_DEG lontxt = str(lon)+FixStars.signtxts[sign]+' '+(str(m)).zfill(2)+"' "+(str(s)).zfill(2)+'"' d, m, s = util.decToDeg(dat[1]) si = '' if dat[1] < 0.0: si = '-' lattxt = si+str(d)+' '+(str(m)).zfill(2)+"' "+(str(s)).zfill(2)+'"' nam = name[0].strip() nomnam = '' DELIMITER = ',' if nam.find(DELIMITER) != -1: snam = nam.split(DELIMITER) nam = snam[0].strip() nomnam = snam[1].strip() self.data.append(FixStars.FixStar(nam, nomnam, lontxt, lattxt)) except IOError: res = False pass return res