rayopt icon indicating copy to clipboard operation
rayopt copied to clipboard

pupil aiming with tilted object

Open MaximilianHoffmann opened this issue 9 years ago • 8 comments

s1=ro.system_from_yaml('''!!python/unicode 'description': !!python/unicode 'AC508-200-B AC508-200-B NEAR IR
  ACHROMATS: Infinite Conjugate 200'
!!python/unicode 'elements':
- !!python/unicode 'angles': [0.08726646259971647, 0.0, 0.0]
  !!python/unicode 'material': basic/air
  !!python/unicode 'radius': 0.01401147303517
- {!!python/unicode 'curvature': 0.0019409937888199, !!python/unicode 'distance': 193.14,
  !!python/unicode 'material': SCHOTT/N-SF6HT, !!python/unicode 'radius': 25.4}
- {!!python/unicode 'curvature': 0.0091575091575092, !!python/unicode 'distance': 5.0,
  !!python/unicode 'material': SCHOTT/N-LAK22, !!python/unicode 'radius': 25.4}
- {!!python/unicode 'curvature': -0.0074626865671642, !!python/unicode 'distance': 8.2,
  !!python/unicode 'material': basic/air, !!python/unicode 'radius': 25.4}
- {!!python/unicode 'distance': 100.0, !!python/unicode 'material': basic/air}
- {!!python/unicode 'material': basic/air, !!python/unicode 'radius': 18.0}
- {!!python/unicode 'curvature': 0.0074626865671642, !!python/unicode 'distance': 100.0,
  !!python/unicode 'material': SCHOTT/N-LAK22, !!python/unicode 'radius': 25.4}
- {!!python/unicode 'curvature': -0.0091575091575092, !!python/unicode 'distance': 8.2,
  !!python/unicode 'material': SCHOTT/N-SF6HT, !!python/unicode 'radius': 25.4}
- {!!python/unicode 'curvature': -0.0019409937888199, !!python/unicode 'distance': 5.0,
  !!python/unicode 'material': basic/air, !!python/unicode 'radius': 25.4}
- !!python/unicode 'angles': [-0.08726646259971647, 0.0, 0.0]
  !!python/unicode 'distance': 193.33044385190678
  !!python/unicode 'material': basic/air
  !!python/unicode 'radius': 10.0
!!python/unicode 'image':
  !!python/unicode 'pupil': {!!python/unicode 'distance': -404.3669122413583, !!python/unicode 'radius': 36.37432010274401,
    !!python/unicode 'refractive_index': 1.0002750477973053, !!python/unicode 'update_radius': true}
  !!python/unicode 'radius': 0.01401147303517
  !!python/unicode 'type': !!python/unicode 'finite'
!!python/unicode 'object':
  !!python/unicode 'pupil': {!!python/unicode 'distance': 404.1764683894514, !!python/unicode 'radius': 36.374320102743994,
    !!python/unicode 'refractive_index': 1.0002750477973053, !!python/unicode 'update_radius': true}
  !!python/unicode 'radius': 10.0
  !!python/unicode 'type': !!python/unicode 'finite'
!!python/unicode 'pickups': []
!!python/unicode 'scale': 0.001
!!python/unicode 'solves': []
!!python/unicode 'stop': 5
!!python/unicode 'validators': []
!!python/unicode 'wavelengths': [8.0e-07]''')

ro.Analysis(s1)

MaximilianHoffmann avatar Jun 08 '16 14:06 MaximilianHoffmann

The above code tries to evaluate a 4f system from a tilted plane to a tilted plane. Obviously something is wrong here, probably I entered bad parameters. But the stop should be plane 5, although the bundle diameter is still according to the stop, the rays do not pass through it.

The marginal and chief rays seem fine. So there is possible an aiming issue?

MaximilianHoffmann avatar Jun 08 '16 14:06 MaximilianHoffmann

Indeed , when

t = ro.GeometricTrace(s1)
t.rays_point((0, 0),stop=5)

is executed for stop=5 the brentq solver in aim_marginal does throw an error. Although a paraxial marginal ray is clearly found.

MaximilianHoffmann avatar Jun 08 '16 17:06 MaximilianHoffmann

Yes. This is incomplete/a bug. I would have to think a bit how to correctly do a tilted object plane. Without looking at the code again I think it assumes that it can hit the stop center from an on-axis object point by going straight. But I would have to check again. This assumption is not generally true. Paraxial calculations assume that things are "aligned".

jordens avatar Jun 09 '16 16:06 jordens

Oh and I don't like it sprinkling the !!python/unicode stuff everywhere. Is this Python 2.X?

jordens avatar Jun 09 '16 16:06 jordens

Yes, it is Python 2.X . Are you using new language features? Apart from this, everything seemed to run fine. I guess by dropping all aiming tracing a given set of rays via geometric_ray.propagate(clip=True) will work correctly even for a tilted object plane.

MaximilianHoffmann avatar Jun 09 '16 17:06 MaximilianHoffmann

True. You can always use GeometricTrace.rays_given(y, u) and then propagate(). Initial y and u given in element-normal coordinates.

jordens avatar Jun 09 '16 21:06 jordens

Please, say if you are tired of these discussions. I know much less about these matters and how ray tracing packages usually operate. Wouldn't it be ok to aim from the non tilted plane and tilt the aimed rays with s[0].to_normal(). Of course, this won't satisfy the distribution exactly... A general question about pupil aiming would be: If one is interested in how well a system images, why can't one just start with rays with a uniform angular distribution.

MaximilianHoffmann avatar Jun 15 '16 15:06 MaximilianHoffmann

You can have other elements offset and tilted on the way from the object to the stop. Therefore you can just as well aim in the fully tilted configuration.

Yes. uniform angular distributions are correct for some cases. But other cases need cos^4 for example. It's very application dependent.

jordens avatar Jun 16 '16 09:06 jordens