コード例 #1
0
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)
# ch.setFormatter(formatter)
# # add the handlers to the logger
# modlogger.addHandler(fh)
# modlogger.addHandler(ch)
コード例 #2
0
ファイル: AWG520.py プロジェクト: RaeesKhan65/quantum-pulse
_WFM_MEMORY_LIMIT = 1048512  # at most this many points can be in a waveform
_SEQ_MEMORY_LIMIT = 8000
_IQTYPE = np.dtype(
    '<f4')  # AWG520 stores analog values as 4 bytes in little-endian format
_MARKTYPE = np.dtype('<i1')  # AWG520 stores marker values as 1 byte

sourcedir = get_project_root()
saveawgfilepath = sourcedir / 'Hardware/AWG520/sequencefiles/'
# ensure that the awg files can be saved
if not saveawgfilepath.exists():
    os.mkdir(saveawgfilepath)
    print('Creating directory for AWG files at:'.format(
        saveawgfilepath.resolve()))

# create the logger
privatelogger = create_logger('awg520private')
# privatelogger = logging.getLogger('awg520private')
# privatelogger.setLevel(logging.DEBUG)
# fh = logging.FileHandler((logfilepath / 'qpulse-app.log').resolve())
# 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)
# ch.setFormatter(formatter)
# # add the handlers to the logger
# privatelogger.addHandler(fh)
# privatelogger.addHandler(ch)
コード例 #3
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# 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

# this code is adapted from https://wiki.python.org/moin/PythonDecoratorLibrary#Logging_decorator_with_specified_logger_
# .28or_default.29

from source.common.utils import log_with, get_project_root, create_logger
import logging

log = create_logger('utilslogger')


@log_with(log)
class TestLog:
    def __init__(self):
        print('creating test log class')
        self.logger = logging.getLogger('utilslogger.testlogcls')

    def foo3(self):
        print('this is foo3')
        self.logger.info('this is foo3')

    def foo4(self):
        print('this is foo4')
コード例 #4
0
ファイル: app.py プロジェクト: pgw4/quantum-pulse
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',
               'IQ scale factor', 'phase', 'skew phase','iterate pulses','num pulses'
     4. ui: the UI instance variable
     5. mplDataPlot: matplotlib data plot
     6.sigPlot, RefPlot: signal, reference Plots
コード例 #5
0
ファイル: Sequence.py プロジェクト: RaeesKhan65/quantum-pulse
_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}

_DAC_UPPER = 1024.0  # DAC has only 1024 levels
_DAC_MID = 512
_IQTYPE = np.dtype('<f4')  # AWG520 stores analog values as 4 bytes in little-endian format
_MARKTYPE = np.dtype('<i1')  # AWG520 stores marker values as 1 byte

modlogger = create_logger('seqlogger')
# modlogger.setLevel(logging.DEBUG)
# # create a file handler that logs even debug messages
# if not logfiledir.exists():
#     os.mkdir(logfiledir)
#     print('Creating directory for AWG logging at:'.format(logfiledir.resolve()))
# fh = logging.FileHandler((logfiledir / 'qpulse-app.log').resolve())
# 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)
# ch.setFormatter(formatter)
# # add the handlers to the logger