7. i-SAS_SensorPostprocessor

7.1. interface

class sensor_postprocessor.interface.Interface(instance_name, input_names, output_names, postprocess, structural_model_name=None, **kwargs)

Bases: object

interface class of sensor postprocessor

package_name = 'sensor_postprocessor'
structural_model_required = False
__init__(instance_name, input_names, output_names, postprocess, structural_model_name=None, **kwargs)

initialization of interface class of sensor postprocessor

Parameters
  • instance_name (str) – instance name.

  • input_names (dict) – dict whose keys are names of input quantity and values are names of input data.

  • output_names (dict) – dict whose keys are names of output quantity and values are names of output data.

  • postprocess (list) – list of processing class instances which apply to data

  • structural_model_name (str, optional) – structural model name.

  • **kwargs – Arbitrary keyword arguments.

Example

>>> input_names = {'strain': ['rosette_strain_x', 'rosette_strain_y', 'rosette_strain_xy']}
>>> output_names =
        {'strain': ['postprocessed_strain_x', 'postprocessed_strain_y', 'postprocessed_strain_xy']}
>>> start_timestamp = 1587772811000000000
>>> end_timestamp = 1587772911000000000
>>> delta_t = 10000000000
>>> postprocess = [Extract(start_timestamp, end_timestamp),
                   TimestampChanging('interpolate', 'linear', start_timestamp, end_timestamp, delta_t),
                   Detrand()]
>>> interface = Interface(input_names, output_names, postprocess)
set_project(project_name)
Parameters

project_name (str) – project name.

set_model(output_metadata, sensors, structural_models, structural_model_connections, streaming=False)

set structural model

Parameters
  • output_metadata (pd.DataFrame) – output metadata.

  • sensors (dict) – sensors.

  • structural_models (dict) – structural models.

  • structural_model_connections (dict) – connections between data and structural model.

  • streaming (bool, optional) – if true, run as structural_analysis.

Returns

containing followings

dict: information on instance of this model. pandas.DataFrame: output metadata of this model. dict: connections between output data of this model and structural model.

Return type

tuple

__call__(input_data)

calculate quantity of state

Parameters

input_data (dict) – data calculated before

Returns

containing:

dict: analysis data. pandas.DataFrame: timestamp used. The length is the same as analysis data.

Return type

tuple

exit()

exit solver

7.2. model

class sensor_postprocessor.model.Model(input_names, output_names, postprocess, structural_model_name, cfg)

Bases: object

model class

__init__(input_names, output_names, postprocess, structural_model_name, cfg)

constructor

Parameters
  • input_names (dict) – dict whose keys are names of input quantity and values are names of input data.

  • output_names (dict) – dict whose keys are names of output quantity and values are names of output data.

  • postprocess (list) – list of processing class instances which apply to data

  • structural_model_name (str, optional) – structural model name.

  • cfg (dict) – config.

set_model(output_metadata, sensors, structural_models, structural_model_connections, streaming)

set model and calculate intermediate values

Parameters
  • output_metadata (pd.DataFrame) – output metadata.

  • sensors (dict) – sensors.

  • structural_models (dict) – structural models.

  • structural_model_connections (dict) – connections between data and structural model.

  • streaming (bool) – if true, run as structural_analysis.

__call__(input_data)

calculate analysis data from input using functions

Parameters

input_data (dict) – input data.

Returns

containing followings,
dict: analysis data. the key is output_quantity_name, and the value is the list, which

has data value (the type is pandas.DataFrame) as element corresponding to its data name.

dict: used timestamp for each input data. Dict has two keys, ‘s’ as strating timestamp and

’e’ as end time stamp, and the value is 1d-array of the timestamp used to caclulate output, whose length is the same as the length of output.

Return type

tuple

7.3. process

processing classes in i-SAS_SensorPostprocessor

class sensor_postprocessor.process.Extract(start_timestamp, end_timestamp)

Bases: object

extract data

__init__(start_timestamp, end_timestamp)

initialization of extract class :param start_timestamp: extracts the data with timestamps after start_timestamp :type start_timestamp: int :param end_timestamp: extracts the data with timestamps before end_timestamp :type end_timestamp: int

__call__(data)

execute

Parameters

data (pd.DataFrame) – input data

Returns

extracted data

Return type

pd.DataFrame

class sensor_postprocessor.process.TimestampChanging(start_timestamp, end_timestamp, delta_t, interp_kind='linear', extrap_kind='linear')

Bases: object

change timestamp of data

__init__(start_timestamp, end_timestamp, delta_t, interp_kind='linear', extrap_kind='linear')

initialization of timestamp changing class

Parameters
  • start_timestamp (int) – start timestamp of interpolation or extrapolation range.

  • end_timestamp (int) – end timestamp of interpolation or extrapolation range.

  • delta_t (int) – time increments for interpolation / extrapolation range.

  • interp_kind (str, optional) – method of interpolation, the default is ‘linear’.

  • extrap_kind (str, optional) – method of extrapolation, the default is ‘linear’.

__call__(data)

change timestamp by interpolate or extrapolate

Parameters

data (pd.DataFrame) – input data

Returns

interpolated or extrapolated data

Return type

pd.DataFrame

class sensor_postprocessor.process.Thinning(interval)

Bases: object

thinning data from input cata

__init__(interval)

initialization of thinning class

Parameters

interval (int) – the interval between the rows to be thinned out.

__call__(data)

execute

Parameters

data (pd.DataFrame) – input data

Returns

thinned data

Return type

pd.DataFrame

class sensor_postprocessor.process.RefDiff(ref_timestamp, ref_data=None)

Bases: object

calculate difference between input data and reference data

__init__(ref_timestamp, ref_data=None)

initialization of RefDiff class

Parameters
  • ref_timestamp (int, list) – timestamp of reference data

  • ref_data (pd.DataFrame, optional) – reference data. Defaults to None.

Example

>>> # if reference data is on specific time.
>>> ref_timestamp = 1587772800000000000
>>> # if reference data is average data of designated time range.
>>> ref_timestamp = [1587772800000000000, 1587772900000000000]
__call__(data)

execute

Parameters

data (pd.DataFrame) – input data

Returns

calculated data

Return type

pd.DataFrame

class sensor_postprocessor.process.Detrend

Bases: object

remove trend from data

__init__()

initialization of detrend class

__call__(data)

execute

Parameters

data (pd.DataFrame) – input data

Returns

data without trend

Return type

pd.DataFrame

class sensor_postprocessor.process.Lowpass

Bases: object

apply low-pass filter to data

__init__()

initialization of Lowpass class

__call__(data)

execute

Parameters

data (pd.DataFrame) – input data

Returns

filtered data

Return type

pd.DataFrame

class sensor_postprocessor.process.Kalman

Bases: object

apply Kalman filter to data

__init__()

initialization of Kalman class

__call__(data)

execute

Parameters

data (pd.DataFrame) – input data

Returns

filtered data

Return type

pd.DataFrame

class sensor_postprocessor.process.MovingAverage

Bases: object

apply moving average filter to data

__init__()

initialization of MovingAverage class

__call__(data)

execute

Parameters

data (pd.DataFrame) – input data

Returns

filtered data

Return type

pd.DataFrame