utils

The utils module provides functions for general operations and plotting.

Functions

poli_sci_kit.utils.normalize(vals)[source]

Returns respective normalized values.

poli_sci_kit.utils.gen_list_of_lists(original_list, new_structure)[source]

Generates a list of lists with a given structure from a given list.

poli_sci_kit.utils.gen_faction_groups(original_list, factions_indexes)[source]

Reorders a list into a list of lists where sublists are faction amounts.

Parameters:
original_listlist

The data to be reorganized.

factions_indexeslist of lists (contains ints)

The structure of original_list indexes to output.

Returns:
factioned_listlist of lists

The values of original_list ordered as the indexes of factions_indexes.

poli_sci_kit.utils.hex_to_rgb(hex_rep)[source]

Converts a hexadecimal representation to its RGB ratios.

Parameters:
hex_repstr

The hex representation of the color.

Returns:
rgb_triptuple

An RGB tuple color representation.

poli_sci_kit.utils.rgb_to_hex(rgb_trip)[source]

Converts rgb ratios to their hexadecimal representation.

Parameters:
rgb_triptuple

An RGB tuple color representation.

Returns:
hex_repstr

The hex representation of the color.

poli_sci_kit.utils.scale_saturation(rgb_trip, sat)[source]

Changes the saturation of an rgb color.

Parameters:
rgb_triptuple

An RGB tuple color representation.

satfloat

The saturation it rgb_trip should be modified by.

Returns:
saturated_rgbtuple

colorsys.hls_to_rgb saturation of the given color.