chromatix-team / chromatix

Differentiable wave optics using JAX! Documentation can be found at https://chromatix.readthedocs.io
MIT License
71 stars 12 forks source link

Trainable kwarg #95

Closed GJBoth closed 1 year ago

GJBoth commented 1 year ago

This PR overhauls our trainable selection. We now have a simple Trainable class which just wraps any value, and comes from trainable so the API is the same. Also overhauls the internal structure - we can now register non-trainable parameters which are callables too (for example, non-traineable phasemask based on field shape).

This slightly changes how to train as we now need to separate trainable and non-trainable parameters from each other - I've also updated the notebook about training. This doesn't change much as the Propagation method was already using variables to cache the propagator.