atomicds.results.rheed_image.RHEEDImageResult

class atomicds.results.rheed_image.RHEEDImageResult(data_id: UUID | str, processed_image: Image, pattern_graph: Graph | None, metadata: dict | None = None)[source]

Bases: MSONable

RHEED image result

Parameters:
  • data_id (UUID | str) – Data ID for the entry in the data catalogue.

  • processed_image (Image) – Processed image data in a PIL Image format.

  • pattern_graph (Graph | None) – NetworkX Graph object for the extracted diffraction pattern.

  • metadata (dict) – Generic metadata (e.g. timestamp, cluster_id, etc…).

__init__(data_id: UUID | str, processed_image: Image, pattern_graph: Graph | None, metadata: dict | None = None)[source]

RHEED image result

Parameters:
  • data_id (UUID | str) – Data ID for the entry in the data catalogue.

  • processed_image (Image) – Processed image data in a PIL Image format.

  • pattern_graph (Graph | None) – NetworkX Graph object for the extracted diffraction pattern.

  • metadata (dict) – Generic metadata (e.g. timestamp, cluster_id, etc…).

Methods

__init__(data_id, processed_image, pattern_graph)

RHEED image result

as_dict()

A JSON serializable dict representation of an object.

from_dict(d)

get_laue_zero_radius()

Get the radius of the zeroth order Laue zone.

get_partial_json([json_kwargs, pickle_kwargs])

get_pattern_dataframe([extra_data, ...])

Featurize the RHEED image collection into a dataframe of node features and edge features.

get_plot([show_mask, show_spot_nodes, ...])

Get diffraction pattern image with optional overlays

load(file_path)

Loads a class from a provided json file.

save(json_path[, mkdir, json_kwargs, ...])

Utility that uses the standard tools of MSONable to convert the class to json format, but also save it to disk.

to_json()

Returns a json string representation of the MSONable object.

unsafe_hash()

Returns an 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

REDIRECT

get_plot(show_mask: bool = True, show_spot_nodes: bool = True, symmetrize: bool = False, alpha: float = 0.2) Image[source]

Get diffraction pattern image with optional overlays

Parameters:
  • show_mask (bool) – Whether to show mask overlay of identified pattern. Defaults to True.

  • show_spot_nodes (bool) – Whether to show identified diffraction node overlays. Defaults to True.

Returns:

PIL Image object with optional overlays

Return type:

(Image)

get_laue_zero_radius() tuple[float, tuple[float, float]][source]

Get the radius of the zeroth order Laue zone. Note that the data is symmetrized across the vertical axis before the Laue zone is searched for.

Returns:

Tuple containing the best fit radius and center point.

Return type:

(tuple[float, tuple[float, float]])

get_pattern_dataframe(extra_data: dict | None = None, symmetrize: bool = False, return_as_features: bool = False) DataFrame[source]

Featurize the RHEED image collection into a dataframe of node features and edge features.

Parameters:
  • extra_data (dict | None) – Dictionary containing field names and values of extra data to be included in the DataFrame object. Defaults to None.

  • symmetrize (bool) – Whether to symmetrize the data across the vertical axis. Defaults to False.

  • return_as_features (bool) – Whether to return a feature-foward version of the DataFrame. Defaults to False.

Returns:

Pandas DataFrame object of RHEED node and edge features.

Return type:

(DataFrame)

as_dict() dict

A JSON serializable dict representation of an object.

classmethod from_dict(d)
Parameters:

d – Dict representation.

Returns:

MSONable class.

get_partial_json(json_kwargs=None, pickle_kwargs=None)
Parameters:
  • json_kwargs (dict) – Keyword arguments to pass to the serializer.

  • pickle_kwargs (dict) – Keyword arguments to pass to pickle.dump.

Returns:

The json encoding of the class and the name-object map if one is required, otherwise None.

Return type:

str, dict

classmethod load(file_path)

Loads a class from a provided json file.

Parameters:

file_path (os.PathLike) – The json file to load from.

Returns:

An instance of the class being reloaded.

Return type:

MSONable

save(json_path, mkdir=True, json_kwargs=None, pickle_kwargs=None, strict=True)

Utility that uses the standard tools of MSONable to convert the class to json format, but also save it to disk. In addition, this method intelligently uses pickle to individually pickle class objects that are not serializable, saving them separately. This maximizes the readability of the saved class information while allowing _any_ class to be at least partially serializable to disk.

For a fully MSONable class, only a class.json file will be saved to the location {save_dir}/class.json. For a partially MSONable class, additional information will be saved to the save directory at {save_dir}. This includes a pickled object for each attribute that e serialized.

Parameters:
  • file_path (os.PathLike) – The file to which to save the json object. A pickled object of the same name but different extension might also be saved if the class is not entirely MSONable.

  • mkdir (bool) – If True, makes the provided directory, including all parent directories.

  • json_kwargs (dict) – Keyword arguments to pass to the serializer.

  • pickle_kwargs (dict) – Keyword arguments to pass to pickle.dump.

  • strict (bool) – If True, will not allow you to overwrite existing files.

to_json() str

Returns a json string representation of the MSONable object.

unsafe_hash()

Returns an 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

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