MCPcopy Create free account
hub / github.com/NanoComp/meep / _embedded_frames

Method _embedded_frames

python/visualization.py:1653–1667  ·  view source on GitHub ↗
(self, frame_list: list, frame_format: str)

Source from the content-addressed store, hash-verified

1651 self._saved_frames.append(bin_data.getvalue())
1652
1653 def _embedded_frames(self, frame_list: list, frame_format: str) -> str:
1654 # converts frame data stored in memory to html5 friendly format
1655 # frame_list should be a list of base64-encoded png files
1656 # modified from matplotlib
1657 import base64
1658
1659 template = ' frames[{0}] = "data:image/{1};base64,{2}"\n'
1660 return "\n" + "".join(
1661 template.format(
1662 i,
1663 frame_format,
1664 base64.encodebytes(frame_data).decode("ascii").replace("\n", "\\\n"),
1665 )
1666 for i, frame_data in enumerate(frame_list)
1667 )
1668
1669 def to_jshtml(self, fps: int) -> JS_Animation:
1670 """

Callers 1

to_jshtmlMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected