示例#1
0
        ax.set_xlabel(r'$x$', fontsize=16)
        ax.set_ylabel(r'$C_p$', fontsize=16)
        color_cycle = ax._get_lines.prop_cycler
        for angle, subdata in data.items():
            color = next(color_cycle)['color']
            ax.plot(subdata[subdata['loc'] == 'upper']['x'],
                    subdata[subdata['loc'] == 'upper']['cp'],
                    label=fr'$\alpha={angle}^o$',
                    color=color,
                    linewidth=1.0,
                    linestyle='-')
            ax.plot(subdata[subdata['loc'] == 'lower']['x'],
                    subdata[subdata['loc'] == 'lower']['cp'],
                    color=color,
                    linewidth=1.0,
                    linestyle='--')
        handles, labels = ax.get_legend_handles_labels()
        ax.legend(handles[::2], labels[::2], prop={'size': 10}, ncol=1)
        ax.set_xlim(0.0, 1.0)
        ax.set_ylim(1.0, -6.0)
        fig.tight_layout()
        print('[Figure 2] Saving figure ...')
        filepath = os.path.join(self.get_outputs()[0], 'figure2.png')
        fig.savefig(filepath, dpi=300, fmt='png')


automator = Automator(simulation_dir='data',
                      output_dir='manuscript/figures',
                      all_problems=[CpVsFoils, CpVsAngle])
automator.run()
示例#2
0
                root=self.input_path(str(i)),
                base_command=base_cmd,
                power=float(i)
            )
            for i in range(1, 5)
        ]

    def run(self):
        self.make_output_dir()
        for case in self.cases:
            data = np.load(case.input_path('results.npz'))
            plt.plot(
                data['x'], data['y'],
                label=r'$x^{{%.2f}}$' % case.params['power']
            )
        plt.grid()
        plt.xlabel('x')
        plt.ylabel('y')
        plt.legend()
        plt.savefig(self.output_path('powers.pdf'))


if __name__ == '__main__':
    automator = Automator(
        simulation_dir='outputs',
        output_dir='manuscript/figures',
        all_problems=[Squares, Powers],
        cluster_manager_factory=CondaClusterManager
    )
    automator.run()
示例#3
0
    def get_name(self):
        return 'squares'

    def get_commands(self):
        return [
            ('1', 'python square.py 1', None),
            ('2', 'python square.py 2', None),
            ('3', 'python square.py 3', None),
            ('4', 'python square.py 4', None),
        ]

    def run(self):
        self.make_output_dir()
        data = []
        for i in ('1', '2', '3', '4'):
            stdout = self.input_path(i, 'stdout.txt')
            with open(stdout) as f:
                data.append(f.read().split())

        output = self.output_path('output.txt')
        with open(output, 'w') as o:
            o.write(str(data))


if __name__ == '__main__':
    automator = Automator(simulation_dir='outputs',
                          output_dir='manuscript/figures',
                          all_problems=[Squares])

    automator.run()