示例#1
0
文件: app.py 项目: pgw4/quantum-pulse
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.animation import FuncAnimation
from pathlib import Path
import sys, numpy, datetime, os
import logging

import numpy as np
import matplotlib.pyplot as plt
from source.Hardware.AWG520.Sequence import Sequence
"""
if I import the Ui_Pulseshaper class from the python file, then I will have to inherit from it in the main appGUI class from appgui, load Ui_Pulseshaper. Instead I use the uic 
module to directly load GUI. Then I dont have to inherit from it and can assign a ui variable inside the appGUI class. Either method is fine.
"""

thisdir = get_project_root()
qtdesignerfile = thisdir / 'appgui_V3.ui'  # this is the .ui file created in QtCreator

# start the logger
logger = create_logger('qpulseapp')

Ui_quantumpulse, junk = uic.loadUiType(qtdesignerfile)


@log_with(logger)
class appGUI(QtWidgets.QMainWindow):
    """ this is the main class for the GUI. It has several important variables:
     1. mw : dictionary where each key value has an array contains all the mw parameters such as 'enable device',
     'frequency (GHz)', 'enable scan', 'start', 'step','stop'
     2. scan: array contains all amplitude scan parameters such as start, stop, numsteps
     3. awg:  array contains all awg parameters such as 'awg device', 'amplitude (mV)', 'pulse width', 'time resolution(ns)', 'pulseshape',  'enable IQ','SB freq',
from source.Hardware.AWG520.AWG520 import AWGFile
from source.Hardware.AWG520.Sequence import Sequence, SequenceList
from source.Hardware.PTS3200.PTS import PTS
from source.Hardware.MCL.NanoDrive import MCL_NanoDrive
from source.common.utils import log_with, create_logger, get_project_root
import time, sys, multiprocessing
import logging
_PTS_PORT = 'COM3'  #---2021-02-09: new PTS com port

import ADwin, os

from pathlib import Path

# hwdir  = Path('.')
# dirPath = hwdir / 'AWG520/sequencefiles/'
sourcedir = get_project_root()
#print(sourcedir)
dirPath = Path(sourcedir / 'Hardware/AWG520/sequencefiles/'
               )  # remove the tests part of the string later
awgPath = Path('./pulsed_esr')
modlogger = create_logger('threadlogger')
# modlogger.setLevel(logging.DEBUG)
# # create a file handler that logs even debug messages
# fh = logging.FileHandler('./logs/threadlog.log')
# fh.setLevel(logging.DEBUG)
# # create a console handler with a higher log level
# ch = logging.StreamHandler()
# ch.setLevel(logging.ERROR)
# # create formatter and add it to the handlers
# formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# fh.setFormatter(formatter)
示例#3
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
import numpy as np
import logging
from pathlib import Path
import os

from .Pulse import Gaussian, Square, Marker, Sech, Lorentzian, LoadWave
from source.common.utils import log_with, create_logger,get_project_root
import copy

maindir = get_project_root()
seqfiledir = Path('.') / 'sequencefiles/'
# logfiledir = maindir / 'logs/'
# print('the sequence file directory is {0} and log file directory is {1}'.format(seqfiledir.resolve(),logfiledir.resolve()))

_GHZ = 1.0  # we assume the time units is in ns for the AWG
_MW_S1 = 'S1'  # disconnected for now
_MW_S2 = 'S2'  # channel 1, marker 1
_GREEN_AOM = 'Green'  # ch1, marker 2
_ADWIN_TRIG = 'Measure'  # ch2, marker 2
_WAVE = 'Wave'  # channel 1 and 2, analog I/Q data
_BLANK = 'Blank' # new keyword which turns off all channels, to be implemented
_FULL = 'Full' # new keyword which turns on all channels high, to be implemented
# dictionary of connections from marker channels to devices,
_CONN_DICT = {_MW_S1: None, _MW_S2: 1, _GREEN_AOM: 2, _ADWIN_TRIG: 4}