matcal.core.qoi_extractor
This module contains all classes related to data QoI extractors. Most are user facing classes that can be added to objectives, however, there a few that are not intended for users.
Classes
This is a wrapper class for a QOI extractor lookup and execution that looks like a QOI extractor such that it is invisible to external users |
|
|
THe InterpolatingExtractor QoIExtractor will return the field values of the working data at the independent field values of the reference data. |
|
The MaxExtractor QoI Extractor will return the field values of all fields at the max value of the analyzed field. |
This is the default QoI Extractor. |
|
This is a general wrapper class that allows for different instances of a qoi extractor to exist for different data states. |
|
|
The UserDefinedExtractor QoIExtractor will extract the data according to a user specified python function. |
- class matcal.core.qoi_extractor.QoIExtractorBase[source]
Base class for quantity of interest (QoI) extractors not intended for users.
- class matcal.core.qoi_extractor.ReturnPassedDataExtractor[source]
This is the default QoI Extractor. The data just passes through it. If it is used in an objective, the objective will attempt to subtract the experimental data from the simulation data as it is read in from the files.
- class matcal.core.qoi_extractor.StateSpecificExtractorWrapper[source]
This is a general wrapper class that allows for different instances of a qoi extractor to exist for different data states. It has the same interface as a QOI extractor, thus should be almost indistinguishable from a regular qoi extractor
- class matcal.core.qoi_extractor.DataSpecificExtractorWrapper[source]
This is a wrapper class for a QOI extractor lookup and execution that looks like a QOI extractor such that it is invisible to external users
- class matcal.core.qoi_extractor.MaxExtractor(analyzed_field, max_index=0)[source]
The MaxExtractor QoI Extractor will return the field values of all fields at the max value of the analyzed field. This can useful when calibrating to the peak load or displacement at peak load for a solid mechanics calibration or the max temperature or time of the max temperature for a thermal calibration.
- Parameters:
analyzed_field (int) – the maximum of this field is where all data fields will be extracted and returned.
max_index (int) – If there are multiple maximum values for the analyzed field, this index can be used to select which value to return.
- Raises:
TypeError – If the wrong types are passed into the constructor.
- class matcal.core.qoi_extractor.InterpolatingExtractor(independent_field, left=None, right=None, period=None)[source]
THe InterpolatingExtractor QoIExtractor will return the field values of the working data at the independent field values of the reference data. If the InterpolatingExtractor is applied to the simulation data, the simulation data will be interpolated onto the experimental data independent field values.
Note: In order to use the interpolation algorithm, the independent variable for interpolation must be monotonically increasing. As a result, MatCal automatically sorts the data so that the independent variable is monotonically increasing in order to conform to this requirement. If this is not desired, create a UserDefinedExtractor to meet your needs.
- Parameters:
independent_field (str) – The field to be used as the independent variable for interpolation.
left (float) – the left parameter as described in the NumPy interp function.
right (float) – the right parameter as described in the NumPy interp function
period (float) – the period parameter as described in the NumPy interp function
- Raises:
TypeError – If the wrong types are passed into the constructor.
- class matcal.core.qoi_extractor.UserDefinedExtractor(function, *required_experiment_fields)[source]
The UserDefinedExtractor QoIExtractor will extract the data according to a user specified python function.
The function is passed three arguments: working_data, reference data and the fields of interest for the objective. The working data is the data from which the QoIs must be extracted. The reference data is the data the working data is being compared to. For example, if the extractor is applied to the simulation data, the reference data is the corresponding experimental data. The working and reference data are passed as
Dataobjects and the function must return a dictionary with keys corresponding to the fields of interest for the objective.- Parameters:
function (FunctionType) –
a callable function that takes the working
Dataobject, referenceDataobject, and a list of strings containing the field names the extractor must return extracted data for. The function must return data as a dictionary with keys for all fields of interest. The function is as follows:def my_qoi_extractor_function(working_data, reference_data, return_keys_list): working_qois = {} #Do something with reference_data and working_data to calculate working qois. #If needed, verify string in return_keys_list are in working_qois.field_names. return working_qois
required_experiment_fields – list of strings that denote data experimental data fields are required for the QoI extractor to perform its QoI extraction.
- Raises:
TypeError – if the function is not callable