Python 3 fixes for new demos

This commit is contained in:
Luke Campagnola 2014-05-22 01:30:15 -04:00
parent 0524bfa6e8
commit 6e9d5c3cfb
4 changed files with 6 additions and 6 deletions

View File

@ -1 +1 @@
from pyoptic import * from .pyoptic import *

View File

@ -14,7 +14,7 @@ class GlassDB:
def __init__(self, fileName='schott_glasses.csv'): def __init__(self, fileName='schott_glasses.csv'):
path = os.path.dirname(__file__) path = os.path.dirname(__file__)
fh = gzip.open(os.path.join(path, 'schott_glasses.csv.gz'), 'rb') fh = gzip.open(os.path.join(path, 'schott_glasses.csv.gz'), 'rb')
r = csv.reader(fh.readlines()) r = csv.reader(map(str, fh.readlines()))
lines = [x for x in r] lines = [x for x in r]
self.data = {} self.data = {}
header = lines[0] header = lines[0]
@ -47,8 +47,8 @@ class GlassDB:
info = self.data[glass] info = self.data[glass]
cache = info['ior_cache'] cache = info['ior_cache']
if wl not in cache: if wl not in cache:
B = map(float, [info['B1'], info['B2'], info['B3']]) B = list(map(float, [info['B1'], info['B2'], info['B3']]))
C = map(float, [info['C1'], info['C2'], info['C3']]) C = list(map(float, [info['C1'], info['C2'], info['C3']]))
w2 = (wl/1000.)**2 w2 = (wl/1000.)**2
n = np.sqrt(1.0 + (B[0]*w2 / (w2-C[0])) + (B[1]*w2 / (w2-C[1])) + (B[2]*w2 / (w2-C[2]))) n = np.sqrt(1.0 + (B[0]*w2 / (w2-C[0])) + (B[1]*w2 / (w2-C[1])) + (B[2]*w2 / (w2-C[2])))
cache[wl] = n cache[wl] = n

View File

@ -1 +1 @@
from chain import ChainSim from .chain import ChainSim

View File

@ -1,7 +1,7 @@
import pyqtgraph as pg import pyqtgraph as pg
import numpy as np import numpy as np
import time import time
from relax import relax from .relax import relax
class ChainSim(pg.QtCore.QObject): class ChainSim(pg.QtCore.QObject):