mjhoptics / ray-optics

geometric ray tracing for optical systems
BSD 3-Clause "New" or "Revised" License
263 stars 54 forks source link

Plots are not printing #115

Closed cbhirsch closed 1 year ago

cbhirsch commented 1 year ago

I'm running the example:

%matplotlib widget

initialization

from rayoptics.environment import * import matplotlib matplotlib.use('Qt5Agg')

root_pth = Path(rayoptics.file).resolve().parent

app = AppManager(None) opm = app.model = OpticalModel() sm = opm['seq_model'] osp = opm['optical_spec'] pm = opm['parax_model'] em = opm['ele_model'] pt = opm['part_tree']

copying the code until: layout_plt0 = plt.figure(FigureClass=InteractiveLayout, opt_model=opm,do_draw_rays=True, do_paraxial_layout=False).plot()

The code runs but it will not display a plot I've tried this in both VScode and Juypter notebook.

mjhoptics commented 1 year ago

Hello @cbhirsch, The rayoptics environment.py file imports a lot of stuff, including matplotlib and pyplot. Can you try moving the environment.py import after the matplotlib.uses('Qt5Agg') statement and see if anything changes? Thanks, Mike Hayford

cbhirsch commented 1 year ago

Where would I move this file too?

cbhirsch commented 1 year ago

This is working now

mjhoptics commented 1 year ago

Good to hear. Mike