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_documentation_string
stringlengths
1
47.2k
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...
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...
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...
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
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...
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...
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...
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...
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...
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...
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...
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
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...
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...
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 ...
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...
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...
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...
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...
Cable length per MV grid district
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...
Plot of generation over load
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...
Read multiple pickles, join nd objects and save to file Parameters ---------- mv_grid_districts : list Ints describing MV grid districts
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 ...
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
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 ...
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
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...
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 ...
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...
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...
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...
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...
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...
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...
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, ...
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...
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...
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...
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 ...
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).
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...
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...
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...
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...
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...
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...
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...
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 --------...
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...
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...
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 ...
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 ...
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>` ...
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
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, ...
Adds a generator to _generators and grid graph if not already existing Parameters ---------- generator : GridDing0 Description #TODO
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 ...
Adds a station or cable distributor object to grid graph if not already existing Parameters ---------- node_object : GridDing0 Description #TODO
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...
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 ...
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(_))
Returns an (ascending) sorted list of graph's nodes (name is used as key). Returns ------- :any:`list` Description #TODO check
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...
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
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 :...
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...
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...
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...
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,...
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...
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:...
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...
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:...
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...
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))
Finds isolated nodes = nodes with no neighbors (degree zero) Returns ------- :any:`list` of :obj:`GridDing0` List of nodes (Ding0 objects)
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): ...
Adds a transformer to _transformers if not already existing Args ---- transformer : StationDing0 Description #TODO
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
#TODO: description
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
#TODO: description
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'
Open a Circuit Breaker #TODO Check
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'
Close a Circuit Breaker #TODO Check
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
Returns a generator for iterating over load_areas Yields ------ int generator for iterating over load_areas
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...
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
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)
Adds a LV load_area to _lv_load_areas if not already existing.
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 ...
Summarizes peak loads of underlying load_areas in kVA. (peak load sum and peak load of satellites)
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...
Summarizes peak loads of underlying aggregated load_areas
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...
Returns a generator for iterating over LV grid districts Yields ------ int generator for iterating over LV grid districts
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...
Adds a LV grid district to _lv_grid_districts if not already existing Args ---- lv_grid_district: :shapely:`Shapely Polygon object<polygons>` Descr
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 ...
Cumulative peak generation of generators connected to LV grids of underlying LVGDs
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....
get pair description Parameters ---------- pair : :any:`list` of nodes Descr Returns ------- type Descr
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...
Returns True if this is a complete solution, i.e, all nodes are allocated Returns ------- bool True if all nodes are llocated.
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)) ...
Returns a deep copy of self Function clones: * route * allocation * nodes Returns ------- type Deep copy of self
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
Returns the solution length (or cost) Returns ------- float Solution length (or cost).
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 = {} ...
Draws solution's graph using networkx Parameters ---------- AnimationDing0 AnimationDing0 object
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...
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. ...
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...
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...
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...
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 ...
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...
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...
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...
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...
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...
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 ...
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 ...
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...
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>` ...
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...
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...
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...
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...
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.
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' ...
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 ...
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...
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...
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...
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...
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 ...
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....
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...
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:`...
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...
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...
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...
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...
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...
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...
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...
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...
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"'...
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.
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", ...
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...
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...
Copy all of the resources over to the toplevel client -return: populates self with a pointer to each ._client.Resource
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 ...
Prompts user for username and password, gets API key from server if not provided.
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...
Login main function
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....
Remove ~/.onecodex file, returning True if successul or False if the file didn't exist
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) ...
Logout main function, just rm ~/.onecodex more or less
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...
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...
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...
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 ...
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...
Query the results table to get abundance data for all or some tax ids
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()
Persist changes on this Samples object back to the One Codex server along with any changes on its metadata (if it has any).
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...
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...
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....
Add comments to the localization entry Args: comments (list of str): The comments to be added to the localization entry.
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...
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.
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, ): ""...
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...
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...
Raise an exception with a pretty message in various states of upload
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...
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 ...
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...
Pretty print Flask-Potion error messages for the user.
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...
Convert the model to JSON using the PotionJSONEncode and automatically resolving the resource as needed (`_properties` call handles this).
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)
Returns all objects of this type. Alias for where() (without filter arguments). See `where` for documentation on the `sort` and `limit` parameters.
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...
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...
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....
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 -----...
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...
Delete this object from the One Codex server.
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...
Either create or persist changes on this object back to the One Codex server.
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/__init__.py#L535-L560