def create_ipython_console(app, title, view_width, view_ht):
    ' create a iPython console with a rayoptics environment '
    opt_model = app.app_manager.model
    if opt_model:
        ro_env = {'app': app, 'opm': opt_model, 'sm': opt_model.seq_model, 'osp': opt_model.optical_spec, 'pm': opt_model.parax_model}
    else:
        ro_env = {'app': app, 'opm': opt_model}
    ro_setup = 'from rayoptics.environment import *'
    ipy_console = ConsoleWidget()
    ipy_console.execute_command(ro_setup)
    ipy_console.push_vars(ro_env)
    mi = ModelInfo(opt_model)
    sub_window = app.add_subwindow(ipy_console, mi)
    sub_window.setWindowTitle(title)
    (orig_x, orig_y) = app.initial_window_offset()
    sub_window.setGeometry(orig_x, orig_y, view_width, view_ht)
    sub_window.show()
create a iPython console with a rayoptics environment
def create_ipython_console(app, title, view_width, view_ht):
    '  '
    opt_model = app.app_manager.model
    if opt_model:
        ro_env = {'app': app, 'opm': opt_model, 'sm': opt_model.seq_model, 'osp': opt_model.optical_spec, 'pm': opt_model.parax_model}
    else:
        ro_env = {'app': app, 'opm': opt_model}
    ro_setup = 'from rayoptics.environment import *'
    ipy_console = ConsoleWidget()
    ipy_console.execute_command(ro_setup)
    ipy_console.push_vars(ro_env)
    mi = ModelInfo(opt_model)
    sub_window = app.add_subwindow(ipy_console, mi)
    sub_window.setWindowTitle(title)
    (orig_x, orig_y) = app.initial_window_offset()
    sub_window.setGeometry(orig_x, orig_y, view_width, view_ht)
    sub_window.show()