The SingleLens.py actually is more like a test area in which it graphs the outputs.  It would not be part of the final solution.  When we actually run the whole system, we won't want those plots for each separate lenslet.  That's why it is a repeat.  For a single lens, imo , if it was divided into functions they would need so many of the constructs that it would be a bigger mess.