Skip to content

Commit

Permalink
Merge develop into master.
Browse files Browse the repository at this point in the history
  • Loading branch information
dalonsoa committed Sep 18, 2021
2 parents 24fe4ff + b5fb69c commit 572dc46
Show file tree
Hide file tree
Showing 25 changed files with 1,056 additions and 612 deletions.
Binary file added .DS_Store
Binary file not shown.
42 changes: 42 additions & 0 deletions .github/workflows/build_deploy_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy_wheels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy wheels - Setup python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Deploy wheels - Install dependencies
run: |
python -m pip install --upgrade setuptools wheel pip twine numpy
- name: Deploy wheels - Build manylinux2014 binary wheels - py37/py38 - x86_64
uses: RalfG/python-wheels-manylinux-build@v0.3.1-manylinux2014_x86_64
with:
python-versions: 'cp37-cp37m cp38-cp38'
build-requirements: 'numpy'
system-packages: 'gcc-gfortran'
pre-build-command: 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/; export SOLCORE_WITH_PDD=1'

- name: Deploy wheels - Build manylinux2014 binary wheels - py37/py38 - i686
uses: RalfG/python-wheels-manylinux-build@v0.3.1-manylinux2014_i686
with:
python-versions: 'cp37-cp37m cp38-cp38'
build-requirements: 'numpy'
system-packages: 'gcc-gfortran'
pre-build-command: 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/; export SOLCORE_WITH_PDD=1'

- name: Publish wheels to PyPI
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload dist/*-manylinux*.whl
35 changes: 20 additions & 15 deletions .github/workflows/test_unit_and_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8]
exclude:
- os: windows-latest
python-version: 3.8
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand All @@ -30,12 +27,14 @@ jobs:

- name: Install system dependencies in Linux
if: matrix.os == 'ubuntu-latest'
run: sudo apt install -y gfortran ngspice python3-tk libboost-all-dev libopenblas-dev libfftw3-dev libsuitesparse-dev
run: |
sudo apt-get update
sudo apt install -y gfortran ngspice python3-tk libboost-all-dev libopenblas-dev libfftw3-dev libsuitesparse-dev
- name: Install system dependencies in MacOS
if: matrix.os == 'macos-latest'
run: |
brew reinstall gcc
brew reinstall gfortran
brew install ngspice
- name: Install system dependencies in Windows
Expand Down Expand Up @@ -75,7 +74,7 @@ jobs:
env:
SOLCORE_SPICE: ngspice
run: |
pytest -r a -v --cov=solcore/ --ignore tests/test_examples.py
pytest -r a -v --cov=solcore/ --ignore tests/test_examples.py -n "auto"
- name: Codecov
if: matrix.os == 'ubuntu-latest'
Expand Down Expand Up @@ -108,15 +107,15 @@ jobs:

- name: Install system dependencies in Linux
if: matrix.os == 'ubuntu-latest'
run: sudo apt install -y gfortran ngspice
run: |
sudo apt-get update
sudo apt install -y gfortran ngspice python3-tk libboost-all-dev libopenblas-dev libfftw3-dev libsuitesparse-dev
- name: Install system dependencies in MacOS
if: matrix.os == 'macos-latest'
run: brew install ngspice

- name: Install system dependencies in Windows
if: matrix.os == 'windows-latest'
run: choco install ngspice
run: |
brew reinstall gfortran
brew install ngspice
- name: Install python dependencies
run: |
Expand All @@ -137,8 +136,14 @@ jobs:
pip install --no-deps --force-reinstall --install-option="--with_pdd" -e .
shell: powershell

- name: Test examples
- name: Test examples Linux and MacOS
if: matrix.os != 'windows-latest'
env:
SOLCORE_SPICE: ngspice
run: |
pytest -r a -v tests/test_examples.py
pytest -r a -v tests/test_examples.py -n "auto"
- name: Test examples Linux and MacOS
if: matrix.os == 'windows-latest'
run: |
pytest -r a -v tests/test_examples.py -n "auto"
1 change: 1 addition & 0 deletions binder/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ regex
cycler
pyyaml
yabox
joblib
File renamed without changes.
File renamed without changes.
41 changes: 21 additions & 20 deletions examples/custom_materials_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,26 @@
"""
EXAMPLE 2
Can also create a Solcore material from a material in the refractiveindex.info database:
if necessary, download database:
(Uncomment lines below to run this part of the example!)
"""
download_db()

# search what options are available for diamond, then use the first result's pageid to
# create data files for the n & k of diamond:

results = search_db('Diamond')
create_nk_txt(pageid=results[0][0], file='C_Diamond')
create_new_material(mat_name = 'Diamond', n_source='C_Diamond_n.txt', k_source='C_Diamond_k.txt')

Diamond = material('Diamond')()

plt.figure()
plt.plot(si(np.arange(100, 800, 5), 'nm')*1e9, Diamond.n(si(np.arange(100, 800, 5), 'nm')))
plt.plot(si(np.arange(100, 800, 5), 'nm')*1e9, Diamond.k(si(np.arange(100, 800, 5), 'nm')))

plt.xlabel('Wavelength (nm)')
plt.ylabel('Diamond n / k')

plt.show()
#
# download_db()
#
# # search what options are available for diamond, then use the first result's pageid to
# # create data files for the n & k of diamond:
#
# results = search_db('Diamond')
# create_nk_txt(pageid=results[0][0], file='C_Diamond')
# create_new_material(mat_name = 'Diamond', n_source='C_Diamond_n.txt', k_source='C_Diamond_k.txt')
#
# Diamond = material('Diamond')()
#
# plt.figure()
# plt.plot(si(np.arange(100, 800, 5), 'nm')*1e9, Diamond.n(si(np.arange(100, 800, 5), 'nm')))
# plt.plot(si(np.arange(100, 800, 5), 'nm')*1e9, Diamond.k(si(np.arange(100, 800, 5), 'nm')))
#
# plt.xlabel('Wavelength (nm)')
# plt.ylabel('Diamond n / k')
#
# plt.show()
Empty file added examples/external_optics.py
Empty file.

0 comments on commit 572dc46

Please sign in to comment.