Skip to content

Commit

Permalink
Merge pull request #7 from lukasc-ubc/main
Browse files Browse the repository at this point in the history
unit testing
  • Loading branch information
JymBone5 authored May 28, 2024
2 parents fee9e54 + f6c3f48 commit 9617f2e
Show file tree
Hide file tree
Showing 10 changed files with 422 additions and 58 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/run-code-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Run code tests

on:
workflow_dispatch:
push:
paths:
- '**'
branches:
- '**'
pull_request:
branches:
- main
- master


jobs:
test_layouts:
runs-on: ubuntu-latest

steps:
- name: checkout repo content
uses: actions/checkout@v3


- name: setup python, 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: "pip"
#cache-dependency-path: pyproject.toml

- name: install Python 3.11 packages
run: |
pip install pytest pytest-cov
pip install -e .
- name: Test with pytest, Python 3.11
run: pytest app/siepic_testcreator




# can also specify python version if needed
- name: setup python, 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
#cache: "pip"
#cache-dependency-path: pyproject.toml

- name: install Python 3.10 packages
run: |
pip install pytest pytest-cov
pip install -e .
- name: Test with pytest, Python 3.10
run: pytest --cov=app/siepic_testcreator --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: github.repository_owner == 'SiEPIC'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
41 changes: 39 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
*.pyc
__pycache__


# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# Mac OSX
*.DS_Store
.DS_Store

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg


15 changes: 13 additions & 2 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ Windows 10 or greater, Linux, or Mac OSX

### Installing

* How/where to download your program
* Any modifications needed to be made to files/folders
```
pip install siepic_testcreator
```

### Executing program

