Skip to content

Instantly share code, notes, and snippets.

View indranilsinharoy's full-sized avatar

Indranil Sinharoy indranilsinharoy

View GitHub Profile
@indranilsinharoy
indranilsinharoy / PSF_and_MTF_functions_test.ipynb
Created January 26, 2015 08:42
Basic tests for PSF and MTF related functions in PyZDDE
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@indranilsinharoy
indranilsinharoy / zGetPOP.py
Created June 11, 2014 07:54
An example of how the zGetPOP() function could be written.
def _getStartLine(line_list, pattern):
"""return the line number that is the starting line
for the data of interest, identified by the regex
pattern
Parameters
----------
line_list : list
list of lines in the file returned by ``_readLinesFromFile()``
pattern : string
@indranilsinharoy
indranilsinharoy / create2DListFromZemaxTextData.py
Last active August 29, 2015 14:02
Here is one way of doing what I suggested in the email about the extraction of the 2D data from the POP file dumped by Zemax.
import pyzdde.zdde as pyz
import numpy as np
import matplotlib.pyplot as plt
import re
# Helper functions
def _getStartLine(line_list, pattern):
"""return the line number that is the starting line
for the data of interest, identified by the regex
pattern
@indranilsinharoy
indranilsinharoy / OpticStudio_GetTextFile_GetMetaFile_Text.json
Created March 21, 2014 23:27
Quick test of GetTextFile and GetMetaFile data items used by Zeamx extensions show that there OpticStudio doesn't output the expected analysis windows.
{
"metadata": {
"name": "OpticStudio_Tests"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@indranilsinharoy
indranilsinharoy / IPython_Notebook_PyZDDE_Demo_ZemaxKB_Article.json
Last active January 4, 2016 10:49
IPython notebook for portion of the Zemax knowledge-base article describing the notebook-Zemax communication.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
# -*- coding: utf-8 -*-
"""
File: simpleLensScaling.py
Purpose : Calculate two-point resolution using Rayleigh criterion and
study the effect of lens scaling on Rayleigh resolution.
Assumption: First order optical analysis, specifically they are:
1. The system is diffraction limited (aberrations are not considered)
2. The aperture is circular
3. A simple single lens system is considered, thus
@indranilsinharoy
indranilsinharoy / jinc.py
Created July 16, 2013 10:15
I was expecting the numba implementation to be faster. However the standard NumPy vectorized implementation seems to be faster. jinc function: standard NumPy implementation Time taken = 49.9999523163 ms jinc function: numba 'style' implementation Time taken = 884.999990463 ms
from __future__ import division, print_function
import numpy as np
from numba import double, jit
def jinc1(rho):
"""Internal implementation of the jinc function over a radial grid `rho`
The `jinc(rho)` is defined as `2*(J_1(2*pi*rho)/2*pi*rho)` and `jinc(0)=1.0`.
"""
mask = rho != 0.0
result = np.ones(rho.shape)
@indranilsinharoy
indranilsinharoy / PyZDDE_With_IPython_Webnotebook.json
Last active December 18, 2015 20:59
An IPython Webnotebook demonstrating basic usage of PyZDDE to communicate with ZEMAX from an webnotebook environment.
This file has been truncated, but you can view the full file.
{
"metadata": {
"name": "pyZDDE_Usage_Test_In_Notebook"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@indranilsinharoy
indranilsinharoy / GilbertStrangLinAlgLec01.ipynb
Last active March 11, 2017 18:16
Gilbert Strang's Lecture on Linear Algebra: Lecture 01- The Geometry of Linear Equations
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.