def CheckSameObj(obj0, obj1, LFields=None):
    """ Check if two variables are the same instance of a ToFu class

    Checks a list of attributes, provided by LField

    Parameters
    ----------
    obj0 :      tofu object
        A variable refering to a ToFu object of any class
    obj1 :      tofu object
        A variable refering to a ToFu object of the same class as obj0
    LFields :   None / str / list
        The criteria against which the two objects are evaluated:
            - None: True is returned
            - str or list: tests whether all listed attributes have the same value

    Returns
    -------
    A :     bool
        True only is LField is None or a list of attributes that all match

    """
    A = True
    if LField is not None and obj0.__class__==obj1.__class__:
        assert type(LFields) in [str,list]
        if type(LFields) is str:
            LFields = [LFields]
        assert all([type(s) is str for s in LFields])
        ind = [False for ii in range(0,len(LFields))]
        Dir0 = dir(obj0.Id)+dir(obj0)
        Dir1 = dir(obj1.Id)+dir(obj1)
        for ii in range(0,len(LFields)):
            assert LFields[ii] in Dir0, LFields[ii]+" not in "+obj0.Id.Name
            assert LFields[ii] in Dir1, LFields[ii]+" not in "+obj1.Id.Name
            if hasattr(obj0,LFields[ii]):
                ind[ii] = np.all(getattr(obj0,LFields[ii])==getattr(obj1,LFields[ii]))
            else:
                ind[ii] = getattr(obj0.Id,LFields[ii])==getattr(obj1.Id,LFields[ii])
        A = all(ind)
    return A
def CheckSameObj ( obj0 , obj1 , LFields = None ) : A = True if LField is not None and obj0 . __class__ == obj1 . __class__ : assert type ( LFields ) in [ str , list ] if type ( LFields ) is str : LFields = [ LFields ] assert all ( [ type ( s ) is str for s in LFields ] ) ind = [ False for ii in range ( 0 , len ( LFields ) ) ] Dir0 = dir ( obj0 . Id ) + dir ( obj0 ) Dir1 = dir ( obj1 . Id ) + dir ( obj1 ) for ii in range ( 0 , len ( LFields ) ) : assert LFields [ ii ] in Dir0 , LFields [ ii ] + " not in " + obj0 . Id . Name assert LFields [ ii ] in Dir1 , LFields [ ii ] + " not in " + obj1 . Id . Name if hasattr ( obj0 , LFields [ ii ] ) : ind [ ii ] = np . all ( getattr ( obj0 , LFields [ ii ] ) == getattr ( obj1 , LFields [ ii ] ) ) else : ind [ ii ] = getattr ( obj0 . Id , LFields [ ii ] ) == getattr ( obj1 . Id , LFields [ ii ] ) A = all ( ind ) return A
Check if two variables are the same instance of a ToFu class

    Checks a list of attributes, provided by LField

    Parameters
    ----------
    obj0 :      tofu object
        A variable refering to a ToFu object of any class
    obj1 :      tofu object
        A variable refering to a ToFu object of the same class as obj0
    LFields :   None / str / list
        The criteria against which the two objects are evaluated:
            - None: True is returned
            - str or list: tests whether all listed attributes have the same value

    Returns
    -------
    A :     bool
        True only is LField is None or a list of attributes that all match