Skip to content

Commit

Permalink
fixing travis file
Browse files Browse the repository at this point in the history
trying simple import

trying comple import of shape

disabling python2.7

miniconda for python3

miniconda for python3

small parenthesees errors

other print

explicit imports

instalacion como develop

adding small text to travis file

reactivating python 2.7
  • Loading branch information
fariza committed Sep 14, 2015
1 parent 9795dbc commit ad13c26
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 37 deletions.
25 changes: 16 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,25 @@ sudo: false
# https://github.com/Jorge-C/ordination/blob/master/.travis.yml
# https://gist.github.com/dan-blanchard/7045057
before_install:
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- ./miniconda.sh -b
- export PATH=/home/travis/miniconda/bin:$PATH
# Update conda itself
- conda update --yes conda
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda


# Install packages
install:
- conda create --yes -n env_name python=$TRAVIS_PYTHON_VERSION pip numpy matplotlib nose scipy pep8 cython
- source activate env_name
- python setup.py install
- conda install --yes pip numpy matplotlib nose scipy pep8 cython
# For some unknown reason I have to install as develop.
# if not, there will be some errors regarding import problems
# not all the modules get installed in travis
- python setup.py develop

script:
- python tests.py
2 changes: 1 addition & 1 deletion clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def findfiles2clean(dir,files=[], ):

f2c= findfiles2clean(".")
for i in f2c:
print"Deleting: ",i
print("Deleting: ",i)
try:
os.remove(i)
except:
Expand Down
4 changes: 2 additions & 2 deletions ez_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ def main(argv, version=DEFAULT_VERSION):
from setuptools.command.easy_install import main
main(argv)
else:
print "Setuptools version",version,"or greater has been installed."
print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
print("Setuptools version",version,"or greater has been installed.")
print('(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)')



Expand Down
6 changes: 3 additions & 3 deletions gls2rtgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
if options.inputfile==None:
parser.error("\n\nError: Input filename must be given.\n\n")

print "\n\n\nProcessing file", options.inputfile, "\n\n\n"
print("\n\n\nProcessing file", options.inputfile, "\n\n\n")
try:
f=open(options.inputfile, 'r')
except:
print "File ", options.inputfile, "not found"
print("File ", options.inputfile, "not found")

lines=f.readlines()
f.close()
Expand All @@ -39,7 +39,7 @@
exit("The input file seems not to be an OSLO glass description file")

if version not in ("5.00","5.11","5.31","5.32","5.41","6.02" , "6.03"):
print "Library version migth not be supported. Please verify the output file"
print("Library version migth not be supported. Please verify the output file")

# Check if the output file exists

Expand Down
4 changes: 2 additions & 2 deletions pyoptools/gui/ipynbplotutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
OSMesaMakeCurrent, OSMesaDestroyContext)

except:
print "need OSMesa installed, and the following environment variable"
print "export PYOPENGL_PLATFORM=osmesa"
print ("need OSMesa installed, and the following environment variable")
print ("export PYOPENGL_PLATFORM=osmesa")

from pyoptools.raytrace.system import System
from pyoptools.raytrace.component import Component
Expand Down
25 changes: 12 additions & 13 deletions pyoptools/raytrace/calc/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,9 @@ def pupil_location(opsys,ccds,opaxis):


if (len(ccds.hit_list)==0):
raise Exception, "The optical axis did not intersect the aperture"
raise Exception("The optical axis did not intersect the aperture")
if(len(ccds.hit_list)>1):
raise Exception, "The optical axis intersected the aperture more than "
"once"
raise Exception("The optical axis intersected the aperture more than once")

aip=ccds.hit_list[0][0]
air=ccds.hit_list[0][1]
Expand All @@ -303,7 +302,7 @@ def pupil_location(opsys,ccds,opaxis):
#Getting Intersection point in global coordinates

if(len(air.childs)!=1):
raise Exception, "The intersected ray can only have one child"
raise Exception("The intersected ray can only have one child")

