def reproduce_figures(data_dir, output_dir, output_format, component='y'): """ This function reproduces Figures 2-5. It reads the raw simulation data from `data_dir` and stores the resulting plots in `output_dir`. """ output_format = output_format.split(',') check_input_data_exists(data_dir) # Create output directory if it does not exists if not os.path.exists(output_dir): os.makedirs(output_dir) print("\nUsing the following data and output directories \n" "(run 'python reproduce_figures.py --help' to see \n" "how you can change these).\n") print("Input data directory:\n {}\n".format(os.path.abspath(data_dir))) print("Output directory:\n {}\n".format(os.path.abspath(output_dir))) # Create DataReader which provides a convenient way of # reading raw simulation data and computing derived data. data_reader = DataReader(data_dir, data_format='OOMMF') print("Generating plots..."), sys.stdout.flush() # Generate plots fig2 = make_figure_2(data_reader, component=component) fig3 = make_figure_3(data_reader, component=component) fig4 = make_figure_4(data_reader) fig5 = make_figure_5(data_reader) # Save plots to output directory for fmt in output_format: fig2.savefig(os.path.join(output_dir, 'figure_2.' + fmt)) fig3.savefig(os.path.join(output_dir, 'figure_3.' + fmt)) fig4.savefig(os.path.join(output_dir, 'figure_4.' + fmt)) fig5.savefig(os.path.join(output_dir, 'figure_5.' + fmt)) print("Done.") print("Plots have been successfully generated in output directory.")
def reproduce_figures(data_dir, output_dir, output_format, component='y'): """ This function reproduces Figures 2-5. It reads the raw simulation data from `data_dir` and stores the resulting plots in `output_dir`. """ output_format = output_format.split(',') check_input_data_exists(data_dir) # Create output directory if it does not exists if not os.path.exists(output_dir): os.makedirs(output_dir) print("\nUsing the following data and output directories \n" "(run 'python reproduce_figures.py --help' to see \n" "how you can change these).\n") print("Input data directory:\n {}\n".format(os.path.abspath(data_dir))) print("Output directory:\n {}\n".format(os.path.abspath(output_dir))) # Create DataReader which provides a convenient way of # reading raw simulation data and computing derived data. data_reader = DataReader(data_dir, data_format='OOMMF') print("Generating plots..."),; sys.stdout.flush() # Generate plots fig2 = make_figure_2(data_reader, component=component) fig3 = make_figure_3(data_reader, component=component) fig4 = make_figure_4(data_reader) fig5 = make_figure_5(data_reader) # Save plots to output directory for fmt in output_format: fig2.savefig(os.path.join(output_dir, 'figure_2.' + fmt)) fig3.savefig(os.path.join(output_dir, 'figure_3.' + fmt)) fig4.savefig(os.path.join(output_dir, 'figure_4.' + fmt)) fig5.savefig(os.path.join(output_dir, 'figure_5.' + fmt)) print("Done.") print("Plots have been successfully generated in output directory.")
def test__make_figure_5(): data_reader = FakeDataReader(damping=0.08) fig = make_figure_5(data_reader)
def test_reproduce_figure_5(): data_reader = DataReader(data_dir=data_dir, software='OOMMF') make_figure_5(data_reader)