Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Allow for surface type extensibility in AxisymmetricOpticalSystem #179

Merged
merged 14 commits into from
May 13, 2021

Conversation

alfredclwong
Copy link
Collaborator

@alfredclwong alfredclwong commented May 10, 2021

Fixes #176

I'll add support for Zernike surfaces in another PR - thought it'd be best to keep this one focused on reworking the core framework first.

Changes

  1. Changes to the prescription DataFrame:
    • Rename Surface column header to SurfaceType
    • Use Strings instead of Symbols in the SurfaceType column (e.g. :Object -> "Object")
    • Add a Parameter column to allow for surface type extensibility
  2. Support Standard and Aspheric surfaces
  3. Update examples, sample notebooks, diagnostics, test data and Eye.jl to use new scheme
  4. Write a function to validate prescription DataFrames
  5. [TODO] Write tests for AxisymmetricOpticalSystem (will probably rework the system soon so not worth it at the moment)

@alfredclwong alfredclwong self-assigned this May 10, 2021
@alfredclwong alfredclwong force-pushed the alfred/asos-surfaces branch from 53cf644 to 73e562b Compare May 10, 2021 16:07
@alfredclwong alfredclwong added the enhancement New feature or request label May 10, 2021
@alfredclwong alfredclwong force-pushed the alfred/asos-surfaces branch from 73e562b to de74a1f Compare May 10, 2021 16:16
@codecov-commenter

This comment has been minimized.

@alfredclwong alfredclwong force-pushed the alfred/asos-surfaces branch from 5499131 to 019a50d Compare May 11, 2021 09:34
@alfredclwong alfredclwong marked this pull request as ready for review May 11, 2021 09:41
@alfredclwong alfredclwong changed the title [WIP] Allow for surface type extensibility in AxisymmetricOpticalSystem Allow for surface type extensibility in AxisymmetricOpticalSystem May 11, 2021
@alfredclwong alfredclwong force-pushed the alfred/asos-surfaces branch from cd19524 to d0027e1 Compare May 11, 2021 09:45
src/Optical/OpticalSystem.jl Outdated Show resolved Hide resolved
src/Optical/OpticalSystem.jl Outdated Show resolved Hide resolved
src/Optical/OpticalSystem.jl Show resolved Hide resolved
src/Optical/OpticalSystem.jl Outdated Show resolved Hide resolved
src/Optical/OpticalSystem.jl Show resolved Hide resolved
src/Optical/OpticalSystem.jl Outdated Show resolved Hide resolved
src/Examples/docs_examples.jl Outdated Show resolved Hide resolved
@alfredclwong alfredclwong requested review from BrianGun and friggog May 11, 2021 11:24
Copy link
Collaborator Author

@alfredclwong alfredclwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@friggog @BrianGun this PR should be ready for merging now

Comment on lines +44 to +46
[4 => 1.0386E-04, 6 => 1.4209E-07, 8 => -8.8495E-09, 10 => 1.2477E-10, 12 => -1.0367E-12, 14 => 3.6556E-15],
[4 => 4.2721E-05, 6 => 1.2484E-07, 8 => 9.7079E-09, 10 => -1.8444E-10, 12 => 1.8644E-12, 14 => -7.7975E-15],
[4 => 1.1339E-04, 6 => 4.8165E-07, 8 => 1.8778E-08, 10 => -5.7571E-10, 12 => 8.9994E-12, 14 => -4.6768E-14],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite a dictionary, but I think Pairs here are more expressive than tuples regarding our intended usage. This will easily convert to a Dict if needed later.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think there is a better way to do this still eg where surface type is the actual type name allowing you to get the constructor for the surface dynamically and then you could pass the parameter dict as keyword args. This is a pretty fundamental change and might mean modifying the surface constructors too (ughh) but would mean that new surface types would be supported directly and there wouldn’t be any need for hard coding stuff when setting up axisymmetric systems.

Anyway this seems reasonable for now, but I think there is a better solution there that might be easiest to achieve by starting almost from scratch on the design of AxisymmetricOpticalSystem

Copy link
Collaborator Author

@alfredclwong alfredclwong May 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean - got the wrong idea earlier!

It'll definitely require a lot of changes, and it'll get mixed up with some other discussions we're having now about prescription DataFrames for non-axisymmetric systems... (although this also means it's a good time for a rewrite). Let's go with this for now - in the short term, all I want is to add support for Zernike surfaces. I'll factor this into our discussions and work towards something smoother in the future.

side note: i'd still like to stick with Vector{Pair} for coefficients

OptimizeRadius = [false, true, true, true, true, true, true, false],
# OptimizeRadius = [false, true, true, true, true, true, true, false],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These columns can be reintroduced later when the Optimization code is more mature. But they shouldn't be used within the AxisymmetricOpticalSystem constructor. Instead, we should have some kind of AxisymmetricOptimization constructor which parses the extra columns.

Project.toml Outdated
@@ -2,7 +2,7 @@ name = "OpticSim"
uuid = "24114763-4efb-45e7-af0e-cde916beb153"
authors = ["Brian Guenter", "Charlie Hewitt", "Ran Gal", "Alfred Wong"]
repository = "https://github.com/microsoft/OpticSim.jl"
version = "0.5.0"
version = "0.5.0-DEV"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need a bug fix from PR #183 before releasing v0.5.0.

@alfredclwong alfredclwong enabled auto-merge (squash) May 12, 2021 17:03
@alfredclwong alfredclwong merged commit 20ddd28 into main May 13, 2021
@alfredclwong alfredclwong deleted the alfred/asos-surfaces branch May 13, 2021 18:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support more surface types in AxisymmetricOpticalSystem
4 participants