Scene

class marxs.visualization.x3d.Scene(children=None, **kwargs)[source]

Bases: Scene

X3D Scene with added _repr_html_ for notebook output

This function is ‘Keyword only’ for all args due to the ‘*’.

Attributes Summary

dimension_px

Dimension in pixels for default embedding in HTML.

meta

Dictionary of metadata to add to the X3D header.

Methods Summary

embed_in_X3D()

Embed the scene in a full X3D element.

repr_html_X3DOM()

repr_html_X_ITE()

set_X3D_implementation(implementation)

write_html_archive(base_name, format, *args, ...)

Write to an HTML archive with local copies of js and css requirements.

Attributes Documentation

dimension_px = (600, 400)

Dimension in pixels for default embedding in HTML.

meta: dict[str, Any] = {}

Dictionary of metadata to add to the X3D header.

Methods Documentation

embed_in_X3D() X3D[source]

Embed the scene in a full X3D element.

The root element in an X3D file is the X3D element, but in marxs, we usually just manipulate the scene itself. This method creates the full X3D element with the appropriate header and embeds this scene into it using some sensible defaults. For example, it adds metadata such as the creation date and MARXS version. For more control, manually create that x3d.head and x3d.X3D elements.

Returns

x3d_elementx3d.X3D object

X3D element containing this scene.

repr_html_X3DOM()[source]
repr_html_X_ITE() str[source]
set_X3D_implementation(implementation: Literal['X3DOM', 'X_ITE']) None[source]
write_html_archive(base_name: str, format: str, *args, **kwargs) None[source]

Write to an HTML archive with local copies of js and css requirements.

This zip file can be shared with others and opened in a web browser. In particular, it can be used for journal submission for journals that accept interactive js-based content such as ApJ or AJ.

Parameters

base_namestr

Name of the file to create, including the path, minus any format-specific extension.

format{“zip”, “tar”, “gztar”, “bztar”, “xztar”}

The archive format, see shutil.make_archive for details.

argstuple

Other arguments are passed to shutil.make_archive.

kwargsdict, optional

Other keyword arguments are passed to shutil.make_archive