How to use the anypytools.tools.array2anyscript function in anypytools

To help you get started, we’ve selected a few anypytools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AnyBody-Research-Group / AnyPyTools / tests / test_tools.py View on Github external
def test_array2anyscript():

    mat33 = array2anyscript( np.array([[1, 0, 0], [0, 1, 0], [0,0,1]]) )
    assert mat33 == '{{1,0,0},{0,1,0},{0,0,1}}'

    mat31 = array2anyscript(  np.array([[1, 0, 0]]) )
    assert mat31 == '{{1,0,0}}'

    mat13 = array2anyscript( np.array([[1], [0], [0]]) )
    assert mat13 == '{{1},{0},{0}}'

    mat3 = array2anyscript( np.array([0.333333333, -1.9999999999 , 0.0 ]) )
    assert mat3 == '{0.333333333,-1.9999999999,0}'

    str2 = array2anyscript( np.array(['hallo', 'world']) )
    assert str2 == '{"hallo","world"}'
github AnyBody-Research-Group / AnyPyTools / tests / test_tools.py View on Github external
def test_array2anyscript():

    mat33 = array2anyscript( np.array([[1, 0, 0], [0, 1, 0], [0,0,1]]) )
    assert mat33 == '{{1,0,0},{0,1,0},{0,0,1}}'

    mat31 = array2anyscript(  np.array([[1, 0, 0]]) )
    assert mat31 == '{{1,0,0}}'

    mat13 = array2anyscript( np.array([[1], [0], [0]]) )
    assert mat13 == '{{1},{0},{0}}'

    mat3 = array2anyscript( np.array([0.333333333, -1.9999999999 , 0.0 ]) )
    assert mat3 == '{0.333333333,-1.9999999999,0}'

    str2 = array2anyscript( np.array(['hallo', 'world']) )
    assert str2 == '{"hallo","world"}'
github AnyBody-Research-Group / AnyPyTools / tests / test_tools.py View on Github external
def test_array2anyscript():

    mat33 = array2anyscript( np.array([[1, 0, 0], [0, 1, 0], [0,0,1]]) )
    assert mat33 == '{{1,0,0},{0,1,0},{0,0,1}}'

    mat31 = array2anyscript(  np.array([[1, 0, 0]]) )
    assert mat31 == '{{1,0,0}}'

    mat13 = array2anyscript( np.array([[1], [0], [0]]) )
    assert mat13 == '{{1},{0},{0}}'

    mat3 = array2anyscript( np.array([0.333333333, -1.9999999999 , 0.0 ]) )
    assert mat3 == '{0.333333333,-1.9999999999,0}'

    str2 = array2anyscript( np.array(['hallo', 'world']) )
    assert str2 == '{"hallo","world"}'
github AnyBody-Research-Group / AnyPyTools / tests / test_tools.py View on Github external
def test_array2anyscript():

    mat33 = array2anyscript( np.array([[1, 0, 0], [0, 1, 0], [0,0,1]]) )
    assert mat33 == '{{1,0,0},{0,1,0},{0,0,1}}'

    mat31 = array2anyscript(  np.array([[1, 0, 0]]) )
    assert mat31 == '{{1,0,0}}'

    mat13 = array2anyscript( np.array([[1], [0], [0]]) )
    assert mat13 == '{{1},{0},{0}}'

    mat3 = array2anyscript( np.array([0.333333333, -1.9999999999 , 0.0 ]) )
    assert mat3 == '{0.333333333,-1.9999999999,0}'

    str2 = array2anyscript( np.array(['hallo', 'world']) )
    assert str2 == '{"hallo","world"}'
github AnyBody-Research-Group / AnyPyTools / tests / test_tools.py View on Github external
def test_array2anyscript():

    mat33 = array2anyscript( np.array([[1, 0, 0], [0, 1, 0], [0,0,1]]) )
    assert mat33 == '{{1,0,0},{0,1,0},{0,0,1}}'

    mat31 = array2anyscript(  np.array([[1, 0, 0]]) )
    assert mat31 == '{{1,0,0}}'

    mat13 = array2anyscript( np.array([[1], [0], [0]]) )
    assert mat13 == '{{1},{0},{0}}'

    mat3 = array2anyscript( np.array([0.333333333, -1.9999999999 , 0.0 ]) )
    assert mat3 == '{0.333333333,-1.9999999999,0}'

    str2 = array2anyscript( np.array(['hallo', 'world']) )
    assert str2 == '{"hallo","world"}'
github AnyBody-Research-Group / AnyPyTools / anypytools / macroutils.py View on Github external
def _format_macro(self, val):
        if isinstance(val, np.ndarray):
            val = array2anyscript(val)
        elif isinstance(val, float):
            val = "{:.12g}".format(val)
        elif isinstance(val, int):
            val = "{:d}".format(val)
        return 'classoperation {0} "Set Value" --value="{1}"'.format(self.var, val)
github AnyBody-Research-Group / AnyPyTools / anypytools / generate_macros.py View on Github external
def _create_set_value_cmd(self,var,val):
        """Creates a set value macro string"""
        if isinstance(val,list):
            val = np.array(val)
        if isinstance(val, np.ndarray):
            val = array2anyscript(val).strip('"')
        if isinstance(val,float):
            val = '{:.12g}'.format(val)
        return 'classoperation {0} "Set Value" --value="{1}"'.format(var,val)