ip=air.childs[0].pos
d=air.childs[0].dir
Expand Down Expand Up @@ -347,8 +346,8 @@ def pupil_location(opsys,ccds,opaxis):
#log.info("exp="+str(exp))
#log.info("oax="+str(oax))
if len(enp)!=1 or len(exp)!=1 or len(oax)!=1:
raise Exception, "The principal ray or the optical axis ray have more"
" than one final ray"
raise Exception("The principal ray or the optical axis ray have more"
" than one final ray")
#log.info("Calculating entrance pupil location")

# Find the nearest points between the rays.
Expand All @@ -360,16 +359,16 @@ def pupil_location(opsys,ccds,opaxis):
enpl=intersection(opaxis,enp[0])[0]
if (isnan(enpl)).all():
p1, p2, d, rv =nearest_points(opaxis,enp[0])
print"Warning: The optical axis does not intersect the principal ray at the entrance"
print "pupil. The minimum distance is:", d
print("Warning: The optical axis does not intersect the principal ray at the entrance")
print("pupil. The minimum distance is:", d)
enpl=(p1+p2)/2

#log.info("Calculating exit pupil location")
expl=intersection(oax[0],exp[0])[0]
if (isnan(expl)).all():
p1, p2, d, rv =nearest_points(oax[0],exp[0])
print"Warning: The optical axis does not intersect the principal ray at the exit"
print "pupil. The minimum distance is:", d
print("Warning: The optical axis does not intersect the principal ray at the exit")
print("pupil. The minimum distance is:", d)
expl=(p1+p2)/2

return enpl,expl
Expand Down Expand Up @@ -437,8 +436,8 @@ def paraxial_location(opsys, opaxis):
#log.info("oax="+str(oax))

if len(par)!=1 or len(oax)!=1:
raise Exception, "The paraxial ray or the optical axis ray have more"
" than one final ray"
raise Exception("The paraxial ray or the optical axis ray have more"
" than one final ray")

#log.info("Calculating object location")
expl=intersection(oax[0],par[0])
Expand Down Expand Up @@ -537,7 +536,7 @@ def find_ppp(opsys, opaxis):
par_ray_end=par_ray.get_final_rays(inc_zeros = False)

if len(par_ray_end)!=1:
raise Exception, "The paraxial ray has more than one final ray"
raise Exception("The paraxial ray has more than one final ray")

pppl=intersection(par_ray,par_ray_end[0])

Expand Down
4 changes: 2 additions & 2 deletions pyoptools/raytrace/library/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def parts(self):
if len(libfiles)>0:
libname=basename(di)
filename=[ join(di,fn) for fn in libfiles]
print "Loading component library",libname," from files ",filename
print ("Loading component library",libname," from files ",filename)
Library(filename,libname=libname)


Expand Down Expand Up @@ -221,7 +221,7 @@ def zmx_parse(data):

else:
for i in surflist:
print "*", i
print("*", i)
raise ValueError # Esto toca arreglarlo y generar un error que realmente indique que está pasando
def zmx_read(fn):

Expand Down
2 changes: 1 addition & 1 deletion pyoptools/tests/test_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def test_circular():
from pyoptools.raytrace.shape import Circular
from pyoptools.raytrace.shape.circular import Circular
c = Circular()
assert_equal(c.radius, 1.0, 'Unexpected radius')

Expand Down
8 changes: 4 additions & 4 deletions pyoptools/wavefront/zernike/zernike.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ def rnm(n,m,rho):
"""

if(type(n) is not int):
raise Exception, "n must be integer"
raise Exception("n must be integer")
if(type(m) is not int):
raise Exception, "m must be integer"
raise Exception("m must be integer")
if (n-m)%2!=0:
raise Exception, "n-m must be even"
raise Exception("n-m must be even")
if abs(m)>n:
raise Exception, "The following must be true |m|<=n"
raise Exception("The following must be true |m|<=n")
mask=where(rho<=1,False,True)

if(n==0 and m==0):
Expand Down

0 comments on commit ad13c26

Please sign in to comment.