Exemplo n.º 1
0
    def init(self):
        update_namespace_cwd(self.opts, 'outputs')
        head = self.opts.plot[0]

        kwargs = dict(self.opts.options, joints=self.opts.joints)
        kwargs.setdefault('rankdir', 'LR')
        kwargs['subgraph']=self.opts.subgraph
        kwargs['include_only']=self.opts.include_only
        if self.opts.splines:
            kwargs['splines']=self.opts.splines

        if self.opts.namespace is not self.undefined:
            kwargs['namespace']=env.globalns(self.opts.namespace)

        graph = GNADot( head, **kwargs )


        for output in self.opts.outputs:
            print( 'Write graph to:', output )

            if output.endswith('.dot'):
                graph.write(output)
            else:
                graph.layout(prog='dot')
                graph.draw(output)

        if self.opts.stdout:
            graph.write()

        if self.opts.stderr:
            import sys
            graph.write( sys.stderr )
Exemplo n.º 2
0
    def init(self):
        update_namespace_cwd(self.opts, 'output')
        storage = self.env.future
        data = DictWrapper(OrderedDict(), split='.')
        for path in self.opts.paths:
            try:
                data[path] = storage[path].unwrap()
            except KeyError:
                raise Exception('Unable to read data path: ' + path)

        with open(self.opts.output, 'wb') as ofile:
            pickle.dump(data.unwrap(), ofile, pickle.HIGHEST_PROTOCOL)

        if self.opts.verbose:
            print('Save output file:', self.opts.output)
Exemplo n.º 3
0
    def init(self):
        update_namespace_cwd(self.opts, 'output')
        storage = self.env.future
        data = DictWrapper({}, split='.')
        for path in self.opts.paths:
            try:
                data[path] = storage[path].unwrap()
            except KeyError:
                raise Exception('Unable to read data path: '+path)

        with open(self.opts.output, 'w') as ofile:
            ofile.write(yaml.dump(data.unwrap()))

        if self.opts.verbose:
            print('Save output file:', self.opts.output)
Exemplo n.º 4
0
    def init(self):
        update_namespace_cwd(self.opts, 'output')
        try:
            self.exp = self.env.parts.exp[self.opts.exp]
        except Exception:
            print('Unable to retrieve exp ' + self.opts.exp)

        self.namespace = self.exp.namespace
        self.context = self.exp.context
        self.outputs = self.exp.context.outputs
        try:
            self.observation = self.outputs.observation.juno
        except KeyError:
            self.observation = self.outputs.observation.AD1

        self.init_variables()

        self.print_stats()
Exemplo n.º 5
0
    def init(self):
        update_namespace_cwd(self.opts, 'output')
        storage = self.env.future
        verbose = self.opts.verbose

        if verbose > 1:
            print('Create output file:', self.opts.output)
        output = R.TFile(self.opts.output, 'RECREATE')
        for path in self.opts.paths:
            try:
                st = storage[path]
            except KeyError:
                raise Exception('Unable to read data path: ' + path)

            saveobjects(output, st, verbose)

        if verbose:
            print('Save output file:', self.opts.output)
            if verbose > 1:
                output.ls()
        output.Close()
Exemplo n.º 6
0
    def init(self):
        update_namespace_cwd(self.opts, 'output')
        self.level = 0
        cmd = argv[0]
        opts = argv[1:]

        self.out = cmd

        self.inc()
        for opt in opts:
            self.append(opt)

        if self.opts.verbose:
            print('Command line:')
            print(self.out)

        header = '#!/usr/bin/bash\n\n'
        if self.opts.output:
            for opath in self.opts.output:
                with open(opath, 'w') as f:
                    f.writelines([header, self.out, '\n'])
                print('Command line saved to:', opath)
Exemplo n.º 7
0
Arquivo: mpl_v1.py Projeto: gnafit/gna
 def init(self):
     update_namespace_cwd(self.opts, 'output')
     self.configure_mpl()
     self.configure_figure()
     self.configure_axis()
     self.configure_figure1()