Producing Firefly formatted
.json files using the Python API
Firefly reads formatted JSON files.
While it is certainly possible to produce Firefly formatted
manually (with say, a text editor) we have instead provided a convenient Python frontend
for users to take advantage of.
Reader instance serves to link instances of
each of the below classes.
writeToDisk() method will take the data from each of the
attached instances and collect it into a single
JSONdir, producing each of the
necessary files listed in Understanding Firefly’s input requirements automatically.
To quickly open your own data, you can sub-class
firefly.data_reader.SimpleReader) to parse and re-format your
data while maintaining all of the inherited functionality that the
Reader class offers.
Example sub-classes customized for FIRE simulation data ship with Firefly
and are demonstrated in the corresponding example notebook.
Using with yt
ParticleGroup instances organize coordinate array data
alongside any corresponding field array data.
They also contain lists of boolean flags to signal to the Firefly webapp whether
someone who visits the webapp should be allowed to filter and/or colormap by a
ParticleGroup instance gets its own sub-panel in the UI,
the contents of which can be customized using a
Settings.json file (described below).
Filters and colormaps only apply to the particle groups to which they are attached, there are no
global filter options.
Settings instances allow users to customize the
appearance of the webapp’s UI.
Every element of the UI is toggleable and has a corresponding boolean flag.
In this way, custom instances of Firefly can be created to catered to different audiences without having to change any of the Firefly source code.
The appropriate settings can either be passed at the initialization of a
instance OR can be updated after the fact by accessing the
firefly.data_reader.Settings documentation provides
a comprehensive list of the relevant boolean flags and the UI elements they control.
TweenParams instance allows the user to
pre-define interpolated camera paths (tweening; from in-betweening) that visitors to the Firefly
webapp can activate through the UI (see Camera controls).
Keyframe camera locations are specified and are linearly interpolated to produce a smoothly
varying camera path within the webapp.
This feature is available whenever a
JSONdir contains a
This file will be produced if a
Reader has a
TweenParams attached to it
writeToDisk() method is called.