text:
=begin

Copyright 2012-2013 inBloom, Inc. and its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=end

require_relative 'Enum.rb'

# Enumerates the types of exit withdrawals. From Ed-Fi-Core.xsd:
# <xs:simpleType name="ExitWithdrawType">
#   <xs:annotation>
#     <xs:documentation>The circumstances under which the student exited from membership in an educational institution.</xs:documentation>
#   </xs:annotation>
#   <xs:restriction base="xs:token">
#     <xs:enumeration value="Student is in a different public school in the same local education agency"/>
#     <xs:enumeration value="Transferred to a public school in a different local education agency in the same state"/>
#     <xs:enumeration value="Transferred to a public school in a different state"/>
#     <xs:enumeration value="Transferred to a private, non-religiously-affiliated school in the same local education agency"/>
#     <xs:enumeration value="Transferred to a private, non-religiously-affiliated school in a different local education agency in the same state"/>
#     <xs:enumeration value="Transferred to a private, non-religiously-affiliated school in a different state"/>
#     <xs:enumeration value="Transferred to a private, religiously-affiliated school in the same local education agency"/>
#     <xs:enumeration value="Transferred to a private, religiously-affiliated school in a different local education agency in the same state"/>
#     <xs:enumeration value="Transferred to a private, religiously-affiliated school in a different state"/>
#     <xs:enumeration value="Transferred to a school outside of the country"/>
#     <xs:enumeration value="Transferred to an institution"/>
#     <xs:enumeration value="Transferred to home schooling"/>
#     <xs:enumeration value="Transferred to a charter school"/>
#     <xs:enumeration value="Graduated with regular, advanced, International Baccalaureate, or other type of diploma"/>
#     <xs:enumeration value="Completed school with other credentials"/>
#     <xs:enumeration value="Died or is permanently incapacitated"/>
#     <xs:enumeration value="Withdrawn due to illness"/>
#     <xs:enumeration value="Expelled or involuntarily withdrawn"/>
#     <xs:enumeration value="Reached maximum age for services"/>
#     <xs:enumeration value="Discontinued schooling"/>
#     <xs:enumeration value="Completed grade 12, but did not meet all graduation requirements"/>
#     <xs:enumeration value="Enrolled in a postsecondary early admission program, eligible to return"/>
#     <xs:enumeration value="Not enrolled, unknown status"/>
#     <xs:enumeration value="Student is in the same local education agency and receiving education services, but is not assigned to a particular school"/>
#     <xs:enumeration value="Enrolled in an adult education or training program"/>
#     <xs:enumeration value="Completed a state-recognized vocational education program"/>
#     <xs:enumeration value="Not enrolled, eligible to return"/>
#     <xs:enumeration value="Enrolled in a foreign exchange program, eligible to return"/>
#     <xs:enumeration value="Withdrawn from school, under the age for compulsory attendance; eligible to return"/>
#     <xs:enumeration value="Exited"/>
#     <xs:enumeration value="Student is in a charter school managed by the same local education agency"/>
#     <xs:enumeration value="Completed with a state-recognized equivalency certificate"/>
#     <xs:enumeration value="Removed by Child Protective Services"/>
#     <xs:enumeration value="Transferred to a private school in the state"/>
#     <xs:enumeration value="Graduated outside of state prior to enrollment"/>
#     <xs:enumeration value="Completed equivalency certificate outside of state"/>
#     <xs:enumeration value="Enrolled in University High School Diploma Program"/>
#     <xs:enumeration value="Court ordered to a GED program, has not earned a GED"/>
#     <xs:enumeration value="Incarcerated in a state jail or federal penitentiary as an adult"/>
#     <xs:enumeration value="Graduated from another state under Interstate Compact on Educational Opportunity for Military Children"/>
#     <xs:enumeration value="Dropout"/>
#     <xs:enumeration value="End of school year"/>
#     <xs:enumeration value="Invalid enrollment"/>
#     <xs:enumeration value="No show"/>
#     <xs:enumeration value="Other"/>
#   </xs:restriction>
# </xs:simpleType>
class ExitWithdrawType
  include Enum

  ExitWithdrawType.define :DISCONTINUED_SCHOOLING, "Discontinued schooling"
  ExitWithdrawType.define :END_OF_SCHOOL_YEAR, "End of school year"
  ExitWithdrawType.define :EXITED, "Exited"
  ExitWithdrawType.define :INVALID_ENROLLMENT, "Invalid enrollment"
  ExitWithdrawType.define :NO_SHOW, "No show"
  ExitWithdrawType.define :OTHER, "Other"
end


text:
require "serverspec"

set :backend, :exec

def redhat?
  os[:family] == "redhat"
end

def status_command
  config_file = redhat? ? "/etc/monit.conf" : "/etc/monit/monitrc"
  "monit -c #{config_file} status"
end

describe "Source install of monit" do
  describe package("monit") do
    it { should_not be_installed }
  end

  describe command("monit -V") do
    its(:stdout) { should match(/version 5\.12\.2/) }
    its(:exit_status) { should eq 0 }
  end

  describe service("monit") do
    it { should be_enabled }
    it { should be_running }
  end

  describe command(status_command) do
    its(:stdout) { should match(/System '[\w\-\.]+'/) }
    its(:stdout) { should match(/status\s+(Initializing|Running)/) }
    its(:stdout) do
      should match(/monitoring status\s+(Initializing|Monitored)/)
    end
    its(:exit_status) { should eq 0 }
  end
end

redpajama_set_name: RedPajamaGithub


