Ejemplo n.º 1
0
                                           data=self.camera.color_image())
            self.update_progress(i + 1)


class TimelapseCameraControlWidget(CameraControlWidget):
    """A control widget for the Lumenera camera, with extra buttons."""
    def __init__(self, camera, auto_connect=True):
        super(TimelapseCameraControlWidget, self).__init__(camera,
                                                           auto_connect=False)
        gb = QuickControlBox()
        gb.add_doublespinbox("exposure")
        gb.add_spinbox("timelapse_n")
        gb.add_doublespinbox("timelapse_dt")
        gb.add_button("take_timelapse", title="Acquire Timelapse")
        self.layout().insertWidget(1,
                                   gb)  # put the extra settings in the middle
        self.quick_settings_groupbox = gb

        self.auto_connect_by_name(controlled_object=self.camera, verbose=False)


if __name__ == '__main__':
    device = int(input("Enter the number of the camera to use: "))
    cam = DumbOpenCVCameraWithTimelapse(device)
    df = nplab.datafile.set_temporary_current_datafile()
    cam.live_view = True
    show_guis([cam, df])
    cam.live_view = False
    cam.close()
    nplab.close_current_datafile()
Ejemplo n.º 2
0
            elif sys_args['raster_3d']:
                raster3d = exp.RasterXYZ(scope, config)
                raster3d.run()
            elif sys_args['timed']:
                timed = exp.TimedMeasurements(scope, config)
                timed.run()
            elif sys_args['measure']:
                print scope.sensor.average_n(1, 0)
            elif sys_args['hill_walk']:
                hilly = exp.HillWalk(scope, config)
                hilly.run()
            elif sys_args['hill_walk2']:
                hill_walk = exp.AdaptiveHillWalk(scope, config,
                                                 **adaptive_kwargs)
                hill_walk.run()
            elif sys_args['drift_recentre']:
                drift = exp.DriftReCentre(scope, config)
                drift.run()

        elif sys_args['move']:
            positions = []
            for axis in ['--x', '--y', '--z']:
                if sys_args[axis] is None:
                    sys_args[axis] = 0
                positions.append(int(sys_args[axis]))
            print "Moved by {}".format(positions)
            stage = micro.Stage(config)
            stage.move_rel(positions)

    nplab.close_current_datafile()