From 89d5de1c1f0516418c6522a985e4bda9b8bb489d Mon Sep 17 00:00:00 2001 From: nulinspiratie Date: Mon, 19 Dec 2016 21:36:25 +1100 Subject: [PATCH 1/6] WOrk on init --- silq/tools/gui_tools.py | 101 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 silq/tools/gui_tools.py diff --git a/silq/tools/gui_tools.py b/silq/tools/gui_tools.py new file mode 100644 index 000000000..531d5b40a --- /dev/null +++ b/silq/tools/gui_tools.py @@ -0,0 +1,101 @@ +import sys +from datetime import datetime, timedelta +from queue import Empty +from traceback import format_exc +import logging + +from PyQt4 import QtGui +from PyQt4.QtCore import QThread + + +from qcodes.process.server import BaseServer + + + +class PipeServer(BaseServer): + def __init__(self, query_queue, response_queue, extras=None): + super().__init__(query_queue, response_queue, extras) + + app = QtGui.QApplication(sys.argv) + # ex = GUIServer(query_queue=query_queue, + # response_queue=response_queue) + ex = GUIServer(query_queue=query_queue, response_queue=response_queue) + sys.exit(app.exec_()) + + +class GUIServer(BaseServer, QtGui.QMainWindow): + def __init__(self, query_queue, response_queue): + QtGui.QMainWindow.__init__(self) + BaseServer.__init__(self, query_queue, response_queue) + + self.initUI() + self.run_event_loop() + + def initUI(self): + self.text_box = QtGui.QTextEdit() + self.setCentralWidget(self.text_box) + + exitAction = QtGui.QAction(QtGui.QIcon('exit24.png'), 'Exit', self) + exitAction.setShortcut('Ctrl+Q') + exitAction.setStatusTip('Exit application') + exitAction.triggered.connect(self.close) + + self.statusBar() + + menubar = self.menuBar() + fileMenu = menubar.addMenu('&File') + fileMenu.addAction(exitAction) + + toolbar = self.addToolBar('Exit') + toolbar.addAction(exitAction) + + self.setGeometry(300, 300, 350, 250) + self.setWindowTitle('Main window') + self.show() + + + def handle_append(self, text): + self.text_box.append(text) + + +class EventLoopThread(QThread): + + def __init__(self, query_queue, response_queue): + QThread.__init__(self) + self.query_queue = query_queue + self.response_queue = response_queue + + def __del__(self): + self.wait() + + def run_event_loop(self): + self.running = True + next_store_ts = datetime.now() + next_monitor_ts = datetime.now() + + while self.running: + read_timeout = self._storage_period / self.queries_per_store + try: + query = self._query_queue.get(timeout=read_timeout) + self.process_query(query) + except Empty: + pass + + try: + now = datetime.now() + + if self._measuring and now > next_store_ts: + td = timedelta(seconds=self._storage_period) + next_store_ts = now + td + self._data.write() + + if now > next_monitor_ts: + td = timedelta(seconds=self._monitor_period) + next_monitor_ts = now + td + # TODO: update the monitor data storage + + except: + logging.error(format_exc()) + + def run(self): + # your logic here \ No newline at end of file From 78f679aa47f0085c0e837e4fe895a020bdbe674d Mon Sep 17 00:00:00 2001 From: nulinspiratie Date: Tue, 20 Dec 2016 10:58:05 +1100 Subject: [PATCH 2/6] GUI_tools --- silq/tools/gui_tools.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/silq/tools/gui_tools.py b/silq/tools/gui_tools.py index 531d5b40a..042902c1d 100644 --- a/silq/tools/gui_tools.py +++ b/silq/tools/gui_tools.py @@ -23,12 +23,12 @@ def __init__(self, query_queue, response_queue, extras=None): sys.exit(app.exec_()) -class GUIServer(BaseServer, QtGui.QMainWindow): +class GUIClass(QtGui.QMainWindow): def __init__(self, query_queue, response_queue): - QtGui.QMainWindow.__init__(self) - BaseServer.__init__(self, query_queue, response_queue) + super().__init__() self.initUI() + EventLoopServer self.run_event_loop() def initUI(self): @@ -58,7 +58,7 @@ def handle_append(self, text): self.text_box.append(text) -class EventLoopThread(QThread): +class EventLoopServer(QThread, BaseServer): def __init__(self, query_queue, response_queue): QThread.__init__(self) From e88f99f49a4a619e1af96357f084e3c5e865fd23 Mon Sep 17 00:00:00 2001 From: nulinspiratie Date: Tue, 20 Dec 2016 12:36:54 +1100 Subject: [PATCH 3/6] Package stuff --- silq.egg-info/PKG-INFO | 160 +++++++++------------------------ silq.egg-info/SOURCES.txt | 45 ++++++++-- silq.egg-info/requires.txt | 2 + silq/tests/test_gui.py | 58 ++++++++++++ silq/tests/test_instruments.py | 5 +- 5 files changed, 145 insertions(+), 125 deletions(-) create mode 100644 silq/tests/test_gui.py diff --git a/silq.egg-info/PKG-INFO b/silq.egg-info/PKG-INFO index e00e1bee8..1f213e94a 100644 --- a/silq.egg-info/PKG-INFO +++ b/silq.egg-info/PKG-INFO @@ -6,131 +6,55 @@ Home-page: https://github.com/nulinspiratie/SilQ Author: Serwan Asaad, Stefanie Tenberg Author-email: serwan.asaad@gmail.com License: Private -Description: # QCoDeS [![Build Status](https://travis-ci.com/qdev-dk/Qcodes.svg?token=H7MjHi74teZgv8JHTYhx&branch=master)](https://travis-ci.com/qdev-dk/Qcodes) - - QCoDeS is a Python-based data acquisition framework developed by the Copenhagen / Delft / Sydney / Microsoft quantum computing consortium. While it has been developed to serve the needs of nanoelectronic device experiments, it is not inherently limited to such experiments, and can be used anywhere a system with many degrees of freedom is controllable by computer. - - QCoDeS has taken inspiration from many similar frameworks that have come before it, including: - - [QTLab](https://github.com/heeres/qtlab) - - [Special Measure](https://github.com/yacobylab/special-measure) - - "Alex Igor Procedures" see [thesis](http://qdev.nbi.ku.dk/student_theses/pdf_files/A_Johnson_thesis.pdf) appendix D and [successors](http://www.igorexchange.com/project/Expt_Procedures) - - and countless smaller components created by students and postdocs throughout the quantum computing community - - QCoDeS is compatible with Python 3.4+. It is primarily intended for use from Jupyter notebooks, but can be used from traditional terminal-based shells and in stand-alone scripts as well. - Although some feature at the moment are b0rken outside the notebook. - - ## Install - - ### PyPi - PyPi is the fastest way to install QCoDeS, will be avaiable once out of beta/private. - - ### Developer - - We use virtualenv and pyenv to make sure all the system are the same, this rules out issues and the usual "it works on my machine". - Install virtual env (optionally virtualenvwrapper for convenience, if you are on linux) and pyenv according to your distribution. - Once all is installed, and working: - - ```bash - pyenv install 3.4.5 - pyenv local 3.4.5 - mkvirtualenv qcodes-dev -r develop_requirements.txt --python $HOME/.pyenv/versions/3.4.5/bin/python3.4 - git clone https://github.com/qdev-dk/Qcodes.git $QCODES_INSTALL_DIR - cd $QCODES_INSTALL_DIR - pip install -r develop_requirements.txt - pip install -e . - python qcodes/test.py -f - ``` - - If the tests pass you are ready to hack! - Note that sometimes the test suite because there is a bug somewhere in the mulitprocessing architecture. - - This is the reference setup one needs to have to contribute, otherwise too many non-reproducible environments will show up. - - ### Anaconda - - We recommend [Anaconda](https://www.continuum.io/downloads) as an easy way to get most of the dependencies out-of-the-box. - - As the project is still private, install it directly from this repository: - - - Install git: the [command-line toolset](https://git-scm.com/) is the most powerful but the [desktop GUI from github](https://desktop.github.com/) is also quite good - - - Clone this repository somewhere on your hard drive. If you're using command line git, open a terminal window in the directory where you'd like to put QCoDeS and type: - ``` - git clone https://github.com/qdev-dk/Qcodes.git - ``` - #### the easy way - - Open the 'navigator' app that was installed with anaconda. - - On the left side click on "Environments". - - Then on the "import" icon, on the bottom. - - Pick a name, and click on the folder icon next to file to import from. - - Make sure you select "Pip requirement files" from the "Files of type" dialog then navigate to the qcodes folder and select `basic_requirements.txt`. - - Finally click import, and wait until done. - - The enviroment is now created, click on the green arrow to open a terminal inside it. - - Navigate again with the terminal (or drag and drop the the folder on OsX) - - Most likely you will want to plot stuff, so type: - - `conda install matplotlib` - - and after if you want qtplot - - `conda install pyqtgraph` - - - Then type - ` pip install -e . ` - - - Finally bring Giulio to Sabøtoren, Fensmarkgade 27, 2200 København N. - - - #### the not so easy way that often does not work - - - Register qcoes with Python, and install dependencies if any are missing: run this from the root directory of the repository you just cloned: - ``` - python setup.py develop - ``` - - Now QCoDeS should be available to import into all Python sessions you run. To test, run `python` from some other directory (not where you just ran `setup.py`) and type `import qcodes`. If it works without an error you're ready to go. - - ### Plotting Requirements - - Because these can sometimes be tricky to install (and not everyone will want all of them), the plotting packages are not set as required dependencies, so setup.py will not automatically install them. You can install them with `pip`: - - - For `qcodes.MatPlot`: matplotlib version 1.5 or higher - - For `qcodes.QtPlot`: pyqtgraph version 0.9.10 or higher - - ### Updating QCoDeS - - If you registered QCoDeS with Python via `setup.py develop`, all you need to do to get the latest code is open a terminal window pointing to anywhere inside the repository and run `git pull` - - ## Usage - - Read the [docs](http://qdev-dk.github.io/Qcodes) and the notebooks in [docs/examples](docs/examples) - - - ## Contributing - - See [Contributing](CONTRIBUTING.rst) for information about bug/issue reports, contributing code, style, and testing - See the [Roadmap](http://qdev-dk.github.io/Qcodes/roadmap.html) an overview of where the project intends to go. - - - ## Docs - - We use sphinx for documentations, makefiles are provied boht for Windows, and *nix. - - Go to the directory `docs` and - +Description: #SilQ + + SilQ is a measurement software designed to control spin-based systems. It utilizes the QCoDeS data acquisition framework. + + + ## Installation + + ### Install Python + 1. Download [Anaconda 64bit python 3.5](https://www.continuum.io/downloads) + 2. Install Anaconda (make sure to tick the options add to system path and register as python 3.5 + ### Install Github + 1. Download and install [Github Desktop]9https://desktop.github.com/) and create a [Github account](https://github.com/) + 2. Give Serwan your account details to add you to the private git repository + ### Install SilQ+QCodes + 1. Clone the repository [SilQ](https://github.com/nulinspiratie/SilQ) (includes QCodes) into your hard drive + (e.g. User/Documents/PythonSoftware) using the installed Github desktop + 2. SilQ: Open Command prompt (type cmd into start menu and right click to open as administrator) + 1. Navigate to SilQ folder on your computer (not SilQ/silq) + 2. Run “python setup.py develop” + 3. It will likely say that packages are missing (usually lmfit and peakutils). + Install these missing packages like instructed (conda (or pip) install lmfit and peakutils) + 3. QCodes: Open command prompt, Navigate to the Qcodes folder on your computer (SilQ/Qcodes), + run ‘python setup.py develop’ and install missing packages (usually coverage and pyqtgraph) + + ## Using SilQ + The measurement software SilQ and QCodes can be imported as a package, just like any other python packages. + To use the measurement software in your script, use the following line ``` - make html + import qcodes as qc + import silq ``` - This generate a webpage, index.html, in `docs/_build/html` with the rendered html. - Documentation is updated and deployed on every successful build. + ## Using GitHub + 1. Commit your changes to the master branch including a meaningful heading and commentary + 2. Sync with the master branch to get other people’s changes - ## License + ## Choosing an IDE + ### PyCharm + 1. Download, install, and open PyCharm Community Edition (or use the professional version which is free for students) + 2. Open SilQ project + 3. Go to file -> default settings -> project interpreter + 4. Set interpreter to the newly installed Python Anaconda 3.5 + 5. Restart PyCharm - QCoDeS is currently a private development of Microsoft's Station Q collaboration, and IS NOT licensed for distribution outside the collaboration except by arrangement. We intend to release it as open source software once it is robust and reasonably stable, under the MIT license. See [License](LICENSE.md). + When using PyCharm, code must be executed in scripts. To run QCoDeS, write your commands after `if __name__ == "__main__":` + ### Jupyter Notebook + should be already installed alongside Anaconda Python Platform: UNKNOWN Classifier: Development Status :: 1 - Alpha Classifier: Intended Audience :: Science/Research diff --git a/silq.egg-info/SOURCES.txt b/silq.egg-info/SOURCES.txt index ff3e3d682..a62511035 100644 --- a/silq.egg-info/SOURCES.txt +++ b/silq.egg-info/SOURCES.txt @@ -1,5 +1,6 @@ setup.py silq/__init__.py +silq/configurations.py silq/version.py silq.egg-info/PKG-INFO silq.egg-info/SOURCES.txt @@ -10,17 +11,49 @@ silq.egg-info/top_level.txt silq/analysis/__init__.py silq/analysis/analysis.py silq/analysis/fit_toolbox.py -silq/meta_instruments/HackInstrument.py +silq/instrument_interfaces/__init__.py +silq/instrument_interfaces/chip_interface.py +silq/instrument_interfaces/interface.py +silq/instrument_interfaces/AlazarTech/ATS_interface.py +silq/instrument_interfaces/AlazarTech/__init__.py +silq/instrument_interfaces/keysight/E8267D_interface.py +silq/instrument_interfaces/keysight/__init__.py +silq/instrument_interfaces/lecroy/ArbStudio1104_interface.py +silq/instrument_interfaces/lecroy/__init__.py +silq/instrument_interfaces/spincore/PulseBlasterESRPRO_interface.py +silq/instrument_interfaces/spincore/__init__.py silq/meta_instruments/Lockin.py +silq/meta_instruments/PulseMaster_old.py +silq/meta_instruments/Pulsemaster.py silq/meta_instruments/Simrack.py -silq/meta_instruments/VoltageControl.py silq/meta_instruments/__init__.py -silq/meta_instruments/pulsemaster/PulseMaster.py -silq/meta_instruments/pulsemaster/__init__.py +silq/meta_instruments/chip.py +silq/meta_instruments/hack_instrument.py +silq/meta_instruments/layout.py +silq/meta_instruments/lockin.py +silq/meta_instruments/simrack.py +silq/meta_instruments/voltage_control.py +silq/meta_instruments/mock_instruments/__init__.py +silq/meta_instruments/mock_instruments/mock_ATS.py +silq/meta_instruments/mock_instruments/mock_acquisition_controller.py +silq/meta_instruments/mock_instruments/mock_arbstudio.py +silq/meta_instruments/mock_instruments/mock_instrument.py +silq/meta_instruments/mock_instruments/mock_pulseblaster.py silq/parameters/__init__.py +silq/parameters/acquisition_parameters.py silq/parameters/general_parameters.py -silq/parameters/instrument_parameters.py +silq/parameters/loop_parameters.py silq/parameters/measurement_parameters.py +silq/pulses/__init__.py +silq/pulses/pulse_modules.py +silq/pulses/pulse_types.py +silq/tests/__init__.py +silq/tests/test_gui.py +silq/tests/test_instruments.py +silq/tests/test_parameters.py silq/tools/__init__.py silq/tools/data_tools.py -silq/tools/ring.py \ No newline at end of file +silq/tools/fit_toolbox.py +silq/tools/general_tools.py +silq/tools/instrument_tools.py +silq/tools/notebook_tools.py \ No newline at end of file diff --git a/silq.egg-info/requires.txt b/silq.egg-info/requires.txt index 9e5b02ed7..865b71ae7 100644 --- a/silq.egg-info/requires.txt +++ b/silq.egg-info/requires.txt @@ -3,6 +3,8 @@ pyvisa>=1.8 IPython>=4.0 ipywidgets>=4.1 h5py>=2.6 +pyperclip>=1.5 +ipympl>=0.0.2 [Non-Linear Least-Squares Minimization and Curve-Fitting] lmfit>=0.9.5 diff --git a/silq/tests/test_gui.py b/silq/tests/test_gui.py new file mode 100644 index 000000000..375750676 --- /dev/null +++ b/silq/tests/test_gui.py @@ -0,0 +1,58 @@ +import time +from threading import Thread +from winsound import Beep +import sys +from PyQt4 import QtGui + +from qcodes.process.server import BaseServer + + +class GUIServer(BaseServer): + def __init__(self, query_queue, response_queue, extras=None): + super().__init__(query_queue, response_queue, extras) + + app = QtGui.QApplication(sys.argv) + self.gui = ExampleGui(query_queue, response_queue) + sys.exit(app.exec_()) + + def handle_add_text(self, text): + self.example_gui.add_text(text) + +class ExampleGui(QtGui.QMainWindow): + def __init__(self, query_queue, response_queue): + super().__init__() + + self.initUI() + self.textEdit.append('hi') + + def initUI(self): + textEdit = QtGui.QTextEdit() + self.setCentralWidget(textEdit) + self.textEdit = textEdit + + exitAction = QtGui.QAction(QtGui.QIcon('exit24.png'), 'Exit', self) + exitAction.setShortcut('Ctrl+Q') + exitAction.setStatusTip('Exit application') + exitAction.triggered.connect(self.close) + + self.statusBar() + + menubar = self.menuBar() + fileMenu = menubar.addMenu('&File') + fileMenu.addAction(exitAction) + + toolbar = self.addToolBar('Exit') + toolbar.addAction(exitAction) + + self.setGeometry(300, 300, 350, 250) + self.setWindowTitle('Main window') + self.show() + + def add_text(self, text): + self.textEdit.append(text) + +def create_gui(*args, **kwargs): + app = QtGui.QApplication(sys.argv) + example_gui = ExampleGui(*args, **kwargs) + + sys.exit(app.exec_()) \ No newline at end of file diff --git a/silq/tests/test_instruments.py b/silq/tests/test_instruments.py index 0fa0ef832..78d928823 100644 --- a/silq/tests/test_instruments.py +++ b/silq/tests/test_instruments.py @@ -33,4 +33,7 @@ def __init__(self, name, **kwargs): vals=vals.Anything()) def set_x(self, val): - self.x = val \ No newline at end of file + self.x = val + + def print(self): + print('printing from test instrument') \ No newline at end of file From 90d59c28bec4b56e967a8401e7001dc5fe864834 Mon Sep 17 00:00:00 2001 From: nulinspiratie Date: Tue, 20 Dec 2016 12:37:17 +1100 Subject: [PATCH 4/6] GUI stuff --- Qcodes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Qcodes b/Qcodes index 02e14ebca..0e5c7c64a 160000 --- a/Qcodes +++ b/Qcodes @@ -1 +1 @@ -Subproject commit 02e14ebca995fd87b37e6553b682ac821455787f +Subproject commit 0e5c7c64abc398f8a183957f42b9145d1b3c427d From be62671324fd9512bccca5e2599e046b90452761 Mon Sep 17 00:00:00 2001 From: nulinspiratie Date: Fri, 23 Dec 2016 12:34:03 +1100 Subject: [PATCH 5/6] Slack integration From 1daf2a4398d13ffbb7ae1c7cbe0a50feac6d7aa2 Mon Sep 17 00:00:00 2001 From: nulinspiratie Date: Fri, 23 Dec 2016 12:40:53 +1100 Subject: [PATCH 6/6] updates to slack