12.8. pyVig - cablings

class nettoolkit.pyVig.cablings.ADevCablings(self_device, **kwargs)[source]

Bases: object

A single Device Cabling details

Parameters:

self_device (str) – device hostname (self)

add_to_cablings(**kwargs)[source]

add provided keyword arguments to cablings (dictionary)

cabling_dataframe()[source]

generate the dataframe for the cablings details captured in cablings dictionary of self.

Returns:

Pandas DataFrame object

Return type:

DataFrame

update_attrib(**kwargs)[source]

update object attributes

12.9. pyVig - mathamatics

class nettoolkit.pyVig.maths.CalculateXY(dev_df, default_x_spacing, default_y_spacing, cbl_df, sheet_filter_dict)[source]

Bases: object

Co-ordinate calculator

Parameters:
  • dev_df (DataFrame) – Device DataFrame

  • default_x_spacing (int, float) – horizontal spacing between two devices

  • default_y_spacing (int, float) – vertical spacing between two devices

  • cbl_df (DataFrame) – Cabling DataFrame

  • sheet_filter_dict (dict) – sheet filters for multi tab drawing

calc()[source]

calculation sequences

calc_xs(ho_dict)[source]

calculate x-axis refereances with respect to high order dictionary

Parameters:

ho_dict (dict) – high order devices dictionary

Returns:

high order dictionary with x-axis reference values

Return type:

dict

calc_ys(ho_dict)[source]

calculate y-axis refereances with respect to high order dictionary

Parameters:

ho_dict (dict) – high order devices dictionary

Returns:

high order dictionary with y-axis reference values

Return type:

dict

count_of_ho(df)[source]

counts hierarchical_order items for given dataframe and stores it in local dict

Parameters:

df (DataFrame) – Device Dataframe with hierarchical_order column

Returns:

_description_

Return type:

_type_

get_x(ho)[source]

get the x axis value for a device from given hierarchical order number

Parameters:

ho (int) – hierarchical order number

Returns:

x axis value

Return type:

int, float

get_y(ho)[source]

get the y axis value for the given hierarchical_order

Parameters:

ho (int) – hierarchical order number

Returns:

y axis value

Return type:

int, float

inverse_y(y)[source]

inverses the y axis values (turn upside down)

Parameters:

y (dict) – dictionary with y axis placement values based on hierarchical_order

Returns:

inversed dictionary with y axis placement values based on reversed hierarchical_order

Return type:

dict

merge_xy_filter_dfs_with_dev_df()[source]

merge sheet filter x,y column information with main device dataframe

sort()[source]

sort the Device DataFrame based on [‘hierarchical_order’, ‘hostname’]

update_xs(df, x_axis, ho_dict)[source]

update x-axis column to given df Device DataFrame

Parameters:
  • df (DataFrame) – Device DataFrame

  • x_axis (str) – column name for x_axis

  • ho_dict (dict) – high order devices dictionary

update_xy_for_sheet_filter_dict()[source]

create and calculate x-axis, y-axis columns, values for each filtered tab database

update_ys(df, y_axis, ho_dict)[source]

update y-axis column to given df Device DataFrame

Parameters:
  • df (DataFrame) – Device DataFrame

  • y_axis (str) – column name for y_axis

  • ho_dict (dict) – high order devices dictionary

class nettoolkit.pyVig.maths.CalculateXYNative(ddf, cdf, sfd)[source]

Bases: object

Calculate co-ordinate default Native way

Parameters:
  • ddf (DataFrame) – Devices DataFrame

  • cdf (DataFrame) – Cabling DataFrame

add(item, x, y)[source]

add an item to provided co-ordinates

Parameters:
  • item (str) – device hostname

  • x (int) – x-coordinate

  • y (int) – y-coordinate

add_x_y_to_df()[source]

add x,y axis columns to devices data frame.

calc()[source]

start calculator

count_of_devices(dev)[source]

identify devices from cable matrix and provide its occurances number.

Parameters:

dev (str) – Device hostname to match with

Returns:

number of occurances

Return type:

int

dev_connectors_dict()[source]

set device connectors dictionary and its inverse dictionary

device_add(device, root)[source]

check if device and its childs is added or not and add its co-ordinates.

Parameters:
  • device (str) – hostname of device

  • root (bool) – is it root path or not

Returns:

No return

Return type:

None

get_nbr_devices(device)[source]

get set of neighbor devices for provided host/device

Parameters:

device (str) – device hostname

Returns:

set of devices

Return type:

set

get_xy(dev, i)[source]

retrive (x,y) co-ordinate for provided device. (i=0 for x, i=1 for y)

Parameters:
  • dev (str) – device hostname

  • i (int) – index number from tuple for x, y

Returns:

respective co-ordinate

Return type:

int

iterate()[source]

iterate thru all devices and add its co-ordinates

nettoolkit.pyVig.maths.df_with_slops_and_angles(df, x1_col, x2_col, y1_col, y2_col)[source]

add the dataframe with slop and angle for the given co-ordinates on plane.

Parameters:
  • df (DataFrame) – Input DataFrame

  • x1_col (str) – column name for point 1 - x axis

  • x2_col (str) – column name for point 2 - x axis

  • y1_col (str) – column name for point 1 - y axis

  • y2_col (str) – column name for point 2 - y axis

Returns:

Updated Output DataFrame

Return type:

DataFrame

nettoolkit.pyVig.maths.slop_to_angled_connector(m)[source]

calculate angle from given slop(m) of an angled line.

Parameters:

m (float) – slop of an angled line

Returns:

degree/slop of line

Return type:

int

nettoolkit.pyVig.maths.slop_to_straight_connector(m)[source]

calculate angle from given slop(m) of a straight line.

Parameters:

m (float) – slop of a straight line

Returns:

degree/slop of line

Return type:

int