示例#1
0
def test_animate_calls_figure(mock_figure):
    r = [306 * u.m, np.pi / 2 * u.rad, np.pi / 2 * u.rad]
    v = [0 * u.m / u.s, 0 * u.rad / u.s, 951.0 * u.rad / u.s]
    m = 4e24 * u.kg
    el = 0.002
    ss = 0.5e-6
    cl = ScatterGeodesicPlotter(m)
    cl.animate(r, v, el, ss)
    mock_figure.assert_called_with()
示例#2
0
def test_plot_calls_plot_attractor(mock_plot_attractor):
    r = [306 * u.m, np.pi / 2 * u.rad, np.pi / 2 * u.rad]
    v = [0 * u.m / u.s, 0 * u.rad / u.s, 951.0 * u.rad / u.s]
    m = 4e24 * u.kg
    el = 0.002
    ss = 0.5e-6
    cl = ScatterGeodesicPlotter(m)
    cl.plot(r, v, el, ss)
    mock_plot_attractor.assert_called_with()
示例#3
0
def test_plot_save_saves_plot(mock_save, dummy_data):
    sph_obj, _, m, _, el, ss = dummy_data
    cl = ScatterGeodesicPlotter(m)
    cl.plot(sph_obj, el, ss)
    name = "test_plot.png"
    cl.save(name)
    mock_save.assert_called_with(name)
示例#4
0
def test_plot_save_saves_plot(mock_save):
    r = [306 * u.m, np.pi / 2 * u.rad, np.pi / 2 * u.rad]
    v = [0 * u.m / u.s, 0 * u.rad / u.s, 951.0 * u.rad / u.s]
    m = 4e24 * u.kg
    el = 0.002
    ss = 0.5e-6
    cl = ScatterGeodesicPlotter(m)
    cl.plot(r, v, el, ss)
    name = "test_plot.png"
    cl.save(name)
    mock_save.assert_called_with(name)
示例#5
0
def test_plot_attractor_is_called_only_once(dummy_data):
    r, v, _, m, _, el, ss = dummy_data
    cl = ScatterGeodesicPlotter(m)
    assert cl._attractor_present == False
    cl.plot(r, v, el, ss)
    assert cl._attractor_present == True
# Create a trace
trace = go.Scatter(
    x=pos_x,
    y=pos_y,
)

data = [trace]

# Plot and embed in ipython notebook!
iplot(data, filename='basic-scatter')

# In[ ]:

get_ipython().run_line_magic('matplotlib', 'inline')
obj = ScatterGeodesicPlotter(M)
obj.plot(pos, vel, 0.002, 5e-8)
obj.show()

# In[ ]:

get_ipython().system('ls')

# In[ ]:

# In[ ]:

import numpy as np
import astropy.units as u
import matplotlib.pyplot as plt
from einsteinpy.utils import kerr_utils, schwarzschild_radius
示例#7
0
def test_plot_show_shows_plot(mock_show, dummy_data):
    sph_obj, _, m, _, el, ss = dummy_data
    cl = ScatterGeodesicPlotter(m)
    cl.plot(sph_obj, el, ss)
    cl.show()
    mock_show.assert_called_with()
示例#8
0
def test_animate_calls_figure(mock_figure, dummy_data):
    sph_obj, _, m, _, el, ss = dummy_data
    cl = ScatterGeodesicPlotter(m)
    cl.animate(sph_obj, el, ss)
    mock_figure.assert_called_with()
示例#9
0
def test_plot_calls_plot_attractor(mock_plot_attractor, dummy_data):
    sph_obj, _, m, _, el, ss = dummy_data
    cl = ScatterGeodesicPlotter(m)
    cl.plot(sph_obj, el, ss)
    mock_plot_attractor.assert_called_with()
示例#10
0
def test_plot_attractor_is_called_only_once(dummy_data):
    sph_obj, _, m, _, el, ss = dummy_data
    cl = ScatterGeodesicPlotter(m)
    assert not cl._attractor_present
    cl.plot(sph_obj, el, ss)
    assert cl._attractor_present