示例#1
0
    def __init__(self):
        self.calibration = Calibration()
        self.calibration.load_calib_a("a.txt")
        self.calibration.load_calib_b("b.txt")
        self.calibration.load_calib_c("c.txt")
        self.calibration.load_calib_t("t.txt")
        # Initialize miniPIX driver subsystem
        pypixet.start()
        self.pixet = pypixet.pixet
        self.device = self.pixet.devices()[0]

        if self.device.fullName() != "MiniPIX H06-W0239":
            print("No minipix found exiting...")
            exit(0)
        self.device.loadConfigFromFile("H06-W0239.xml")

        print("Found device: {}".format(self.device.fullName()))

        # Allows for retrieval of MiniPIX frames at regular intervals
        self.minipix = MiniPIXAcquisition(self.device,
                                          self.pixet,
                                          variable_frate=False,
                                          shutter_time=1)
        self.minipix.daemon = True

        # Allows for regular handling of uplink commmands from HASP
        self.serial_connection = SerialConnectionTest()
        self.cmd_handler = HASPCommandHandler(self.serial_connection)
        self.cmd_handler.start()

        self.bus = smbus.SMBus(i2CBUS)

        self.running = False
示例#2
0
def minipix_init():
    pypixet.start()
    pixet = pypixet.pixet

    # first list all Medipix/Timepix devices and use the first one:
    devices = pixet.devices()
    if not devices:
        raise Exception("No devices connected")

    device = devices[0]  # use  the first device

    return device
def minipix_init():
    pypixet.start()
    pixet = pypixet.pixet

    # first list all Medipix/Timepix devices and use the first one:
    print("Number of devices: " + str(pixet.deviceCount()))
    devices = pixet.devices()
    print(devices)
    if not devices:
        raise Exception("No devices connected")

    device = devices[0]  # use  the first device

    return device
示例#4
0
#!/usr/bin/env python

import pypixet
import math
import time

from time import sleep

sleep(5)
pypixet.start()
pixet = pypixet.pixet
# first list all Medipix/Timepix devices and use the first one:
devices = pixet.devices()

if not devices:
    raise Exception("No devices connected")
device = devices[0]  # use  the first device
device.loadConfigFromFile("Fixed_Config_MiniPIX-H06-W0239.xml")

if str(type(device)) != "<type 'IDevMpx2'>":
    print("No minipix installed exitting...")
    exit(0)

print("Found Device: %s" % device.fullName())

startTime = time.time()


# -----------------------------------------------------------------------------------
#                      ACQUISITION EXAMPLE - SAVING TO FILE
# -----------------------------------------------------------------------------------
    def __init__(self):
        # Set up MiniPIX
        self.mp_calibration = Calibration()
        self.mp_calibration.load_calib_a(
            "/home/pi/SOCRATES-FC/flight-computer/calibration/mp_a.txt")
        self.mp_calibration.load_calib_b(
            "/home/pi/SOCRATES-FC/flight-computer/calibration/mp_b.txt")
        self.mp_calibration.load_calib_c(
            "/home/pi/SOCRATES-FC/flight-computer/calibration/mp_c.txt")
        self.mp_calibration.load_calib_t(
            "/home/pi/SOCRATES-FC/flight-computer/calibration/mp_t.txt")
        # Set up FitPIX
        self.fp_calibration = Calibration()
        self.fp_calibration.load_calib_a(
            "/home/pi/SOCRATES-FC/flight-computer/calibration/fp_a.txt")
        self.fp_calibration.load_calib_b(
            "/home/pi/SOCRATES-FC/flight-computer/calibration/fp_b.txt")
        self.fp_calibration.load_calib_c(
            "/home/pi/SOCRATES-FC/flight-computer/calibration/fp_c.txt")
        self.fp_calibration.load_calib_t(
            "/home/pi/SOCRATES-FC/flight-computer/calibration/fp_t.txt")

        # Initialize miniPIX driver subsystem
        pypixet.start()
        self.pixet = pypixet.pixet
        self.mp_device = None
        self.fp_device = None
        devices = self.pixet.devices()
        logger.info('Found PIX devices: ' + str(devices))

        for device in devices:
            if 'MiniPIX' in device.fullName():
                self.mp_device = device
            elif 'FITPix' in device.fullName():
                self.fp_device = device

        if self.mp_device.fullName() != "MiniPIX H06-W0239":
            logger.error("No minipix found exiting...")
            os.unlink(pidfile)
            exit(0)
        #if self.fp_device.fullName() != "FITPix":

        self.mp_device.loadConfigFromFile(
            "/home/pi/SOCRATES-FC/flight-computer/calibration/MiniPIX-H06-W0239.xml"
        )
        self.fp_device.loadConfigFromFile(
            "/home/pi/SOCRATES-FC/flight-computer/calibration/E10-W0119.xml")

        logger.info("Found MiniPIX device: {}".format(
            self.mp_device.fullName()))
        logger.info("Found FitPIX device: {}".format(
            self.fp_device.fullName()))

        # Allows for retrieval of MiniPIX frames at regular intervals
        self.minipix = MiniPIXAcquisition(self.mp_device,
                                          self.pixet,
                                          variable_frate=False,
                                          shutter_time=1)
        self.minipix.daemon = True

        self.fitpix = MiniPIXAcquisition(self.fp_device,
                                         self.pixet,
                                         variable_frate=False,
                                         shutter_time=1)
        self.fitpix.daemon = True

        # Allows for regular handling of uplink commmands from HASP
        self.arduino_serial_connection = connectToArduino()
        self.hasp_serial_connection = connectToHASP()
        self.cmd_handler = HASPCommandHandler(self.hasp_serial_connection,
                                              self.arduino_serial_connection)
        self.cmd_handler.start()

        self.running = False