gemseo.core.discipline.data_processor module#

The data conversion processors.

class ComplexDataProcessor[source]#

Bases: DataProcessor

Data preprocessor to convert complex arrays to float arrays back and forth.

post_process_data(data)[source]#

Execute a post-processing of the output data.

Parameters:

data (StrKeyMapping) -- The data to process.

Returns:

The processed data.

Return type:

MutableStrKeyMapping

pre_process_data(data)[source]#

Pre-process data.

Parameters:

data (StrKeyMapping) -- The data to process.

Returns:

The processed data.

Return type:

MutableStrKeyMapping

class DataProcessor[source]#

Bases: object

Base class for pre- and post-processing data.

This is useful to cast the data types, since the GEMSEO kernel only handles numpy arrays, and interfaces to disciplinary tools, workflow engines or environment can require different types.

abstract post_process_data(data)[source]#

Execute a post-processing of the output data.

Parameters:

data (StrKeyMapping) -- The data to process.

Returns:

The processed data.

Return type:

MutableStrKeyMapping

abstract pre_process_data(data)[source]#

Pre-process data.

Parameters:

data (StrKeyMapping) -- The data to process.

Returns:

The processed data.

Return type:

MutableStrKeyMapping

class FloatDataProcessor[source]#

Bases: DataProcessor

A data preprocessor that converts all scalar input data to floats.

It converts all discipline output data to numpy arrays

post_process_data(data)[source]#

Execute a post-processing of the output data.

Parameters:

data (StrKeyMapping) -- The data to process.

Returns:

The processed data.

Return type:

MutableStrKeyMapping

pre_process_data(data)[source]#

Pre-process data.

Parameters:

data (StrKeyMapping) -- The data to process.

Returns:

The processed data.

Return type:

MutableStrKeyMapping

class NameMapping(mapping)[source]#

Bases: DataProcessor

A data preprocessor to map process level names to local discipline names.

Initialize self. See help(type(self)) for accurate signature.

Parameters:

mapping (Mapping[str, str]) -- A mapping structure of the form {global_name: local_name} where global_name must be consistent with the grammar of the discipline. The local name is the data provided to the Discipline._run() method. When missing, the global name is the local name.

post_process_data(data)[source]#

Execute a post-processing of the output data.

Parameters:

data (StrKeyMapping) -- The data to process.

Returns:

The processed data.

Return type:

MutableStrKeyMapping

pre_process_data(data)[source]#

Pre-process data.

Parameters:

data (StrKeyMapping) -- The data to process.

Returns:

The processed data.

Return type:

MutableStrKeyMapping

mapping: Mapping[str, str]#

The mapping structure of the form {global_name: local_name}.

reverse_mapping: Mapping[str, str]#

The reverse mapping structure of the form {local_name: global_name}.