def get_runattrs(filter_or_dataframe="", include_runattrs=False, include_itervars=False, include_param_assignments=False, include_config_entries=False): """ Returns a filtered list of run attributes. The set of run attributes is fixed: `configname`, `datetime`, `experiment`, `inifile`, `iterationvars`, `iterationvarsf`, `measurement`, `network`, `processid`, `repetition`, `replication`, `resultdir`, `runnumber`, `seedset`. Parameters: - `filter_or_dataframe` (string or dataframe): The filter expression to select the desired run attributes from the inputs, or a dataframe in the "raw" format. Example: `name =~ *date* AND config:Aloha.slotTime =~ 0` - `include_runattrs`, `include_itervars`, `include_param_assignments`, `include_config_entries` (bool): Optional. When set to `True`, additional pieces of metadata about the run is appended to the result, pivoted into columns. See the "Metadata columns" section of the module documentation for details. Columns of the returned DataFrame: - `runID` (string): Identifies the simulation run - `name` (string): The name of the run attribute - `value` (string): The value of the run attribute - Additional metadata items (run attributes, iteration variables, etc.) """ if type(filter_or_dataframe) is str: filter_expression = filter_or_dataframe del filter_or_dataframe return impl.get_runattrs(**locals()) else: df = filter_or_dataframe runattrs = df[df["type"] == "runattr"] runattrs = runattrs[["runID", "attrname", "attrvalue"]] runattrs.rename(columns={ "attrname": "name", "attrvalue": "value" }, inplace=True) runattrs.reset_index(inplace=True, drop=True) row_types = ["itervar", "runattr", "config"] metadf = df[df["type"].isin(row_types)] df = _pivot_metadata(runattrs, metadf, include_runattrs, include_itervars, include_param_assignments, include_config_entries) df.dropna(axis='columns', how='all', inplace=True) return df
def get_param_assignments(filter_or_dataframe, include_runattrs=False, include_itervars=False, include_param_assignments=False, include_config_entries=False): """ Returns a filtered list of parameter assignment patterns. The result is a subset of what `get_config_entries` would return with the same arguments. Parameters: - `filter_or_dataframe` (string): The filter expression to select the desired parameter assignments, or a dataframe in the "raw" format. Example: `name =~ **.flowID AND itervar:numHosts =~ 10` - `include_runattrs`, `include_itervars`, `include_param_assignments`, `include_config_entries` (bool): Optional. When set to `True`, additional pieces of metadata about the run is appended to the result, pivoted into columns. See the "Metadata columns" section of the module documentation for details. Columns of the returned DataFrame: - `runID` (string): Identifies the simulation run - `name` (string): The parameter assignment pattern - `value` (string): The assigned value - Additional metadata items (run attributes, iteration variables, etc.), as requested """ if type(filter_or_dataframe) is str: filter_expression = filter_or_dataframe del filter_or_dataframe return impl.get_param_assignments(**locals()) else: df = filter_or_dataframe paramassignments = _select_param_assignments( df[df["type"] == "config"]) paramassignments = paramassignments[["runID", "attrname", "attrvalue"]] paramassignments.rename(columns={ "attrname": "name", "attrvalue": "value" }, inplace=True) paramassignments.reset_index(inplace=True, drop=True) row_types = ["itervar", "runattr", "config"] metadf = df[df["type"].isin(row_types)] df = _pivot_metadata(paramassignments, metadf, include_runattrs, include_itervars, include_param_assignments, include_config_entries) df.dropna(axis='columns', how='all', inplace=True) return df
def get_runs(filter_or_dataframe="", include_runattrs=False, include_itervars=False, include_param_assignments=False, include_config_entries=False): """ Returns a filtered list of runs, identified by their run ID. Parameters: - `filter_or_dataframe` (string or dataframe): The filter expression to select the desired run from the inputs, or a dataframe in the "raw" format (e.g. one returned by `read_result_files()`). Example: `runattr:network =~ "Aloha" AND config:Aloha.slotTime =~ 0` - `include_runattrs`, `include_itervars`, `include_param_assignments`, `include_config_entries` (bool): Optional. When set to `True`, additional pieces of metadata about the run is appended to the result, pivoted into columns. See the "Metadata columns" section of the module documentation for details. Columns of the returned DataFrame: - `runID` (string): Identifies the simulation run - Additional metadata items (run attributes, iteration variables, etc.), as requested """ if type(filter_or_dataframe) is str: filter_expression = filter_or_dataframe del filter_or_dataframe return impl.get_runs(**locals()) else: df = filter_or_dataframe runs = df[["runID"]].drop_duplicates() row_types = ["itervar", "runattr", "config"] metadf = df[df["type"].isin(row_types)] df = _pivot_metadata(runs, metadf, include_runattrs, include_itervars, include_param_assignments, include_config_entries) df.dropna(axis='columns', how='all', inplace=True) return df