EmMotl#

class cryocat.core.cryomotl.EmMotl(input_motl=None, header=None)#

Bases: Motl

Motl subclass for the EM file format used by STOPGAP / TOM / Dynamo.

Parameters:
input_motlEmMotl or pandas.DataFrame or str or Path, optional

Source data. Accepts an existing EmMotl, a correctly formatted DataFrame, or a path to an .em file.

headerdict, optional

EM file header metadata. Defaults to an empty dict.

Raises:
UserInputError

If input_motl is of an unsupported type.

convert_to_motl(input_df)#

Convert input_df to correct motl_df format. In this class, it is expected to have the correct format already and no conversion is provided. If this function is called the format of the input is incorrect and error is raised.

Parameters:
input_dfpandas.DataFrame

DataFrame expected to already be in the standard motl format.

Returns:
None
Raises:
UserInputError

The provided input_df should be in correct format

static read_in(input_path)#

Reads in an EM file and returns a pandas DataFrame and header.

Parameters:
input_pathPathOrStr

The path to the EM file.

Returns:
motl_dfpandas.DataFrame

Particle list.

headerdict

Header from the the parsed EM file.

Raises:
UserInputError

If the provided file does not exist or if it contains a different number of columns than expected.

write_out(output_path)#

Writes out the dataframe as emfile.

Parameters:
output_pathPathOrStr

Name of the file to be written out (including the path).

Returns:
None