예제 #1
0
def test_add_conepill():
    with patch('rockets.AsyncClient.connected', new=mock_connected), \
         patch('brayns.utils.http_request', new=mock_http_request), \
         patch('brayns.utils.in_notebook', new=mock_not_in_notebook), \
         patch('rockets.Client.request', new=mock_ce_rpc_request), \
         patch('rockets.Client.batch', new=mock_batch):
        app = brayns.Client('localhost:8200')
        ce = CircuitExplorer(app)
        response = ce.add_conepill(
            p1=(-1,0,0),
            p2=(1,0,0),
            radius1=1.0,
            radius2=1.0,
            color=(1,1,1,1))
        assert_equal(response, {'ok'})
예제 #2
0
def test_set_materials():
    with patch('rockets.AsyncClient.connected', new=mock_connected), \
         patch('brayns.utils.http_request', new=mock_http_request), \
         patch('brayns.utils.in_notebook', new=mock_not_in_notebook), \
         patch('rockets.Client.request', new=mock_ce_rpc_request), \
         patch('rockets.Client.batch', new=mock_batch):
        app = brayns.Client('localhost:8200')
        ce = CircuitExplorer(app)
        simulation_data_casts = list()
        opacities = list()
        refraction_indices = list()
        reflection_indices = list()
        shading_modes = list()
        diffuse_colors = list()
        specular_colors = list()
        specular_exponents = list()
        material_ids = list()
        glossinesses = list()
        emissions = list()
        clips = list()

        palette = [(1, 1, 1), (1, 1, 1)]

        nb_materials = len(palette)
        for i in range(nb_materials):
            material_ids.append(i)
            simulation_data_casts.append(False)
            opacities.append(1)
            refraction_indices.append(1.5)
            reflection_indices.append(0)
            color = palette[i]
            specular_exponents.append(100)
            glossinesses.append(1.0)
            diffuse_colors.append(color)
            specular_colors.append((1, 1, 1))
            shading_modes.append(ce.SHADING_MODE_CARTOON)
            emissions.append(0)
            clips.append(True)

        response = ce.set_materials(
            model_ids=[0], material_ids=material_ids,
            simulation_data_casts=simulation_data_casts,
            opacities=opacities, reflection_indices=reflection_indices,
            shading_modes=shading_modes,
            diffuse_colors=diffuse_colors, specular_colors=specular_colors,
            specular_exponents=specular_exponents, glossinesses=glossinesses,
            emissions=emissions, refraction_indices=refraction_indices)
        assert_equal(response, {'ok'})
예제 #3
0
def test_add_grid():
    with patch('rockets.AsyncClient.connected', new=mock_connected), \
         patch('brayns.utils.http_request', new=mock_http_request), \
         patch('brayns.utils.in_notebook', new=mock_not_in_notebook), \
         patch('rockets.Client.request', new=mock_ce_rpc_request), \
         patch('rockets.Client.batch', new=mock_batch):
        app = brayns.Client('localhost:8200')
        ce = CircuitExplorer(app)
        response = ce.add_grid(min_value=0,
                               max_value=100,
                               interval=10,
                               radius=1,
                               opacity=1,
                               show_axis=True,
                               colored=True)
        assert_equal(response, {'ok'})
예제 #4
0
def test_export_frames_to_disk():
    with patch('rockets.AsyncClient.connected', new=mock_connected), \
         patch('brayns.utils.http_request', new=mock_http_request), \
         patch('brayns.utils.in_notebook', new=mock_not_in_notebook), \
         patch('rockets.Client.request', new=mock_ce_rpc_request), \
         patch('rockets.Client.batch', new=mock_batch):
        app = brayns.Client('localhost:8200')
        ce = CircuitExplorer(app)
        response = ce.export_frames_to_disk(path='/tmp',
                                            animation_frames=[0],
                                            camera_definitions=[[
                                                (0.0, 0.0, 0.0), (0.0, 0.0,
                                                                  1.0),
                                                (0.0, 1.0, 0.0)
                                            ]])
        assert_equal(response, {'ok'})