text:
[![pytest](https://github.com/amccaugh/phidl/actions/workflows/pytest.yml/badge.svg)](https://github.com/amccaugh/phidl/actions/workflows/pytest.yml)
[![pre-commit](https://github.com/amccaugh/phidl/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/amccaugh/phidl/actions/workflows/pre-commit.yml)

# PHIDL
GDS scripting for Python that's intuitive, fast, and powerful.

- [**Installation / requirements**](#installation--requirements)
- [**Tutorial + examples**](https://phidl.readthedocs.io/en/latest/tutorials.html) (or [try an interactive notebook](https://mybinder.org/v2/gh/amccaugh/phidl/master?filepath=phidl_tutorial_example.ipynb))
- [**Geometry library + function documentation**](https://phidl.readthedocs.io/en/latest/geometry_reference.html)
- [Changelog](https://github.com/amccaugh/phidl/blob/master/CHANGELOG.md) (latest update 1.6.2 on July 25, 2022)
    - Huge new routing rewrite for `phidl.routing`, including automatic manhattan routing with custom cross-sections!  See [the routing documentation](https://phidl.readthedocs.io/en/latest/tutorials/routing.html) for details. Big thanks to Jeffrey Holzgrafe @jolzgrafe for this contribution
    - `Path`s can now be used to produce sharp angles, in addition to smooth bends. See [the Path documentation](https://phidl.readthedocs.io/en/latest/tutorials/waveguides.html#Sharp/angular-paths)

```python
import phidl.routing as pr
D_left = pr.route_smooth(port1, port2, radius=8, layer = 2)
D_right = pr.route_sharp(port1, port2, layer = 2)
```

![phidl example image](https://amccaugh.github.io/phidl/readme_9.png)

# Citation

If you found PHIDL useful, please consider citing it in (just one!) of your publications -- we appreciate it greatly. ([BibTeX](https://raw.githubusercontent.com/amccaugh/phidl/master/CITATION.bib))
 - McCaughan, A. N., et. al. PHIDL: Python-based layout and geometry creation for nanolithography. *J. Vac. Sci. Technol. B* 39, 062601 (2021). http://dx.doi.org/10.1116/6.0001203

# Gallery

# Installation / requirements
- Install or upgrade with `pip install -U phidl`
- Python version >=3.6
- If you are on Windows or Mac and don't already have `gdspy` installed, you will need a C++ compiler
    - For Windows + Python 3, install ["Build Tools for Visual Studio"](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019) (make sure to check the "C++ build tools" checkbox when installing)
    - For Mac, install "Xcode" from the App Store, then run the command `xcode-select --install` in the terminal

# About PHIDL

*fiddle (verb) - /ˈfidl/ - to make minor manual movements, especially to adjust something*

PHIDL is an open-source GDS-based CAD tool for Python that significantly extends the excellent [gdspy](https://github.com/heitzmann/gdspy).  The base installation includes a large library of simple shapes (e.g. rectangles, circles), photonic structures (e.g. sine curve waveguides), and superconducting nanowire shapes (e.g. single photon detectors) that are fully parameterized. It also has a built-in quick-plotting function based on matplotlib (or Qt) that allows you view the state of any GDS object, useful when scripting geometry-making functions. It also has a [__geometry library reference__](https://phidl.readthedocs.io/) and a set of [__very thorough tutorials__](https://phidl.readthedocs.io/en/latest/tutorials.html) that will walk you through the process of getting acquainted with PHIDL.

The goal is to bring the usability of Illustrator / Inkscape drawing programs to the GDS scripting world. Like Python itself, it aims to be readable, and intuitive.  For instance, when building a geometry you don't have to worry about what the exact coordinates are anymore. If you want to separate two ellipses in the x direction by 5 units, you can do things like this:

`ellipse1.xmin = ellipse2.xmax + 5`

or if you want to move then rotate one ellipse by 45 degrees you can do

`ellipse2.move([1,7]).rotate(45)`

There's a few dozen shortcuts like this that make life easier built into PHIDL--they're simple, but they make a world of difference when you just want to e.g. space a ring resonator some distance from a waveguide without having to track each and every coordinate of the shape.

[](http://amccaugh.github.io/phidl)

![phidl example image](https://amccaugh.github.io/phidl/readme_1.png)

There's also a "port" functionality that allows you to snap together geometry like Legos without caring about where exactly the absolute coordinates of either geometry is.  For instance, connecting the above misaligned rectangles is a two-line command:

![phidl example image](https://amccaugh.github.io/phidl/readme_2.png)

It also allows you to do things like add text and create smooth or straight routing curves between "ports" of different devices, convenient for making electrical or optical connections:

![phidl example image](https://amccaugh.github.io/phidl/readme_3.png)
![phidl example image](https://amccaugh.github.io/phidl/readme_4.png)

Other useful functionality available are standard operations like booleans:

![phidl example image](https://amccaugh.github.io/phidl/readme_8.png)

 and less standard ones like creating outlines. A whole layout can be outlined directly in the GDS without requiring you to use Beamer (useful for positive-tone resist structures):

`pg.outline(D, distance = 0.7, layer = 4)`

![phidl example image](https://amccaugh.github.io/phidl/readme_5.png)

The geometry library also has useful resolution test-structures built into it, for instance

```
pg.litho_calipers(num_notches = 7, offset_per_notch = 0.1)
pg.litho_steps(line_widths = [1,2,4,8,16])
pg.litho_star(num_lines = 16, line_width = 3)
```

![phidl example image](https://amccaugh.github.io/phidl/readme_7.png)

There are also handy functions to help pack shapes into as small an area as possible:

```
pg.packer(D_list, spacing = 1.25, aspect_ratio = (2,1))
```

![phidl example image](https://amccaugh.github.io/phidl/packer.png)