Esempio n. 1
0
# from time import sleep
import logging
import concert
# Miscellaneous imports
from numpy import linspace
import yaml
import time
import argparse
import os
import numpy as np
from datetime import date
# Dark style
# noinspection PyUnresolvedReferences
from styles.breeze import styles_breeze
from edc import log
concert.require("0.11.0")


def process_cl_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('-d', '--debug', action='store_const',
                        const=True)  # optional flags
    parsed_args, unparsed_args = parser.parse_known_args()
    return parsed_args, unparsed_args


class GUI(QDialog):
    '''
    Creates main GUI, holds references to physical devices, and
    provides start/abort controls for Concert scans, and holds
    4 groups where parameters can be entered
Esempio n. 2
0
"""---\nThis session shows how to implement a simple zig-zag scan using
two motors for horizontal (x_motor) and vertical movement (z_motor) as well as
a detector. The result is an image composed of all scanned tiles."""

import concert
concert.require('0.8')

import numpy as np
import scipy.misc
import matplotlib.pyplot as plt
from concert.quantities import q
from concert.session.utils import ddoc, dstate, pdoc
from concert.devices.cameras.dummy import Camera
from concert.devices.motors.dummy import LinearMotor


# Create a camera with noisy background
camera = Camera(background=scipy.misc.lena())

# Assume motors' zero coordinate is left and up respectively
x_motor = LinearMotor()
z_motor = LinearMotor()


def zig_zag_scan(num_images_horizontally=2, num_images_vertically=2,
                 pixel_size=5*q.micrometer):
    x_motor.position = 0 * q.micrometer
    z_motor.position = 0 * q.micrometer

    width = pixel_size * camera.roi_width
    height = pixel_size * camera.roi_height
Esempio n. 3
0
"""---\nThis is session uca-check."""

import concert
concert.require("0.10.0")

import sys
import inspect
import numpy as np
from concert.quantities import q
from concert.session.utils import ddoc, dstate, pdoc
from concert.devices.cameras.uca import Camera

try:
    from clint.textui import colored
    _clint_available = True
except ImportError:
    _clint_available = False


def acquire_frame(camera):
    camera.start_recording()
    frame = camera.grab()
    camera.stop_recording()
    return frame


def test_bit_depth_consistency(camera):
    camera.exposure_time = 1 * q.s
    frame = acquire_frame(camera)

    bits = camera.sensor_bitdepth
Esempio n. 4
0
"""---\nDemonstrating Concert capabilities."""

import concert
concert.require("0.6")

import numpy as np
from concert.quantities import q
from concert.session.utils import ddoc, dstate, pdoc, code_of
from concert.devices.cameras.dummy import Camera
from concert.devices.motors.dummy import LinearMotor
from concert.devices.storagerings.dummy import StorageRing


ring = StorageRing()
motor = LinearMotor()
camera = Camera()
Esempio n. 5
0
import concert
concert.require("0.9.0")

import timeit

N_SETS = 1000
N_RUNS = 3

setup_futures = """
from concert.quantities import q
from concert.async import wait
from concert.devices.motors.dummy import LinearMotor

m = LinearMotor()

def test_set_position():
    futures = [m.set_position(0 * q.mm) for i in range({})]
    wait(futures)
""".format(N_SETS)

setup_raw = """
from concert.quantities import q
from concert.async import wait
from concert.devices.motors.dummy import LinearMotor

m = LinearMotor()

def test_set_position():
    for i in range({}):
        m.position = 0 * q.mm
""".format(N_SETS)
"""---\nThis session demonstrates reconstruction with the UFO data
processing framework."""

import concert
concert.require("0.11.0")

import numpy as np
from gi.repository import Ufo
from concert.quantities import q
from concert.session.utils import ddoc, dstate, pdoc
from concert.ext.ufo import PluginManager, InjectProcess
from concert.devices.cameras.dummy import Camera


def acquire(camera, num_frames):
    camera.start_recording()

    for i in xrange(num_frames):
        yield camera.grab()


def reconstruct_from(camera):
    pm = PluginManager()

    fft = pm.get_task('fft', dimensions=1)
    ifft = pm.get_task('ifft', dimensions=1)
    fltr = pm.get_task('filter')
    bp = pm.get_task('backproject')
    writer = pm.get_task('write')

    graph = Ufo.TaskGraph()