MIT License

项目介绍

fancompute/ceviche 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 431 个 Star、89 次 Fork。

仓库全名
fancompute/ceviche
开源许可证
MIT License
Star 数
431
Fork 数
89
未关闭 Issue
11

README 摘要

Electromagnetic Simulation Tools + Automatic Differentiation. Code for paper Forward-Mode Differentiation of Maxwell's Equations. What is ceviche? ceviche provides two core electromagnetic simulation tools for solving Maxwell's equations: finite-difference frequency-domain (FDFD) finite-difference time-domain (FDTD) Both are written in numpy / scipy and are compatible with the HIPS autograd package, supporting…

完整内容见 GitHub 原始 README 或本页 。

常见问题

ceviche 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 431 个 Star。

ceviche 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 ceviche 的源码?

可以直接克隆仓库:git clone https://github.com/fancompute/ceviche.git,默认分支为 master;安装与运行步骤见仓库 README。

ceviche 最近还在维护吗?

仓库最近一次更新为 2023年7月7日,当前有 11 个未关闭 Issue;Star 数为 431,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

:shrimp: Electromagnetic Simulation + Automatic Differentiation

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
629
价值分
286
活跃状态
活跃

语言占比

Python
Shell

Release

README

ceviche Build Status

Electromagnetic Simulation Tools + Automatic Differentiation. Code for paper Forward-Mode Differentiation of Maxwell’s Equations.

ceviche

What is ceviche?

ceviche provides two core electromagnetic simulation tools for solving Maxwell’s equations:

  • finite-difference frequency-domain (FDFD)

  • finite-difference time-domain (FDTD)

Both are written in numpy / scipy and are compatible with the HIPS autograd package, supporting forward-mode and reverse-mode automatic differentiation.

This allows you to write code to solve your E&M problem, and then use automatic differentiation on your results.

As a result, you can do gradient-based optimization, sensitivity analysis, or plug your E&M solver into a machine learning model without having to go through the tedious process of deriving your derivatives by hand.

Examples

There is a comprehensive ceviche tutorial available at this link with several ipython notebook examples:

  1. Running FDFD simulations in ceviche.
  2. Performing inverse design of a mode converter.
  3. Adding fabrication constraints and device parameterizations.
  4. Inverse design of a wavelength-division multiplexer and advanced topics.

There are also a few examples in the examples/* directory.

Installation

There are many ways to install ceviche.

The easiest is by

pip install ceviche

But to install from a local copy, one can instead do

git clone https://github.com/twhughes/ceviche.git
pip install -e ceviche
pip install -r ceviche/requirements.txt

from the main directory.

Alternatively, just download it:

git clone https://github.com/twhughes/ceviche.git

and then import the package from within your python script

import sys
sys.path.append('path/to/ceviche')

Package Structure

Ceviche

The ceviche directory contains everything needed.

To get the FDFD and FDTD simulators, import directly from ceviche import fdtd, fdfd_ez, fdfd_hz

To get the differentiation, import from ceviche import jacobian.

constants.py contains some constants EPSILON_0, C_0, ETA_0, Q_E, which are needed throughout the package

utils.py contains a few useful functions for plotting, autogradding, and various other things.

optimizers.py contains optimizer functions for doing inverse design.

viz.py are functions that help with plotting fields and sructures.

modes.py contains a mode sorter (WIP) that can be used to create waveguide mode profiles for the simulation, for example.

Examples

There are many demos in the examples directory, which will give you a good sense of how to use the package.

Tests

Tests are located in tests. To run, cd into tests and

python -m unittest

to run all or

python specific_test.py

to run a specific one. Some of these tests involve visual inspection of the field plots rather than error checking on values.

To run all of the gradient checking functions, run

chmod +x test/test_all_gradients.sh
tests/test_all_gradients.sh

Credits

If you use this for your research or work, please cite

@article{hughes2019forward,
  title={Forward-Mode Differentiation of Maxwell’s Equations},
  author={Hughes, Tyler W and Williamson, Ian AD and Minkov, Momchil and Fan, Shanhui},
  journal={ACS Photonics},
  volume={6},
  number={11},
  pages={3010--3016},
  year={2019},
  publisher={ACS Publications}
}

Our logo was created by @nagilmer

评论

暂无评论