ShiftSnapshots
Module for Scaler plugin
- class ShiftSnapshots(shift_function, interpolator, parameter_index=0, reference_index=0)[source]
Bases:
PluginThe plugin implements the “shifting” preprocessing: it makes possible the rigid shift of the snapshots composing the database, such that the reduction method performs better, dipendentely by the problem at hand. The shift function has to be passed by the user, together with an Approximation class in order to evaluate the translated snapshots onto the space of a custom reference space.
Reference: Reiss, J., Schulze, P., Sesterhenn, J., & Mehrmann, V. (2018). The shifted proper orthogonal decomposition: A mode decomposition for multiple transport phenomena. SIAM Journal on Scientific Computing, 40(3), A1322-A1344.
- Parameters:
shift_function (callable) – a user defined function that return the shifting quantity for any the snapshot, given the corresponding input parameter.
interpolator (Approximation) – the interpolator to use to evaluate the shifted snapshots on some reference space.
parameter_index (int) – in case of multi-dimensional parameter, indicate the index of the parameter component to pass to the shift function. Default is 0.
reference_index (int) – indicate the index of the snapshots within the database whose space will be used as reference space. Default is 0.
Example:
>>> def shift(time): >>> return time-0.5 >>> pod = POD() >>> rbf = RBF() >>> db = Database() >>> for param in params: >>> space, values = wave(param) >>> snap = Snapshot(values=values, space=space) >>> db.add(Parameter(param), snap) >>> rom = ROM(db, pod, rbf, plugins=[ShiftSnapshots(shift, RBF())]) >>> rom.fit()
Initialize the ShiftSnapshots plugin.
- Parameters:
- _abc_impl = <_abc._abc_data object>
- fit_preprocessing(rom)[source]
Shift snapshots to a reference space during fit preprocessing.
- Parameters:
rom (ReducedOrderModel) – The ROM instance.
- predict_postprocessing(rom)[source]
Shift predicted snapshots back to their original space.
- Parameters:
rom (ReducedOrderModel) – The ROM instance.