Hash

Functions to generate unique name files.

For a matrix

Compute a text represenation of matrix


source

matrix

 matrix (matrix:Union[list,numpy.ndarray],
         decimal_sep_replacement:Optional[bool]='_')
Type Default Details
matrix Union Input
decimal_sep_replacement Optional _ Decimal point separator
Returns str Text representation

It can be used on lists,

matrix([[1, 2], [3,4]])
'1234'

or arrays

matrix(np.array([[1, 2], [3,4]]))
'1234'

Decimal separators are by default replaced.

matrix(np.array([[1.1, 2.2], [3.3,4.4]]))
'1_12_23_34_4'

Lists are also fine.

matrix([1.3, 2.4])
'1_32_4'

For a number

Compute a text represenation of number


source

number

 number (number:Union[float,numpy.float64],
         decimal_sep_replacement:Optional[bool]='_')
Type Default Details
number Union Input
decimal_sep_replacement Optional _ Decimal point separator
Returns str Text representation
number(3.14)
'3_14'

For a string

From this post: a function to hash any arbitray string.


source

string

 string (s:str)
Type Details
s str Input
Returns str Text representation
string('foo-bar#baz?qux@127/\\9]')
'foobarbazqux1279'