def scenario_solve(scenario, actions):
    exploration = {}
    M0 = scenario['M0']
    for action in actions:
        code = '%s' % action
        res = diffeo_apply(action.diffeo.d, M0)
        res2 = diffeo_apply(action.diffeo.d, res)
        res3 = diffeo_apply(action.diffeo.d, res2)
        res4 = diffeo_apply(action.diffeo.d, res3)
        exploration[code] = res4  # {'actions' = }
    scenario['exploration'] = exploration
Exemple #2
0
    def update(self):
        rgb = self.input.rgb
        if rgb.ndim == 2:
            shape = rgb.shape
        elif rgb.ndim == 3:
            shape = (rgb.shape[0], rgb.shape[1])
        else:
            raise BadInput('expected rgb', self, 'rgb')

        if self.D is None:
            # create diffeormorphism if needed
            self.info('Creating diffeormophism %s at %s' % (self.f, shape))
            self.D = diffeo_from_function(shape, self.f)
            self.info('Done.')

        self.output.rgb = diffeo_apply(self.D, rgb)
def diffeo_quick1(id_dd, dd):  # @UnusedVariable
    M, N = dd.shape[0], dd.shape[1]
    template = np.random.rand(M, N)

    fda = FastDiffeoApply(dd)

    functions = dict(regular=lambda: diffeo_apply(dd, template),
                     fast=lambda: fda(template))

    repeat = 100
    for name, function in functions.items():
        fps = InAWhile()
        for _ in range(repeat):
            fps.its_time()
            _ = function()
        print('%s: %s fps' % (name, fps.fps()))
def diffeo_quick1(id_dd, dd):  # @UnusedVariable
    M, N = dd.shape[0], dd.shape[1]
    template = np.random.rand(M, N)

    fda = FastDiffeoApply(dd)
    
    functions = dict(regular=lambda: diffeo_apply(dd, template),
                     fast=lambda: fda(template))

    repeat = 100
    for name, function in functions.items():
        fps = InAWhile()
        for _ in range(repeat):
            fps.its_time()
            _ = function()
        print('%s: %s fps' % (name, fps.fps()))
 def show(x):
     return diffeo_apply(x, template)
Exemple #6
0
 def show(x):
     return diffeo_apply(x, template)