winnet_example.py
Go to the documentation of this file.
1 # Example file for winnet class
2 # Author: Moritz Reichert
3 # Date : 08.05.17
4 
5 # Import winnet class
6 from class_files.winnet_class import winnet
7 import matplotlib.pyplot as plt
8 import pandas as pd
9 
10 # The class is able to plot several things and return the data.
11 
12 ################
13 # INITIALIZING #
14 ################
15 
16 # Create an instance of the reaclib class. If you want the class to be quiet, add quiet=True.
17 w_testclass = winnet('testfiles/winnet_testfiles/example_run')
18 # There is a possibility to read a "First started" guide:
19 print(w_testclass.get_man())
20 # As told, you first have to read data. For simplicity our test folder only contains the finabs, mainout and the param.out, but in principle the class is able to read nearly all data.
21 # possible read values are given by:
22 # w_testclass.read_finab()
23 # w_testclass.read_mainout()
24 # w_testclass.read_snapshots()
25 # w_testclass.read_timescales()
26 # w_testclass.read_template()
27 # Or if you want to read the whole run w_testclass.read_run(). This might complain that some things are not there
28 w_testclass.read_finab()
29 w_testclass.read_template()
30 w_testclass.read_mainout()
31 
32 
33 
34 
35 #############################
36 # PLOTTING AND GETTING DATA #
37 #############################
38 
39 # The path for the sunet is extracted from param.out
40 # We can plot the contained nuclei in the run
41 w_testclass.plot_sunet()
42 # Show the content
43 plt.show()
44 
45 # or plot more normal things like mass number over mass fraction
46 w_testclass.plot_final_A_X()
47 # Show the content
48 plt.show()
49 
50 # or plot the different isotopes
51 # This function has several options:
52 # lower_limit : lowest massfraction that will be plotted (default 10^-10)
53 # isotopes : isotopes to be plotted. If none (default), all isotopes of finab will get plotted. Type is list that contains the Z number
54 # isotope_label : Plot the labels of the isotopes?
55 # ignore_isotope_names : which name label should be ignored? (list contains Z number)
56 # text_clipping : Text clipping yes or no? ( Should the text shown outside the plotting area? )
57 # ytext_pos_factor : offset factor for the y position of the labels. Only has an effect when isotope_label is true
58 # xtext_pos_offset : offset for the x position of the labels. Only has an effect when isotope_label is true
59 w_testclass.plot_final_isotopes()
60 plt.show()
61 
62 # or just show different quantities of the mainout and look for crazy things
63 w_testclass.plot_mainout()
64 plt.show()
65 
66 # Useful can be the time evolution of the nuclei from snapshots. Because there are no snapshots in the example folder, we can not show this here.
67 # in principle you have to read the snapshots first
68 # w_testclass.read_snapshots()
69 # and you will have access to the data afterwards through (e.g. for he4)
70 # w_testclass.get_time_evolution('he4')
71 
72 
73 # There is much more included. A list with all possible routines can be accessed by
74 print(w_testclass.get_methods())
bin.class_files.winnet_class.winnet
Definition: winnet_class.py:41