Skip to content

Commit

Permalink
Improve doc
Browse files Browse the repository at this point in the history
  • Loading branch information
sofiia-chorna committed Sep 4, 2024
1 parent 149d783 commit d5e3873
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
3 changes: 3 additions & 0 deletions python/chemiscope/explore.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def explore(frames, featurize=None, properties=None, environments=None, mode="de
cores for parallelization. PCA reduces the dimensionality to two components by
default.
If `environments` is provided, frames and properties are filtered to include only
those related to the environments.
:param list frames: list of frames
:param callable featurize: optional. Function to compute features and perform
Expand Down
24 changes: 15 additions & 9 deletions python/examples/7-explore-advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,16 @@ def mace_mp0_tsne(frames, environments):

# %%
#
# Example usage of environments with SOAP and t-SNE
# +++++++++++++++++++++++++++++++++++++++++++++++++++++
# Example Usage of SOAP and t-SNE with environments
# +++++++++++++++++++++++++++++++++++++++++++++++++
#
# In this example, we demonstrate how to use the SOAP to compute atomic
# descriptors and then visualize them using t-SNE.
#
# Provide a created function and environments to :py:func:`chemiscope.explore`.
# Use the defined ``soap_tnse_with_environments``` function to compute t-SNE embeddings
# and explore them with a widget.
# This example demonstrates how to compute descriptors using the SOAP and t-SNE with
# ``environments`` parameter specifying which atoms in the frames are used for
# calculating the descriptors.
#
# We are defining a custom featurizer that takes frames and environments. Note, that the
# frames corresponding to the ``environments`` will already be picked internally once
# :py:func:`chemiscope.explore` is executed.


def soap_tnse_with_environments(frames, environments):
Expand Down Expand Up @@ -241,7 +241,13 @@ def soap_tnse_with_environments(frames, environments):
return reducer.fit_transform(feats)


cs = chemiscope.explore(
# %%
#
# Provide a created function and environments to :py:func:`chemiscope.explore`. The
# environments are manually defined following the format ``[index of structure, index
# of atom, cutoff]``.

chemiscope.explore(
frames=m3cd_frames,
featurize=soap_tnse_with_environments,
environments=[(1, 2, 3.5), (2, 0, 3.5)],
Expand Down

0 comments on commit d5e3873

Please sign in to comment.