def serviceRequest(self): magnitude = None if (self.environment == None): return None sensorRightA = self.getSensorPosition()[0] sensorDeclination = self.getSensorPosition()[1] s = StarCatalog() s.starList = self.starList magnitude = s.getMagnitude(sensorRightA, sensorDeclination, self.fieldOfView) if (magnitude == None): return None magnitude = magnitude * 10 printMag = '' if (magnitude < 0): printMag = (hex(((abs(magnitude) ^ 0xffff) + 1) & 0xffff)[2:]) else: printMag = (hex(magnitude)[2:]) if (len(printMag) == 1): printMag = '000' + printMag elif(len(printMag) == 2): printMag = '00' + printMag elif(len(printMag) == 3): printMag = '0' + printMag self.environment.incrementTime(40) return printMag
def isSunInView(self): from collections import namedtuple Star = namedtuple("Star", "identifier brightness ascension declination") sun = Star("10137", "-32768", "0", "0") self.starList.append(sun) s = StarCatalog() s.starList = self.starList if (float(s.getMagnitude(0,0, .5)) == -32768.0): return True else: return False
''' Created on Aug 30, 2015 @author: Jonathan Sligh ''' from CA01.prod.StarCatalog import StarCatalog s = StarCatalog() s.loadCatalog("star_file.txt") print(s.getStarCount(0, 5)) print(s.getMagnitude(100, 11, 100))
def initializeSensor(self, starFile): s = StarCatalog() numStars = s.loadCatalog(starFile) starList = s.starList return numStars