Expand Down Expand Up @@ -64,3 +65,13 @@ Inspiration, code snippets, etc.
* [dbader](https://github.com/dbader/readme-template)
* [zenorocha](https://gist.github.com/zenorocha/4526327)
* [fvcproductions](https://gist.github.com/fvcproductions/1bfc2d4aecb01a834b46)

## Developers

* Contributions are welcome, via Pull Requests
* Create a fork, and download it using GitHub Desktop to work on your local copy
* Install the package as a symbolic link
```
pip install -e $HOME/Documents/GitHub/SiEPIC_testcreator
```
* Keep your fork and local copy up to date
1 change: 0 additions & 1 deletion app/siepic_testcreator/sequencecreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import logging
from siepic_testcreator.yamlcheck import yaml_check


def launch():
app = QApplication([])
ex = GUI()
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
% X-coord, Y-coord, Polarization, wavelength, type, deviceID, params
81, 333, TE, 1550, device, mustafahspiral, comment
84, 269, TE, 1550, device, mustafahmzi, comment

% X-coord, Y-coord, deviceID, padName, params
393, 168, mustafahmzi, comment, comment
393, 419, mustafahspiral, comment, comment

% X-coord, Y-coord, recipeID, params
205 changes: 205 additions & 0 deletions app/siepic_testcreator/tests/EBeam_heaters_mustafah_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
Devices:
mustafah_mzi:
device_id: mustafah_mzi
device_type: device
electricalCoordinates:
- G
- 393.0
- 168.0
opticalCoordinates:
- 84.0
- 142.0
polarization: TE
sequences:
- IV_mzi(voltage_sweep_ida)
- passive_sweep(wavelength_sweep_ida)
- livsweep_mzi(set_wavelength_voltage_sweep_ida)
- wavlsweep_biased(set_voltage_wavelength_sweep_ida)
wavelength: '1550'
mustafahspiral:
device_id: mustafahspiral
device_type: device
electricalCoordinates:
- G
- 393.0
- 419.0
opticalCoordinates:
- 84.0
- 333.0
polarization: TE
sequences:
- IV_spiral(voltage_sweep_ida)
- passive_sweep(wavelength_sweep_ida)
- livsweep_spiral(set_wavelength_voltage_sweep_ida)
- wavlsweep_biased(set_voltage_wavelength_sweep_ida)
wavelength: '1550'
Sequences:
IV_mzi(voltage_sweep_ida):
Runtime: 25.0
results_info:
csv: 'True'
foldername: ''
legend: 'True'
mat: 'True'
num_plots: '1'
pdf: 'True'
pkl: 'True'
plottitle: Voltage Sweep
save_location: ''
saveplot: 'True'
visual: 'True'
xscale: '1'
xtitle: Voltage (V)
yscale: '1'
ytitle: Current (A)
variables:
Channel A: 'True'
Channel B: 'False'
IV: 'True'
PV: 'True'
RV: 'True'
Start: '0'
Step: '0.1'
Stop: '5'
IV_spiral(voltage_sweep_ida):
Runtime: 25.0
results_info:
csv: 'True'
foldername: ''
legend: 'True'
mat: 'True'
num_plots: '1'
pdf: 'True'
pkl: 'True'
plottitle: Voltage Sweep
save_location: ''
saveplot: 'True'
visual: 'True'
xscale: '1'
xtitle: Voltage (V)
yscale: '1'
ytitle: Current (A)
variables:
Channel A: 'True'
Channel B: 'False'
IV: 'True'
PV: 'True'
RV: 'True'
Start: '0'
Step: '0.2'
Stop: '10'
livsweep_mzi(set_wavelength_voltage_sweep_ida):
Runtime: 75.0
results_info:
csv: 'True'
foldername: ''
legend: 'True'
mat: 'True'
num_plots: '1'
pdf: 'True'
pkl: 'False'
plottitle: Set Wavelength Voltage Sweep
save_location: ''
saveplot: 'True'
visual: 'True'
xscale: '1'
xtitle: Voltage (V)
yscale: '1'
ytitle: Current (A)
variables:
Channel A: 'True'
Channel B: 'False'
IV: 'True'
PV: 'True'
RV: 'True'
Start: '0'
Step: '0.1'
Stop: '5'
Wavelengths: 1520, 1540, 1560
livsweep_spiral(set_wavelength_voltage_sweep_ida):
Runtime: 75.0
results_info:
csv: 'True'
foldername: ''
legend: 'True'
mat: 'True'
num_plots: '1'
pdf: 'True'
pkl: 'False'
plottitle: Set Wavelength Voltage Sweep
save_location: ''
saveplot: 'True'
visual: 'True'
xscale: '1'
xtitle: Voltage (V)
yscale: '1'
ytitle: Current (A)
variables:
Channel A: 'True'
Channel B: 'False'
IV: 'True'
PV: 'True'
RV: 'True'
Start: '0'
Step: '0.2'
Stop: '10'
Wavelengths: 1520, 1540, 1560
passive_sweep(wavelength_sweep_ida):
Runtime: 237.5
results_info:
csv: 'True'
foldername: ''
legend: 'True'
mat: 'True'
num_plots: '1'
pdf: 'True'
pkl: 'False'
plottitle: WavelengthSweep
save_location: ''
saveplot: 'True'
visual: 'True'
xscale: '1'
xtitle: Wavelength (nm)
yscale: '1'
ytitle: Power (dBm)
variables:
Initialrange: '-20'
Laser Output: High Power
Numscans: '1'
Power: '1'
RangeDec: '20'
Start: '1485'
Step: '.1'
Stop: '1580'
Sweep Speed: auto
wavlsweep_biased(set_voltage_wavelength_sweep_ida):
Runtime: 1000.0
results_info:
csv: 'True'
foldername: ''
legend: 'True'
mat: 'True'
num_plots: '1'
pdf: 'True'
pkl: 'False'
plottitle: Set Voltage Wavelength Sweep
save_location: ''
saveplot: 'True'
visual: 'True'
xscale: '1'
xtitle: Wavelength (nm)
yscale: '1'
ytitle: Power (dBm)
variables:
Channel A: 'True'
Channel B: 'False'
Initialrange: '-20'
Laser Output: High Power
Numscans: '1'
Power: '1'
RangeDec: '20'
Start: '1480'
Step: '.1'
Stop: '1580'
Sweep Speed: auto
Voltages: 0, 2, 5, 10
Loading

0 comments on commit 9617f2e

Please sign in to comment.