In [2]:
from astropy.units import Quantity

In [3]:
f1 = Quantity(1500, 'mm')
f2 = Quantity(200, 'mm')
f3 = Quantity(30, 'mm')

In [4]:
def image_distance(object_distance, focal_length):
    return (object_distance * focal_length)/(object_distance - focal_length)

In [7]:
print(image_distance(Quantity(100, 'm'), f1))


1522.84263959 mm

In [14]:
def saas_image_distance(object_distance):
    f1 = Quantity(1500, 'mm')
    f2 = Quantity(200, 'mm')
    f3 = Quantity(30, 'mm')
    
    d12 = Quantity(1819, 'mm')
    d23 = Quantity(229, 'mm')
    
    image_1 = image_distance(object_distance, f1)
    print(image_1)
    image_2 = image_distance(d12 + image_1, f2)
    print(image_2)
    image_3 = image_distance(d23 + image_2, f3)
    return image_3

In [26]:
saas_image_distance(Quantity(10, 'm'))


1764.70588235 mm
211.821358413 mm
Out[26]:
$32.1907 \; \mathrm{mm}$

In [1]:
import pyoptools


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-04348a2c3635> in <module>()
----> 1 import pyoptools

ImportError: No module named pyoptools

In [2]:
from pyoptools.all import *


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-8f2c36d42409> in <module>()
----> 1 from pyoptools.all import *

ImportError: No module named pyoptools.all

In [ ]: