Skip to content

Commit

Permalink
Allow to give settings to chemiscope.explore
Browse files Browse the repository at this point in the history
  • Loading branch information
Luthaf committed Oct 15, 2024
1 parent 42b1d9b commit ab07d59
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 28 deletions.
24 changes: 18 additions & 6 deletions python/chemiscope/explore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
__all__ = ["explore", "metatensor_featurizer"]


def explore(frames, featurize=None, properties=None, environments=None, mode="default"):
def explore(
frames,
featurize=None,
properties=None,
environments=None,
settings=None,
mode="default",
):
"""
Automatically explore a dataset containing all structures in ``frames``.
Expand All @@ -32,11 +39,14 @@ def explore(frames, featurize=None, properties=None, environments=None, mode="de
with the atomic structures. Properties can be extracted from frames with
:py:func:`extract_properties` or manually defined by the user.
:param environments: optional. List of environments (described as
``(structure id, center id, cutoff)``) to include when extracting the
atomic properties. Can be extracted from frames with
:py:func:`all_atomic_environments`.
or manually defined.
:param environments: optional. List of environments (described as ``(structure id,
center id, cutoff)``) to include when extracting the atomic properties. Can be
extracted from frames with :py:func:`all_atomic_environments`. or manually
defined.
:param dict settings: optional dictionary of settings to use when displaying the
data. Possible entries for the ``settings`` dictionary are documented in the
chemiscope input file reference.
:param str mode: optional. Visualization mode for the chemiscope widget. Can be one
of "default", "structure", or "map". The default mode is "default".
Expand Down Expand Up @@ -121,6 +131,8 @@ def soap_kpca_featurize(frames, environments):
return show(
frames=frames,
properties=properties,
shapes=None,
environments=environments,
settings=settings,
mode=mode,
)
42 changes: 20 additions & 22 deletions python/chemiscope/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,28 +176,26 @@ def show(
mode="default",
):
"""
Show the dataset defined by the given ``frames`` and ``properties``
(optionally ``meta``, ``environments`` and ``shapes`` as well) using an embedded
chemiscope visualizer inside a Jupyter notebook. These parameters have the same
meaning as in the :py:func:`chemiscope.create_input` function.
The ``mode`` keyword also allows overriding the default two-panels
visualization to show only a structure panel (``mode = "structure"``) or the
map panel (``mode = "map"``). These modes also make it possible to view a
dataset for which properties (or frames) are not available.
When inside a jupyter notebook, the returned object will create a new
chemiscope visualizer displaying the dataset. The object exposes a
`settings` traitlet, that allows to modify the visualization options
(possibly even linking the parameters to another widget). Printing the value
of the `settings` property is also a good way to see a full list of the
available options.
The returned object also have a ``save`` function that can be used to save
the dataset to a ``.json`` or ``.json.gz`` file to load it in the main website
later. The visualization options will be those used in the active widget, so
this is also a good way to tweak the appearence of the visualization before
saving it.
Show the dataset defined by the given ``frames`` and ``properties`` (optionally
``meta``, ``environments`` and ``shapes`` as well) using an embedded chemiscope
visualizer inside a Jupyter notebook. These parameters have the same meaning as in
the :py:func:`chemiscope.create_input` function.
The ``mode`` keyword also allows overriding the default two-panels visualization to
show only a structure panel (``mode = "structure"``) or the map panel (``mode =
"map"``). These modes also make it possible to view a dataset for which properties
(or frames) are not available.
When inside a jupyter notebook, the returned object will create a new chemiscope
visualizer displaying the dataset. The object exposes a ``settings`` traitlet, that
allows to modify the visualization options (possibly even linking the parameters to
another widget). Printing the value of the ``settings`` property is also a good way
to see a full list of the available options.
The returned object also have a ``save`` function that can be used to save the
dataset to a ``.json`` or ``.json.gz`` file to load it in the main website later.
The visualization options will be those used in the active widget, so this is also a
good way to tweak the appearance of the visualization before saving it.
.. code-block:: python
Expand Down

0 comments on commit ab07d59

Please sign in to comment.