def take_image(filename):
    """take_image: The function will create a Operating System timestamp variable (OS_time), configure
                the 2 IRCSP cameras to take an image (image1 & image2) and store the FPA temperatures
                (temp1 & temp2) into an HDF5 File format with a unique naming convention.

    Parameters:
                filename - the filename of the HDF5 file.


    Returns: HDF5 file with 2 FLIR Boson Images, 2 FPA Temperatures & OS_time string.
    """

    # Time/Speed Test - Start
    start = datetime.datetime.now()

    #Create Timestamp for File Creation Tracking
    now = datetime.datetime.now()
    OS_time = now.strftime("%H:%M")

    camera1 = Boson(port='COM4')
    #camera2 = Boson(port='COM6')

    print(camera1.find_video_device())
    #print(camera2.find_video_device())

    #set FFC to manual
    #camera1.set_ffc_manual()
    #camera2.set_ffc_manual()

    #get FPA temperature
    #temp1 = camera1.get_fpa_temperature()
    #temp2 = camera2.get_fpa_temperature()

    #Take Image
    #image1 = camera1.grab(device_id = 1)
    #image2 = camera2.grab(device_id = 2)

    #Close Camera
    camera1.close()
    #camera2.close()

    # Open as Read-Write ("a" - creates file if doesn't exist)
    #with h5py.File(filename, "a") as h5:
    #h5.attrs["OS_time"] = OS_time
    #h5["image1"] = image1
    #h5["image2"] = image2
    #h5["temp1"] = temp1
    #h5["temp2"] = temp2

    #Time/Speed Test - Finish
    finish = datetime.datetime.now()
    print("Image Capture File: ", filename, " created in ", finish - start)

    #Adjust Sleep for File Creation Rate - (File/Seconds)
    time.sleep(10)
Example #2
0
single_cam_mono_sweep
Created on Wed Dec  9 13:12:18 2020

This script will sweep over wavelength on the monochomator
for a single measurement configuration.

This includes image capture for a single camera (no MS)
And a single polarization state (unpol, H,V, ect)
Output will be saved as a hdf5 file 
Uses flirpy, make sure enviroment is open
uses python-usbtmc

@author: khart
"""
from flirpy.camera.boson import Boson
import matplotlib.pyplot as plt
import numpy as np
import h5py
import time

#initialize camera
camera1 = Boson(port="COM5")
camera2 = Boson(port="COM6")

print(camera1.find_video_device())
print(camera2.find_video_device())

#close camera
camera1.close()
camera2.close()
Example #3
0
from flirpy.camera.boson import Boson
import flirpy.camera.boson
import pytest
import os
import time

if Boson.find_video_device() is None:
    pytest.skip("Boson not connected, skipping tests", allow_module_level=True)


def test_open_boson():
    camera = Boson()
    camera.close()


@pytest.mark.skipif(os.name != "nt", reason="Skipping Windows-only test")
def test_capture_windows():
    with Boson() as camera:
        # Currently have no way of figuring this out
        res = camera.grab()

        assert res is not None
        assert len(res.shape) == 2
        assert res.dtype == "uint16"


@pytest.mark.skipif(os.name == "nt", reason="Skipping on Windows")
def test_capture_unix():
    with Boson() as camera:
        res = camera.grab()