quartiq / rayopt

Python optics and lens design, raytracing
GNU Lesser General Public License v3.0
260 stars 50 forks source link

Update object angle/CRA according to image size #12

Open MaximilianHoffmann opened 8 years ago

MaximilianHoffmann commented 8 years ago

Is this already possible or even desired? For me it would be helpful for designing a lens with a certain FOV.

jordens commented 8 years ago

An InfiniteConjugate is specified by its object angle, i.e. FOV. Do you want fixed object size and fixed angle? That's fixed object size and fixed distance to entrance pupil.

IIRC the code should be able to do that just fine. If not, you should be able to do that with pickups or solves:

http://nbviewer.jupyter.org/github/jordens/rayopt-notebooks/blob/master/offner_relay.ipynb https://github.com/jordens/rayopt/blob/12531617533e6722cc8889cea3a33e27845e3377/rayopt/test/test_raytrace.py#L50

MaximilianHoffmann commented 8 years ago

That's fixed object size and fixed distance to entrance pupil.

Yes, just that I don't know which angle/distance to the pupil corresponds to a certain FOV before paraxial tracing. I saw the solve function in the tutorial but it wasn't so clear how to use it. I'll check it out. I thought the problem to be a more generic one, e.g. I have collimated rays of a certain size (object size), and want a FOV (image size) of a certain size, what is the angle at the stop, which will correspond to this, but maybe its not.

jordens commented 8 years ago

But if you have a collimated input beam (i.e. an infinite conjugate) it should just do that.

import rayopt as ro

s = ro.system_from_yaml("""
object:
  type: infinite
  angle_deg: 10
  pupil:
    radius: 1
stop: 2
elements:
- {}
- {distance: 1, material: 1.5, roc: 5}
- {distance: .2, material: 1.0}
- {}
""")
s.update()
s.paraxial.resize()
print(s)
print(s.paraxial)
System: 
Scale: 1.0 mm
Wavelengths: 588, 656, 486 nm
Fields: 0, 0.7, 1
Object:
 Semi-Angle: 10 deg
 Pupil:
   Pupil Distance: 1.13514
   Radius: 1
Image:
 Radius: inf
 Update Radius: True
 Pupil:
   Pupil Distance: 0
   Update Radius: True
   Radius: inf
Stop: 2
Elements:
 # T   Distance   Rad Curv   Diameter          Material       n      nd      Vd
 0 S          0        inf        inf              None     nan     nan     nan
 1 S          1          5     2.0479                 -   1.500   1.500     inf
 2 S        0.2        inf     1.9733                 -   1.000   1.000     inf
 3 S          0        inf     1.9733              None     nan     nan     nan

lagrange: -0.17725
track length: 0.2
object, image height: [  2.0121e-01   3.7340e-17]
front, back focal length (from PP): [-10. 10.]
entry, exit pupil height: [ 1.      0.9867]
entry, exit pupil distance: [  1.3514e-01   2.0785e-16]
front, back focal distance: [-10.       9.8667]
front, back principal distance: [ -1.7764e-15  -1.3333e-01]
front, back nodal distance: [ -1.7764e-15  -1.3333e-01]
front, back numerical aperture: [ 0.      0.0995]
front, back f number: [ 5.      5.0676]
front, back working f number: [    inf  5.0249]
front, back airy radius: [    inf  0.0036]
transverse, angular magnification: [-0.      1.0135]

 # T      path         n   axial y  axial nu   chief y  chief nu
 0 S         0         1         1         0   -0.2012    0.1773
 1 S         1       1.5         1      -0.1  -0.02395    0.1796
 2 S       1.2         1    0.9867      -0.1-3.734e-17    0.1796
 3 S       1.2         1    0.9867      -0.1-3.734e-17    0.1796

 # T       SA3      CMA3      AST3      PTZ3      DIS3     TACHC      TCHC
 0 S         0         0         0         0         0         0         0
 1 S-1.873e-19-1.615e-19-1.392e-19-2.206e-19-3.103e-19         0         0
 2 S-5.774e-20 1.037e-19-1.863e-19         0 3.347e-19        -0         0
 3 S         0         0         0         0         0        -0         0
     -2.45e-19-5.775e-20-3.256e-19-2.206e-19 2.444e-20         0         0
jordens commented 8 years ago

Oh. Image size! I misread that.

jordens commented 8 years ago

It might be better to rewrite the paraxial trace so that it doesn't care about object height/chief ray angle and pupil height/marginal ray angle and instead just use "1" and just scale the printed data. Then you could always do the trace without ever hitting nans, then do solves/pickups on that data and then everything would always give the right result.

jordens commented 8 years ago

But for now i would just guess some initial value so that the primary trace gives you pupil data and then use a pickup to set the actual value.