Tutorial notebook: minimal working example
Here we use some minimal example data.
[1]:
import numpy as np
[2]:
# Load your data. Here we're creating random data.
coords = np.random.randn( 20000, 3 )
fields = np.random.random(size=coords[:,0].size)
Format Data for Firefly
[3]:
from firefly.data_reader import ArrayReader
[4]:
my_arrayReader = ArrayReader(
coords,
fields=fields,
write_to_disk=False)
datadir is None, defaulting to /Users/agurvich/research/repos/Firefly/src/firefly/static/data/Data
Make sure each field_array (1) has a field_filter_flag (0), assuming True.
Make sure each field_array (1) has a field_colormap_flag (0), assuming True.
Make sure each field_array (1) has a field_radius_flag (0), assuming False.
PGroup_0 - 20000/20000 particles - 1 tracked fields
Display Inline
[5]:
from firefly.server import spawnFireflyServer,quitAllFireflyServers
[6]:
process = spawnFireflyServer()
Waiting up to 10 seconds for background Firefly server to start....done! Your server is available at - http://localhost:5500
[7]:
from IPython.display import IFrame
url = "http://localhost:5500/combined"
IFrame(url, width=1000, height=500)
[7]:
[8]:
# Send data to the server.
# Wait until it loads to run this command
my_arrayReader.sendDataViaFlask()
PGroup_0 - 20000/20000 particles - 1 tracked fields
Posting data on port 5500...data posted!
[9]:
return_code = quitAllFireflyServers()
Server output:
--------------
kill: 35494: No such process
[ ]: