import emerge as em
import emerge.plot as plt
import numpy as np

# Constants
cm = 0.01
mm = 0.001
mil = 0.0254
um = 0.000001
PI = np.pi

with em.Simulation("myfile", load_file=True) as m:
    
    data = m.data.mw.scalar.grid

    f = data.freq
    S11 = data.S(1,1)
    S21 = data.S(2,1)
    plt.plot_sp(f/1e9, [S11, S21])

    m.set_mesh(m.data.mw.field[0].mesh)
    m.display.add_object(m['box'])
    m.display.add_surf(*m.data.mw.field[0].cutplane(1*mm, z=5*mm).scalar('Ez','real'))
    m.display.show()
