arsenalgear-py
A library containing general purpose Python utils.
|
Functions | |
def | TimeToInt (time_string) |
TimeToInt. More... | |
def | IntToTime (time_int) |
IntToTime. More... | |
def | save_img (img_name, save_path, tight=False) |
save_img More... | |
def arsenalgear.utils.IntToTime | ( | time_int | ) |
IntToTime.
Function used to convert an integer into a time-string. Args: time_int ( int ): the integer. Returns: string: the converted time-string. Testing: >>> IntToTime( 20220314092000 ) '2022.03.14 09:20:00' >>> IntToTime( 20220314094000 ) '2022.03.14 09:40:00'
def arsenalgear.utils.save_img | ( | img_name, | |
save_path, | |||
tight = False |
|||
) |
save_img
Function used to save a specific plot "img_name" into a specific directory "save_path". Args: img_name (str): The name of the plot to be saved. No file extension needed. save_path (str): The path in which the plot should be saved. tight (bool, optional): Set "tight" option for plot into True or False. Default to False. Testing: >>> a = [ 1, 2, 3, 4 ] >>> _ = plt.plot( a ) >>> save_img( "save_img_test", "../../img/tests" ) >>> os.path.exists( "../img/tests/save_img_test.png" ) True
def arsenalgear.utils.TimeToInt | ( | time_string | ) |
TimeToInt.
Function used to convert a time-string into an integer. Args: time_string ( string ): the time-string. Returns: int: the converted time-string into int. Testing: >>> TimeToInt( "2022.03.14 09:20:00.000" ) 20220314092000000 >>> TimeToInt( "2022.03.14 09:20:00" ) 20220314092000 >>> TimeToInt( "2022.03.14 09:20:00" ) + 3 20220314092003