Ejemplo n.º 1
0
    def changePath(self, index):
        path = self.filesystemmodel.fileInfo(index).absoluteFilePath()
        self.files = SkyCameraFile.glob(path)
        if len(self.files) > 0:
            self.ui.imageSelector.setMaximum(len(self.files) - 1)
            self.ui.imageSelector.setEnabled(True)
        else:
            self.ui.imageSelector.setEnabled(False)

        self.difference_mode.reset()
        self.selectFile(0)
Ejemplo n.º 2
0
	def changePath(self, index):
		path = self.filesystemmodel.fileInfo(index).absoluteFilePath()
		self.files = SkyCameraFile.glob(path)
		if len(self.files) > 0:
			self.ui.imageSelector.setMaximum(len(self.files) - 1)
			self.ui.imageSelector.setEnabled(True)
		else:
			self.ui.imageSelector.setEnabled(False)
		
		self.difference_mode.reset()
		self.selectFile(0)
Ejemplo n.º 3
0
    def __init__(self):
        if len(sys.argv) < 2:
            print('Usage: calibration <directory> [<filename>]')
            print(
                'The supplied directory should contain the calibration images.'
            )
            sys.exit(1)

        size = 640

        self.path = sys.argv[1]
        self.image_window = 'Image Calibration'
        self.sky_window = 'Sky Calibration'
        self.tb_image_switch = 'image'
        self.tb_max_mag = 'maximum magnitude'
        self.save_file_name = 'data'
        self.selected_star = None
        self.selected_color = (0, 0, 255)
        self.marked_color = (0, 255, 0)
        self.circle_radius = 5
        self.max_mag = 4
        self.renderer = SkyRenderer(size)

        try:
            self.calibrator = Calibrator(
                SkyCameraFile.glob(self.path),
                EarthLocation(lat=Configuration.latitude,
                              lon=Configuration.longitude,
                              height=Configuration.elevation))
        except Exception as e:
            print(e.message)
            sys.exit(2)

        if len(sys.argv) > 2:
            self.save_file_name = sys.argv[2]
            if os.path.exists(self.save_file_name):
                self.calibrator.load(self.save_file_name)

        cv2.namedWindow(self.image_window, cv2.WINDOW_AUTOSIZE)
        cv2.namedWindow(self.sky_window, cv2.WINDOW_AUTOSIZE)

        self.selectImage(0)

        cv2.setMouseCallback(self.image_window, self.imageMouseCallback)
        cv2.setMouseCallback(self.sky_window, self.skyMouseCallback)
        cv2.createTrackbar(self.tb_image_switch, self.image_window, 0,
                           len(self.calibrator.files) - 1, self.selectImage)
        cv2.createTrackbar(self.tb_max_mag, self.sky_window, self.max_mag, 6,
                           self.setMaxMag)
Ejemplo n.º 4
0
	def __init__(self):
		if len(sys.argv) < 2:
			print('Usage: calibration <directory> [<filename>]')
			print('The supplied directory should contain the calibration images.')
			sys.exit(1)
		
		size = 640
		
		self.path = sys.argv[1]
		self.image_window = 'Image Calibration'
		self.sky_window = 'Sky Calibration'
		self.tb_image_switch = 'image'
		self.tb_max_mag = 'maximum magnitude'
		self.save_file_name = Configuration.calibration_file
		self.selected_star = None
		self.selected_color = (0, 0, 255)
		self.marked_color = (0, 255, 0)
		self.circle_radius = 5
		self.max_mag = 4
		self.renderer = SkyRenderer(size)
		
		try:
			self.calibrator = Calibrator(SkyCameraFile.glob(self.path), EarthLocation(lat=Configuration.latitude, lon=Configuration.longitude, height=Configuration.elevation))
		except Exception as e:
			print(e.message)
			sys.exit(2)
		
		if len(sys.argv) > 2:
			self.save_file_name = sys.argv[2]
			if os.path.exists(self.save_file_name):
				self.calibrator.load(self.save_file_name)

		cv2.namedWindow(self.image_window, cv2.WINDOW_AUTOSIZE)
		cv2.namedWindow(self.sky_window, cv2.WINDOW_AUTOSIZE)
		
		self.selectImage(0)

		cv2.setMouseCallback(self.image_window, self.imageMouseCallback)
		cv2.setMouseCallback(self.sky_window, self.skyMouseCallback)
		cv2.createTrackbar(self.tb_image_switch, self.image_window, 0, len(self.calibrator.files) - 1, self.selectImage)
		cv2.createTrackbar(self.tb_max_mag, self.sky_window, self.max_mag, 6, self.setMaxMag)
Ejemplo n.º 5
0
		self.alt = alt[0]

		return self.alt
		
	def isNight(self):
		return self.alt < Configuration.night_angle

	def isDay(self):
		return self.alt > Configuration.day_angle

	def __str__(self):
		if self.isNight():
			return "Night"
		elif self.isDay():
			return "Day"
		else:
			return "Twilight"

if __name__ == '__main__':
	checker = NightChecker()

	if len(sys.argv) > 1:
		files = SkyCameraFile.glob(sys.argv[1])

		for f in files:
			time = SkyCameraFile.parseTime(f)
			checker.setTime(time)
			print(f, checker)
	else:
		print(checker)
Ejemplo n.º 6
0
    def setTime(self, time):
        self.catalog.setTime(time)
        _, _, alt, _ = self.catalog.calculate()

        self.alt = alt[0]

        return self.alt

    def isUp(self):
        return self.alt > Configuration.moon_up_angle

    def __str__(self):
        if self.isUp():
            return "Up"
        else:
            return "Down"


if __name__ == '__main__':
    checker = MoonChecker()

    if len(sys.argv) > 1:
        files = SkyCameraFile.glob(sys.argv[1])

        for f in files:
            time = SkyCameraFile.parseTime(f)
            checker.setTime(time)
            print(f, checker)
    else:
        print(checker)