From f583b1c58f45ef6fa48bcc9a1f4fba566d88f984 Mon Sep 17 00:00:00 2001 From: Jon <104854240+JymBone5@users.noreply.github.com> Date: Thu, 18 Jul 2024 14:01:43 -0700 Subject: [PATCH] added config file to store info such as version number, added automatically changing version number to header --- app/SiEPIC_TestCreator/config.py | 4 ++++ app/SiEPIC_TestCreator/sequencecreator.py | 23 +++++++++++++++++-- .../sequences/DREAM/current_sweep.py | 2 +- .../DREAM/set_current_wavelength_sweep.py | 2 +- .../DREAM/set_voltage_wavelength_sweep.py | 2 +- .../DREAM/set_wavelength_current_sweep.py | 23 ++++++++++++++----- .../DREAM/set_wavelength_voltage_sweep.py | 2 +- .../sequences/DREAM/voltage_sweep.py | 2 +- .../sequences/DREAM/wavelength_sweep.py | 2 +- .../sequences/IDA/current_sweep_ida.py | 2 +- .../IDA/set_current_wavelength_sweep_ida.py | 2 +- .../IDA/set_voltage_wavelength_sweep_ida.py | 2 +- .../IDA/set_wavelength_current_sweep_ida.py | 2 +- .../IDA/set_wavelength_voltage_sweep_ida.py | 2 +- .../sequences/IDA/voltage_sweep_ida.py | 2 +- .../sequences/IDA/wavelength_sweep_ida.py | 2 +- setup.py | 5 ++-- 17 files changed, 58 insertions(+), 23 deletions(-) create mode 100644 app/SiEPIC_TestCreator/config.py diff --git a/app/SiEPIC_TestCreator/config.py b/app/SiEPIC_TestCreator/config.py new file mode 100644 index 0000000..a44e35e --- /dev/null +++ b/app/SiEPIC_TestCreator/config.py @@ -0,0 +1,4 @@ + +class MYAPP: + version = '0.1.16' + pypi_token = 'pypi-AgEIcHlwaS5vcmcCJGU5ZWI5NWZiLTIzODUtNDMyNi05NGQ3LWNhZWU5NWI3ZWYzMwACGlsxLFsic2llcGljLXRlc3RjcmVhdG9yIl1dAAIsWzIsWyIzNDFlYzM3OC1jYmE2LTQxMzYtYjhhZi1mN2U4ZDE5MjEzNjAiXV0AAAYgsgF4EVG7qeB7ED0QsM1jeZxjHJxBEGU39NHJaAlyQZk' diff --git a/app/SiEPIC_TestCreator/sequencecreator.py b/app/SiEPIC_TestCreator/sequencecreator.py index 20fdfa2..49d145a 100644 --- a/app/SiEPIC_TestCreator/sequencecreator.py +++ b/app/SiEPIC_TestCreator/sequencecreator.py @@ -15,6 +15,8 @@ QMessageBox, QCheckBox, QComboBox, + QSpacerItem, + QSizePolicy ) from PyQt5.QtCore import Qt, pyqtSignal, QObject from PyQt5.QtWidgets import QLabel, QLineEdit, QVBoxLayout, QWidget, QFormLayout @@ -30,6 +32,7 @@ from watchdog.events import FileSystemEventHandler import logging from SiEPIC_TestCreator.yamlcheck import yaml_check +from SiEPIC_TestCreator.config import MYAPP def launch(): app = QApplication([]) @@ -39,7 +42,7 @@ def launch(): class GUI(QWidget): def __init__(self): super().__init__() - self.setWindowTitle("SiEPIC TestCreator") + self.setWindowTitle("SiEPIC TestCreator" + ' (' + str(MYAPP.version) + ')') self.custom_sequences_store = dict() self.branch = 'IDA' self.runtime_max = 100000 @@ -71,8 +74,15 @@ def __init__(self): def setup_outputlog(self): # Set up the output log + horlayout = QHBoxLayout() self.outputtitle = QLabel("Output Log") - self.layout.addWidget(self.outputtitle) + self.clear_output_btn = QPushButton("Clear Output Log") + + horlayout.addWidget(self.outputtitle) + horlayout.addItem(QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum)) + horlayout.addWidget(self.clear_output_btn) + + self.layout.addLayout(horlayout) # Log Viewer @@ -106,6 +116,15 @@ def setup_outputlog(self): # self.layout.addWidget(self.textEdit) + self.clear_output_btn.clicked.connect(self.clear_output_log) + + def clear_output_log(self): + # Get the underlying QTextEdit widget from the QTextEditLogger + log_text_edit = self.logTextBox.widget + + # Clear the contents of the QTextEdit + log_text_edit.clear() + def setup_file_selection(self): self.file_title = QLabel("Upload coordinates file or Yaml file") self.file_label = QLineEdit("No file selected") diff --git a/app/SiEPIC_TestCreator/sequences/DREAM/current_sweep.py b/app/SiEPIC_TestCreator/sequences/DREAM/current_sweep.py index 1fc11fa..c9a8364 100644 --- a/app/SiEPIC_TestCreator/sequences/DREAM/current_sweep.py +++ b/app/SiEPIC_TestCreator/sequences/DREAM/current_sweep.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.smu_sweep import SmuSweep +from SiEPIC_TestCreator.sequences.core.smu_sweep import SmuSweep class CurrentSweep(SmuSweep): """ diff --git a/app/SiEPIC_TestCreator/sequences/DREAM/set_current_wavelength_sweep.py b/app/SiEPIC_TestCreator/sequences/DREAM/set_current_wavelength_sweep.py index 71b6ec7..579d870 100644 --- a/app/SiEPIC_TestCreator/sequences/DREAM/set_current_wavelength_sweep.py +++ b/app/SiEPIC_TestCreator/sequences/DREAM/set_current_wavelength_sweep.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.laser_sweep import LaserSweep +from SiEPIC_TestCreator.sequences.core.laser_sweep import LaserSweep class SetCurrentWavelengthSweep(LaserSweep): """ diff --git a/app/SiEPIC_TestCreator/sequences/DREAM/set_voltage_wavelength_sweep.py b/app/SiEPIC_TestCreator/sequences/DREAM/set_voltage_wavelength_sweep.py index 0399d68..4323d9b 100644 --- a/app/SiEPIC_TestCreator/sequences/DREAM/set_voltage_wavelength_sweep.py +++ b/app/SiEPIC_TestCreator/sequences/DREAM/set_voltage_wavelength_sweep.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.laser_sweep import LaserSweep +from SiEPIC_TestCreator.sequences.core.laser_sweep import LaserSweep class SetVoltageWavelengthSweep(LaserSweep): """ diff --git a/app/SiEPIC_TestCreator/sequences/DREAM/set_wavelength_current_sweep.py b/app/SiEPIC_TestCreator/sequences/DREAM/set_wavelength_current_sweep.py index 1cf1296..14e9d97 100644 --- a/app/SiEPIC_TestCreator/sequences/DREAM/set_wavelength_current_sweep.py +++ b/app/SiEPIC_TestCreator/sequences/DREAM/set_wavelength_current_sweep.py @@ -1,4 +1,5 @@ -from siepic_testcreator.sequences.core.smu_sweep import SmuSweep +from SiEPIC_TestCreator.sequences.core.smu_sweep import SmuSweep +import time class SetWavelengthCurrentSweep(SmuSweep): """ @@ -40,9 +41,18 @@ def __init__(self, ps): 'Sweeptype': 'current', 'Sweeptype_info': 'Please enter sweep type', 'Sweeptype_options': ['current'], + 'Upper Limit': 5, + 'Upper Limit_info': 'Please enter upper limit value', + 'Upper Limit_bounds': [0, 100], + 'Trans_col': False, + 'Trans_col_info': 'Please enter trans_col value', + 'Trans_col_options': ['True', 'False'], 'Wavelengths': [1480, 1500, 1580], 'Wavelengths_info': 'Please enter wavelengths value', - 'Wavelengths_bounds': [[1270, 1480], [1350, 1580]] + 'Wavelengths_bounds': [[1270, 1480], [1350, 1580]], + 'Power': 1, + 'Power_info': 'Please enter power (dBm) value', + 'Power_bounds': [-70, 100] } self.results_info = { 'num_plots': 1, @@ -62,22 +72,23 @@ def __init__(self, ps): 'pkl': False } - super().__init__(variable=self.variables, resultsinfo=self.resultsinfo, type='current', ps=ps) + super().__init__(variables=self.variables, resultsinfo=self.resultsinfo, sweeptype='current', ps=ps) def run(self, routine=False): self.set_results(variables=self.variables, resultsinfo = self.resultsinfo, routine=routine) settings = self.ps.get_settings(self.verbose) - for wav in self.wavelengths: + for wav in self.variables['wavelengths']: self.ps.optprobe.laser.set_wavl(wav) self.ps.optprobe.laser.set_pwr_unit('dBm') - self.ps.optprobe.laser.set_pwr(self.pwr) + self.ps.optprobe.laser.set_pwr(self.variables['pwr']) self.ps.optprobe.laser.set_pwr_unit('mW') self.ps.optprobe.laser.set_output(True) + time.sleep(3) self.execute() - self.tls.set_output(False) + self.ps.optprobe.laser.set_output(False) self.ps.set_settings(settings) \ No newline at end of file diff --git a/app/SiEPIC_TestCreator/sequences/DREAM/set_wavelength_voltage_sweep.py b/app/SiEPIC_TestCreator/sequences/DREAM/set_wavelength_voltage_sweep.py index 6cc1ba5..2ccf443 100644 --- a/app/SiEPIC_TestCreator/sequences/DREAM/set_wavelength_voltage_sweep.py +++ b/app/SiEPIC_TestCreator/sequences/DREAM/set_wavelength_voltage_sweep.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.smu_sweep import SmuSweep +from SiEPIC_TestCreator.sequences.core.smu_sweep import SmuSweep import time class SetWavelengthVoltageSweep(SmuSweep): diff --git a/app/SiEPIC_TestCreator/sequences/DREAM/voltage_sweep.py b/app/SiEPIC_TestCreator/sequences/DREAM/voltage_sweep.py index 7a4de0c..340ced4 100644 --- a/app/SiEPIC_TestCreator/sequences/DREAM/voltage_sweep.py +++ b/app/SiEPIC_TestCreator/sequences/DREAM/voltage_sweep.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.smu_sweep import SmuSweep +from SiEPIC_TestCreator.sequences.core.smu_sweep import SmuSweep class VoltageSweep(SmuSweep): """ diff --git a/app/SiEPIC_TestCreator/sequences/DREAM/wavelength_sweep.py b/app/SiEPIC_TestCreator/sequences/DREAM/wavelength_sweep.py index 4cdfa24..925468f 100644 --- a/app/SiEPIC_TestCreator/sequences/DREAM/wavelength_sweep.py +++ b/app/SiEPIC_TestCreator/sequences/DREAM/wavelength_sweep.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.laser_sweep import LaserSweep +from SiEPIC_TestCreator.sequences.core.laser_sweep import LaserSweep class WavelengthSweep(LaserSweep): """ diff --git a/app/SiEPIC_TestCreator/sequences/IDA/current_sweep_ida.py b/app/SiEPIC_TestCreator/sequences/IDA/current_sweep_ida.py index 1f453c4..092e334 100644 --- a/app/SiEPIC_TestCreator/sequences/IDA/current_sweep_ida.py +++ b/app/SiEPIC_TestCreator/sequences/IDA/current_sweep_ida.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.smu_sweep import SmuSweep +from SiEPIC_TestCreator.sequences.core.smu_sweep import SmuSweep class CurrentSweepIda(SmuSweep): """ diff --git a/app/SiEPIC_TestCreator/sequences/IDA/set_current_wavelength_sweep_ida.py b/app/SiEPIC_TestCreator/sequences/IDA/set_current_wavelength_sweep_ida.py index d5da72c..92139ec 100644 --- a/app/SiEPIC_TestCreator/sequences/IDA/set_current_wavelength_sweep_ida.py +++ b/app/SiEPIC_TestCreator/sequences/IDA/set_current_wavelength_sweep_ida.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.laser_sweep import LaserSweep +from SiEPIC_TestCreator.sequences.core.laser_sweep import LaserSweep class SetCurrentWavelengthSweepIda(LaserSweep): """ diff --git a/app/SiEPIC_TestCreator/sequences/IDA/set_voltage_wavelength_sweep_ida.py b/app/SiEPIC_TestCreator/sequences/IDA/set_voltage_wavelength_sweep_ida.py index 22720db..63aade1 100644 --- a/app/SiEPIC_TestCreator/sequences/IDA/set_voltage_wavelength_sweep_ida.py +++ b/app/SiEPIC_TestCreator/sequences/IDA/set_voltage_wavelength_sweep_ida.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.laser_sweep import LaserSweep +from SiEPIC_TestCreator.sequences.core.laser_sweep import LaserSweep class SetVoltageWavelengthSweepIda(LaserSweep): """ diff --git a/app/SiEPIC_TestCreator/sequences/IDA/set_wavelength_current_sweep_ida.py b/app/SiEPIC_TestCreator/sequences/IDA/set_wavelength_current_sweep_ida.py index c877bbd..ffc9621 100644 --- a/app/SiEPIC_TestCreator/sequences/IDA/set_wavelength_current_sweep_ida.py +++ b/app/SiEPIC_TestCreator/sequences/IDA/set_wavelength_current_sweep_ida.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.smu_sweep import SmuSweep +from SiEPIC_TestCreator.sequences.core.smu_sweep import SmuSweep class SetWavelengthCurrentSweepIda(SmuSweep): """ diff --git a/app/SiEPIC_TestCreator/sequences/IDA/set_wavelength_voltage_sweep_ida.py b/app/SiEPIC_TestCreator/sequences/IDA/set_wavelength_voltage_sweep_ida.py index 4581c23..14e91ce 100644 --- a/app/SiEPIC_TestCreator/sequences/IDA/set_wavelength_voltage_sweep_ida.py +++ b/app/SiEPIC_TestCreator/sequences/IDA/set_wavelength_voltage_sweep_ida.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.smu_sweep import SmuSweep +from SiEPIC_TestCreator.sequences.core.smu_sweep import SmuSweep import time class SetWavelengthVoltageSweepIda(SmuSweep): diff --git a/app/SiEPIC_TestCreator/sequences/IDA/voltage_sweep_ida.py b/app/SiEPIC_TestCreator/sequences/IDA/voltage_sweep_ida.py index d5009d8..2574575 100644 --- a/app/SiEPIC_TestCreator/sequences/IDA/voltage_sweep_ida.py +++ b/app/SiEPIC_TestCreator/sequences/IDA/voltage_sweep_ida.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.smu_sweep import SmuSweep +from SiEPIC_TestCreator.sequences.core.smu_sweep import SmuSweep class VoltageSweepIda(SmuSweep): """ diff --git a/app/SiEPIC_TestCreator/sequences/IDA/wavelength_sweep_ida.py b/app/SiEPIC_TestCreator/sequences/IDA/wavelength_sweep_ida.py index 28dbd96..7ec85d4 100644 --- a/app/SiEPIC_TestCreator/sequences/IDA/wavelength_sweep_ida.py +++ b/app/SiEPIC_TestCreator/sequences/IDA/wavelength_sweep_ida.py @@ -1,4 +1,4 @@ -from siepic_testcreator.sequences.core.laser_sweep import LaserSweep +from SiEPIC_TestCreator.sequences.core.laser_sweep import LaserSweep class WavelengthSweepIda(LaserSweep): """ diff --git a/setup.py b/setup.py index e6b7652..ca6bf77 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ from setuptools import find_packages, setup +from app.SiEPIC_TestCreator.config import MYAPP with open("app/README.md", "r") as f: long_description = f.read() @@ -6,13 +7,13 @@ setup( name = "SiEPIC_TestCreator", - version = "0.1.8", + version = MYAPP.version, description = "A tool for creating YAML files for use in Dream Photonics and edx course", package_dir = {"": "app"}, packages = find_packages(where="app"), entry_points={ 'console_scripts': [ - 'siepic_testcreator=siepic_testcreator.__main__:main' + 'siepic_testcreator=SiEPIC_TestCreator.__main__:main' ] }, long_description = long_description,