def save_parameters( self, parameters: ParameterGroup, file_name: str, *, sep: str = ",", as_optimized: bool = True, replace_infinfinity: bool = True, ) -> None: """Save a :class:`ParameterGroup` to a CSV file. Parameters ---------- parameters : ParameterGroup Parameters to be saved to file. file_name : str File to write the parameters to. sep: str Other separators can be used optionally., by default ',' as_optimized : bool Weather to include properties which are the result of optimization. replace_infinfinity : bool Weather to replace infinity values with empty strings. """ df = parameters.to_dataframe(as_optimized=as_optimized) if replace_infinfinity is True: safe_dataframe_replace(df, "minimum", -np.inf, "") safe_dataframe_replace(df, "maximum", np.inf, "") df.to_csv(file_name, na_rep="None", index=False, sep=sep)
def save_parameters( self, parameters: ParameterGroup, file_name: str, *, as_optimized: bool = True ): """Save a :class:`ParameterGroup` to a Excel file. Parameters ---------- parameters : ParameterGroup Parameters to be saved to file. file_name : str File to write the parameters to. as_optimized : bool Whether to include properties which are the result of optimization. """ df = parameters.to_dataframe(as_optimized=as_optimized) safe_dataframe_replace(df, "minimum", -np.inf, "") safe_dataframe_replace(df, "maximum", np.inf, "") df.to_excel(file_name, na_rep="None", index=False)
def save_parameters(self, file_name: str, parameters: ParameterGroup): """Save a :class:`ParameterGroup` to a CSV file.""" parameters.to_dataframe().to_csv(file_name, na_rep="None", index=False)