Source code for pycif.plugins.obsoperators.standard.transforms.period_pipe

from logging import info

from .utils.default_subsimus import default_subsimus
from .utils.fwd_pipe import fwd_adj_pipe

[docs]def period_pipe(self, all_transforms, mapper): """Arrange all transformations for all their sub-simulation periods into a pipe whose order respects the required precursors and successors for each transformation. First propagate sub-simulation periods to precursors/successors for transformations which don't have pre-defined sub-simulation periods. Second, define a graph from all the precursors of all transformations Last, walk the graph to define the proper order of the transformations :param all_transforms: the object gathering all transformations :param mapper: the dictionary containing all information about the input/output of each transformation :return: the pipes to be computed in forward and backward mode, including for each direction a dry run in the other direction for initialization """ info("Computing the optimal order of transformation. This can take a while") # First update subsimulations from precursors and successors default_subsimus(all_transforms, mapper) # Get final pipe_list including forward transformations info("Doing forward order") all_pipe_transforms_fwd = fwd_adj_pipe( self, all_transforms, mapper, mode="forward") info("Doing adjoint order") all_pipe_transforms_bkwd = fwd_adj_pipe( self, all_transforms, mapper, mode="adjoint") return all_pipe_transforms_fwd, all_pipe_transforms_bkwd