Example #1
0
    def __new__(cls, indexed_data_matrixes):

        # checking states_data_arrays are all StatesDataArray's instance
        assert check_type_of_args(IndexedDataMatrix, *indexed_data_matrixes)

        # checking indexed_data_matrixes have the same _nrow
        assert len(np.unique(np.array(map(lambda xx: xx._nrow,
                                          indexed_data_matrixes)))) == 1

        return np.array(indexed_data_matrixes).view(cls)
Example #2
0
    def __init__(self, *multi_idxed_data_matrixes):

        # checking states_data_multi_arrays are all StatesDataMultiArrays's instance
        assert check_type_of_args(MultiIndexedDataMatrix, *multi_idxed_data_matrixes)

        # checking states_data_multi_arrays are all has the same _ncols
        assert len(np.unique(map(lambda xx: tuple(xx._ncols), multi_idxed_data_matrixes)).tolist()) == 1

        self._ncols = tuple(multi_idxed_data_matrixes[0]._ncols)

        list.__init__(self, multi_idxed_data_matrixes)
 def __init__(self, *states_dicts):
     
     # checking states_dicts are all StatesDictionary's instance
     assert check_type_of_args(StatesDictionary, *states_dicts)
     
     # checking states_dicts have the same dtype
     assert len(np.unique(np.array(map(lambda xx:xx.dtype.type,states_dicts)))) == 1
     self._dtype_type = states_dicts[0].dtype.type
     
     # checking states_dicts have the same _eval_cls
     assert len(np.unique(np.array(map(lambda xx:xx._eval_cls,states_dicts)))) == 1
     self._eval_cls = states_dicts[0]._eval_cls
     
     self._executed_merge = False
     
     list.__init__(self,states_dicts)
Example #4
0
    def __init__(self, *states_mats):

        # checking states_mats are all StatesDictionary's instance
        assert check_type_of_args(StatesMatrix, *states_mats)

        # checking states_mats have the same _is_row_struct
        assert len(np.unique(np.array(map(lambda xx: xx._is_row_struct, states_mats)))) == 1
        self._is_row_struct = states_mats[0]._is_row_struct

        # checking states_mats have the same dtype.type
        assert len(np.unique(np.array(map(lambda xx: xx.dtype.type, states_mats)))) == 1
        self._dtype_type = states_mats[0].dtype.type

        # checking states_mats have the same _eval_cls
        assert len(np.unique(np.array(map(lambda xx: xx._eval_cls, states_mats)))) == 1
        self._eval_cls = states_mats[0]._eval_cls

        self._is_already_merged = False
        self._is_already_updated = False

        list.__init__(self, states_mats)
Example #5
0
def test_check_type_of_args_2():
    test_args = range(10) + map(str,range(10)) + map(float,range(10)) + map(unicode,range(10))
    assert check_type_of_args([int,float,unicode], *test_args) == False
Example #6
0
    def __init__(self, *idxed_data_matrixes):

        # checking states_data_arrays are all StatesDataArray's instance
        assert check_type_of_args(IndexedDataMatrix, *idxed_data_matrixes)

        list.__init__(self, idxed_data_matrixes)