repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
openego/ding0
ding0/grid/lv_grid/build_grid.py
select_grid_model_ria
def select_grid_model_ria(lvgd, sector): """Select a typified grid for retail/industrial and agricultural Parameters ---------- lvgd : ding0.core.structure.regions.LVGridDistrictDing0 Low-voltage grid district object sector : str Either 'retail/industrial' or 'agricultural'. Dependi...
python
def select_grid_model_ria(lvgd, sector): """Select a typified grid for retail/industrial and agricultural Parameters ---------- lvgd : ding0.core.structure.regions.LVGridDistrictDing0 Low-voltage grid district object sector : str Either 'retail/industrial' or 'agricultural'. Dependi...
[ "def", "select_grid_model_ria", "(", "lvgd", ",", "sector", ")", ":", "cable_lf", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'load_factor_lv_cable_lc_normal'", ")", "cos_phi_load", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'cos_phi_l...
Select a typified grid for retail/industrial and agricultural Parameters ---------- lvgd : ding0.core.structure.regions.LVGridDistrictDing0 Low-voltage grid district object sector : str Either 'retail/industrial' or 'agricultural'. Depending on choice different parameters to gri...
[ "Select", "a", "typified", "grid", "for", "retail", "/", "industrial", "and", "agricultural" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/lv_grid/build_grid.py#L177-L275
openego/ding0
ding0/grid/lv_grid/build_grid.py
grid_model_params_ria
def grid_model_params_ria(lvgd): """Determine grid model parameters for LV grids of sectors retail/industrial and agricultural Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object Returns ------- :obj:`dict` Structural description of (pa...
python
def grid_model_params_ria(lvgd): """Determine grid model parameters for LV grids of sectors retail/industrial and agricultural Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object Returns ------- :obj:`dict` Structural description of (pa...
[ "def", "grid_model_params_ria", "(", "lvgd", ")", ":", "# Choose retail/industrial and agricultural grid model", "model_params_ria", "=", "{", "}", "if", "(", "(", "lvgd", ".", "sector_count_retail", "+", "lvgd", ".", "sector_count_industrial", ">", "0", ")", "or", ...
Determine grid model parameters for LV grids of sectors retail/industrial and agricultural Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object Returns ------- :obj:`dict` Structural description of (parts of) LV grid topology
[ "Determine", "grid", "model", "parameters", "for", "LV", "grids", "of", "sectors", "retail", "/", "industrial", "and", "agricultural", "Parameters", "----------", "lvgd", ":", "LVGridDistrictDing0", "Low", "-", "voltage", "grid", "district", "object" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/lv_grid/build_grid.py#L278-L311
openego/ding0
ding0/grid/lv_grid/build_grid.py
build_lv_graph_ria
def build_lv_graph_ria(lvgd, grid_model_params): """Build graph for LV grid of sectors retail/industrial and agricultural Based on structural description of LV grid topology for sectors retail/industrial and agricultural (RIA) branches for these sectors are created and attached to the LV grid's MV-LV s...
python
def build_lv_graph_ria(lvgd, grid_model_params): """Build graph for LV grid of sectors retail/industrial and agricultural Based on structural description of LV grid topology for sectors retail/industrial and agricultural (RIA) branches for these sectors are created and attached to the LV grid's MV-LV s...
[ "def", "build_lv_graph_ria", "(", "lvgd", ",", "grid_model_params", ")", ":", "def", "lv_graph_attach_branch", "(", ")", ":", "\"\"\"Attach a single branch including its equipment (cable dist, loads\n and line segments) to graph of `lv_grid`\n \"\"\"", "# determine maximum ...
Build graph for LV grid of sectors retail/industrial and agricultural Based on structural description of LV grid topology for sectors retail/industrial and agricultural (RIA) branches for these sectors are created and attached to the LV grid's MV-LV substation bus bar. LV loads of the sectors retail/i...
[ "Build", "graph", "for", "LV", "grid", "of", "sectors", "retail", "/", "industrial", "and", "agricultural" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/lv_grid/build_grid.py#L314-L524
openego/ding0
ding0/grid/lv_grid/build_grid.py
select_grid_model_residential
def select_grid_model_residential(lvgd): """Selects typified model grid based on population Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object Returns ------- :pandas:`pandas.DataFrame<dataframe>` Selected string of typified model grid :pa...
python
def select_grid_model_residential(lvgd): """Selects typified model grid based on population Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object Returns ------- :pandas:`pandas.DataFrame<dataframe>` Selected string of typified model grid :pa...
[ "def", "select_grid_model_residential", "(", "lvgd", ")", ":", "# Load properties of LV typified model grids", "string_properties", "=", "lvgd", ".", "lv_grid", ".", "network", ".", "static_data", "[", "'LV_model_grids_strings'", "]", "# Load relational table of apartment count...
Selects typified model grid based on population Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object Returns ------- :pandas:`pandas.DataFrame<dataframe>` Selected string of typified model grid :pandas:`pandas.DataFrame<dataframe>` Param...
[ "Selects", "typified", "model", "grid", "based", "on", "population" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/lv_grid/build_grid.py#L544-L598
openego/ding0
ding0/grid/lv_grid/build_grid.py
build_lv_graph_residential
def build_lv_graph_residential(lvgd, selected_string_df): """Builds nxGraph based on the LV grid model Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object selected_string_df: :pandas:`pandas.DataFrame<dataframe>` Table of strings of the selected grid mo...
python
def build_lv_graph_residential(lvgd, selected_string_df): """Builds nxGraph based on the LV grid model Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object selected_string_df: :pandas:`pandas.DataFrame<dataframe>` Table of strings of the selected grid mo...
[ "def", "build_lv_graph_residential", "(", "lvgd", ",", "selected_string_df", ")", ":", "houses_connected", "=", "(", "selected_string_df", "[", "'occurence'", "]", "*", "selected_string_df", "[", "'count house branch'", "]", ")", ".", "sum", "(", ")", "average_load"...
Builds nxGraph based on the LV grid model Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object selected_string_df: :pandas:`pandas.DataFrame<dataframe>` Table of strings of the selected grid model Notes ----- To understand what is happening in t...
[ "Builds", "nxGraph", "based", "on", "the", "LV", "grid", "model" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/lv_grid/build_grid.py#L601-L752
openego/ding0
ding0/grid/lv_grid/build_grid.py
build_residential_branches
def build_residential_branches(lvgd): """Based on population and identified peak load data, the according grid topology for residential sector is determined and attached to the grid graph Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object """ # Choice...
python
def build_residential_branches(lvgd): """Based on population and identified peak load data, the according grid topology for residential sector is determined and attached to the grid graph Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object """ # Choice...
[ "def", "build_residential_branches", "(", "lvgd", ")", ":", "# Choice of typified lv model grid depends on population within lv", "# grid district. If no population is given, lv grid is omitted and", "# load is represented by lv station's peak load", "if", "lvgd", ".", "population", ">", ...
Based on population and identified peak load data, the according grid topology for residential sector is determined and attached to the grid graph Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object
[ "Based", "on", "population", "and", "identified", "peak", "load", "data", "the", "according", "grid", "topology", "for", "residential", "sector", "is", "determined", "and", "attached", "to", "the", "grid", "graph" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/lv_grid/build_grid.py#L755-L795
openego/ding0
ding0/tools/results.py
lv_grid_generators_bus_bar
def lv_grid_generators_bus_bar(nd): """ Calculate statistics about generators at bus bar in LV grids Parameters ---------- nd : ding0.NetworkDing0 Network container object Returns ------- lv_stats : dict Dict with keys of LV grid repr() on first level. Each of the grids...
python
def lv_grid_generators_bus_bar(nd): """ Calculate statistics about generators at bus bar in LV grids Parameters ---------- nd : ding0.NetworkDing0 Network container object Returns ------- lv_stats : dict Dict with keys of LV grid repr() on first level. Each of the grids...
[ "def", "lv_grid_generators_bus_bar", "(", "nd", ")", ":", "lv_stats", "=", "{", "}", "for", "la", "in", "nd", ".", "_mv_grid_districts", "[", "0", "]", ".", "lv_load_areas", "(", ")", ":", "for", "lvgd", "in", "la", ".", "lv_grid_districts", "(", ")", ...
Calculate statistics about generators at bus bar in LV grids Parameters ---------- nd : ding0.NetworkDing0 Network container object Returns ------- lv_stats : dict Dict with keys of LV grid repr() on first level. Each of the grids has a set of statistical information ab...
[ "Calculate", "statistics", "about", "generators", "at", "bus", "bar", "in", "LV", "grids" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L63-L92
openego/ding0
ding0/tools/results.py
save_nd_to_pickle
def save_nd_to_pickle(nd, path='', filename=None): """Use pickle to save the whole nd-object to disc The network instance is entirely pickled to a file. Parameters ---------- nd : NetworkDing0 Ding0 grid container object path : str Absolute or relative path where pickle should ...
python
def save_nd_to_pickle(nd, path='', filename=None): """Use pickle to save the whole nd-object to disc The network instance is entirely pickled to a file. Parameters ---------- nd : NetworkDing0 Ding0 grid container object path : str Absolute or relative path where pickle should ...
[ "def", "save_nd_to_pickle", "(", "nd", ",", "path", "=", "''", ",", "filename", "=", "None", ")", ":", "abs_path", "=", "os", ".", "path", ".", "abspath", "(", "path", ")", "if", "len", "(", "nd", ".", "_mv_grid_districts", ")", ">", "1", ":", "nam...
Use pickle to save the whole nd-object to disc The network instance is entirely pickled to a file. Parameters ---------- nd : NetworkDing0 Ding0 grid container object path : str Absolute or relative path where pickle should be saved. Default is '' which means pickle is save...
[ "Use", "pickle", "to", "save", "the", "whole", "nd", "-", "object", "to", "disc" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L95-L127
openego/ding0
ding0/tools/results.py
load_nd_from_pickle
def load_nd_from_pickle(filename=None, path=''): """ Use pickle to save the whole nd-object to disc Parameters ---------- filename : str Filename of nd pickle path : str Absolute or relative path where pickle should be saved. Default is '' which means pickle is save to P...
python
def load_nd_from_pickle(filename=None, path=''): """ Use pickle to save the whole nd-object to disc Parameters ---------- filename : str Filename of nd pickle path : str Absolute or relative path where pickle should be saved. Default is '' which means pickle is save to P...
[ "def", "load_nd_from_pickle", "(", "filename", "=", "None", ",", "path", "=", "''", ")", ":", "abs_path", "=", "os", ".", "path", ".", "abspath", "(", "path", ")", "if", "filename", "is", "None", ":", "raise", "NotImplementedError", "return", "pickle", "...
Use pickle to save the whole nd-object to disc Parameters ---------- filename : str Filename of nd pickle path : str Absolute or relative path where pickle should be saved. Default is '' which means pickle is save to PWD Returns ------- nd : NetworkDing0 Din...
[ "Use", "pickle", "to", "save", "the", "whole", "nd", "-", "object", "to", "disc" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L130-L153
openego/ding0
ding0/tools/results.py
plot_cable_length
def plot_cable_length(stats, plotpath): """ Cable length per MV grid district """ # cable and line kilometer distribution f, axarr = plt.subplots(2, 2, sharex=True) stats.hist(column=['Length of MV overhead lines'], bins=5, alpha=0.5, ax=axarr[0, 0]) stats.hist(column=['Length of MV undergr...
python
def plot_cable_length(stats, plotpath): """ Cable length per MV grid district """ # cable and line kilometer distribution f, axarr = plt.subplots(2, 2, sharex=True) stats.hist(column=['Length of MV overhead lines'], bins=5, alpha=0.5, ax=axarr[0, 0]) stats.hist(column=['Length of MV undergr...
[ "def", "plot_cable_length", "(", "stats", ",", "plotpath", ")", ":", "# cable and line kilometer distribution", "f", ",", "axarr", "=", "plt", ".", "subplots", "(", "2", ",", "2", ",", "sharex", "=", "True", ")", "stats", ".", "hist", "(", "column", "=", ...
Cable length per MV grid district
[ "Cable", "length", "per", "MV", "grid", "district" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L156-L169
openego/ding0
ding0/tools/results.py
plot_generation_over_load
def plot_generation_over_load(stats, plotpath): """ Plot of generation over load """ # Generation capacity vs. peak load sns.set_context("paper", font_scale=1.1) sns.set_style("ticks") # reformat to MW gen_cap_indexes = ["Gen. Cap. of MV at v_level 4", "Gen. Cap...
python
def plot_generation_over_load(stats, plotpath): """ Plot of generation over load """ # Generation capacity vs. peak load sns.set_context("paper", font_scale=1.1) sns.set_style("ticks") # reformat to MW gen_cap_indexes = ["Gen. Cap. of MV at v_level 4", "Gen. Cap...
[ "def", "plot_generation_over_load", "(", "stats", ",", "plotpath", ")", ":", "# Generation capacity vs. peak load", "sns", ".", "set_context", "(", "\"paper\"", ",", "font_scale", "=", "1.1", ")", "sns", ".", "set_style", "(", "\"ticks\"", ")", "# reformat to MW", ...
Plot of generation over load
[ "Plot", "of", "generation", "over", "load" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L172-L204
openego/ding0
ding0/tools/results.py
concat_nd_pickles
def concat_nd_pickles(self, mv_grid_districts): """ Read multiple pickles, join nd objects and save to file Parameters ---------- mv_grid_districts : list Ints describing MV grid districts """ pickle_name = cfg_ding0.get('output', 'nd_pickle') # self.nd = self.read_pickles_from...
python
def concat_nd_pickles(self, mv_grid_districts): """ Read multiple pickles, join nd objects and save to file Parameters ---------- mv_grid_districts : list Ints describing MV grid districts """ pickle_name = cfg_ding0.get('output', 'nd_pickle') # self.nd = self.read_pickles_from...
[ "def", "concat_nd_pickles", "(", "self", ",", "mv_grid_districts", ")", ":", "pickle_name", "=", "cfg_ding0", ".", "get", "(", "'output'", ",", "'nd_pickle'", ")", "# self.nd = self.read_pickles_from_files(pickle_name)", "# TODO: instead of passing a list of mvgd's, pass list o...
Read multiple pickles, join nd objects and save to file Parameters ---------- mv_grid_districts : list Ints describing MV grid districts
[ "Read", "multiple", "pickles", "join", "nd", "objects", "and", "save", "to", "file" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L232-L277
openego/ding0
ding0/tools/results.py
calculate_lvgd_stats
def calculate_lvgd_stats(nw): """ LV Statistics for an arbitrary network Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- lvgd_stats : pandas.DataFrame Dataframe containing several statistical numbers about the LVGD ...
python
def calculate_lvgd_stats(nw): """ LV Statistics for an arbitrary network Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- lvgd_stats : pandas.DataFrame Dataframe containing several statistical numbers about the LVGD ...
[ "def", "calculate_lvgd_stats", "(", "nw", ")", ":", "##############################", "# ETRS (equidistant) to WGS84 (conformal) projection", "proj", "=", "partial", "(", "pyproj", ".", "transform", ",", "# pyproj.Proj(init='epsg:3035'), # source coordinate system", "# pyproj.Pr...
LV Statistics for an arbitrary network Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- lvgd_stats : pandas.DataFrame Dataframe containing several statistical numbers about the LVGD
[ "LV", "Statistics", "for", "an", "arbitrary", "network" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L281-L466
openego/ding0
ding0/tools/results.py
calculate_mvgd_stats
def calculate_mvgd_stats(nw): """ MV Statistics for an arbitrary network Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- mvgd_stats : pandas.DataFrame Dataframe containing several statistical numbers about the MVGD ...
python
def calculate_mvgd_stats(nw): """ MV Statistics for an arbitrary network Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- mvgd_stats : pandas.DataFrame Dataframe containing several statistical numbers about the MVGD ...
[ "def", "calculate_mvgd_stats", "(", "nw", ")", ":", "##############################", "omega", "=", "2", "*", "pi", "*", "50", "# close circuit breakers", "nw", ".", "control_circuit_breakers", "(", "mode", "=", "'close'", ")", "##############################", "# Col...
MV Statistics for an arbitrary network Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- mvgd_stats : pandas.DataFrame Dataframe containing several statistical numbers about the MVGD
[ "MV", "Statistics", "for", "an", "arbitrary", "network" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L470-L1043
openego/ding0
ding0/tools/results.py
calculate_mvgd_voltage_current_stats
def calculate_mvgd_voltage_current_stats(nw): """ MV Voltage and Current Statistics for an arbitrary network Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- pandas.DataFrame nodes_df : Dataframe containing voltage stati...
python
def calculate_mvgd_voltage_current_stats(nw): """ MV Voltage and Current Statistics for an arbitrary network Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- pandas.DataFrame nodes_df : Dataframe containing voltage stati...
[ "def", "calculate_mvgd_voltage_current_stats", "(", "nw", ")", ":", "##############################", "# close circuit breakers", "nw", ".", "control_circuit_breakers", "(", "mode", "=", "'close'", ")", "##############################", "nodes_idx", "=", "0", "nodes_dict", ...
MV Voltage and Current Statistics for an arbitrary network Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- pandas.DataFrame nodes_df : Dataframe containing voltage statistics for every node in the MVGD pandas.DataFrame ...
[ "MV", "Voltage", "and", "Current", "Statistics", "for", "an", "arbitrary", "network" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L1047-L1118
openego/ding0
ding0/tools/results.py
calculate_lvgd_voltage_current_stats
def calculate_lvgd_voltage_current_stats(nw): """ LV Voltage and Current Statistics for an arbitrary network Note ---- Aggregated Load Areas are excluded. Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- pandas.Data...
python
def calculate_lvgd_voltage_current_stats(nw): """ LV Voltage and Current Statistics for an arbitrary network Note ---- Aggregated Load Areas are excluded. Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- pandas.Data...
[ "def", "calculate_lvgd_voltage_current_stats", "(", "nw", ")", ":", "##############################", "# close circuit breakers", "nw", ".", "control_circuit_breakers", "(", "mode", "=", "'close'", ")", "##############################", "nodes_idx", "=", "0", "nodes_dict", ...
LV Voltage and Current Statistics for an arbitrary network Note ---- Aggregated Load Areas are excluded. Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- pandas.DataFrame nodes_df : Dataframe containing voltage, res...
[ "LV", "Voltage", "and", "Current", "Statistics", "for", "an", "arbitrary", "network" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L1122-L1212
openego/ding0
ding0/tools/results.py
init_mv_grid
def init_mv_grid(mv_grid_districts=[3545], filename='ding0_tests_grids_1.pkl'): '''Runs ding0 over the districtis selected in mv_grid_districts It also writes the result in filename. If filename = False, then the network is not saved. Parameters ---------- mv_grid_districts: :any:`list` of :ob...
python
def init_mv_grid(mv_grid_districts=[3545], filename='ding0_tests_grids_1.pkl'): '''Runs ding0 over the districtis selected in mv_grid_districts It also writes the result in filename. If filename = False, then the network is not saved. Parameters ---------- mv_grid_districts: :any:`list` of :ob...
[ "def", "init_mv_grid", "(", "mv_grid_districts", "=", "[", "3545", "]", ",", "filename", "=", "'ding0_tests_grids_1.pkl'", ")", ":", "print", "(", "'\\n########################################'", ")", "print", "(", "' Running ding0 for district'", ",", "mv_grid_districts...
Runs ding0 over the districtis selected in mv_grid_districts It also writes the result in filename. If filename = False, then the network is not saved. Parameters ---------- mv_grid_districts: :any:`list` of :obj:`int` Districts IDs: Defaults to [3545] filename: str Defaults to...
[ "Runs", "ding0", "over", "the", "districtis", "selected", "in", "mv_grid_districts" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L1216-L1255
openego/ding0
ding0/tools/results.py
process_stats
def process_stats(mv_districts, n_of_districts, source, mode, critical, filename, output): '''Generates stats dataframes for districts in mv_districts. If source=='ding0', then runned districts are saved...
python
def process_stats(mv_districts, n_of_districts, source, mode, critical, filename, output): '''Generates stats dataframes for districts in mv_districts. If source=='ding0', then runned districts are saved...
[ "def", "process_stats", "(", "mv_districts", ",", "n_of_districts", ",", "source", ",", "mode", ",", "critical", ",", "filename", ",", "output", ")", ":", "#######################################################################", "# decide what exactly to do with MV LV", "if"...
Generates stats dataframes for districts in mv_districts. If source=='ding0', then runned districts are saved to a pickle named filename+str(n_of_districts[0])+'_to_'+str(n_of_districts[-1])+'.pkl' Parameters ---------- districts_list: list of int List with all districts to be run. n_o...
[ "Generates", "stats", "dataframes", "for", "districts", "in", "mv_districts", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L1259-L1382
openego/ding0
ding0/tools/results.py
parallel_running_stats
def parallel_running_stats(districts_list, n_of_processes, n_of_districts=1, source='pkl', mode='', critical=False, save_csv=False, ...
python
def parallel_running_stats(districts_list, n_of_processes, n_of_districts=1, source='pkl', mode='', critical=False, save_csv=False, ...
[ "def", "parallel_running_stats", "(", "districts_list", ",", "n_of_processes", ",", "n_of_districts", "=", "1", ",", "source", "=", "'pkl'", ",", "mode", "=", "''", ",", "critical", "=", "False", ",", "save_csv", "=", "False", ",", "save_path", "=", "''", ...
Organize parallel runs of ding0 to calculate stats The function take all districts in a list and divide them into n_of_processes parallel processes. For each process, the assigned districts are given to the function process_runs() with arguments n_of_districts, source, mode, and critical Parameter...
[ "Organize", "parallel", "runs", "of", "ding0", "to", "calculate", "stats" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L1385-L1575
openego/ding0
ding0/tools/results.py
export_network
def export_network(nw, mode=''): """ Export all nodes and lines of the network nw as DataFrames Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied mode: str If 'MV' export only medium voltage nodes and lines If 'LV' export only low voltage...
python
def export_network(nw, mode=''): """ Export all nodes and lines of the network nw as DataFrames Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied mode: str If 'MV' export only medium voltage nodes and lines If 'LV' export only low voltage...
[ "def", "export_network", "(", "nw", ",", "mode", "=", "''", ")", ":", "# close circuit breakers", "nw", ".", "control_circuit_breakers", "(", "mode", "=", "'close'", ")", "# srid", "srid", "=", "str", "(", "int", "(", "nw", ".", "config", "[", "'geo'", "...
Export all nodes and lines of the network nw as DataFrames Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied mode: str If 'MV' export only medium voltage nodes and lines If 'LV' export only low voltage nodes and lines else, exports MV and...
[ "Export", "all", "nodes", "and", "lines", "of", "the", "network", "nw", "as", "DataFrames" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L1579-L2166
openego/ding0
ding0/examples/example_analyze_multiple_grid_districts.py
ding0_exemplary_plots
def ding0_exemplary_plots(stats, base_path=BASEPATH): """ Analyze multiple grid district data generated with Ding0. Parameters ---------- stats : pandas.DataFrame Statistics of each MV grid districts base_path : str Root directory of Ding0 data structure, i.e. '~/.ding0' (which ...
python
def ding0_exemplary_plots(stats, base_path=BASEPATH): """ Analyze multiple grid district data generated with Ding0. Parameters ---------- stats : pandas.DataFrame Statistics of each MV grid districts base_path : str Root directory of Ding0 data structure, i.e. '~/.ding0' (which ...
[ "def", "ding0_exemplary_plots", "(", "stats", ",", "base_path", "=", "BASEPATH", ")", ":", "# make some plot", "plotpath", "=", "os", ".", "path", ".", "join", "(", "base_path", ",", "'plots'", ")", "results", ".", "plot_cable_length", "(", "stats", ",", "pl...
Analyze multiple grid district data generated with Ding0. Parameters ---------- stats : pandas.DataFrame Statistics of each MV grid districts base_path : str Root directory of Ding0 data structure, i.e. '~/.ding0' (which is default).
[ "Analyze", "multiple", "grid", "district", "data", "generated", "with", "Ding0", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/examples/example_analyze_multiple_grid_districts.py#L37-L56
openego/ding0
ding0/examples/example_analyze_multiple_grid_districts.py
nd_load_and_stats
def nd_load_and_stats(filenames, base_path=BASEPATH): """ Load multiple files from disk and generate stats Passes the list of files assuming the ding0 data structure as default in :code:`~/.ding0`. Data will be concatenated and key indicators for each grid district are returned in table and gra...
python
def nd_load_and_stats(filenames, base_path=BASEPATH): """ Load multiple files from disk and generate stats Passes the list of files assuming the ding0 data structure as default in :code:`~/.ding0`. Data will be concatenated and key indicators for each grid district are returned in table and gra...
[ "def", "nd_load_and_stats", "(", "filenames", ",", "base_path", "=", "BASEPATH", ")", ":", "# load Ding0 data", "nds", "=", "[", "]", "for", "filename", "in", "filenames", ":", "try", ":", "nd_load", "=", "results", ".", "load_nd_from_pickle", "(", "filename",...
Load multiple files from disk and generate stats Passes the list of files assuming the ding0 data structure as default in :code:`~/.ding0`. Data will be concatenated and key indicators for each grid district are returned in table and graphic format. Parameters ---------- filenames : list o...
[ "Load", "multiple", "files", "from", "disk", "and", "generate", "stats" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/examples/example_analyze_multiple_grid_districts.py#L59-L105
openego/ding0
ding0/flexopt/reinforce_measures.py
reinforce_branches_current
def reinforce_branches_current(grid, crit_branches): #TODO: finish docstring """ Reinforce MV or LV grid by installing a new branch/line type Parameters ---------- grid : GridDing0 Grid identifier. crit_branches : dict Dict of critical branches with max. relative overloading...
python
def reinforce_branches_current(grid, crit_branches): #TODO: finish docstring """ Reinforce MV or LV grid by installing a new branch/line type Parameters ---------- grid : GridDing0 Grid identifier. crit_branches : dict Dict of critical branches with max. relative overloading...
[ "def", "reinforce_branches_current", "(", "grid", ",", "crit_branches", ")", ":", "#TODO: finish docstring", "# load cable data, file_names and parameter", "branch_parameters", "=", "grid", ".", "network", ".", "static_data", "[", "'MV_cables'", "]", "branch_parameters", "=...
Reinforce MV or LV grid by installing a new branch/line type Parameters ---------- grid : GridDing0 Grid identifier. crit_branches : dict Dict of critical branches with max. relative overloading. Notes ----- The branch type to be installed is determined per bran...
[ "Reinforce", "MV", "or", "LV", "grid", "by", "installing", "a", "new", "branch", "/", "line", "type", "Parameters", "----------", "grid", ":", "GridDing0", "Grid", "identifier", ".", "crit_branches", ":", "dict", "Dict", "of", "critical", "branches", "with", ...
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/reinforce_measures.py#L31-L82
openego/ding0
ding0/flexopt/reinforce_measures.py
reinforce_branches_voltage
def reinforce_branches_voltage(grid, crit_branches, grid_level='MV'): #TODO: finish docstring """ Reinforce MV or LV grid by installing a new branch/line type Parameters ---------- grid : GridDing0 Grid identifier. crit_branches : :any:`list` of :obj:`int` List of critical branc...
python
def reinforce_branches_voltage(grid, crit_branches, grid_level='MV'): #TODO: finish docstring """ Reinforce MV or LV grid by installing a new branch/line type Parameters ---------- grid : GridDing0 Grid identifier. crit_branches : :any:`list` of :obj:`int` List of critical branc...
[ "def", "reinforce_branches_voltage", "(", "grid", ",", "crit_branches", ",", "grid_level", "=", "'MV'", ")", ":", "#TODO: finish docstring", "# load cable data, file_names and parameter", "branch_parameters", "=", "grid", ".", "network", ".", "static_data", "[", "'{gridle...
Reinforce MV or LV grid by installing a new branch/line type Parameters ---------- grid : GridDing0 Grid identifier. crit_branches : :any:`list` of :obj:`int` List of critical branches. #TODO: check if a list or a dictionary grid_level : str Specifying either 'MV' for medium...
[ "Reinforce", "MV", "or", "LV", "grid", "by", "installing", "a", "new", "branch", "/", "line", "type" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/reinforce_measures.py#L84-L136
openego/ding0
ding0/flexopt/reinforce_measures.py
extend_substation
def extend_substation(grid, critical_stations, grid_level): """ Reinforce MV or LV substation by exchanging the existing trafo and installing a parallel one if necessary. First, all available transformers in a `critical_stations` are extended to maximum power. If this does not solve all present iss...
python
def extend_substation(grid, critical_stations, grid_level): """ Reinforce MV or LV substation by exchanging the existing trafo and installing a parallel one if necessary. First, all available transformers in a `critical_stations` are extended to maximum power. If this does not solve all present iss...
[ "def", "extend_substation", "(", "grid", ",", "critical_stations", ",", "grid_level", ")", ":", "load_factor_lv_trans_lc_normal", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'load_factor_lv_trans_lc_normal'", ")", "load_factor_lv_trans_fc_normal", "=", "cfg_...
Reinforce MV or LV substation by exchanging the existing trafo and installing a parallel one if necessary. First, all available transformers in a `critical_stations` are extended to maximum power. If this does not solve all present issues, additional transformers are build. Parameters --------...
[ "Reinforce", "MV", "or", "LV", "substation", "by", "exchanging", "the", "existing", "trafo", "and", "installing", "a", "parallel", "one", "if", "necessary", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/reinforce_measures.py#L139-L237
openego/ding0
ding0/flexopt/reinforce_measures.py
extend_substation_voltage
def extend_substation_voltage(crit_stations, grid_level='LV'): """ Extend substation if voltage issues at the substation occur Follows a two-step procedure: i) Existing transformers are extended by replacement with large nominal apparent power ii) New additional transformers adde...
python
def extend_substation_voltage(crit_stations, grid_level='LV'): """ Extend substation if voltage issues at the substation occur Follows a two-step procedure: i) Existing transformers are extended by replacement with large nominal apparent power ii) New additional transformers adde...
[ "def", "extend_substation_voltage", "(", "crit_stations", ",", "grid_level", "=", "'LV'", ")", ":", "grid", "=", "crit_stations", "[", "0", "]", "[", "'node'", "]", ".", "grid", "trafo_params", "=", "grid", ".", "network", ".", "_static_data", "[", "'{grid_l...
Extend substation if voltage issues at the substation occur Follows a two-step procedure: i) Existing transformers are extended by replacement with large nominal apparent power ii) New additional transformers added to substation (see 'Notes') Parameters ---------- crit_stati...
[ "Extend", "substation", "if", "voltage", "issues", "at", "the", "substation", "occur" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/reinforce_measures.py#L240-L318
openego/ding0
ding0/flexopt/reinforce_measures.py
reinforce_lv_branches_overloading
def reinforce_lv_branches_overloading(grid, crit_branches): """ Choose appropriate cable type for branches with line overloading Parameters ---------- grid : LVGridDing0 Ding0 LV grid object crit_branches : :any:`list` List of critical branches incl. its line loading Notes ...
python
def reinforce_lv_branches_overloading(grid, crit_branches): """ Choose appropriate cable type for branches with line overloading Parameters ---------- grid : LVGridDing0 Ding0 LV grid object crit_branches : :any:`list` List of critical branches incl. its line loading Notes ...
[ "def", "reinforce_lv_branches_overloading", "(", "grid", ",", "crit_branches", ")", ":", "unsolved_branches", "=", "[", "]", "cable_lf", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'load_factor_lv_cable_lc_normal'", ")", "cables", "=", "grid", ".", "...
Choose appropriate cable type for branches with line overloading Parameters ---------- grid : LVGridDing0 Ding0 LV grid object crit_branches : :any:`list` List of critical branches incl. its line loading Notes ----- If maximum size cable is not capable to resolve issue due ...
[ "Choose", "appropriate", "cable", "type", "for", "branches", "with", "line", "overloading" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/reinforce_measures.py#L331-L385
openego/ding0
ding0/flexopt/reinforce_measures.py
extend_trafo_power
def extend_trafo_power(extendable_trafos, trafo_params): """ Extend power of first trafo in list of extendable trafos Parameters ---------- extendable_trafos : :any:`list` Trafos with rated power below maximum size available trafo trafo_params : :pandas:`pandas.DataFrame<dataframe>` ...
python
def extend_trafo_power(extendable_trafos, trafo_params): """ Extend power of first trafo in list of extendable trafos Parameters ---------- extendable_trafos : :any:`list` Trafos with rated power below maximum size available trafo trafo_params : :pandas:`pandas.DataFrame<dataframe>` ...
[ "def", "extend_trafo_power", "(", "extendable_trafos", ",", "trafo_params", ")", ":", "trafo", "=", "extendable_trafos", "[", "0", "]", "trafo_s_max_a_before", "=", "trafo", ".", "s_max_a", "trafo_nearest_larger", "=", "trafo_params", ".", "loc", "[", "trafo_params"...
Extend power of first trafo in list of extendable trafos Parameters ---------- extendable_trafos : :any:`list` Trafos with rated power below maximum size available trafo trafo_params : :pandas:`pandas.DataFrame<dataframe>` Transformer parameters
[ "Extend", "power", "of", "first", "trafo", "in", "list", "of", "extendable", "trafos" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/reinforce_measures.py#L388-L410
openego/ding0
ding0/core/network/__init__.py
GridDing0.add_generator
def add_generator(self, generator): """Adds a generator to _generators and grid graph if not already existing Parameters ---------- generator : GridDing0 Description #TODO """ if generator not in self._generators and isinstance(generator, ...
python
def add_generator(self, generator): """Adds a generator to _generators and grid graph if not already existing Parameters ---------- generator : GridDing0 Description #TODO """ if generator not in self._generators and isinstance(generator, ...
[ "def", "add_generator", "(", "self", ",", "generator", ")", ":", "if", "generator", "not", "in", "self", ".", "_generators", "and", "isinstance", "(", "generator", ",", "GeneratorDing0", ")", ":", "self", ".", "_generators", ".", "append", "(", "generator", ...
Adds a generator to _generators and grid graph if not already existing Parameters ---------- generator : GridDing0 Description #TODO
[ "Adds", "a", "generator", "to", "_generators", "and", "grid", "graph", "if", "not", "already", "existing", "Parameters", "----------", "generator", ":", "GridDing0", "Description", "#TODO" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L100-L112
openego/ding0
ding0/core/network/__init__.py
GridDing0.graph_add_node
def graph_add_node(self, node_object): """Adds a station or cable distributor object to grid graph if not already existing Parameters ---------- node_object : GridDing0 Description #TODO """ if ((node_object not in self._graph.nodes()) and ...
python
def graph_add_node(self, node_object): """Adds a station or cable distributor object to grid graph if not already existing Parameters ---------- node_object : GridDing0 Description #TODO """ if ((node_object not in self._graph.nodes()) and ...
[ "def", "graph_add_node", "(", "self", ",", "node_object", ")", ":", "if", "(", "(", "node_object", "not", "in", "self", ".", "_graph", ".", "nodes", "(", ")", ")", "and", "(", "isinstance", "(", "node_object", ",", "(", "StationDing0", ",", "CableDistrib...
Adds a station or cable distributor object to grid graph if not already existing Parameters ---------- node_object : GridDing0 Description #TODO
[ "Adds", "a", "station", "or", "cable", "distributor", "object", "to", "grid", "graph", "if", "not", "already", "existing", "Parameters", "----------", "node_object", ":", "GridDing0", "Description", "#TODO" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L114-L129
openego/ding0
ding0/core/network/__init__.py
GridDing0.graph_draw
def graph_draw(self, mode): """ Draws grid graph using networkx This method is for debugging purposes only. Use ding0.tools.plots.plot_mv_topology() for advanced plotting. Parameters ---------- mode : str Mode selection 'MV' or 'LV'. Not...
python
def graph_draw(self, mode): """ Draws grid graph using networkx This method is for debugging purposes only. Use ding0.tools.plots.plot_mv_topology() for advanced plotting. Parameters ---------- mode : str Mode selection 'MV' or 'LV'. Not...
[ "def", "graph_draw", "(", "self", ",", "mode", ")", ":", "g", "=", "self", ".", "_graph", "if", "mode", "==", "'MV'", ":", "# get draw params from nodes and edges (coordinates, colors, demands, etc.)", "nodes_pos", "=", "{", "}", "demands", "=", "{", "}", "deman...
Draws grid graph using networkx This method is for debugging purposes only. Use ding0.tools.plots.plot_mv_topology() for advanced plotting. Parameters ---------- mode : str Mode selection 'MV' or 'LV'. Notes ----- The geo coords ...
[ "Draws", "grid", "graph", "using", "networkx" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L131-L226
openego/ding0
ding0/core/network/__init__.py
GridDing0.graph_nodes_sorted
def graph_nodes_sorted(self): """ Returns an (ascending) sorted list of graph's nodes (name is used as key). Returns ------- :any:`list` Description #TODO check """ return sorted(self._graph.nodes(), key=lambda _: repr(_))
python
def graph_nodes_sorted(self): """ Returns an (ascending) sorted list of graph's nodes (name is used as key). Returns ------- :any:`list` Description #TODO check """ return sorted(self._graph.nodes(), key=lambda _: repr(_))
[ "def", "graph_nodes_sorted", "(", "self", ")", ":", "return", "sorted", "(", "self", ".", "_graph", ".", "nodes", "(", ")", ",", "key", "=", "lambda", "_", ":", "repr", "(", "_", ")", ")" ]
Returns an (ascending) sorted list of graph's nodes (name is used as key). Returns ------- :any:`list` Description #TODO check
[ "Returns", "an", "(", "ascending", ")", "sorted", "list", "of", "graph", "s", "nodes", "(", "name", "is", "used", "as", "key", ")", ".", "Returns", "-------", ":", "any", ":", "list", "Description", "#TODO", "check" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L228-L237
openego/ding0
ding0/core/network/__init__.py
GridDing0.graph_nodes_from_branch
def graph_nodes_from_branch(self, branch): """ Returns nodes that are connected by `branch` Args ---- branch: BranchDing0 Description #TODO Returns ------- (:obj:`GridDing0`, :obj:`GridDing0`) 2-tuple of nodes (Ding0 objec...
python
def graph_nodes_from_branch(self, branch): """ Returns nodes that are connected by `branch` Args ---- branch: BranchDing0 Description #TODO Returns ------- (:obj:`GridDing0`, :obj:`GridDing0`) 2-tuple of nodes (Ding0 objec...
[ "def", "graph_nodes_from_branch", "(", "self", ",", "branch", ")", ":", "edges", "=", "nx", ".", "get_edge_attributes", "(", "self", ".", "_graph", ",", "'branch'", ")", "nodes", "=", "list", "(", "edges", ".", "keys", "(", ")", ")", "[", "list", "(", ...
Returns nodes that are connected by `branch` Args ---- branch: BranchDing0 Description #TODO Returns ------- (:obj:`GridDing0`, :obj:`GridDing0`) 2-tuple of nodes (Ding0 objects) #TODO:Check
[ "Returns", "nodes", "that", "are", "connected", "by", "branch" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L239-L254
openego/ding0
ding0/core/network/__init__.py
GridDing0.graph_branches_from_node
def graph_branches_from_node(self, node): """ Returns branches that are connected to `node` Args ---- node: GridDing0 Ding0 object (member of graph) Returns ------- :any:`list` List of tuples (node in :obj:`GridDing0`, branch in :...
python
def graph_branches_from_node(self, node): """ Returns branches that are connected to `node` Args ---- node: GridDing0 Ding0 object (member of graph) Returns ------- :any:`list` List of tuples (node in :obj:`GridDing0`, branch in :...
[ "def", "graph_branches_from_node", "(", "self", ",", "node", ")", ":", "# TODO: This method can be replaced and speed up by using NetworkX' neighbors()", "branches", "=", "[", "]", "branches_dict", "=", "self", ".", "_graph", ".", "adj", "[", "node", "]", "for", "bran...
Returns branches that are connected to `node` Args ---- node: GridDing0 Ding0 object (member of graph) Returns ------- :any:`list` List of tuples (node in :obj:`GridDing0`, branch in :obj:`BranchDing0`) :: (no...
[ "Returns", "branches", "that", "are", "connected", "to", "node" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L256-L280
openego/ding0
ding0/core/network/__init__.py
GridDing0.graph_edges
def graph_edges(self): """ Returns a generator for iterating over graph edges The edge of a graph is described by the two adjacent node and the branch object itself. Whereas the branch object is used to hold all relevant power system parameters. Yields ------ in...
python
def graph_edges(self): """ Returns a generator for iterating over graph edges The edge of a graph is described by the two adjacent node and the branch object itself. Whereas the branch object is used to hold all relevant power system parameters. Yields ------ in...
[ "def", "graph_edges", "(", "self", ")", ":", "# get edges with attributes", "edges", "=", "nx", ".", "get_edge_attributes", "(", "self", ".", "_graph", ",", "'branch'", ")", ".", "items", "(", ")", "# sort them according to connected nodes", "edges_sorted", "=", "...
Returns a generator for iterating over graph edges The edge of a graph is described by the two adjacent node and the branch object itself. Whereas the branch object is used to hold all relevant power system parameters. Yields ------ int Description #TODO che...
[ "Returns", "a", "generator", "for", "iterating", "over", "graph", "edges" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L282-L317
openego/ding0
ding0/core/network/__init__.py
GridDing0.find_path
def find_path(self, node_source, node_target, type='nodes'): """Determines shortest path Determines the shortest path from `node_source` to `node_target` in _graph using networkx' shortest path algorithm. Args ---- node_source: GridDing0 source node,...
python
def find_path(self, node_source, node_target, type='nodes'): """Determines shortest path Determines the shortest path from `node_source` to `node_target` in _graph using networkx' shortest path algorithm. Args ---- node_source: GridDing0 source node,...
[ "def", "find_path", "(", "self", ",", "node_source", ",", "node_target", ",", "type", "=", "'nodes'", ")", ":", "if", "(", "node_source", "in", "self", ".", "_graph", ".", "nodes", "(", ")", ")", "and", "(", "node_target", "in", "self", ".", "_graph", ...
Determines shortest path Determines the shortest path from `node_source` to `node_target` in _graph using networkx' shortest path algorithm. Args ---- node_source: GridDing0 source node, member of _graph node_target: GridDing0 target node...
[ "Determines", "shortest", "path" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L319-L359
openego/ding0
ding0/core/network/__init__.py
GridDing0.find_and_union_paths
def find_and_union_paths(self, node_source, nodes_target): """ Determines shortest paths from `node_source` to all nodes in `node_target` in _graph using find_path(). The branches of all paths are stored in a set - the result is a list of unique branches. Args ---- node_source:...
python
def find_and_union_paths(self, node_source, nodes_target): """ Determines shortest paths from `node_source` to all nodes in `node_target` in _graph using find_path(). The branches of all paths are stored in a set - the result is a list of unique branches. Args ---- node_source:...
[ "def", "find_and_union_paths", "(", "self", ",", "node_source", ",", "nodes_target", ")", ":", "branches", "=", "set", "(", ")", "for", "node_target", "in", "nodes_target", ":", "path", "=", "self", ".", "find_path", "(", "node_source", ",", "node_target", "...
Determines shortest paths from `node_source` to all nodes in `node_target` in _graph using find_path(). The branches of all paths are stored in a set - the result is a list of unique branches. Args ---- node_source: GridDing0 source node, member of _graph node_targe...
[ "Determines", "shortest", "paths", "from", "node_source", "to", "all", "nodes", "in", "node_target", "in", "_graph", "using", "find_path", "()", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L361-L385
openego/ding0
ding0/core/network/__init__.py
GridDing0.graph_path_length
def graph_path_length(self, node_source, node_target): """ Calculates the absolute distance between `node_source` and `node_target` in meters using find_path() and branches' length attribute. Args ---- node_source: GridDing0 source node, member of _graph node_target:...
python
def graph_path_length(self, node_source, node_target): """ Calculates the absolute distance between `node_source` and `node_target` in meters using find_path() and branches' length attribute. Args ---- node_source: GridDing0 source node, member of _graph node_target:...
[ "def", "graph_path_length", "(", "self", ",", "node_source", ",", "node_target", ")", ":", "length", "=", "0", "path", "=", "self", ".", "find_path", "(", "node_source", ",", "node_target", ")", "node_pairs", "=", "list", "(", "zip", "(", "path", "[", "0...
Calculates the absolute distance between `node_source` and `node_target` in meters using find_path() and branches' length attribute. Args ---- node_source: GridDing0 source node, member of _graph node_target: GridDing0 target node, member of _graph Retur...
[ "Calculates", "the", "absolute", "distance", "between", "node_source", "and", "node_target", "in", "meters", "using", "find_path", "()", "and", "branches", "length", "attribute", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L387-L410
openego/ding0
ding0/core/network/__init__.py
GridDing0.graph_isolated_nodes
def graph_isolated_nodes(self): """ Finds isolated nodes = nodes with no neighbors (degree zero) Returns ------- :any:`list` of :obj:`GridDing0` List of nodes (Ding0 objects) """ return sorted(nx.isolates(self._graph), key=lambda x: repr(x))
python
def graph_isolated_nodes(self): """ Finds isolated nodes = nodes with no neighbors (degree zero) Returns ------- :any:`list` of :obj:`GridDing0` List of nodes (Ding0 objects) """ return sorted(nx.isolates(self._graph), key=lambda x: repr(x))
[ "def", "graph_isolated_nodes", "(", "self", ")", ":", "return", "sorted", "(", "nx", ".", "isolates", "(", "self", ".", "_graph", ")", ",", "key", "=", "lambda", "x", ":", "repr", "(", "x", ")", ")" ]
Finds isolated nodes = nodes with no neighbors (degree zero) Returns ------- :any:`list` of :obj:`GridDing0` List of nodes (Ding0 objects)
[ "Finds", "isolated", "nodes", "=", "nodes", "with", "no", "neighbors", "(", "degree", "zero", ")" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L412-L420
openego/ding0
ding0/core/network/__init__.py
StationDing0.add_transformer
def add_transformer(self, transformer): """Adds a transformer to _transformers if not already existing Args ---- transformer : StationDing0 Description #TODO """ if transformer not in self.transformers() and isinstance(transformer, TransformerDing0): ...
python
def add_transformer(self, transformer): """Adds a transformer to _transformers if not already existing Args ---- transformer : StationDing0 Description #TODO """ if transformer not in self.transformers() and isinstance(transformer, TransformerDing0): ...
[ "def", "add_transformer", "(", "self", ",", "transformer", ")", ":", "if", "transformer", "not", "in", "self", ".", "transformers", "(", ")", "and", "isinstance", "(", "transformer", ",", "TransformerDing0", ")", ":", "self", ".", "_transformers", ".", "appe...
Adds a transformer to _transformers if not already existing Args ---- transformer : StationDing0 Description #TODO
[ "Adds", "a", "transformer", "to", "_transformers", "if", "not", "already", "existing", "Args", "----", "transformer", ":", "StationDing0", "Description", "#TODO" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L483-L492
openego/ding0
ding0/core/network/__init__.py
RingDing0.branches
def branches(self): """ #TODO: description """ for branch in self._grid.graph_edges(): if branch['branch'].ring == self: yield branch
python
def branches(self): """ #TODO: description """ for branch in self._grid.graph_edges(): if branch['branch'].ring == self: yield branch
[ "def", "branches", "(", "self", ")", ":", "for", "branch", "in", "self", ".", "_grid", ".", "graph_edges", "(", ")", ":", "if", "branch", "[", "'branch'", "]", ".", "ring", "==", "self", ":", "yield", "branch" ]
#TODO: description
[ "#TODO", ":", "description" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L527-L532
openego/ding0
ding0/core/network/__init__.py
RingDing0.lv_load_areas
def lv_load_areas(self): """ #TODO: description """ for lv_load_area in self._grid._graph.nodes(): if isinstance(lv_load_area, LVLoadAreaDing0): if lv_load_area.ring == self: yield lv_load_area
python
def lv_load_areas(self): """ #TODO: description """ for lv_load_area in self._grid._graph.nodes(): if isinstance(lv_load_area, LVLoadAreaDing0): if lv_load_area.ring == self: yield lv_load_area
[ "def", "lv_load_areas", "(", "self", ")", ":", "for", "lv_load_area", "in", "self", ".", "_grid", ".", "_graph", ".", "nodes", "(", ")", ":", "if", "isinstance", "(", "lv_load_area", ",", "LVLoadAreaDing0", ")", ":", "if", "lv_load_area", ".", "ring", "=...
#TODO: description
[ "#TODO", ":", "description" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L534-L540
openego/ding0
ding0/core/network/__init__.py
CircuitBreakerDing0.open
def open(self): """ Open a Circuit Breaker #TODO Check """ self.branch_nodes = self.grid.graph_nodes_from_branch(self.branch) self.grid._graph.remove_edge(self.branch_nodes[0], self.branch_nodes[1]) self.status = 'open'
python
def open(self): """ Open a Circuit Breaker #TODO Check """ self.branch_nodes = self.grid.graph_nodes_from_branch(self.branch) self.grid._graph.remove_edge(self.branch_nodes[0], self.branch_nodes[1]) self.status = 'open'
[ "def", "open", "(", "self", ")", ":", "self", ".", "branch_nodes", "=", "self", ".", "grid", ".", "graph_nodes_from_branch", "(", "self", ".", "branch", ")", "self", ".", "grid", ".", "_graph", ".", "remove_edge", "(", "self", ".", "branch_nodes", "[", ...
Open a Circuit Breaker #TODO Check
[ "Open", "a", "Circuit", "Breaker", "#TODO", "Check" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L826-L831
openego/ding0
ding0/core/network/__init__.py
CircuitBreakerDing0.close
def close(self): """ Close a Circuit Breaker #TODO Check """ self.grid._graph.add_edge(self.branch_nodes[0], self.branch_nodes[1], branch=self.branch) self.status = 'closed'
python
def close(self): """ Close a Circuit Breaker #TODO Check """ self.grid._graph.add_edge(self.branch_nodes[0], self.branch_nodes[1], branch=self.branch) self.status = 'closed'
[ "def", "close", "(", "self", ")", ":", "self", ".", "grid", ".", "_graph", ".", "add_edge", "(", "self", ".", "branch_nodes", "[", "0", "]", ",", "self", ".", "branch_nodes", "[", "1", "]", ",", "branch", "=", "self", ".", "branch", ")", "self", ...
Close a Circuit Breaker #TODO Check
[ "Close", "a", "Circuit", "Breaker", "#TODO", "Check" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L833-L837
openego/ding0
ding0/core/structure/regions.py
MVGridDistrictDing0.lv_load_areas
def lv_load_areas(self): """Returns a generator for iterating over load_areas Yields ------ int generator for iterating over load_areas """ for load_area in sorted(self._lv_load_areas, key=lambda _: repr(_)): yield load_area
python
def lv_load_areas(self): """Returns a generator for iterating over load_areas Yields ------ int generator for iterating over load_areas """ for load_area in sorted(self._lv_load_areas, key=lambda _: repr(_)): yield load_area
[ "def", "lv_load_areas", "(", "self", ")", ":", "for", "load_area", "in", "sorted", "(", "self", ".", "_lv_load_areas", ",", "key", "=", "lambda", "_", ":", "repr", "(", "_", ")", ")", ":", "yield", "load_area" ]
Returns a generator for iterating over load_areas Yields ------ int generator for iterating over load_areas
[ "Returns", "a", "generator", "for", "iterating", "over", "load_areas", "Yields", "------", "int", "generator", "for", "iterating", "over", "load_areas" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/structure/regions.py#L65-L74
openego/ding0
ding0/core/structure/regions.py
MVGridDistrictDing0.add_lv_load_area
def add_lv_load_area(self, lv_load_area): """ Adds a Load Area `lv_load_area` to _lv_load_areas if not already existing Additionally, adds the associated centre object to MV grid's _graph as node. Args ---- lv_load_area: LVLoadAreaDing0 instance of class LVL...
python
def add_lv_load_area(self, lv_load_area): """ Adds a Load Area `lv_load_area` to _lv_load_areas if not already existing Additionally, adds the associated centre object to MV grid's _graph as node. Args ---- lv_load_area: LVLoadAreaDing0 instance of class LVL...
[ "def", "add_lv_load_area", "(", "self", ",", "lv_load_area", ")", ":", "if", "lv_load_area", "not", "in", "self", ".", "lv_load_areas", "(", ")", "and", "isinstance", "(", "lv_load_area", ",", "LVLoadAreaDing0", ")", ":", "self", ".", "_lv_load_areas", ".", ...
Adds a Load Area `lv_load_area` to _lv_load_areas if not already existing Additionally, adds the associated centre object to MV grid's _graph as node. Args ---- lv_load_area: LVLoadAreaDing0 instance of class LVLoadAreaDing0
[ "Adds", "a", "Load", "Area", "lv_load_area", "to", "_lv_load_areas", "if", "not", "already", "existing", "Additionally", "adds", "the", "associated", "centre", "object", "to", "MV", "grid", "s", "_graph", "as", "node", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/structure/regions.py#L76-L88
openego/ding0
ding0/core/structure/regions.py
MVGridDistrictDing0.add_lv_load_area_group
def add_lv_load_area_group(self, lv_load_area_group): """Adds a LV load_area to _lv_load_areas if not already existing. """ if lv_load_area_group not in self.lv_load_area_groups(): self._lv_load_area_groups.append(lv_load_area_group)
python
def add_lv_load_area_group(self, lv_load_area_group): """Adds a LV load_area to _lv_load_areas if not already existing. """ if lv_load_area_group not in self.lv_load_area_groups(): self._lv_load_area_groups.append(lv_load_area_group)
[ "def", "add_lv_load_area_group", "(", "self", ",", "lv_load_area_group", ")", ":", "if", "lv_load_area_group", "not", "in", "self", ".", "lv_load_area_groups", "(", ")", ":", "self", ".", "_lv_load_area_groups", ".", "append", "(", "lv_load_area_group", ")" ]
Adds a LV load_area to _lv_load_areas if not already existing.
[ "Adds", "a", "LV", "load_area", "to", "_lv_load_areas", "if", "not", "already", "existing", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/structure/regions.py#L111-L115
openego/ding0
ding0/core/structure/regions.py
MVGridDistrictDing0.add_peak_demand
def add_peak_demand(self): """Summarizes peak loads of underlying load_areas in kVA. (peak load sum and peak load of satellites) """ peak_load = peak_load_satellites = 0 for lv_load_area in self.lv_load_areas(): peak_load += lv_load_area.peak_load ...
python
def add_peak_demand(self): """Summarizes peak loads of underlying load_areas in kVA. (peak load sum and peak load of satellites) """ peak_load = peak_load_satellites = 0 for lv_load_area in self.lv_load_areas(): peak_load += lv_load_area.peak_load ...
[ "def", "add_peak_demand", "(", "self", ")", ":", "peak_load", "=", "peak_load_satellites", "=", "0", "for", "lv_load_area", "in", "self", ".", "lv_load_areas", "(", ")", ":", "peak_load", "+=", "lv_load_area", ".", "peak_load", "if", "lv_load_area", ".", "is_s...
Summarizes peak loads of underlying load_areas in kVA. (peak load sum and peak load of satellites)
[ "Summarizes", "peak", "loads", "of", "underlying", "load_areas", "in", "kVA", ".", "(", "peak", "load", "sum", "and", "peak", "load", "of", "satellites", ")" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/structure/regions.py#L117-L128
openego/ding0
ding0/core/structure/regions.py
MVGridDistrictDing0.add_aggregated_peak_demand
def add_aggregated_peak_demand(self): """Summarizes peak loads of underlying aggregated load_areas""" peak_load_aggregated = 0 for lv_load_area in self.lv_load_areas(): if lv_load_area.is_aggregated: peak_load_aggregated += lv_load_area.peak_load self.peak_loa...
python
def add_aggregated_peak_demand(self): """Summarizes peak loads of underlying aggregated load_areas""" peak_load_aggregated = 0 for lv_load_area in self.lv_load_areas(): if lv_load_area.is_aggregated: peak_load_aggregated += lv_load_area.peak_load self.peak_loa...
[ "def", "add_aggregated_peak_demand", "(", "self", ")", ":", "peak_load_aggregated", "=", "0", "for", "lv_load_area", "in", "self", ".", "lv_load_areas", "(", ")", ":", "if", "lv_load_area", ".", "is_aggregated", ":", "peak_load_aggregated", "+=", "lv_load_area", "...
Summarizes peak loads of underlying aggregated load_areas
[ "Summarizes", "peak", "loads", "of", "underlying", "aggregated", "load_areas" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/structure/regions.py#L130-L136
openego/ding0
ding0/core/structure/regions.py
LVLoadAreaDing0.lv_grid_districts
def lv_grid_districts(self): """Returns a generator for iterating over LV grid districts Yields ------ int generator for iterating over LV grid districts """ for lv_grid_district in sorted(self._lv_grid_districts, key=lambda _: repr(_)): y...
python
def lv_grid_districts(self): """Returns a generator for iterating over LV grid districts Yields ------ int generator for iterating over LV grid districts """ for lv_grid_district in sorted(self._lv_grid_districts, key=lambda _: repr(_)): y...
[ "def", "lv_grid_districts", "(", "self", ")", ":", "for", "lv_grid_district", "in", "sorted", "(", "self", ".", "_lv_grid_districts", ",", "key", "=", "lambda", "_", ":", "repr", "(", "_", ")", ")", ":", "yield", "lv_grid_district" ]
Returns a generator for iterating over LV grid districts Yields ------ int generator for iterating over LV grid districts
[ "Returns", "a", "generator", "for", "iterating", "over", "LV", "grid", "districts", "Yields", "------", "int", "generator", "for", "iterating", "over", "LV", "grid", "districts" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/structure/regions.py#L215-L224
openego/ding0
ding0/core/structure/regions.py
LVLoadAreaDing0.add_lv_grid_district
def add_lv_grid_district(self, lv_grid_district): # TODO: check docstring """Adds a LV grid district to _lv_grid_districts if not already existing Args ---- lv_grid_district: :shapely:`Shapely Polygon object<polygons>` Descr """ if lv_grid_di...
python
def add_lv_grid_district(self, lv_grid_district): # TODO: check docstring """Adds a LV grid district to _lv_grid_districts if not already existing Args ---- lv_grid_district: :shapely:`Shapely Polygon object<polygons>` Descr """ if lv_grid_di...
[ "def", "add_lv_grid_district", "(", "self", ",", "lv_grid_district", ")", ":", "# TODO: check docstring", "if", "lv_grid_district", "not", "in", "self", ".", "_lv_grid_districts", "and", "isinstance", "(", "lv_grid_district", ",", "LVGridDistrictDing0", ")", ":", "sel...
Adds a LV grid district to _lv_grid_districts if not already existing Args ---- lv_grid_district: :shapely:`Shapely Polygon object<polygons>` Descr
[ "Adds", "a", "LV", "grid", "district", "to", "_lv_grid_districts", "if", "not", "already", "existing", "Args", "----", "lv_grid_district", ":", ":", "shapely", ":", "Shapely", "Polygon", "object<polygons", ">", "Descr" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/structure/regions.py#L236-L248
openego/ding0
ding0/core/structure/regions.py
LVLoadAreaDing0.peak_generation
def peak_generation(self): """Cumulative peak generation of generators connected to LV grids of underlying LVGDs """ cum_peak_generation = 0 for lv_grid_district in self._lv_grid_districts: cum_peak_generation += lv_grid_district.lv_grid.station().peak_generation ...
python
def peak_generation(self): """Cumulative peak generation of generators connected to LV grids of underlying LVGDs """ cum_peak_generation = 0 for lv_grid_district in self._lv_grid_districts: cum_peak_generation += lv_grid_district.lv_grid.station().peak_generation ...
[ "def", "peak_generation", "(", "self", ")", ":", "cum_peak_generation", "=", "0", "for", "lv_grid_district", "in", "self", ".", "_lv_grid_districts", ":", "cum_peak_generation", "+=", "lv_grid_district", ".", "lv_grid", ".", "station", "(", ")", ".", "peak_generat...
Cumulative peak generation of generators connected to LV grids of underlying LVGDs
[ "Cumulative", "peak", "generation", "of", "generators", "connected", "to", "LV", "grids", "of", "underlying", "LVGDs" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/structure/regions.py#L251-L260
openego/ding0
ding0/grid/mv_grid/solvers/base.py
BaseSolution.get_pair
def get_pair(self, pair): """get pair description Parameters ---------- pair : :any:`list` of nodes Descr Returns ------- type Descr """ i, j = pair return (self._nodes[i.name()], self._nodes[j....
python
def get_pair(self, pair): """get pair description Parameters ---------- pair : :any:`list` of nodes Descr Returns ------- type Descr """ i, j = pair return (self._nodes[i.name()], self._nodes[j....
[ "def", "get_pair", "(", "self", ",", "pair", ")", ":", "i", ",", "j", "=", "pair", "return", "(", "self", ".", "_nodes", "[", "i", ".", "name", "(", ")", "]", ",", "self", ".", "_nodes", "[", "j", ".", "name", "(", ")", "]", ")" ]
get pair description Parameters ---------- pair : :any:`list` of nodes Descr Returns ------- type Descr
[ "get", "pair", "description", "Parameters", "----------", "pair", ":", ":", "any", ":", "list", "of", "nodes", "Descr", "Returns", "-------", "type", "Descr" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/base.py#L41-L55
openego/ding0
ding0/grid/mv_grid/solvers/base.py
BaseSolution.is_complete
def is_complete(self): """Returns True if this is a complete solution, i.e, all nodes are allocated Returns ------- bool True if all nodes are llocated. """ return all( [node.route_allocation() is not None for node in list(self._nodes.valu...
python
def is_complete(self): """Returns True if this is a complete solution, i.e, all nodes are allocated Returns ------- bool True if all nodes are llocated. """ return all( [node.route_allocation() is not None for node in list(self._nodes.valu...
[ "def", "is_complete", "(", "self", ")", ":", "return", "all", "(", "[", "node", ".", "route_allocation", "(", ")", "is", "not", "None", "for", "node", "in", "list", "(", "self", ".", "_nodes", ".", "values", "(", ")", ")", "if", "node", "!=", "self...
Returns True if this is a complete solution, i.e, all nodes are allocated Returns ------- bool True if all nodes are llocated.
[ "Returns", "True", "if", "this", "is", "a", "complete", "solution", "i", ".", "e", "all", "nodes", "are", "allocated", "Returns", "-------", "bool", "True", "if", "all", "nodes", "are", "llocated", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/base.py#L57-L67
openego/ding0
ding0/grid/mv_grid/solvers/base.py
BaseSolution.clone
def clone(self): """Returns a deep copy of self Function clones: * route * allocation * nodes Returns ------- type Deep copy of self """ new_solution = self.__class__(self._problem, len(self._routes)) ...
python
def clone(self): """Returns a deep copy of self Function clones: * route * allocation * nodes Returns ------- type Deep copy of self """ new_solution = self.__class__(self._problem, len(self._routes)) ...
[ "def", "clone", "(", "self", ")", ":", "new_solution", "=", "self", ".", "__class__", "(", "self", ".", "_problem", ",", "len", "(", "self", ".", "_routes", ")", ")", "# Clone routes", "for", "index", ",", "r", "in", "enumerate", "(", "self", ".", "_...
Returns a deep copy of self Function clones: * route * allocation * nodes Returns ------- type Deep copy of self
[ "Returns", "a", "deep", "copy", "of", "self" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/base.py#L69-L94
openego/ding0
ding0/grid/mv_grid/solvers/base.py
BaseSolution.length
def length(self): """Returns the solution length (or cost) Returns ------- float Solution length (or cost). """ length = 0 for r in self._routes: length = length + r.length() return length
python
def length(self): """Returns the solution length (or cost) Returns ------- float Solution length (or cost). """ length = 0 for r in self._routes: length = length + r.length() return length
[ "def", "length", "(", "self", ")", ":", "length", "=", "0", "for", "r", "in", "self", ".", "_routes", ":", "length", "=", "length", "+", "r", ".", "length", "(", ")", "return", "length" ]
Returns the solution length (or cost) Returns ------- float Solution length (or cost).
[ "Returns", "the", "solution", "length", "(", "or", "cost", ")", "Returns", "-------", "float", "Solution", "length", "(", "or", "cost", ")", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/base.py#L107-L119
openego/ding0
ding0/grid/mv_grid/solvers/base.py
BaseSolution.draw_network
def draw_network(self, anim): """Draws solution's graph using networkx Parameters ---------- AnimationDing0 AnimationDing0 object """ g = nx.Graph() ntemp = [] nodes_pos = {} demands = {} demands_pos = {} ...
python
def draw_network(self, anim): """Draws solution's graph using networkx Parameters ---------- AnimationDing0 AnimationDing0 object """ g = nx.Graph() ntemp = [] nodes_pos = {} demands = {} demands_pos = {} ...
[ "def", "draw_network", "(", "self", ",", "anim", ")", ":", "g", "=", "nx", ".", "Graph", "(", ")", "ntemp", "=", "[", "]", "nodes_pos", "=", "{", "}", "demands", "=", "{", "}", "demands_pos", "=", "{", "}", "for", "no", ",", "node", "in", "self...
Draws solution's graph using networkx Parameters ---------- AnimationDing0 AnimationDing0 object
[ "Draws", "solution", "s", "graph", "using", "networkx", "Parameters", "----------", "AnimationDing0", "AnimationDing0", "object" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/base.py#L163-L213
openego/ding0
ding0/tools/geo.py
calc_geo_branches_in_polygon
def calc_geo_branches_in_polygon(mv_grid, polygon, mode, proj): """ Calculate geographical branches in polygon. For a given `mv_grid` all branches (edges in the graph of the grid) are tested if they are in the given `polygon`. You can choose different modes and projections for this operation. Para...
python
def calc_geo_branches_in_polygon(mv_grid, polygon, mode, proj): """ Calculate geographical branches in polygon. For a given `mv_grid` all branches (edges in the graph of the grid) are tested if they are in the given `polygon`. You can choose different modes and projections for this operation. Para...
[ "def", "calc_geo_branches_in_polygon", "(", "mv_grid", ",", "polygon", ",", "mode", ",", "proj", ")", ":", "branches", "=", "[", "]", "polygon_shp", "=", "transform", "(", "proj", ",", "polygon", ")", "for", "branch", "in", "mv_grid", ".", "graph_edges", "...
Calculate geographical branches in polygon. For a given `mv_grid` all branches (edges in the graph of the grid) are tested if they are in the given `polygon`. You can choose different modes and projections for this operation. Parameters ---------- mv_grid : MVGridDing0 MV Grid object. ...
[ "Calculate", "geographical", "branches", "in", "polygon", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/geo.py#L31-L74
openego/ding0
ding0/tools/geo.py
calc_geo_branches_in_buffer
def calc_geo_branches_in_buffer(node, mv_grid, radius, radius_inc, proj): """ Determines branches in nodes' associated graph that are at least partly within buffer of `radius` from `node`. If there are no nodes, the buffer is successively extended by `radius_inc` until nodes are found. Paramet...
python
def calc_geo_branches_in_buffer(node, mv_grid, radius, radius_inc, proj): """ Determines branches in nodes' associated graph that are at least partly within buffer of `radius` from `node`. If there are no nodes, the buffer is successively extended by `radius_inc` until nodes are found. Paramet...
[ "def", "calc_geo_branches_in_buffer", "(", "node", ",", "mv_grid", ",", "radius", ",", "radius_inc", ",", "proj", ")", ":", "branches", "=", "[", "]", "while", "not", "branches", ":", "node_shp", "=", "transform", "(", "proj", ",", "node", ".", "geo_data",...
Determines branches in nodes' associated graph that are at least partly within buffer of `radius` from `node`. If there are no nodes, the buffer is successively extended by `radius_inc` until nodes are found. Parameters ---------- node : LVStationDing0, GeneratorDing0, or CableDistributorD...
[ "Determines", "branches", "in", "nodes", "associated", "graph", "that", "are", "at", "least", "partly", "within", "buffer", "of", "radius", "from", "node", ".", "If", "there", "are", "no", "nodes", "the", "buffer", "is", "successively", "extended", "by", "ra...
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/geo.py#L77-L116
openego/ding0
ding0/tools/geo.py
calc_geo_dist_vincenty
def calc_geo_dist_vincenty(node_source, node_target): """ Calculates the geodesic distance between `node_source` and `node_target` incorporating the detour factor specified in :file:`ding0/ding0/config/config_calc.cfg`. Parameters ---------- node_source: LVStationDing0, GeneratorDing0, or CableDist...
python
def calc_geo_dist_vincenty(node_source, node_target): """ Calculates the geodesic distance between `node_source` and `node_target` incorporating the detour factor specified in :file:`ding0/ding0/config/config_calc.cfg`. Parameters ---------- node_source: LVStationDing0, GeneratorDing0, or CableDist...
[ "def", "calc_geo_dist_vincenty", "(", "node_source", ",", "node_target", ")", ":", "branch_detour_factor", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'branch_detour_factor'", ")", "# notice: vincenty takes (lat,lon)", "branch_length", "=", "branch_detour_fact...
Calculates the geodesic distance between `node_source` and `node_target` incorporating the detour factor specified in :file:`ding0/ding0/config/config_calc.cfg`. Parameters ---------- node_source: LVStationDing0, GeneratorDing0, or CableDistributorDing0 source node, member of GridDing0._graph ...
[ "Calculates", "the", "geodesic", "distance", "between", "node_source", "and", "node_target", "incorporating", "the", "detour", "factor", "specified", "in", ":", "file", ":", "ding0", "/", "ding0", "/", "config", "/", "config_calc", ".", "cfg", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/geo.py#L119-L152
openego/ding0
ding0/tools/geo.py
calc_geo_dist_matrix_vincenty
def calc_geo_dist_matrix_vincenty(nodes_pos): """ Calculates the geodesic distance between all nodes in `nodes_pos` incorporating the detour factor in config_calc.cfg. For every two points/coord it uses geopy's vincenty function (formula devised by Thaddeus Vincenty, with an accurate ellipsoidal m...
python
def calc_geo_dist_matrix_vincenty(nodes_pos): """ Calculates the geodesic distance between all nodes in `nodes_pos` incorporating the detour factor in config_calc.cfg. For every two points/coord it uses geopy's vincenty function (formula devised by Thaddeus Vincenty, with an accurate ellipsoidal m...
[ "def", "calc_geo_dist_matrix_vincenty", "(", "nodes_pos", ")", ":", "branch_detour_factor", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'branch_detour_factor'", ")", "matrix", "=", "{", "}", "for", "i", "in", "nodes_pos", ":", "pos_origin", "=", "t...
Calculates the geodesic distance between all nodes in `nodes_pos` incorporating the detour factor in config_calc.cfg. For every two points/coord it uses geopy's vincenty function (formula devised by Thaddeus Vincenty, with an accurate ellipsoidal model of the earth). As default ellipsoidal model of th...
[ "Calculates", "the", "geodesic", "distance", "between", "all", "nodes", "in", "nodes_pos", "incorporating", "the", "detour", "factor", "in", "config_calc", ".", "cfg", ".", "For", "every", "two", "points", "/", "coord", "it", "uses", "geopy", "s", "vincenty", ...
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/geo.py#L155-L203
openego/ding0
ding0/tools/geo.py
calc_geo_centre_point
def calc_geo_centre_point(node_source, node_target): """ Calculates the geodesic distance between `node_source` and `node_target` incorporating the detour factor specified in config_calc.cfg. Parameters ---------- node_source: LVStationDing0, GeneratorDing0, or CableDistributorDing0 sou...
python
def calc_geo_centre_point(node_source, node_target): """ Calculates the geodesic distance between `node_source` and `node_target` incorporating the detour factor specified in config_calc.cfg. Parameters ---------- node_source: LVStationDing0, GeneratorDing0, or CableDistributorDing0 sou...
[ "def", "calc_geo_centre_point", "(", "node_source", ",", "node_target", ")", ":", "proj_source", "=", "partial", "(", "pyproj", ".", "transform", ",", "pyproj", ".", "Proj", "(", "init", "=", "'epsg:4326'", ")", ",", "# source coordinate system", "pyproj", ".", ...
Calculates the geodesic distance between `node_source` and `node_target` incorporating the detour factor specified in config_calc.cfg. Parameters ---------- node_source: LVStationDing0, GeneratorDing0, or CableDistributorDing0 source node, member of GridDing0._graph node_target: LVStati...
[ "Calculates", "the", "geodesic", "distance", "between", "node_source", "and", "node_target", "incorporating", "the", "detour", "factor", "specified", "in", "config_calc", ".", "cfg", ".", "Parameters", "----------", "node_source", ":", "LVStationDing0", "GeneratorDing0"...
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/geo.py#L206-L241
openego/ding0
ding0/grid/mv_grid/mv_connect.py
find_nearest_conn_objects
def find_nearest_conn_objects(node_shp, branches, proj, conn_dist_weight, debug, branches_only=False): """Searches all `branches` for the nearest possible connection object per branch. Picks out 1 object out of 3 possible objects: * 2 branch-adjacent stations and * 1 potentially created cable...
python
def find_nearest_conn_objects(node_shp, branches, proj, conn_dist_weight, debug, branches_only=False): """Searches all `branches` for the nearest possible connection object per branch. Picks out 1 object out of 3 possible objects: * 2 branch-adjacent stations and * 1 potentially created cable...
[ "def", "find_nearest_conn_objects", "(", "node_shp", ",", "branches", ",", "proj", ",", "conn_dist_weight", ",", "debug", ",", "branches_only", "=", "False", ")", ":", "# threshold which is used to determine if 2 objects are on the same position (see below for details on usage)",...
Searches all `branches` for the nearest possible connection object per branch. Picks out 1 object out of 3 possible objects: * 2 branch-adjacent stations and * 1 potentially created cable distributor on the line (perpendicular projection)). The resulting stack (list) is sorted ascending ...
[ "Searches", "all", "branches", "for", "the", "nearest", "possible", "connection", "object", "per", "branch", ".", "Picks", "out", "1", "object", "out", "of", "3", "possible", "objects", ":", "*", "2", "branch", "-", "adjacent", "stations", "and", "*", "1",...
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/mv_connect.py#L38-L136
openego/ding0
ding0/grid/mv_grid/mv_connect.py
find_connection_point
def find_connection_point(node, node_shp, graph, proj, conn_objects_min_stack, conn_dist_ring_mod, debug): """ Goes through the possible target connection objects in `conn_objects_min_stack` (from nearest to most far object) and tries to connect `node` to one of them. Function searches from nearest to ...
python
def find_connection_point(node, node_shp, graph, proj, conn_objects_min_stack, conn_dist_ring_mod, debug): """ Goes through the possible target connection objects in `conn_objects_min_stack` (from nearest to most far object) and tries to connect `node` to one of them. Function searches from nearest to ...
[ "def", "find_connection_point", "(", "node", ",", "node_shp", ",", "graph", ",", "proj", ",", "conn_objects_min_stack", ",", "conn_dist_ring_mod", ",", "debug", ")", ":", "node_connected", "=", "False", "# go through the stack (from nearest to most far connection target obj...
Goes through the possible target connection objects in `conn_objects_min_stack` (from nearest to most far object) and tries to connect `node` to one of them. Function searches from nearest to most far object. Args ---- node: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph obj...
[ "Goes", "through", "the", "possible", "target", "connection", "objects", "in", "conn_objects_min_stack", "(", "from", "nearest", "to", "most", "far", "object", ")", "and", "tries", "to", "connect", "node", "to", "one", "of", "them", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/mv_connect.py#L169-L338
openego/ding0
ding0/grid/mv_grid/mv_connect.py
connect_node
def connect_node(node, node_shp, mv_grid, target_obj, proj, graph, conn_dist_ring_mod, debug): """ Connects `node` to `target_obj`. Args ---- node: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0) node_shp: :shapely:`Shapely Point object<points>` ...
python
def connect_node(node, node_shp, mv_grid, target_obj, proj, graph, conn_dist_ring_mod, debug): """ Connects `node` to `target_obj`. Args ---- node: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0) node_shp: :shapely:`Shapely Point object<points>` ...
[ "def", "connect_node", "(", "node", ",", "node_shp", ",", "mv_grid", ",", "target_obj", ",", "proj", ",", "graph", ",", "conn_dist_ring_mod", ",", "debug", ")", ":", "target_obj_result", "=", "None", "# MV line is nearest connection point", "if", "isinstance", "("...
Connects `node` to `target_obj`. Args ---- node: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0) node_shp: :shapely:`Shapely Point object<points>` Shapely Point object of origin node target_obj: type object that node shall be connect...
[ "Connects", "node", "to", "target_obj", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/mv_connect.py#L341-L540
openego/ding0
ding0/grid/mv_grid/mv_connect.py
disconnect_node
def disconnect_node(node, target_obj_result, graph, debug): """ Disconnects `node` from `target_obj` Args ---- node: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0) target_obj_result: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph obj...
python
def disconnect_node(node, target_obj_result, graph, debug): """ Disconnects `node` from `target_obj` Args ---- node: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0) target_obj_result: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph obj...
[ "def", "disconnect_node", "(", "node", ",", "target_obj_result", ",", "graph", ",", "debug", ")", ":", "# backup kind and type of branch", "branch_kind", "=", "graph", ".", "adj", "[", "node", "]", "[", "target_obj_result", "]", "[", "'branch'", "]", ".", "kin...
Disconnects `node` from `target_obj` Args ---- node: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0) target_obj_result: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0) graph: :networkx:`NetworkX Grap...
[ "Disconnects", "node", "from", "target_obj" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/mv_connect.py#L543-L580
openego/ding0
ding0/grid/mv_grid/mv_connect.py
parametrize_lines
def parametrize_lines(mv_grid): """ Set unparametrized branches to default branch type Args ---- mv_grid: MVGridDing0 MV grid instance Notes ----- During the connection process of satellites, new branches are created - these have to be parametrized. """ for branch...
python
def parametrize_lines(mv_grid): """ Set unparametrized branches to default branch type Args ---- mv_grid: MVGridDing0 MV grid instance Notes ----- During the connection process of satellites, new branches are created - these have to be parametrized. """ for branch...
[ "def", "parametrize_lines", "(", "mv_grid", ")", ":", "for", "branch", "in", "mv_grid", ".", "graph_edges", "(", ")", ":", "if", "branch", "[", "'branch'", "]", ".", "kind", "is", "None", ":", "branch", "[", "'branch'", "]", ".", "kind", "=", "mv_grid"...
Set unparametrized branches to default branch type Args ---- mv_grid: MVGridDing0 MV grid instance Notes ----- During the connection process of satellites, new branches are created - these have to be parametrized.
[ "Set", "unparametrized", "branches", "to", "default", "branch", "type", "Args", "----", "mv_grid", ":", "MVGridDing0", "MV", "grid", "instance" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/mv_connect.py#L583-L601
openego/ding0
ding0/grid/mv_grid/mv_connect.py
mv_connect_satellites
def mv_connect_satellites(mv_grid, graph, mode='normal', debug=False): """ Connect satellites (small Load Areas) to MV grid Args ---- mv_grid: MVGridDing0 MV grid instance graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes mode: str, defaults to 'normal' ...
python
def mv_connect_satellites(mv_grid, graph, mode='normal', debug=False): """ Connect satellites (small Load Areas) to MV grid Args ---- mv_grid: MVGridDing0 MV grid instance graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes mode: str, defaults to 'normal' ...
[ "def", "mv_connect_satellites", "(", "mv_grid", ",", "graph", ",", "mode", "=", "'normal'", ",", "debug", "=", "False", ")", ":", "# conn_dist_weight: The satellites can be connected to line (new terminal is created) or to one station where the", "# line ends, depending on the dist...
Connect satellites (small Load Areas) to MV grid Args ---- mv_grid: MVGridDing0 MV grid instance graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes mode: str, defaults to 'normal' Specify mode how satellite `LVLoadAreaCentreDing0` are connected to the ...
[ "Connect", "satellites", "(", "small", "Load", "Areas", ")", "to", "MV", "grid" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/mv_connect.py#L604-L722
openego/ding0
ding0/grid/mv_grid/mv_connect.py
mv_connect_stations
def mv_connect_stations(mv_grid_district, graph, debug=False): """ Connect LV stations to MV grid Args ---- mv_grid_district: MVGridDistrictDing0 MVGridDistrictDing0 object for which the connection process has to be done graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object...
python
def mv_connect_stations(mv_grid_district, graph, debug=False): """ Connect LV stations to MV grid Args ---- mv_grid_district: MVGridDistrictDing0 MVGridDistrictDing0 object for which the connection process has to be done graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object...
[ "def", "mv_connect_stations", "(", "mv_grid_district", ",", "graph", ",", "debug", "=", "False", ")", ":", "# WGS84 (conformal) to ETRS (equidistant) projection", "proj1", "=", "partial", "(", "pyproj", ".", "transform", ",", "pyproj", ".", "Proj", "(", "init", "=...
Connect LV stations to MV grid Args ---- mv_grid_district: MVGridDistrictDing0 MVGridDistrictDing0 object for which the connection process has to be done graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes debug: bool, defaults to False If True, informa...
[ "Connect", "LV", "stations", "to", "MV", "grid" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/mv_connect.py#L725-L898
openego/ding0
ding0/grid/mv_grid/mv_connect.py
mv_connect_generators
def mv_connect_generators(mv_grid_district, graph, debug=False): """Connect MV generators to MV grid Args ---- mv_grid_district: MVGridDistrictDing0 MVGridDistrictDing0 object for which the connection process has to be done graph: :networkx:`NetworkX Graph Obj< >` NetworkX g...
python
def mv_connect_generators(mv_grid_district, graph, debug=False): """Connect MV generators to MV grid Args ---- mv_grid_district: MVGridDistrictDing0 MVGridDistrictDing0 object for which the connection process has to be done graph: :networkx:`NetworkX Graph Obj< >` NetworkX g...
[ "def", "mv_connect_generators", "(", "mv_grid_district", ",", "graph", ",", "debug", "=", "False", ")", ":", "generator_buffer_radius", "=", "cfg_ding0", ".", "get", "(", "'mv_connect'", ",", "'generator_buffer_radius'", ")", "generator_buffer_radius_inc", "=", "cfg_d...
Connect MV generators to MV grid Args ---- mv_grid_district: MVGridDistrictDing0 MVGridDistrictDing0 object for which the connection process has to be done graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes debug: bool, defaults to False If Tru...
[ "Connect", "MV", "generators", "to", "MV", "grid" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/mv_connect.py#L901-L1008
openego/ding0
ding0/grid/mv_grid/mv_routing.py
ding0_graph_to_routing_specs
def ding0_graph_to_routing_specs(graph): """ Build data dictionary from graph nodes for routing (translation) Args ---- graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes Returns ------- :obj:`dict` Data dictionary for routing. See Also ...
python
def ding0_graph_to_routing_specs(graph): """ Build data dictionary from graph nodes for routing (translation) Args ---- graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes Returns ------- :obj:`dict` Data dictionary for routing. See Also ...
[ "def", "ding0_graph_to_routing_specs", "(", "graph", ")", ":", "# get power factor for loads", "cos_phi_load", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'cos_phi_load'", ")", "specs", "=", "{", "}", "nodes_demands", "=", "{", "}", "nodes_pos", "=",...
Build data dictionary from graph nodes for routing (translation) Args ---- graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes Returns ------- :obj:`dict` Data dictionary for routing. See Also -------- ding0.grid.mv_grid.models.models....
[ "Build", "data", "dictionary", "from", "graph", "nodes", "for", "routing", "(", "translation", ")" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/mv_routing.py#L33-L99
openego/ding0
ding0/grid/mv_grid/mv_routing.py
routing_solution_to_ding0_graph
def routing_solution_to_ding0_graph(graph, solution): """ Insert `solution` from routing into `graph` Args ---- graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes solution: BaseSolution Instance of `BaseSolution` or child class (e.g. `LocalSearchSolution`) (=s...
python
def routing_solution_to_ding0_graph(graph, solution): """ Insert `solution` from routing into `graph` Args ---- graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes solution: BaseSolution Instance of `BaseSolution` or child class (e.g. `LocalSearchSolution`) (=s...
[ "def", "routing_solution_to_ding0_graph", "(", "graph", ",", "solution", ")", ":", "# TODO: Bisherige Herangehensweise (diese Funktion): Branches werden nach Routing erstellt um die Funktionsfähigkeit", "# TODO: des Routing-Tools auch für die TestCases zu erhalten. Es wird ggf. notwendig, diese di...
Insert `solution` from routing into `graph` Args ---- graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes solution: BaseSolution Instance of `BaseSolution` or child class (e.g. `LocalSearchSolution`) (=solution from routing) Returns ------- :networkx:`...
[ "Insert", "solution", "from", "routing", "into", "graph" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/mv_routing.py#L102-L233
openego/ding0
ding0/grid/mv_grid/mv_routing.py
solve
def solve(graph, debug=False, anim=None): # TODO: check docstring """ Do MV routing for given nodes in `graph`. Translate data from node objects to appropriate format before. Args ---- graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes debug: bool, defaul...
python
def solve(graph, debug=False, anim=None): # TODO: check docstring """ Do MV routing for given nodes in `graph`. Translate data from node objects to appropriate format before. Args ---- graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes debug: bool, defaul...
[ "def", "solve", "(", "graph", ",", "debug", "=", "False", ",", "anim", "=", "None", ")", ":", "# TODO: check docstring", "# TODO: Implement debug mode (pass to solver) to get more information while routing (print routes, draw network, ..)", "# translate DING0 graph to routing specs",...
Do MV routing for given nodes in `graph`. Translate data from node objects to appropriate format before. Args ---- graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes debug: bool, defaults to False If True, information is printed while routing anim: An...
[ "Do", "MV", "routing", "for", "given", "nodes", "in", "graph", ".", "Translate", "data", "from", "node", "objects", "to", "appropriate", "format", "before", "." ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/mv_routing.py#L236-L301
openego/ding0
ding0/grid/tools.py
cable_type
def cable_type(nom_power, nom_voltage, avail_cables): """Determine suitable type of cable for given nominal power Based on maximum occurring current which is derived from nominal power (either peak load or max. generation capacity) a suitable cable type is chosen. Thus, no line overloading issues shoul...
python
def cable_type(nom_power, nom_voltage, avail_cables): """Determine suitable type of cable for given nominal power Based on maximum occurring current which is derived from nominal power (either peak load or max. generation capacity) a suitable cable type is chosen. Thus, no line overloading issues shoul...
[ "def", "cable_type", "(", "nom_power", ",", "nom_voltage", ",", "avail_cables", ")", ":", "I_max_load", "=", "nom_power", "/", "(", "3", "**", "0.5", "*", "nom_voltage", ")", "# determine suitable cable for this current", "suitable_cables", "=", "avail_cables", "[",...
Determine suitable type of cable for given nominal power Based on maximum occurring current which is derived from nominal power (either peak load or max. generation capacity) a suitable cable type is chosen. Thus, no line overloading issues should occur. Parameters ---------- nom_power : float...
[ "Determine", "suitable", "type", "of", "cable", "for", "given", "nominal", "power" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/tools.py#L16-L47
openego/ding0
ding0/grid/lv_grid/lv_connect.py
lv_connect_generators
def lv_connect_generators(lv_grid_district, graph, debug=False): """ Connect LV generators to LV grid Args ---- lv_grid_district: LVGridDistrictDing0 LVGridDistrictDing0 object for which the connection process has to be done graph: :networkx:`NetworkX Graph Obj< >` NetworkX gra...
python
def lv_connect_generators(lv_grid_district, graph, debug=False): """ Connect LV generators to LV grid Args ---- lv_grid_district: LVGridDistrictDing0 LVGridDistrictDing0 object for which the connection process has to be done graph: :networkx:`NetworkX Graph Obj< >` NetworkX gra...
[ "def", "lv_connect_generators", "(", "lv_grid_district", ",", "graph", ",", "debug", "=", "False", ")", ":", "cable_lf", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'load_factor_lv_cable_fc_normal'", ")", "cos_phi_gen", "=", "cfg_ding0", ".", "get", ...
Connect LV generators to LV grid Args ---- lv_grid_district: LVGridDistrictDing0 LVGridDistrictDing0 object for which the connection process has to be done graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes debug: bool, defaults to False If True, i...
[ "Connect", "LV", "generators", "to", "LV", "grid", "Args", "----", "lv_grid_district", ":", "LVGridDistrictDing0", "LVGridDistrictDing0", "object", "for", "which", "the", "connection", "process", "has", "to", "be", "done", "graph", ":", ":", "networkx", ":", "Ne...
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/lv_grid/lv_connect.py#L27-L146
openego/ding0
ding0/grid/mv_grid/tools.py
set_circuit_breakers
def set_circuit_breakers(mv_grid, mode='load', debug=False): """ Calculates the optimal position of a circuit breaker on all routes of mv_grid, adds and connects them to graph. Args ---- mv_grid: MVGridDing0 Description#TODO debug: bool, defaults to False If True, information is p...
python
def set_circuit_breakers(mv_grid, mode='load', debug=False): """ Calculates the optimal position of a circuit breaker on all routes of mv_grid, adds and connects them to graph. Args ---- mv_grid: MVGridDing0 Description#TODO debug: bool, defaults to False If True, information is p...
[ "def", "set_circuit_breakers", "(", "mv_grid", ",", "mode", "=", "'load'", ",", "debug", "=", "False", ")", ":", "# get power factor for loads and generators", "cos_phi_load", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'cos_phi_load'", ")", "cos_phi_f...
Calculates the optimal position of a circuit breaker on all routes of mv_grid, adds and connects them to graph. Args ---- mv_grid: MVGridDing0 Description#TODO debug: bool, defaults to False If True, information is printed during process Notes ----- According to plan...
[ "Calculates", "the", "optimal", "position", "of", "a", "circuit", "breaker", "on", "all", "routes", "of", "mv_grid", "adds", "and", "connects", "them", "to", "graph", ".", "Args", "----", "mv_grid", ":", "MVGridDing0", "Description#TODO", "debug", ":", "bool",...
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/tools.py#L26-L156
joytunes/JTLocalize
localization_flow/jtlocalize/core/handle_duplicates_in_localization.py
handle_duplications
def handle_duplications(file_path): """ Omits the duplications in the strings files. Keys that appear more than once, will be joined to one appearance and the omit will be documented. Args: file_path (str): The path to the strings file. """ logging.info('Handling duplications for "%s"'...
python
def handle_duplications(file_path): """ Omits the duplications in the strings files. Keys that appear more than once, will be joined to one appearance and the omit will be documented. Args: file_path (str): The path to the strings file. """ logging.info('Handling duplications for "%s"'...
[ "def", "handle_duplications", "(", "file_path", ")", ":", "logging", ".", "info", "(", "'Handling duplications for \"%s\"'", ",", "file_path", ")", "f", "=", "open_strings_file", "(", "file_path", ",", "\"r+\"", ")", "header_comment_key_value_tuples", "=", "extract_he...
Omits the duplications in the strings files. Keys that appear more than once, will be joined to one appearance and the omit will be documented. Args: file_path (str): The path to the strings file.
[ "Omits", "the", "duplications", "in", "the", "strings", "files", ".", "Keys", "that", "appear", "more", "than", "once", "will", "be", "joined", "to", "one", "appearance", "and", "the", "omit", "will", "be", "documented", "." ]
train
https://github.com/joytunes/JTLocalize/blob/87864dc60114e0e61c768d057c6eddfadff3f40a/localization_flow/jtlocalize/core/handle_duplicates_in_localization.py#L22-L67
onecodex/onecodex
onecodex/viz/_heatmap.py
VizHeatmapMixin.plot_heatmap
def plot_heatmap( self, rank="auto", normalize="auto", top_n="auto", threshold="auto", title=None, xlabel=None, ylabel=None, tooltip=None, return_chart=False, linkage="average", haxis=None, metric="euclidean", ...
python
def plot_heatmap( self, rank="auto", normalize="auto", top_n="auto", threshold="auto", title=None, xlabel=None, ylabel=None, tooltip=None, return_chart=False, linkage="average", haxis=None, metric="euclidean", ...
[ "def", "plot_heatmap", "(", "self", ",", "rank", "=", "\"auto\"", ",", "normalize", "=", "\"auto\"", ",", "top_n", "=", "\"auto\"", ",", "threshold", "=", "\"auto\"", ",", "title", "=", "None", ",", "xlabel", "=", "None", ",", "ylabel", "=", "None", ",...
Plot heatmap of taxa abundance/count data for several samples. Parameters ---------- rank : {'auto', 'kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species'}, optional Analysis will be restricted to abundances of taxa at the specified level. normalize : 'auto' or...
[ "Plot", "heatmap", "of", "taxa", "abundance", "/", "count", "data", "for", "several", "samples", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/viz/_heatmap.py#L8-L291
onecodex/onecodex
onecodex/api.py
Api._copy_resources
def _copy_resources(self): """ Copy all of the resources over to the toplevel client -return: populates self with a pointer to each ._client.Resource """ for resource in self._client._resources: # set the name param, the keys now have / in them potion_re...
python
def _copy_resources(self): """ Copy all of the resources over to the toplevel client -return: populates self with a pointer to each ._client.Resource """ for resource in self._client._resources: # set the name param, the keys now have / in them potion_re...
[ "def", "_copy_resources", "(", "self", ")", ":", "for", "resource", "in", "self", ".", "_client", ".", "_resources", ":", "# set the name param, the keys now have / in them", "potion_resource", "=", "self", ".", "_client", ".", "_resources", "[", "resource", "]", ...
Copy all of the resources over to the toplevel client -return: populates self with a pointer to each ._client.Resource
[ "Copy", "all", "of", "the", "resources", "over", "to", "the", "toplevel", "client" ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/api.py#L125-L142
onecodex/onecodex
onecodex/auth.py
login_uname_pwd
def login_uname_pwd(server, api_key=None): """ Prompts user for username and password, gets API key from server if not provided. """ username = click.prompt("Please enter your One Codex (email)") if api_key is not None: return username, api_key password = click.prompt("Please enter ...
python
def login_uname_pwd(server, api_key=None): """ Prompts user for username and password, gets API key from server if not provided. """ username = click.prompt("Please enter your One Codex (email)") if api_key is not None: return username, api_key password = click.prompt("Please enter ...
[ "def", "login_uname_pwd", "(", "server", ",", "api_key", "=", "None", ")", ":", "username", "=", "click", ".", "prompt", "(", "\"Please enter your One Codex (email)\"", ")", "if", "api_key", "is", "not", "None", ":", "return", "username", ",", "api_key", "pass...
Prompts user for username and password, gets API key from server if not provided.
[ "Prompts", "user", "for", "username", "and", "password", "gets", "API", "key", "from", "server", "if", "not", "provided", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/auth.py#L22-L35
onecodex/onecodex
onecodex/auth.py
_login
def _login(server, creds_file=None, api_key=None, silent=False): """ Login main function """ # fetch_api_key and check_version expect server to end in / if server[-1] != "/": server = server + "/" # creds file path setup if creds_file is None: creds_file = os.path.expanduser...
python
def _login(server, creds_file=None, api_key=None, silent=False): """ Login main function """ # fetch_api_key and check_version expect server to end in / if server[-1] != "/": server = server + "/" # creds file path setup if creds_file is None: creds_file = os.path.expanduser...
[ "def", "_login", "(", "server", ",", "creds_file", "=", "None", ",", "api_key", "=", "None", ",", "silent", "=", "False", ")", ":", "# fetch_api_key and check_version expect server to end in /", "if", "server", "[", "-", "1", "]", "!=", "\"/\"", ":", "server",...
Login main function
[ "Login", "main", "function" ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/auth.py#L38-L138
onecodex/onecodex
onecodex/auth.py
_remove_creds
def _remove_creds(creds_file=None): """ Remove ~/.onecodex file, returning True if successul or False if the file didn't exist """ if creds_file is None: creds_file = os.path.expanduser("~/.onecodex") try: os.remove(creds_file) except Exception as e: if e.errno == errno....
python
def _remove_creds(creds_file=None): """ Remove ~/.onecodex file, returning True if successul or False if the file didn't exist """ if creds_file is None: creds_file = os.path.expanduser("~/.onecodex") try: os.remove(creds_file) except Exception as e: if e.errno == errno....
[ "def", "_remove_creds", "(", "creds_file", "=", "None", ")", ":", "if", "creds_file", "is", "None", ":", "creds_file", "=", "os", ".", "path", ".", "expanduser", "(", "\"~/.onecodex\"", ")", "try", ":", "os", ".", "remove", "(", "creds_file", ")", "excep...
Remove ~/.onecodex file, returning True if successul or False if the file didn't exist
[ "Remove", "~", "/", ".", "onecodex", "file", "returning", "True", "if", "successul", "or", "False", "if", "the", "file", "didn", "t", "exist" ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/auth.py#L141-L161
onecodex/onecodex
onecodex/auth.py
_logout
def _logout(creds_file=None): """ Logout main function, just rm ~/.onecodex more or less """ if _remove_creds(creds_file=creds_file): click.echo("Successfully removed One Codex credentials.", err=True) sys.exit(0) else: click.echo("No One Codex API keys found.", err=True) ...
python
def _logout(creds_file=None): """ Logout main function, just rm ~/.onecodex more or less """ if _remove_creds(creds_file=creds_file): click.echo("Successfully removed One Codex credentials.", err=True) sys.exit(0) else: click.echo("No One Codex API keys found.", err=True) ...
[ "def", "_logout", "(", "creds_file", "=", "None", ")", ":", "if", "_remove_creds", "(", "creds_file", "=", "creds_file", ")", ":", "click", ".", "echo", "(", "\"Successfully removed One Codex credentials.\"", ",", "err", "=", "True", ")", "sys", ".", "exit", ...
Logout main function, just rm ~/.onecodex more or less
[ "Logout", "main", "function", "just", "rm", "~", "/", ".", "onecodex", "more", "or", "less" ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/auth.py#L164-L173
onecodex/onecodex
onecodex/auth.py
login_required
def login_required(fn): """Requires login before proceeding, but does not prompt the user to login. Decorator should be used only on Click CLI commands. Notes ----- Different means of authentication will be attempted in this order: 1. An API key present in the Click context object from a pr...
python
def login_required(fn): """Requires login before proceeding, but does not prompt the user to login. Decorator should be used only on Click CLI commands. Notes ----- Different means of authentication will be attempted in this order: 1. An API key present in the Click context object from a pr...
[ "def", "login_required", "(", "fn", ")", ":", "@", "wraps", "(", "fn", ")", "def", "login_wrapper", "(", "ctx", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "base_url", "=", "os", ".", "environ", ".", "get", "(", "\"ONE_CODEX_API_BASE\"", ","...
Requires login before proceeding, but does not prompt the user to login. Decorator should be used only on Click CLI commands. Notes ----- Different means of authentication will be attempted in this order: 1. An API key present in the Click context object from a previous successful authenticatio...
[ "Requires", "login", "before", "proceeding", "but", "does", "not", "prompt", "the", "user", "to", "login", ".", "Decorator", "should", "be", "used", "only", "on", "Click", "CLI", "commands", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/auth.py#L176-L218
onecodex/onecodex
onecodex/models/analysis.py
Classifications.results
def results(self, json=True): """ Returns the complete results table for the classification. Parameters ---------- json : bool, optional Return result as JSON? Default True. Returns ------- table : dict | DataFrame Return a JSON o...
python
def results(self, json=True): """ Returns the complete results table for the classification. Parameters ---------- json : bool, optional Return result as JSON? Default True. Returns ------- table : dict | DataFrame Return a JSON o...
[ "def", "results", "(", "self", ",", "json", "=", "True", ")", ":", "if", "json", "is", "True", ":", "return", "self", ".", "_results", "(", ")", "else", ":", "return", "self", ".", "_table", "(", ")" ]
Returns the complete results table for the classification. Parameters ---------- json : bool, optional Return result as JSON? Default True. Returns ------- table : dict | DataFrame Return a JSON object with the classification results or a Pandas ...
[ "Returns", "the", "complete", "results", "table", "for", "the", "classification", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/analysis.py#L44-L62
onecodex/onecodex
onecodex/models/analysis.py
Classifications.abundances
def abundances(self, ids=None): """ Query the results table to get abundance data for all or some tax ids """ # TODO: Consider removing this method... since it's kind of trivial # May want to replace with something that actually gets genome-size adjusted # abu...
python
def abundances(self, ids=None): """ Query the results table to get abundance data for all or some tax ids """ # TODO: Consider removing this method... since it's kind of trivial # May want to replace with something that actually gets genome-size adjusted # abu...
[ "def", "abundances", "(", "self", ",", "ids", "=", "None", ")", ":", "# TODO: Consider removing this method... since it's kind of trivial", "# May want to replace with something that actually gets genome-size adjusted", "# abundances from the results table", "if", "ids", "i...
Query the results table to get abundance data for all or some tax ids
[ "Query", "the", "results", "table", "to", "get", "abundance", "data", "for", "all", "or", "some", "tax", "ids" ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/analysis.py#L85-L98
onecodex/onecodex
onecodex/models/sample.py
Samples.save
def save(self): """ Persist changes on this Samples object back to the One Codex server along with any changes on its metadata (if it has any). """ super(Samples, self).save() if self.metadata is not None: self.metadata.save()
python
def save(self): """ Persist changes on this Samples object back to the One Codex server along with any changes on its metadata (if it has any). """ super(Samples, self).save() if self.metadata is not None: self.metadata.save()
[ "def", "save", "(", "self", ")", ":", "super", "(", "Samples", ",", "self", ")", ".", "save", "(", ")", "if", "self", ".", "metadata", "is", "not", "None", ":", "self", ".", "metadata", ".", "save", "(", ")" ]
Persist changes on this Samples object back to the One Codex server along with any changes on its metadata (if it has any).
[ "Persist", "changes", "on", "this", "Samples", "object", "back", "to", "the", "One", "Codex", "server", "along", "with", "any", "changes", "on", "its", "metadata", "(", "if", "it", "has", "any", ")", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/sample.py#L121-L128
onecodex/onecodex
onecodex/models/sample.py
Samples.upload
def upload( cls, files, metadata=None, tags=None, project=None, coerce_ascii=False, progressbar=None ): """Uploads a series of files to the One Codex server. Parameters ---------- files : `string` or `tuple` A single path to a file on the system, or a tuple conta...
python
def upload( cls, files, metadata=None, tags=None, project=None, coerce_ascii=False, progressbar=None ): """Uploads a series of files to the One Codex server. Parameters ---------- files : `string` or `tuple` A single path to a file on the system, or a tuple conta...
[ "def", "upload", "(", "cls", ",", "files", ",", "metadata", "=", "None", ",", "tags", "=", "None", ",", "project", "=", "None", ",", "coerce_ascii", "=", "False", ",", "progressbar", "=", "None", ")", ":", "res", "=", "cls", ".", "_resource", "if", ...
Uploads a series of files to the One Codex server. Parameters ---------- files : `string` or `tuple` A single path to a file on the system, or a tuple containing a pairs of paths. Tuple values will be interleaved as paired-end reads and both files should contain the sam...
[ "Uploads", "a", "series", "of", "files", "to", "the", "One", "Codex", "server", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/sample.py#L131-L187
joytunes/JTLocalize
localization_flow/jtlocalize/core/localization_objects.py
LocalizationEntry.add_comments
def add_comments(self, comments): """ Add comments to the localization entry Args: comments (list of str): The comments to be added to the localization entry. """ for comment in comments: if comment not in self.comments and len(comment) > 0: self....
python
def add_comments(self, comments): """ Add comments to the localization entry Args: comments (list of str): The comments to be added to the localization entry. """ for comment in comments: if comment not in self.comments and len(comment) > 0: self....
[ "def", "add_comments", "(", "self", ",", "comments", ")", ":", "for", "comment", "in", "comments", ":", "if", "comment", "not", "in", "self", ".", "comments", "and", "len", "(", "comment", ")", ">", "0", ":", "self", ".", "comments", ".", "append", "...
Add comments to the localization entry Args: comments (list of str): The comments to be added to the localization entry.
[ "Add", "comments", "to", "the", "localization", "entry" ]
train
https://github.com/joytunes/JTLocalize/blob/87864dc60114e0e61c768d057c6eddfadff3f40a/localization_flow/jtlocalize/core/localization_objects.py#L46-L56
joytunes/JTLocalize
localization_flow/jtlocalize/merge_translations.py
merge_translations
def merge_translations(localization_bundle_path): """ Merges the new translation with the old one. The translated files are saved as '.translated' file, and are merged with old translated file. Args: localization_bundle_path (str): The path to the localization bundle. """ logging.info("Me...
python
def merge_translations(localization_bundle_path): """ Merges the new translation with the old one. The translated files are saved as '.translated' file, and are merged with old translated file. Args: localization_bundle_path (str): The path to the localization bundle. """ logging.info("Me...
[ "def", "merge_translations", "(", "localization_bundle_path", ")", ":", "logging", ".", "info", "(", "\"Merging translations\"", ")", "for", "lang_dir", "in", "os", ".", "listdir", "(", "localization_bundle_path", ")", ":", "if", "lang_dir", "==", "DEFAULT_LANGUAGE_...
Merges the new translation with the old one. The translated files are saved as '.translated' file, and are merged with old translated file. Args: localization_bundle_path (str): The path to the localization bundle.
[ "Merges", "the", "new", "translation", "with", "the", "old", "one", "." ]
train
https://github.com/joytunes/JTLocalize/blob/87864dc60114e0e61c768d057c6eddfadff3f40a/localization_flow/jtlocalize/merge_translations.py#L33-L52
onecodex/onecodex
onecodex/viz/_bargraph.py
VizBargraphMixin.plot_bargraph
def plot_bargraph( self, rank="auto", normalize="auto", top_n="auto", threshold="auto", title=None, xlabel=None, ylabel=None, tooltip=None, return_chart=False, haxis=None, legend="auto", label=None, ): ""...
python
def plot_bargraph( self, rank="auto", normalize="auto", top_n="auto", threshold="auto", title=None, xlabel=None, ylabel=None, tooltip=None, return_chart=False, haxis=None, legend="auto", label=None, ): ""...
[ "def", "plot_bargraph", "(", "self", ",", "rank", "=", "\"auto\"", ",", "normalize", "=", "\"auto\"", ",", "top_n", "=", "\"auto\"", ",", "threshold", "=", "\"auto\"", ",", "title", "=", "None", ",", "xlabel", "=", "None", ",", "ylabel", "=", "None", "...
Plot a bargraph of relative abundance of taxa for multiple samples. Parameters ---------- rank : {'auto', 'kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species'}, optional Analysis will be restricted to abundances of taxa at the specified level. normalize : 'aut...
[ "Plot", "a", "bargraph", "of", "relative", "abundance", "of", "taxa", "for", "multiple", "samples", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/viz/_bargraph.py#L6-L202
onecodex/onecodex
onecodex/exceptions.py
raise_api_error
def raise_api_error(resp, state=None): """Raise an exception with a pretty message in various states of upload""" # TODO: Refactor into an Exception class error_code = resp.status_code if error_code == 402: error_message = ( "Please add a payment method to upload more samples. If yo...
python
def raise_api_error(resp, state=None): """Raise an exception with a pretty message in various states of upload""" # TODO: Refactor into an Exception class error_code = resp.status_code if error_code == 402: error_message = ( "Please add a payment method to upload more samples. If yo...
[ "def", "raise_api_error", "(", "resp", ",", "state", "=", "None", ")", ":", "# TODO: Refactor into an Exception class", "error_code", "=", "resp", ".", "status_code", "if", "error_code", "==", "402", ":", "error_message", "=", "(", "\"Please add a payment method to up...
Raise an exception with a pretty message in various states of upload
[ "Raise", "an", "exception", "with", "a", "pretty", "message", "in", "various", "states", "of", "upload" ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/exceptions.py#L45-L89
onecodex/onecodex
onecodex/viz/_pca.py
VizPCAMixin.plot_pca
def plot_pca( self, rank="auto", normalize="auto", org_vectors=0, org_vectors_scale=None, title=None, xlabel=None, ylabel=None, color=None, size=None, tooltip=None, return_chart=False, label=None, ): """P...
python
def plot_pca( self, rank="auto", normalize="auto", org_vectors=0, org_vectors_scale=None, title=None, xlabel=None, ylabel=None, color=None, size=None, tooltip=None, return_chart=False, label=None, ): """P...
[ "def", "plot_pca", "(", "self", ",", "rank", "=", "\"auto\"", ",", "normalize", "=", "\"auto\"", ",", "org_vectors", "=", "0", ",", "org_vectors_scale", "=", "None", ",", "title", "=", "None", ",", "xlabel", "=", "None", ",", "ylabel", "=", "None", ","...
Perform principal component analysis and plot first two axes. Parameters ---------- rank : {'auto', 'kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species'}, optional Analysis will be restricted to abundances of taxa at the specified level. normalize : 'auto' or ...
[ "Perform", "principal", "component", "analysis", "and", "plot", "first", "two", "axes", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/viz/_pca.py#L10-L190
onecodex/onecodex
onecodex/models/__init__.py
pretty_print_error
def pretty_print_error(err_json): """Pretty print Flask-Potion error messages for the user.""" # Special case validation errors if len(err_json) == 1 and "validationOf" in err_json[0]: required_fields = ", ".join(err_json[0]["validationOf"]["required"]) return "Validation error. Requires pro...
python
def pretty_print_error(err_json): """Pretty print Flask-Potion error messages for the user.""" # Special case validation errors if len(err_json) == 1 and "validationOf" in err_json[0]: required_fields = ", ".join(err_json[0]["validationOf"]["required"]) return "Validation error. Requires pro...
[ "def", "pretty_print_error", "(", "err_json", ")", ":", "# Special case validation errors", "if", "len", "(", "err_json", ")", "==", "1", "and", "\"validationOf\"", "in", "err_json", "[", "0", "]", ":", "required_fields", "=", "\", \"", ".", "join", "(", "err_...
Pretty print Flask-Potion error messages for the user.
[ "Pretty", "print", "Flask", "-", "Potion", "error", "messages", "for", "the", "user", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/__init__.py#L584-L597
onecodex/onecodex
onecodex/models/__init__.py
OneCodexBase._to_json
def _to_json(self, include_references=True): """Convert the model to JSON using the PotionJSONEncode and automatically resolving the resource as needed (`_properties` call handles this). """ if include_references: return json.dumps(self._resource._properties, cls=PotionJSONEn...
python
def _to_json(self, include_references=True): """Convert the model to JSON using the PotionJSONEncode and automatically resolving the resource as needed (`_properties` call handles this). """ if include_references: return json.dumps(self._resource._properties, cls=PotionJSONEn...
[ "def", "_to_json", "(", "self", ",", "include_references", "=", "True", ")", ":", "if", "include_references", ":", "return", "json", ".", "dumps", "(", "self", ".", "_resource", ".", "_properties", ",", "cls", "=", "PotionJSONEncoder", ")", "else", ":", "r...
Convert the model to JSON using the PotionJSONEncode and automatically resolving the resource as needed (`_properties` call handles this).
[ "Convert", "the", "model", "to", "JSON", "using", "the", "PotionJSONEncode", "and", "automatically", "resolving", "the", "resource", "as", "needed", "(", "_properties", "call", "handles", "this", ")", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/__init__.py#L345-L359
onecodex/onecodex
onecodex/models/__init__.py
OneCodexBase.all
def all(cls, sort=None, limit=None): """Returns all objects of this type. Alias for where() (without filter arguments). See `where` for documentation on the `sort` and `limit` parameters. """ return cls.where(sort=sort, limit=limit)
python
def all(cls, sort=None, limit=None): """Returns all objects of this type. Alias for where() (without filter arguments). See `where` for documentation on the `sort` and `limit` parameters. """ return cls.where(sort=sort, limit=limit)
[ "def", "all", "(", "cls", ",", "sort", "=", "None", ",", "limit", "=", "None", ")", ":", "return", "cls", ".", "where", "(", "sort", "=", "sort", ",", "limit", "=", "limit", ")" ]
Returns all objects of this type. Alias for where() (without filter arguments). See `where` for documentation on the `sort` and `limit` parameters.
[ "Returns", "all", "objects", "of", "this", "type", ".", "Alias", "for", "where", "()", "(", "without", "filter", "arguments", ")", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/__init__.py#L379-L384
onecodex/onecodex
onecodex/models/__init__.py
OneCodexBase.where
def where(cls, *filters, **keyword_filters): """Retrieves objects (Samples, Classifications, etc.) from the One Codex server. Parameters ---------- filters : objects Advanced filters to use (not implemented) sort : string | list, optional Sort the results...
python
def where(cls, *filters, **keyword_filters): """Retrieves objects (Samples, Classifications, etc.) from the One Codex server. Parameters ---------- filters : objects Advanced filters to use (not implemented) sort : string | list, optional Sort the results...
[ "def", "where", "(", "cls", ",", "*", "filters", ",", "*", "*", "keyword_filters", ")", ":", "check_bind", "(", "cls", ")", "# do this here to avoid passing this on to potion", "filter_func", "=", "keyword_filters", ".", "pop", "(", "\"filter\"", ",", "None", ")...
Retrieves objects (Samples, Classifications, etc.) from the One Codex server. Parameters ---------- filters : objects Advanced filters to use (not implemented) sort : string | list, optional Sort the results by this field (or list of fields). By default in descen...
[ "Retrieves", "objects", "(", "Samples", "Classifications", "etc", ".", ")", "from", "the", "One", "Codex", "server", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/__init__.py#L387-L477
onecodex/onecodex
onecodex/models/__init__.py
OneCodexBase.get
def get(cls, uuid): """Retrieve one specific object from the server by its UUID (unique 16-character id). UUIDs can be found in the web browser's address bar while viewing analyses and other objects. Parameters ---------- uuid : string UUID of the object to retrieve....
python
def get(cls, uuid): """Retrieve one specific object from the server by its UUID (unique 16-character id). UUIDs can be found in the web browser's address bar while viewing analyses and other objects. Parameters ---------- uuid : string UUID of the object to retrieve....
[ "def", "get", "(", "cls", ",", "uuid", ")", ":", "check_bind", "(", "cls", ")", "# we're just retrieving one object from its uuid", "try", ":", "resource", "=", "cls", ".", "_resource", ".", "fetch", "(", "uuid", ")", "if", "isinstance", "(", "resource", ","...
Retrieve one specific object from the server by its UUID (unique 16-character id). UUIDs can be found in the web browser's address bar while viewing analyses and other objects. Parameters ---------- uuid : string UUID of the object to retrieve. Returns -----...
[ "Retrieve", "one", "specific", "object", "from", "the", "server", "by", "its", "UUID", "(", "unique", "16", "-", "character", "id", ")", ".", "UUIDs", "can", "be", "found", "in", "the", "web", "browser", "s", "address", "bar", "while", "viewing", "analys...
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/__init__.py#L480-L517
onecodex/onecodex
onecodex/models/__init__.py
OneCodexBase.delete
def delete(self): """Delete this object from the One Codex server.""" check_bind(self) if self.id is None: raise ServerError("{} object does not exist yet".format(self.__class__.name)) elif not self.__class__._has_schema_method("destroy"): raise MethodNotSupported...
python
def delete(self): """Delete this object from the One Codex server.""" check_bind(self) if self.id is None: raise ServerError("{} object does not exist yet".format(self.__class__.name)) elif not self.__class__._has_schema_method("destroy"): raise MethodNotSupported...
[ "def", "delete", "(", "self", ")", ":", "check_bind", "(", "self", ")", "if", "self", ".", "id", "is", "None", ":", "raise", "ServerError", "(", "\"{} object does not exist yet\"", ".", "format", "(", "self", ".", "__class__", ".", "name", ")", ")", "eli...
Delete this object from the One Codex server.
[ "Delete", "this", "object", "from", "the", "One", "Codex", "server", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/__init__.py#L519-L533
onecodex/onecodex
onecodex/models/__init__.py
OneCodexBase.save
def save(self): """Either create or persist changes on this object back to the One Codex server.""" check_bind(self) creating = self.id is None if creating and not self.__class__._has_schema_method("create"): raise MethodNotSupported("{} do not support creating.".format(self...
python
def save(self): """Either create or persist changes on this object back to the One Codex server.""" check_bind(self) creating = self.id is None if creating and not self.__class__._has_schema_method("create"): raise MethodNotSupported("{} do not support creating.".format(self...
[ "def", "save", "(", "self", ")", ":", "check_bind", "(", "self", ")", "creating", "=", "self", ".", "id", "is", "None", "if", "creating", "and", "not", "self", ".", "__class__", ".", "_has_schema_method", "(", "\"create\"", ")", ":", "raise", "MethodNotS...
Either create or persist changes on this object back to the One Codex server.
[ "Either", "create", "or", "persist", "changes", "on", "this", "object", "back", "to", "the", "One", "Codex", "server", "." ]
train
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/__init__.py#L535-L560