firefly.data_reader.TweenParams

class firefly.data_reader.TweenParams(coords=None, duration=5, loop=True)[source]

Bases: object

A class to store tween parameters and make an output file

__init__(coords=None, duration=5, loop=True)[source]
Create a new tween parameter object, allowing the user to press t from within

the webapp to move between keyframe camera locations smoothly and automatically.

Parameters
  • coords (list of float) – keyframe camera coordinates, list of positions that camera will move between. 3 acceptable input formats: * [x,y,z] single keyframe * [[x1,y1,z1],[x2,y2,z2],…] multiple keyframes * [x1,y1,z1,x2,y2,z2,…] multiple flattened keyframes, defaults to []

  • duration (float/list of float) –

    duration to approach keyframe in seconds. 3 acceptable input formats: * d single duration (will be repeated) * [d] single duration in list (will be repeated) * [d1,d2,…] multiple durations (corresponding to number of keyframes or

    raises an error),

    defaults to 5

  • loop (bool, optional) – flag to loop after reaching the last keyframe, defaults to True

__weakref__

list of weak references to the object (if defined)

addKeyframe(coords, duration)[source]

Adds a new keyframe to an existing TweenParams object.

Parameters
  • coords (list of float) –

    keyframe camera coordinates, list of positions that camera will move between 3 acceptable input formats:

    • [x,y,z] single keyframe

    • [[x1,y1,z1],[x2,y2,z2],…] multiple keyframes

    • [x1,y1,z1,x2,y2,z2,…] multiple flattened keyframes

  • duration (float/list of float) –

    duration to approach keyframe, 3 acceptable input formats: * d single duration (will be repeated) * [d] single duration in list (will be repeated) * [d1,d2,…] multiple durations (corresponding to number of keyframes or

    raises an error)

Raises
  • np.AxisError – if len of coords is not divisible by 3

  • np.AxisError – if len of durations does not match len of coords

outputToDict()[source]

Converts stored data into a single python dictionary.

Returns

tween_params_dict

Return type

dict

outputToJSON(JSONdir, JSON_prefix='', filename=None, loud=1, write_jsons_to_disk=True, not_reader=True)[source]

Saves the current tween parameters to a JSON file.

Parameters
  • JSONdir (str, optional) – the sub-directory that will contain your JSON files, relative to your $HOME directory. , defaults to $HOME/<JSON_prefix>

  • JSON_prefix (str, optional) – Prefix for any .json files created, .json files will be of the format: <JSON_prefix><filename>.json, defaults to ‘Data’

  • filename (str, optional) – name of settings .json file, defaults to self.settings_filename

  • JSON_prefix – string that is prepended to filename, defaults to ‘’

  • loud (bool, optional) – flag to print status information to the console, defaults to True

  • write_jsons_to_disk (bool, optional) – flag that controls whether data is saved to disk (True) or only converted to a string and returned (False), defaults to True

  • not_reader – flag for whether to print the Reader filenames.json warning, defaults to True

Raises

NotImplementedError – if filename is anything but None TODO: need to check on this if the webapp actually requires it have a specific name.

Returns

filename, JSON(tween_params_dict) (either a filename if written to disk or a JSON strs)

Return type

str, str