55import os
66plt .style .use ('mosden.plotting' )
77
8- def plot_data (data_vals ):
8+ def plot_data (data_vals , namemod = '' ):
99 formatted_data = defaultdict (list )
1010 formatted_data ['yields' ] = defaultdict (list )
1111 formatted_data ['hls' ] = defaultdict (list )
1212 formatted_data ["xs" ] = []
1313 xlab = 'Irradiation Time [s]'
14+ xscale = 'log'
1415
1516 for t_net , params in data_vals .items ():
1617 formatted_data ['xs' ].append (t_net )
@@ -28,12 +29,13 @@ def plot_data(data_vals):
2829 linewidth = 1 )
2930 plt .legend ()
3031 plt .xlabel (xlab )
32+ plt .xscale (xscale )
3133 if name == 'yields' :
3234 ylab = 'Group Yield'
3335 elif name == 'hls' :
3436 ylab = 'Group Half-life [s]'
3537 plt .ylabel (ylab )
36- plt .savefig (f'{ name } .png' )
38+ plt .savefig (f'{ name } { namemod } .png' )
3739 plt .close ()
3840
3941 xs = formatted_data ['xs' ]
@@ -45,20 +47,21 @@ def plot_data(data_vals):
4547 plt .stackplot (xs , y_arrays , labels = labels )
4648
4749 plt .xlabel (xlab )
50+ plt .xscale (xscale )
4851 plt .ylabel ('Yield' )
4952 plt .legend (loc = 'upper left' )
5053
5154 plt .tight_layout ()
52- plt .savefig ('stack_yields.png' )
55+ plt .savefig (f 'stack_yields{ namemod } .png' )
5356 plt .close ()
5457
55- def build_data_dict (data_path = r'./' ):
58+ def build_data_dict (data_path = r'./data/ ' ):
5659 def helper (pathmod ):
5760 files = glob .glob (os .path .join (data_path , f"*{ pathmod } .csv" ))
5861 data = {}
5962 for file in files :
6063 file : str = file
61- time = file .split ('_' )[1 ]
64+ time = float ( file .split ('_' )[1 ])
6265 data [time ] = dict ()
6366 file_data = CSVHandler (file ).read_vector_csv ()
6467 data [time ]['yields' ] = file_data ['yield' ]
@@ -73,4 +76,5 @@ def helper(pathmod):
7376
7477if __name__ == '__main__' :
7578 post_data , all_data = build_data_dict ()
76- plot_data (post_data )
79+ plot_data (post_data , '_post' )
80+ plot_data (all_data , '_all' )
0 commit comments