samplemaker-sparrow 5.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- samplemaker_sparrow-5.4.4/.github/workflows/build_wheels.yml +64 -0
- samplemaker_sparrow-5.4.4/.gitignore +70 -0
- samplemaker_sparrow-5.4.4/BUILD.md +132 -0
- samplemaker_sparrow-5.4.4/LICENSE.md +11 -0
- samplemaker_sparrow-5.4.4/PKG-INFO +40 -0
- samplemaker_sparrow-5.4.4/README.md +15 -0
- samplemaker_sparrow-5.4.4/pyproject.toml +58 -0
- samplemaker_sparrow-5.4.4/src/boopy/CMakeLists.txt +41 -0
- samplemaker_sparrow-5.4.4/src/boopy/boopy.cpp +94 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/__init__.py +43 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/baselib/__init__.py +5 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/baselib/devices.py +161 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/baselib/waveguides.py +320 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/devices.py +1403 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/documentation.md +65 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/gdsreader.py +252 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/gdswriter.py +368 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/layout.py +1118 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/makers.py +586 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/phc.py +484 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/resources/__init__.py +7 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/resources/boopy.pyi +20 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/resources/sm_stencil_font.txt +747 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/routers.py +340 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/sequencer.py +306 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/shapes.py +2265 -0
- samplemaker_sparrow-5.4.4/src/samplemaker/viewers.py +235 -0
- samplemaker_sparrow-5.4.4/tutorials/.pylint.d/12_Tutorial_LayoutAssembly1.stats +0 -0
- samplemaker_sparrow-5.4.4/tutorials/00_Tutorial_BasicDrawing.py +56 -0
- samplemaker_sparrow-5.4.4/tutorials/01_Tutorial_Shapes.py +89 -0
- samplemaker_sparrow-5.4.4/tutorials/02_Tutorial_CellReferences.py +69 -0
- samplemaker_sparrow-5.4.4/tutorials/03_Tutorial_GroupManipulation.py +76 -0
- samplemaker_sparrow-5.4.4/tutorials/04_Tutorial_Boolean.py +70 -0
- samplemaker_sparrow-5.4.4/tutorials/05_Tutorial_Devices.py +98 -0
- samplemaker_sparrow-5.4.4/tutorials/06_Tutorial_DeviceTables.py +61 -0
- samplemaker_sparrow-5.4.4/tutorials/07_Tutorial_Waveguides.py +99 -0
- samplemaker_sparrow-5.4.4/tutorials/08_Tutorial_WaveguideDevices.py +94 -0
- samplemaker_sparrow-5.4.4/tutorials/09_Tutorial_Circuits.py +97 -0
- samplemaker_sparrow-5.4.4/tutorials/10_Tutorial_ElectricalPorts.py +115 -0
- samplemaker_sparrow-5.4.4/tutorials/11_Tutorial_LayoutAssembly.py +75 -0
- samplemaker_sparrow-5.4.4/tutorials/12_Tutorial_ImportingCircuits.py +40 -0
- samplemaker_sparrow-5.4.4/tutorials/CircuitFile.txt +12 -0
- samplemaker_sparrow-5.4.4/tutorials/TutorialCollection.py +56 -0
- samplemaker_sparrow-5.4.4/uv.lock +588 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Build and upload to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
pull_request:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- master
|
|
9
|
+
release:
|
|
10
|
+
types:
|
|
11
|
+
- published
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build_wheels:
|
|
15
|
+
name: Build wheels on ${{ matrix.os }}
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
# macos-15-intel is an Intel runner, macos-14 is Apple silicon
|
|
20
|
+
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-14]
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v5
|
|
24
|
+
|
|
25
|
+
- name: Build wheels
|
|
26
|
+
uses: pypa/cibuildwheel@v3.3.0
|
|
27
|
+
|
|
28
|
+
- uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
|
31
|
+
path: ./wheelhouse/*.whl
|
|
32
|
+
|
|
33
|
+
make_sdist:
|
|
34
|
+
name: Make SDist
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v5
|
|
38
|
+
with:
|
|
39
|
+
submodules: true
|
|
40
|
+
|
|
41
|
+
- name: Build SDist
|
|
42
|
+
run: pipx run build --sdist
|
|
43
|
+
|
|
44
|
+
- uses: actions/upload-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: cibw-sdist
|
|
47
|
+
path: dist/*.tar.gz
|
|
48
|
+
|
|
49
|
+
upload_pypi:
|
|
50
|
+
needs: [build_wheels, make_sdist]
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
environment: pypi
|
|
53
|
+
permissions:
|
|
54
|
+
id-token: write
|
|
55
|
+
if: github.event_name == 'release' && github.event.action == 'published'
|
|
56
|
+
steps:
|
|
57
|
+
- uses: actions/download-artifact@v5
|
|
58
|
+
with:
|
|
59
|
+
# unpacks all CIBW artifacts into dist/
|
|
60
|
+
pattern: cibw-*
|
|
61
|
+
path: dist
|
|
62
|
+
merge-multiple: true
|
|
63
|
+
|
|
64
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# These are some examples of commonly ignored file patterns.
|
|
2
|
+
# You should customize this list as applicable to your project.
|
|
3
|
+
# Learn more about .gitignore:
|
|
4
|
+
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
|
|
5
|
+
|
|
6
|
+
# Node artifact files
|
|
7
|
+
node_modules/
|
|
8
|
+
dist/
|
|
9
|
+
|
|
10
|
+
# Compiled Java class files
|
|
11
|
+
*.class
|
|
12
|
+
|
|
13
|
+
# Compiled Python bytecode
|
|
14
|
+
*.py[co]
|
|
15
|
+
|
|
16
|
+
# Log files
|
|
17
|
+
*.log
|
|
18
|
+
|
|
19
|
+
# Package files
|
|
20
|
+
*.jar
|
|
21
|
+
|
|
22
|
+
# Maven
|
|
23
|
+
target/
|
|
24
|
+
dist/
|
|
25
|
+
|
|
26
|
+
# JetBrains IDE
|
|
27
|
+
.idea/
|
|
28
|
+
|
|
29
|
+
# Unit test reports
|
|
30
|
+
TEST*.xml
|
|
31
|
+
|
|
32
|
+
# Generated by MacOS
|
|
33
|
+
.DS_Store
|
|
34
|
+
|
|
35
|
+
# Generated by Windows
|
|
36
|
+
Thumbs.db
|
|
37
|
+
|
|
38
|
+
# Applications
|
|
39
|
+
*.app
|
|
40
|
+
*.exe
|
|
41
|
+
*.war
|
|
42
|
+
|
|
43
|
+
# Large media files
|
|
44
|
+
*.mp4
|
|
45
|
+
*.tiff
|
|
46
|
+
*.avi
|
|
47
|
+
*.flv
|
|
48
|
+
*.mov
|
|
49
|
+
*.wmv
|
|
50
|
+
*.cache
|
|
51
|
+
*.gds
|
|
52
|
+
*.cel
|
|
53
|
+
*.lel
|
|
54
|
+
*.gds
|
|
55
|
+
src/boopy/*.pro.user
|
|
56
|
+
html/
|
|
57
|
+
tests/
|
|
58
|
+
# Python build artifacts
|
|
59
|
+
build/
|
|
60
|
+
*.egg-info/
|
|
61
|
+
wheelhouse/
|
|
62
|
+
*.so
|
|
63
|
+
*.pyd
|
|
64
|
+
*.dll
|
|
65
|
+
|
|
66
|
+
# CMake artifacts
|
|
67
|
+
CMakeFiles/
|
|
68
|
+
CMakeCache.txt
|
|
69
|
+
cmake_install.cmake
|
|
70
|
+
Makefile
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Building SampleMaker
|
|
2
|
+
|
|
3
|
+
This document explains how to build SampleMaker with its C++ extension module (boopy) for different platforms.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
SampleMaker includes a C++ component called "boopy" that provides high-performance Boolean polygon operations using
|
|
8
|
+
Boost.Polygon and is exposed to Python via pybind11. The project uses:
|
|
9
|
+
|
|
10
|
+
- **[scikit-build-core](https://scikit-build-core.readthedocs.io/en/latest/)**:
|
|
11
|
+
Modern build system that uses CMake and pure `pyproject.toml` configuration.
|
|
12
|
+
- **[CMake](https://cmake.org/)**: For configuring the C++ extension build.
|
|
13
|
+
- **[Astral uv](https://docs.astral.sh/uv/)**: For faster dependency installation during builds.
|
|
14
|
+
- **[cibuildwheel](https://cibuildwheel.pypa.io/en/stable/)**:
|
|
15
|
+
For cross-platform wheel building.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Local Development Build
|
|
19
|
+
|
|
20
|
+
### Prerequisites
|
|
21
|
+
- Python 3.10 or later
|
|
22
|
+
- CMake 3.15 or later
|
|
23
|
+
- A C++14-compatible compiler
|
|
24
|
+
- pybind11 (installed automatically during build)
|
|
25
|
+
- Boost (header-only, for polygon operations)
|
|
26
|
+
|
|
27
|
+
### Linux
|
|
28
|
+
|
|
29
|
+
Install the required packages using your distribution's package manager:
|
|
30
|
+
```bash
|
|
31
|
+
# Ubuntu/Debian
|
|
32
|
+
sudo apt-get install build-essential cmake libboost-dev
|
|
33
|
+
|
|
34
|
+
# RHEL/CentOS/Fedora
|
|
35
|
+
sudo yum install gcc-c++ make cmake boost-devel
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Navigate to the project directory and build:
|
|
39
|
+
```bash
|
|
40
|
+
# Using Astral uv (recommended)
|
|
41
|
+
uv sync
|
|
42
|
+
|
|
43
|
+
# Using pip
|
|
44
|
+
pip install -e .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### macOS
|
|
48
|
+
Work in progress...
|
|
49
|
+
|
|
50
|
+
### Windows
|
|
51
|
+
To build on Windows, ensure you have Visual Studio with C++ build tools installed.
|
|
52
|
+
|
|
53
|
+
Boost can be installed via vcpkg:
|
|
54
|
+
```powershell
|
|
55
|
+
git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
|
|
56
|
+
C:\vcpkg\bootstrap-vcpkg.bat
|
|
57
|
+
C:\vcpkg\vcpkg.exe install boost-polygon
|
|
58
|
+
C:\vcpkg\vcpkg.exe integrate install
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
> [!NOTE]
|
|
62
|
+
> `vcpkg` may come pre-installed with your Visual Studio installation. This version
|
|
63
|
+
> only works in manifest mode, meaning the above commands will not work. Ensure you
|
|
64
|
+
> are referencing the correct `vcpkg` installation.
|
|
65
|
+
|
|
66
|
+
Open "x64 Native Tools Command Prompt for VS" and navigate to the project directory:
|
|
67
|
+
```cmd
|
|
68
|
+
cd path\to\samplemaker
|
|
69
|
+
set CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
|
|
70
|
+
|
|
71
|
+
# Astral uv (recommended)
|
|
72
|
+
uv sync
|
|
73
|
+
|
|
74
|
+
# Using pip
|
|
75
|
+
pip install -e .
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If boost is not found, try setting the CMAKE_TOOLCHAIN_FILE directly in the build command:
|
|
79
|
+
```cmd
|
|
80
|
+
cd path\to\samplemaker
|
|
81
|
+
|
|
82
|
+
# Astral uv (recommended)
|
|
83
|
+
uv sync -C cmake.args="-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
|
84
|
+
|
|
85
|
+
# Using pip
|
|
86
|
+
pip install -e . -C cmake.args="-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Building Wheels for Distribution
|
|
90
|
+
|
|
91
|
+
To build wheels for distribution, we use `cibuildwheel`. This tool automates
|
|
92
|
+
the process of building wheels for multiple platforms and is intended to run
|
|
93
|
+
in CI environments.
|
|
94
|
+
|
|
95
|
+
This section outlines the steps to build wheels locally using `cibuildwheel`.
|
|
96
|
+
|
|
97
|
+
### Prerequisites
|
|
98
|
+
Ensure you are able to build the project locally as described in the previous section.
|
|
99
|
+
|
|
100
|
+
### Linux
|
|
101
|
+
Building Linux wheels locally requires [Docker](https://docs.docker.com/get-docker/).
|
|
102
|
+
If you are building using WSL2 on Windows, Docker Desktop should be installed on Windows.
|
|
103
|
+
For more information on working with Docker for WSL, see the official [Docker docs article](https://docs.docker.com/desktop/features/wsl/).
|
|
104
|
+
|
|
105
|
+
Once Docker is set up, you can build the wheels using the following command in the project directory:
|
|
106
|
+
```bash
|
|
107
|
+
# Using Astral uv (recommended)
|
|
108
|
+
uvx cibuildwheel .
|
|
109
|
+
|
|
110
|
+
# Using pip
|
|
111
|
+
pip install cibuildwheel
|
|
112
|
+
cibuildwheel .
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### macOS
|
|
116
|
+
Work in progress...
|
|
117
|
+
|
|
118
|
+
### Windows
|
|
119
|
+
To build Windows wheels locally, the correct version of `vcpkg` must be added to the PATH environment variable.
|
|
120
|
+
When using "x64 Native Tools Command Prompt for VS", the wrong version of `vcpkg` may be added to PATH.
|
|
121
|
+
|
|
122
|
+
To ensure the correct version is used, modify the PATH variable in the command prompt before building:
|
|
123
|
+
```cmd
|
|
124
|
+
set PATH=C:\vcpkg;%PATH%
|
|
125
|
+
|
|
126
|
+
# Using Astral uv (recommended)
|
|
127
|
+
uvx cibuildwheel .
|
|
128
|
+
|
|
129
|
+
# Using pip
|
|
130
|
+
pip install cibuildwheel
|
|
131
|
+
cibuildwheel .
|
|
132
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright (c) 2021 Leonardo Midolo, Niels Bohr Institute, Denmark
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: samplemaker-sparrow
|
|
3
|
+
Version: 5.4.4
|
|
4
|
+
Summary: Lithographic mask design package
|
|
5
|
+
Author-Email: Leonardo Midolo <midolo@nbi.ku.dk>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
License-File: LICENSE.md
|
|
8
|
+
Classifier: Programming Language :: C++
|
|
9
|
+
Classifier: Programming Language :: Python
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Operating System :: MacOS
|
|
18
|
+
Classifier: Operating System :: Unix
|
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
+
Project-URL: Repository, https://github.com/lmidolo/samplemaker.git
|
|
21
|
+
Requires-Python: <3.14,>=3.10
|
|
22
|
+
Requires-Dist: matplotlib>=3.7.5
|
|
23
|
+
Requires-Dist: numpy==2.*
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# README
|
|
27
|
+
|
|
28
|
+
Welcome to the SampleMaker git repository.
|
|
29
|
+
|
|
30
|
+
This software has been realized with the financial support from
|
|
31
|
+
the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (Grant agreement No. 949043, NANOMEQ).
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### What is this repository for?
|
|
35
|
+
|
|
36
|
+
* SampleMaker lithographic mask design tool in Python.
|
|
37
|
+
|
|
38
|
+
### How do I get set up?
|
|
39
|
+
|
|
40
|
+
* For local development build instructions, please refer to [BUILD.md](BUILD.md).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# README
|
|
2
|
+
|
|
3
|
+
Welcome to the SampleMaker git repository.
|
|
4
|
+
|
|
5
|
+
This software has been realized with the financial support from
|
|
6
|
+
the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (Grant agreement No. 949043, NANOMEQ).
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### What is this repository for?
|
|
10
|
+
|
|
11
|
+
* SampleMaker lithographic mask design tool in Python.
|
|
12
|
+
|
|
13
|
+
### How do I get set up?
|
|
14
|
+
|
|
15
|
+
* For local development build instructions, please refer to [BUILD.md](BUILD.md).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["scikit-build-core>=0.11.6", "pybind11>=3.0.1"]
|
|
3
|
+
build-backend = "scikit_build_core.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "samplemaker-sparrow"
|
|
7
|
+
authors = [
|
|
8
|
+
{ name = "Leonardo Midolo", email = "midolo@nbi.ku.dk"}
|
|
9
|
+
]
|
|
10
|
+
description = "Lithographic mask design package"
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.10,<3.14"
|
|
13
|
+
license-files = ["LICENSE.md"]
|
|
14
|
+
license = "BSD-3-Clause"
|
|
15
|
+
version = "5.4.4"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"matplotlib>=3.7.5",
|
|
18
|
+
"numpy==2.*",
|
|
19
|
+
]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Programming Language :: C++",
|
|
22
|
+
"Programming Language :: Python",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
25
|
+
"Programming Language :: Python :: 3.10",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
"Programming Language :: Python :: 3.13",
|
|
29
|
+
"Operating System :: Microsoft :: Windows",
|
|
30
|
+
"Operating System :: MacOS",
|
|
31
|
+
"Operating System :: Unix",
|
|
32
|
+
"Operating System :: POSIX :: Linux",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Repository = "https://github.com/lmidolo/samplemaker.git"
|
|
37
|
+
|
|
38
|
+
[tool.scikit-build]
|
|
39
|
+
minimum-version = "0.11.6"
|
|
40
|
+
build-dir = "build/{wheel_tag}"
|
|
41
|
+
cmake.source-dir = "src/boopy"
|
|
42
|
+
wheel.install-dir = "samplemaker"
|
|
43
|
+
wheel.packages = ["src/samplemaker"]
|
|
44
|
+
|
|
45
|
+
[tool.cibuildwheel]
|
|
46
|
+
skip = ["*-musllinux*", "*-win32*"]
|
|
47
|
+
|
|
48
|
+
[tool.cibuildwheel.linux]
|
|
49
|
+
before-all = "yum install -y boost-devel"
|
|
50
|
+
|
|
51
|
+
[tool.cibuildwheel.macos]
|
|
52
|
+
before-all = "brew install boost"
|
|
53
|
+
|
|
54
|
+
[tool.cibuildwheel.windows]
|
|
55
|
+
environment = { BOOST_ROOT = "C:/vcpkg/installed/x64-windows" }
|
|
56
|
+
before-all = [
|
|
57
|
+
"vcpkg install boost-polygon:x64-windows",
|
|
58
|
+
]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.15...3.29)
|
|
2
|
+
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)
|
|
3
|
+
|
|
4
|
+
# Find Python
|
|
5
|
+
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
|
|
6
|
+
|
|
7
|
+
# Find pybind11
|
|
8
|
+
find_package(pybind11 CONFIG REQUIRED)
|
|
9
|
+
|
|
10
|
+
# Find Boost
|
|
11
|
+
if(WIN32)
|
|
12
|
+
# On Windows with vcpkg, use CONFIG mode only
|
|
13
|
+
find_package(Boost REQUIRED CONFIG)
|
|
14
|
+
else()
|
|
15
|
+
# On Linux/macOS, try CONFIG first, fall back to MODULE mode
|
|
16
|
+
find_package(Boost QUIET CONFIG)
|
|
17
|
+
if(NOT Boost_FOUND)
|
|
18
|
+
find_package(Boost REQUIRED)
|
|
19
|
+
endif()
|
|
20
|
+
endif()
|
|
21
|
+
|
|
22
|
+
# Create the Python extension module
|
|
23
|
+
pybind11_add_module(boopy boopy.cpp)
|
|
24
|
+
|
|
25
|
+
# Link Boost headers - handle both old and new Boost installations
|
|
26
|
+
if(TARGET Boost::headers)
|
|
27
|
+
target_link_libraries(boopy PRIVATE Boost::headers)
|
|
28
|
+
elseif(TARGET Boost::boost)
|
|
29
|
+
target_link_libraries(boopy PRIVATE Boost::boost)
|
|
30
|
+
else()
|
|
31
|
+
target_include_directories(boopy PRIVATE ${Boost_INCLUDE_DIRS})
|
|
32
|
+
endif()
|
|
33
|
+
|
|
34
|
+
# Set C++ standard
|
|
35
|
+
target_compile_features(boopy PRIVATE cxx_std_14)
|
|
36
|
+
|
|
37
|
+
# Set visibility
|
|
38
|
+
set_target_properties(boopy PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
|
39
|
+
|
|
40
|
+
# Install the module to the correct location within the package
|
|
41
|
+
install(TARGETS boopy LIBRARY DESTINATION resources)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#include <iostream>
|
|
2
|
+
#include <vector>
|
|
3
|
+
#include <pybind11/pybind11.h>
|
|
4
|
+
#include <pybind11/stl.h>
|
|
5
|
+
#include <pybind11/numpy.h>
|
|
6
|
+
#include <pybind11/stl_bind.h>
|
|
7
|
+
#include <boost/polygon/polygon.hpp>
|
|
8
|
+
|
|
9
|
+
namespace py = pybind11;
|
|
10
|
+
namespace gtl = boost::polygon;
|
|
11
|
+
using namespace boost::polygon::operators;
|
|
12
|
+
|
|
13
|
+
typedef gtl::polygon_data<int> Polygon;
|
|
14
|
+
typedef gtl::polygon_traits<Polygon>::point_type Point;
|
|
15
|
+
typedef std::vector<gtl::polygon_data<int> > PolygonSet;
|
|
16
|
+
|
|
17
|
+
struct PolyGroup {
|
|
18
|
+
void addPolyData(const std::vector<int> &data) {
|
|
19
|
+
size_t npts = (data.size())/2;
|
|
20
|
+
Point *pts = new Point[npts];
|
|
21
|
+
for(unsigned int i = 0; i< npts; i++) {
|
|
22
|
+
pts[i]=gtl::construct<Point>(data.at(2*i),data.at(2*i+1));
|
|
23
|
+
}
|
|
24
|
+
Polygon poly;
|
|
25
|
+
gtl::set_points(poly,pts,pts+npts);
|
|
26
|
+
|
|
27
|
+
ps_.push_back(poly);
|
|
28
|
+
delete [] pts;
|
|
29
|
+
}
|
|
30
|
+
unsigned int getPolyCount(void) {return static_cast<unsigned int>(ps_.size());}
|
|
31
|
+
const std::vector<int> getPoly(unsigned int n) const {
|
|
32
|
+
std::vector<int> pseq;
|
|
33
|
+
if(n<ps_.size()) {
|
|
34
|
+
Polygon poly = ps_[n];
|
|
35
|
+
for(auto v = poly.begin(); v!=poly.end(); v++) {
|
|
36
|
+
pseq.push_back(v->x());
|
|
37
|
+
pseq.push_back(v->y());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return pseq;
|
|
41
|
+
}
|
|
42
|
+
double area() {
|
|
43
|
+
return gtl::area(ps_);
|
|
44
|
+
}
|
|
45
|
+
void clear() {
|
|
46
|
+
gtl::clear(ps_);
|
|
47
|
+
}
|
|
48
|
+
bool empty() {
|
|
49
|
+
return gtl::empty(ps_);
|
|
50
|
+
}
|
|
51
|
+
void difference(PolyGroup &pg2) {
|
|
52
|
+
ps_-=pg2.ps_;
|
|
53
|
+
}
|
|
54
|
+
void intersection(PolyGroup &pg2) {
|
|
55
|
+
ps_&=pg2.ps_;
|
|
56
|
+
}
|
|
57
|
+
void merge(PolyGroup &pg2) {
|
|
58
|
+
ps_+=pg2.ps_;
|
|
59
|
+
}
|
|
60
|
+
void assign() {
|
|
61
|
+
gtl::assign(ps_,ps_);
|
|
62
|
+
}
|
|
63
|
+
void exor(PolyGroup &pg2) {
|
|
64
|
+
ps_^=pg2.ps_;
|
|
65
|
+
}
|
|
66
|
+
void trapezoids() {
|
|
67
|
+
PolygonSet psin = ps_;
|
|
68
|
+
clear();
|
|
69
|
+
gtl::get_trapezoids(ps_,psin);
|
|
70
|
+
}
|
|
71
|
+
void resize(double value, bool corner_fill_arc, unsigned int num_circle_segments) {
|
|
72
|
+
ps_=gtl::resize(ps_,value,corner_fill_arc,num_circle_segments);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
PolygonSet ps_;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
PYBIND11_MODULE(boopy, m) {
|
|
79
|
+
py::class_<PolyGroup>(m, "PolyGroup")
|
|
80
|
+
.def(py::init<>())
|
|
81
|
+
.def("addPolyData",&PolyGroup::addPolyData)
|
|
82
|
+
.def("getPolyCount", &PolyGroup::getPolyCount)
|
|
83
|
+
.def("getPoly", &PolyGroup::getPoly)
|
|
84
|
+
.def("area", &PolyGroup::area)
|
|
85
|
+
.def("clear", &PolyGroup::clear)
|
|
86
|
+
.def("empty", &PolyGroup::empty)
|
|
87
|
+
.def("assign", &PolyGroup::assign)
|
|
88
|
+
.def("difference", &PolyGroup::difference)
|
|
89
|
+
.def("intersection", &PolyGroup::intersection)
|
|
90
|
+
.def("merge", &PolyGroup::merge)
|
|
91
|
+
.def("exor", &PolyGroup::exor)
|
|
92
|
+
.def("trapezoids", &PolyGroup::trapezoids)
|
|
93
|
+
.def("resize", &PolyGroup::resize);
|
|
94
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""
|
|
2
|
+
|
|
3
|
+
This is the Python version of Sample Maker, a scripting tool for designing
|
|
4
|
+
lithographic masks in the GDSII format. Package `samplemaker` comes
|
|
5
|
+
with different tools and submodules for the creation and manipulation of basic
|
|
6
|
+
shapes, periodic shapes, sequences (e.g. waveguides), circuits, and complex
|
|
7
|
+
devices.
|
|
8
|
+
|
|
9
|
+
The code has been developed primarily for nanophotonics, but it can be easily
|
|
10
|
+
extended to different applications in micro and nano device fabrication.
|
|
11
|
+
|
|
12
|
+
Sample Maker is developed and maintained by Leonardo Midolo (Niels Bohr Institute,
|
|
13
|
+
University of Copenhagen). It is based on the MATLAB(R) code developed by Leonardo Midolo
|
|
14
|
+
between 2013 and 2019. The first version of the rewritten Python code has been released in October 2021.
|
|
15
|
+
|
|
16
|
+
This software has been realized with the financial support from
|
|
17
|
+
the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (Grant agreement No. 949043, NANOMEQ).
|
|
18
|
+
|
|
19
|
+
.. include:: ./documentation.md
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from typing import ( # noqa: F401
|
|
23
|
+
cast, Any, Callable, Dict, Generator, Iterable, List, Mapping, NewType,
|
|
24
|
+
Optional, Set, Tuple, Type, TypeVar, Union,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
__version__ = "5.4.3"
|
|
28
|
+
|
|
29
|
+
__pdoc__: Dict[str, Union[bool, str]] = {}
|
|
30
|
+
__pdoc__["samplemaker.Tutorials"]=False
|
|
31
|
+
__pdoc__["samplemaker.tests"]=False
|
|
32
|
+
__pdoc__["samplemaker.resources"]=False
|
|
33
|
+
__pdoc__["samplemaker.gdsreader"]=False
|
|
34
|
+
__pdoc__["samplemaker.devices.DevicePort"]=False
|
|
35
|
+
|
|
36
|
+
# The LayoutPool contains all the current layout, this class should generally not
|
|
37
|
+
# be used directly, but only through the Mask class.
|
|
38
|
+
LayoutPool = dict() # connects a SREF name to a particular geomgroup in the current memory
|
|
39
|
+
# Additional cache pool
|
|
40
|
+
_DevicePool = dict() # connects a device hash to a SREF to be instantiated
|
|
41
|
+
_DeviceLocalParamPool = dict() # connects a device hash to local parameters created by the call to geom()
|
|
42
|
+
_DeviceCountPool = dict() # connects a device name to a device count
|
|
43
|
+
_BoundingBoxPool = dict() # connects a SREF name to its bounding box
|