In [ ]:
import json
import numpy as np
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.graph_objs as go
import plotly_arrows as plar
init_notebook_mode(connected=True)
import boundaries_JSON_output as EM

In [ ]:
data = {
    pol: [
        [EM.run(angle=angle, polarisation=pol, n1=1., n2=n) for angle in np.linspace(0, 85, 20)]
        for n in np.linspace(0.5, 2, 10)
    ] for pol in ['s', 'p']
}

In [ ]:
with open('dielectric_boundary_data.JSON', 'w') as outfile:  
    json.dump(data, outfile)

In [ ]:
with open('dielectric_boundary_data.JSON') as json_data:
    plot_data = json.load(json_data)
    #print(plot_data)
    
    layout = {
    'autosize': True,
    'width': 700, 'height': 700,
    'scene': {
        'aspectmode': 'cube',
        'xaxis': {'range': [-1, 1], 'autorange': False, 'zeroline': True},
        'yaxis': {'range': [-1, 1], 'autorange': False, 'zeroline': True},
        'zaxis': {'range': [-1, 1], 'autorange': False, 'zeroline': True},
        'camera': {
            'up': {'x': 0, 'y': 1, 'z': 0} # DOESN'T WORK -- WHY NOT!?
        }
    }
}

fig = go.Figure(data=plot_data['s'][2][10], layout=layout)
iplot(fig)

In [ ]:
data={'p':[1], 's':[2]}

In [ ]:
data

In [ ]: