This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt5.QtWidgets import QSlider | |
class DoubleSlider(QSlider): | |
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
self.decimals = 5 | |
self._max_int = 10 ** self.decimals | |
super().setMinimum(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import sys | |
import asyncio | |
from functools import partial, wraps | |
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QGridLayout, QProgressBar, QErrorMessage | |
from PyQt5.QtCore import Qt | |
from quamash import QEventLoop | |
import traceback | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Thread, Event, Timer | |
import time | |
def TimerReset(*args, **kwargs): | |
""" Global function for Timer """ | |
return _TimerReset(*args, **kwargs) | |
class _TimerReset(Thread): | |
"""Call a function after a specified number of seconds: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This code was helpful, | |
https://stackoverflow.com/questions/32141623/pyqt5-and-asyncio-yield-from-never-finishes | |
""" | |
import os | |
import sys | |
import quamash | |
import asyncio | |
import traceback | |
import PyQt5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: asyncstuff | |
channels: | |
- defaults | |
- krisvanneste | |
- david_baddeley | |
- conda-forge | |
- danieljfarrell_teraview | |
- teraview | |
- pkgs/main | |
- pkgs/free |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import time | |
now = datetime.datetime.now() | |
now_iso = now.isoformat() | |
def parse_iso8601_badly(iso_str): | |
date_str, time_str = iso_str.split('T') | |
d = dict() | |
d.update(zip(['hour', 'minute', 'second'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tree_editor.py -- Example of a tree editor | |
from traits.api \ | |
import HasTraits, Str, Regex, List, Instance, Any, Property | |
from traitsui.api \ | |
import TreeEditor, TreeNode, View, Item, VSplit, \ | |
HGroup, Handler, Group, ModelView | |
from traitsui.menu \ | |
import Menu, Action, Separator | |
from traitsui.wx.tree_editor \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def remove_reference_signal_with_experimental_reference_method_with_extended_FFT( | |
signal, | |
reference, | |
optical_delay_spacing, | |
ref_calibration=None): | |
"""Removes reference signal using extended FFT method.""" | |
# transform reference signal to frequency domain | |
t_points = reference.shape[0] | |
ref_spec = np.fft.rfft(reference, reference.shape[0]*2) | |
signal_spec = np.fft.rfft(signal, signal.shape[0]*2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_frequency_information(self): | |
"""NB kUseNewFFTMethod = True for MATLAB algorithm.""" | |
reference = self.measurement.reference | |
if len(reference) > 1: | |
dt = self.measurement.optical_delay_spacing | |
t_offset = self.measurement.optical_delay_offset | |
f_max = 1./(2*dt) | |
if kUseNewFFTMethod: | |
freq = np.linspace(0.0, f_max, len(reference) + 1) | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, psutil, subprocess | |
# Usage: | |
# This script MUST be run from the root of the | |
# teraview-test-robot directory for example using, | |
# python run_test_robot_cmd.py | |
def make_test_robot_process(): | |
"""Creates the test robot process.""" | |
REL_TEST_ROBOT_EXE = "bin\\Debug\\test-robot.exe" |