bahamas.cccg

Created on September 7, 2025 @author: wangc, chene

Attributes

logger

Classes

CCCG

Compute CCCGs for the given list of components of diversity and redundancy system

Functions

check_valid(src_arr)

Check if group is empty

clean_string(s)

Remove "None" and "nan" from str that are separated by ";"

merge_multi_lists(*arg)

Merge multiple pd.DataFrame CCCG data and remove duplicates

drop_dup(list_pd)

Drop duplicated CCCG data

unique_cells(src_arr)

Identify the unique inputs/designs/functions for the given coupling factor (i.e., Input Function and Design)

match_CCCG_on(src_arr, col_name)

Get a list of CCCGs based on single coupling factor, meaning the CCCGs are grouped because

match_CCCG_list_on(list_pd, col_name)

Identify CCCGs that are also have the "col_name" coupling factor. (This function is used for two or more shared coupling factors.)

match_multi_on(src_arr, col_name)

Extract a CCCG based on col_name

match_multi_list_on(list_pd, col_name)

Extract the CCCGs from a list of pandas.DataFrame

Module Contents

bahamas.cccg.logger[source]
bahamas.cccg.check_valid(src_arr)[source]

Check if group is empty

Parameters:

src_arr (list or pd.DataFrame) – data to check

Returns:

True if the group is not empty, else False

Return type:

bool

bahamas.cccg.clean_string(s)[source]

Remove “None” and “nan” from str that are separated by “;”

Parameters:

s (str) – string to clean

Returns:

cleaned string

Return type:

str

bahamas.cccg.merge_multi_lists(*arg)[source]

Merge multiple pd.DataFrame CCCG data and remove duplicates

Parameters:

arg (list) – list of pd.DataFrame CCCG data

Returns:

merged CCCG data without duplications

Return type:

list

bahamas.cccg.drop_dup(list_pd)[source]

Drop duplicated CCCG data

Parameters:

list_pd (list) – list of pd.DataFrame (CCCG data)

Returns:

list of pd.DataFrame (CCCG data) without duplications

Return type:

list

bahamas.cccg.unique_cells(src_arr)[source]

Identify the unique inputs/designs/functions for the given coupling factor (i.e., Input Function and Design)

Parameters:

src_arr (pd.DataFrame) – expanded coupling factor data for single coupling factor

Returns:

list of unique inputs/designs/functions among all components

Return type:

list

bahamas.cccg.match_CCCG_on(src_arr, col_name)[source]

Get a list of CCCGs based on single coupling factor, meaning the CCCGs are grouped because they have at least one shared variable of the given coupling factor

Parameters:
  • src_arr (pd.DataFrame) – Component table with expanded coupling factors

  • col_name (str) – coupling factor, Function_, Input_ or Design_

Returns:

list of CCCGs based on single coupling factor, arranged in the order *_1, *_2, *_3, etc. where * represents the coupling factor

Return type:

list

bahamas.cccg.match_CCCG_list_on(list_pd, col_name)[source]

Identify CCCGs that are also have the “col_name” coupling factor. (This function is used for two or more shared coupling factors.)

Parameters:
  • list_pd (list) – list of pd.DataFrame of CCCGs

  • col_name (str) – coupling factor, Function_, Input_ or Design_

Returns:

CCCGs with the additional coupling factor (“col_name”)

Return type:

list

bahamas.cccg.match_multi_on(src_arr, col_name)[source]

Extract a CCCG based on col_name

Parameters:
  • src_arr (pd.DataFrame) – pd.DataFrame of CCCGs

  • col_name (str) – coupling factor

Returns:

extracted the CCCGs based on the given column name

Return type:

list

bahamas.cccg.match_multi_list_on(list_pd, col_name)[source]

Extract the CCCGs from a list of pandas.DataFrame

Parameters:
  • list_pd (list) – list of pd.DataFrame

  • col_name (str) – coupling factor name

Returns:

list of extracted CCCGs

Return type:

list

class bahamas.cccg.CCCG(file)[source]

Bases: object

Compute CCCGs for the given list of components of diversity and redundancy system

_sys_diagram[source]
_cccg_final = [][source]
_cccg_function = [][source]
_cccg_input = [][source]
_cccg_design = [][source]
_cccg_single = [][source]
_cccg_function_input = [][source]
_cccg_function_design = [][source]
_cccg_input_function = [][source]
_cccg_input_design = [][source]
_cccg_design_input = [][source]
_cccg_design_function = [][source]
_cccg_double = [][source]
_cccg_function_input_design = [][source]
_cccg_function_design_input = [][source]
_cccg_input_design_function = [][source]
_cccg_input_function_design = [][source]
_cccg_design_input_function = [][source]
_cccg_design_function_input = [][source]
_cccg_triple = [][source]
_function_all = [][source]
_input_all = [][source]
_design_all = [][source]
generate(config=None)[source]

Generate CCCGs based on three coupling factors (i.e., Function, Input, and Design)

Parameters:

config (dict, optional) – config file for output control. Defaults to None.

get(name)[source]

Get CCCGs

Parameters:

name (str) – name for CCCGs group

Returns:

list of CCCGs

Return type:

list (list of Pandas.DataFrame)

write(data, fname, style='csv')[source]

Dump data

Parameters:
  • data (list of pandas.DataFrame) – output data to dump

  • fname (str) – file name to save the data

  • style (str, optional) – type of file. Defaults to “csv”.

aggregate(cccgs)[source]

Aggregate expanded Function, Input, and Design into Function_Config, Input_Config, and Design_Config

Parameters:

cccgs (list) – list of pd.DataFrame (i.e., CCCGs)

Returns:

list of aggregated CCCGs

Return type:

list