atomscale.results.rheed_image.RHEEDImageCollection#
- class atomscale.results.rheed_image.RHEEDImageCollection(rheed_images: list[RHEEDImageResult], extra_data: list[dict] | None = None, sort_key: str | None = None)[source]
Bases:
MSONableCollection of RHEED images
- Parameters:
rheed_images (list[RHEEDImageResult]) – List of RHEEDImageResult objects.
extra_data (list[dict] | None) – List of dictionaries containing field names and values of extra data to be included in the DataFrame object. Defaults to None.
sort_key (str | None) – Key used to sort the data with.
- __init__(rheed_images: list[RHEEDImageResult], extra_data: list[dict] | None = None, sort_key: str | None = None)[source]
Collection of RHEED images
- Parameters:
rheed_images (list[RHEEDImageResult]) – List of RHEEDImageResult objects.
extra_data (list[dict] | None) – List of dictionaries containing field names and values of extra data to be included in the DataFrame object. Defaults to None.
sort_key (str | None) – Key used to sort the data with.
Methods
__init__(rheed_images[, extra_data, sort_key])Collection of RHEED images
align_fingerprints([node_df, inplace, ...])Align a collection of RHEED fingerprints by relabeling the nodes to connect the same scattering features across RHEED patterns, based on relative position to the center feature.
as_dict()A JSON serializable dict representation of an object.
from_dict(d)Reconstruct an MSONable object from a dict.
get_pattern_dataframe([streamline, ...])Featurize the RHEED image collection into a DataFrame of per-node features across all images.
load(file_path)Load an instance from a JSON file written by
save().save(json_path[, mkdir, json_kwargs, ...])Serialize the instance to JSON on disk, pickling fields if needed.
to_json()Returns a json string representation of the MSONable object.
unsafe_hash()Return a hash of the current object.
validate_monty_v1(_MSONable__input_value)Pydantic validator with correct signature for pydantic v1.x.
validate_monty_v2(_MSONable__input_value, _)Pydantic validator with correct signature for pydantic v2.x.
Attributes
REDIRECTextra_datarheed_imagessort_key- align_fingerprints(node_df: DataFrame | None = None, inplace: bool = False, search_range=0.2) RHEEDImageCollection[source]
Align a collection of RHEED fingerprints by relabeling the nodes to connect the same scattering features across RHEED patterns, based on relative position to the center feature.
- Returns:
- A new collection whose RHEED fingerprints have had their nodes
relabeled so that matching scattering features share the same node ID across images.
- Return type:
(RHEEDImageCollection)
- Parameters:
node_df (
DataFrame|None)inplace (
bool)
- get_pattern_dataframe(streamline: bool = True, normalize: bool = True, symmetrize: bool = False, return_as_features: bool = True) tuple[DataFrame, DataFrame][source]
Featurize the RHEED image collection into a DataFrame of per-node features across all images.
- Parameters:
streamline (bool) – Whether to streamline the DataFrame object and remove null values. Defaults to True.
normalize (bool) – Whether to min/max normalize the feature data across all images. Defaults to True.
symmetrize (bool) – Whether to symmetrize the RHEED images and segmented patterns about the vertical axis before obtaining the DataFrame representation. Defaults to False.
return_as_features (bool) – When True, return a wide feature table (one column per feature/node); when False, return the raw per-node rows. Defaults to True.
- Returns:
Pandas DataFrame of per-node features across all images.
- Return type:
(DataFrame)
- as_dict() dict
A JSON serializable dict representation of an object.
- Return type:
dict
- classmethod from_dict(d: dict) MSONable
Reconstruct an MSONable object from a dict.
- Parameters:
d (
dict) – Dict representation.- Return type:
MSONable- Returns:
MSONable class.
- classmethod load(file_path: PathLike | str) MSONable
Load an instance from a JSON file written by
save().- Parameters:
file_path (
PathLike|str) – The JSON file to load from.- Return type:
MSONable- Returns:
An instance of the class being reloaded.
- save(json_path: PathLike | str, mkdir: bool = True, json_kwargs: dict | None = None, pickle_kwargs: dict | None = None, strict: bool = True) None
Serialize the instance to JSON on disk, pickling fields if needed.
For a fully MSONable class, only
{save_dir}/class.jsonis written. For a partially MSONable class, non-serializable attributes are pickled individually into the same directory, keeping the JSON portion readable.- Parameters:
json_path (
PathLike|str) – The file to which to save the JSON object. A pickled companion file with the same stem but a different extension may also be written if the class is not entirely MSONable.mkdir (
bool) – If True, create the target directory (including parents).json_kwargs (
dict|None) – Keyword arguments forwarded to the JSON serializer.pickle_kwargs (
dict|None) – Keyword arguments forwarded topickle.dump.strict (
bool) – If True, refuse to overwrite existing files.
- Return type:
None
- to_json() str
Returns a json string representation of the MSONable object.
- Return type:
str
- unsafe_hash() Any
Return a hash of the current object.
This uses a generic but low performance method of converting the object to a dictionary, flattening any nested keys, and then performing a hash on the resulting object.
- Return type:
Any
- classmethod validate_monty_v1(_MSONable__input_value)
Pydantic validator with correct signature for pydantic v1.x.
- classmethod validate_monty_v2(_MSONable__input_value, _)
Pydantic validator with correct signature for pydantic v2.x.