diff --git a/data/PEC/Base/Monte_Carlo_Colored_Scatter_PEC_Base.png b/data/PEC/Base/Monte_Carlo_Colored_Scatter_PEC_Base.png new file mode 100644 index 0000000..dfb1f01 Binary files /dev/null and b/data/PEC/Base/Monte_Carlo_Colored_Scatter_PEC_Base.png differ diff --git a/data/PEC/Base/PEC_Base.md b/data/PEC/Base/PEC_Base.md index d301ec2..0c65ff4 100644 --- a/data/PEC/Base/PEC_Base.md +++ b/data/PEC/Base/PEC_Base.md @@ -230,7 +230,7 @@ Name | Value --- | --- show | False save | False -pdf | True +pdf | False dpi | 500 base_string | Base title_string | Target cost range: diff --git a/data/PV_E/Base/Monte_Carlo_Colored_Scatter_PV_E_Base.png b/data/PV_E/Base/Monte_Carlo_Colored_Scatter_PV_E_Base.png new file mode 100644 index 0000000..80c86e7 Binary files /dev/null and b/data/PV_E/Base/Monte_Carlo_Colored_Scatter_PV_E_Base.png differ diff --git a/data/PV_E/Base/Monte_Carlo_Comparative_Distance_Histogram_PV_E_Base.png b/data/PV_E/Base/Monte_Carlo_Comparative_Distance_Histogram_PV_E_Base.png new file mode 100644 index 0000000..a95210f Binary files /dev/null and b/data/PV_E/Base/Monte_Carlo_Comparative_Distance_Histogram_PV_E_Base.png differ diff --git a/data/PV_E/Base/PV_E_Base.md b/data/PV_E/Base/PV_E_Base.md index 3ddebdd..fd30107 100644 --- a/data/PV_E/Base/PV_E_Base.md +++ b/data/PV_E/Base/PV_E_Base.md @@ -193,7 +193,7 @@ Name | Value --- | --- show | False save | False -pdf | True +pdf | False dpi | 500 base_string | Base title_string | Target cost range: @@ -247,7 +247,7 @@ Name | Value --- | --- show | False save | False -pdf | True +pdf | False dpi | 500 fig_width | 5.5 fig_height | 4.5 diff --git a/data/PV_E/Historical_Data/Distance_Time_Relationship_No_Table_PV_E_Distance_Time.pdf b/data/PV_E/Historical_Data/Distance_Time_Relationship_No_Table_PV_E_Distance_Time.pdf new file mode 100644 index 0000000..07d1cf5 Binary files /dev/null and b/data/PV_E/Historical_Data/Distance_Time_Relationship_No_Table_PV_E_Distance_Time.pdf differ diff --git a/data/PV_E/Historical_Data/Distance_Time_Relationship_No_Table_PV_E_Distance_Time.png b/data/PV_E/Historical_Data/Distance_Time_Relationship_No_Table_PV_E_Distance_Time.png new file mode 100644 index 0000000..502dca0 Binary files /dev/null and b/data/PV_E/Historical_Data/Distance_Time_Relationship_No_Table_PV_E_Distance_Time.png differ diff --git a/data/PV_E/Historical_Data/Distance_Time_Relationship_PV_E_Distance_Time.pdf b/data/PV_E/Historical_Data/Distance_Time_Relationship_PV_E_Distance_Time.pdf index 772a7b9..824e391 100644 Binary files a/data/PV_E/Historical_Data/Distance_Time_Relationship_PV_E_Distance_Time.pdf and b/data/PV_E/Historical_Data/Distance_Time_Relationship_PV_E_Distance_Time.pdf differ diff --git a/data/PV_E/Historical_Data/PV_E_Distance_Time.md b/data/PV_E/Historical_Data/PV_E_Distance_Time.md index 71f45ce..e5605b3 100644 --- a/data/PV_E/Historical_Data/PV_E_Distance_Time.md +++ b/data/PV_E/Historical_Data/PV_E_Distance_Time.md @@ -153,6 +153,7 @@ Name | Method Name | Arguments plot_distance_histogram_log | plot_distance_histogram | {'show': False, 'save': False, 'dpi': 400, 'pdf': True, 'image_kwargs': {'path': 'pyH2A.Other~PV_E_Clipart.png'}} plot_distance_cost_log | plot_distance_cost_relationship | {'show': False, 'save': False, 'dpi': 300, 'pdf': False, 'image_kwargs': {'path': 'pyH2A.Other~PV_E_Clipart.png'}} plot_distance_time | plot_distance_time_relationship | Arguments - Time Analysis - distance_time_plot +plot_distance_time_no_table | plot_distance_time_relationship | Arguments - Time Analysis - distance_time_plot_no_table # Arguments - Time Analysis - distance_time_plot @@ -162,8 +163,24 @@ show | True save | False dpi | 500 pdf | True +color_future | False image_kwargs | {'path': 'pyH2A.Other~PV_E_Clipart.png'} +# Arguments - Time Analysis - distance_time_plot_no_table + +Name | Value +--- | --- +show | False +save | False +name | Distance_Time_Relationship_No_Table +dpi | 500 +pdf | False +parameter_table | False +color_future | False +target_distances | [0.5, 0.6] +plot_kwargs | {'left': 0.34, 'right': 0.96, 'bottom': 0.13, 'top': 0.96, 'fig_width': 6.2, 'fig_height': 4.0} +image_kwargs | {'x': -0.37, 'zoom': 0.092, 'y': 0.5, 'path': 'pyH2A.Other~PV_E_Clipart.png'} + # Methods - Monte_Carlo_Analysis Name | Method Name | Arguments diff --git a/data/Photocatalytic/Base/Monte_Carlo_Colored_Scatter_PV_E_Base.png b/data/Photocatalytic/Base/Monte_Carlo_Colored_Scatter_PV_E_Base.png new file mode 100644 index 0000000..80c86e7 Binary files /dev/null and b/data/Photocatalytic/Base/Monte_Carlo_Colored_Scatter_PV_E_Base.png differ diff --git a/data/Photocatalytic/Base/Monte_Carlo_Colored_Scatter_Photocatalytic_Base.png b/data/Photocatalytic/Base/Monte_Carlo_Colored_Scatter_Photocatalytic_Base.png new file mode 100644 index 0000000..444ecb6 Binary files /dev/null and b/data/Photocatalytic/Base/Monte_Carlo_Colored_Scatter_Photocatalytic_Base.png differ diff --git a/data/Photocatalytic/Base/Photocatalytic_Base.md b/data/Photocatalytic/Base/Photocatalytic_Base.md index c1ed0c4..b7187dc 100644 --- a/data/Photocatalytic/Base/Photocatalytic_Base.md +++ b/data/Photocatalytic/Base/Photocatalytic_Base.md @@ -238,7 +238,7 @@ Name | Value --- | --- show | False save | False -pdf | True +pdf | False dpi | 500 base_string | Base title_string | Target cost range: diff --git a/data/pyH2A_execution.py b/data/pyH2A_execution.py index b3a2aa3..12179da 100644 --- a/data/pyH2A_execution.py +++ b/data/pyH2A_execution.py @@ -100,13 +100,13 @@ def test(): print(Energy(285.83 * (1000./2.) * con.Avogadro, kJmol).J) def main(): - #pv_e_base() + pv_e_base() #pv_e_limit() #pv_e_distance_time() #pec_base() #pec_limit() #pec_limit_no_concentration() - photocatalytic_base() + #photocatalytic_base() #photocatalytic_limit() #technology_comparison() #test() diff --git a/doc/plugins/Plugin_Guide.rst b/doc/plugins/Plugin_Guide.rst index c16bbf3..a015941 100644 --- a/doc/plugins/Plugin_Guide.rst +++ b/doc/plugins/Plugin_Guide.rst @@ -8,9 +8,9 @@ pyH2A follows the open-closed principle, meaning that new plugins can be interfa Structure --------- -Plugins are single ``.py`` files, which contain a class with the same name as the filename (this shared name should include the term ``Plugin``). This class is instantiated during pyH2A runtime. The file may also contain other classes and functions, which serve the central class. +Plugins are single ``.py`` files, which contain a class with the same name as the filename (this shared name should include the term ``Plugin``). This class is instantiated during pyH2A runtime. Instantiation requires two arguments: ``dcf``, which is discounted cash flow object (generated during pyH2A runtime) and ``print_info``, which is a flag to control printing of additional runtime information (this flag is passed to :func:`~pyH2A.Utilities.input_modification.insert`) The file may also contain other classes and functions, which serve the central class. -The overall idea is that during instantiation, the class reads information from ``dcf.inp`` (the directory generated from the input file), processes the information and inserts new information into ``dcf.inp``. ``dcf.inp`` is the medium of information exchange between plugins and by inserting information there, the results of the plugin affect the outcome of the discounted cashflow analysis. +The overall idea is that during instantiation, the class reads information from ``dcf.inp`` (the dictionary generated from the input file), processes the information and inserts new information into ``dcf.inp``. ``dcf.inp`` is the medium of information exchange between plugins and by inserting information there, the results of the plugin affect the outcome of the discounted cashflow analysis. Example ------- diff --git a/src/pyH2A.egg-info/PKG-INFO b/src/pyH2A.egg-info/PKG-INFO index f2176fd..986f242 100644 --- a/src/pyH2A.egg-info/PKG-INFO +++ b/src/pyH2A.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pyH2A -Version: 0.0a7 +Version: 0.0a8 Summary: A framework for the analysis of hydrogen production cost Home-page: https://github.com/jschneidewind/pyH2A Author: Jacob Schneidewind diff --git a/src/pyH2A/Analysis/Development_Distance_Time_Analysis.py b/src/pyH2A/Analysis/Development_Distance_Time_Analysis.py index 916c30f..f7b8777 100644 --- a/src/pyH2A/Analysis/Development_Distance_Time_Analysis.py +++ b/src/pyH2A/Analysis/Development_Distance_Time_Analysis.py @@ -475,6 +475,24 @@ def plot_distance_cost_relationship(self, ax = None, figure_lean = True, figure.execute() return figure.fig + def plot_distance_indicator(self, ax, target_distances, model, years, color, ylim_lower): + + idx = find_nearest(model, target_distances) + + x = years[idx[0]:idx[1]+1] + y = model[idx[0]:idx[1]+1] + y_lower = np.ones(len(x)) * ylim_lower + + ax.fill_between(x, y, y_lower, color = color) + + # for i in idx: + # x_coord = years[i] + # y_coord = model[i] + + # ax.annotate('', xy = (x_coord, y_coord), + # xytext = (x_coord, ylim_lower), + # arrowprops={'arrowstyle': '-', 'ls': 'dashed', 'color': color}) + def plot_distance_time_relationship(self, ax = None, figure_lean = True, legend_loc = 'upper left', xlabel_string = 'Year', @@ -483,7 +501,9 @@ def plot_distance_time_relationship(self, ax = None, figure_lean = True, linear_label_string = 'Linear model', datapoint_label_string = ' historical distance', markersize = 10, + color_future = True, parameter_table = True, + target_distances = None, table_kwargs = {}, image_kwargs = {}, plot_kwargs = {}, **kwargs): '''Ploting relationship between time and development distance based on @@ -510,8 +530,13 @@ def plot_distance_time_relationship(self, ax = None, figure_lean = True, is the display name of the model. markersize : float, optional Size of markers in scatter plot. + color_future : bool, optional + Boolean flag to control if past or future region of plot is colored. parameter_table : bool, optional If parameter_table is True, the parameter table is shown in the plot. + target_distances : ndarray, optional + Target distance range as an 1D array with two entries ([lower_limit, higher_limit]), + which is highlighted in the plot. image_kwargs: dict, optional Dictionary containing optional keyword arguments for :func:`~pyH2A.Utilities.output_utilities.insert_image` @@ -552,10 +577,18 @@ def plot_distance_time_relationship(self, ax = None, figure_lean = True, ax.plot(self.years, self.distances, '.', color = self.color, markersize = markersize, label = self.display_name + datapoint_label_string) + xlim = ax.get_xlim() + ax.set_xlim(left = xlim[0], right = np.amax(self.years_extended)) + + ylim = ax.get_ylim() + ax.set_ylim(ylim) + ax.axhspan(0, 1, color = cm(0.5), alpha = 0.1) - ax.axvspan(self.base_year, np.amax(self.years_extended), color = cm(0.75), alpha = 0.1) - ax.set_xlim(right = np.amax(self.years_extended)) + if color_future: + ax.axvspan(self.base_year, np.amax(self.years_extended), color = cm(0.75), alpha = 0.1) + else: + ax.axvspan(xlim[0], self.base_year, color = cm(0.75), alpha = 0.1) ax.set_xlabel(xlabel_string) ax.set_ylabel(ylabel_string) @@ -569,6 +602,16 @@ def plot_distance_time_relationship(self, ax = None, figure_lean = True, if image_kwargs['path'] is not None: insert_image(ax = ax, **image_kwargs) + if target_distances is not None: + ax.axhspan(target_distances[0], target_distances[1], color = 'gray', alpha = 0.3) + + self.plot_distance_indicator(ax, target_distances, self.linear_distance_model, + self.years_extended, cm(0.25), ylim[0]) + + self.plot_distance_indicator(ax, target_distances, self.expo_distance_model, + self.years_extended, cm(0.0), ylim[0]) + + if figure_lean is True: figure.execute() return figure.fig