pyroSAR/ancillary.py
def groupbyTime(images, function, time):
    """
    function to group images by their acquisition time difference

    Parameters
    ----------
    images: list of str
        a list of image names
    function: function
        a function to derive the time from the image names; see e.g. :func:`seconds`
    time: int or float
        a time difference in seconds by which to group the images

    Returns
    -------
    list
        a list of sub-lists containing the grouped images
    """
    # sort images by time stamp
    srcfiles = sorted(images, key=function)
    
    groups = [[srcfiles[0]]]
    group = groups[0]
    
    for i in range(1, len(srcfiles)):
        item = srcfiles[i]
        if 0 < abs(function(item) - function(group[-1])) <= time:
            group.append(item)
        else:
            groups.append([item])
            group = groups[-1]
    return [x[0] if len(x) == 1 else x for x in groups]

    function to group images by their acquisition time difference

    Parameters
    ----------
    images: list of str
        a list of image names
    function: function
        a function to derive the time from the image names; see e.g. :func:`seconds`
    time: int or float
        a time difference in seconds by which to group the images

    Returns
    -------
    list
        a list of sub-lists containing the grouped images
    
function to group images by their acquisition time difference
Parameters

list of str
a list of image names
function: function
a function to derive the time from the image names; see e.g. :func:`seconds`
time: int or float
a time difference in seconds by which to group the images

Returns

list
a list of sub-lists containing the grouped images
function to group images by their acquisition time difference Parameters list of str a list of image names function : function a function to derive the time from the image names ; see e . g . : func : ` seconds ` time : int or float a time difference in seconds by which to group the images Returns list a list of sub - lists containing the grouped images
def groupbyTime(images, function, time):
    srcfiles = sorted(images, key=function)
    groups = [[srcfiles[0]]]
    group = groups[0]
    for i in range(1, len(srcfiles)):
        item = srcfiles[i]
        if 0 < abs(function(item) - function(group[-1])) <= time:
            group.append(item)
        else:
            groups.append([item])
            group = groups[-1]
    return [x[0] if len(x) == 1 else x for x in groups]
def groupbyTime ( images , function , time ) : srcfiles = sorted ( images , key = function ) groups = [ [ srcfiles [ 0 ] ] ] group = groups [ 0 ] for i in range ( 1 , len ( srcfiles ) ) : item = srcfiles [ i ] if 0 < abs ( function ( item ) - function ( group [ - 1 ] ) ) <= time : group . append ( item ) else : groups . append ( [ item ] ) group = groups [ - 1 ] return [ x [ 0 ] if len ( x ) == 1 else x for x in groups ]
function to group images by their acquisition time difference
Parameters
function to group images by their acquisition time difference Parameters
"""
    function to group images by their acquisition time difference

    Parameters
    ----------
    images: list of str
        a list of image names
    function: function
        a function to derive the time from the image names; see e.g. :func:`seconds`
    time: int or float
        a time difference in seconds by which to group the images

    Returns
    -------
    list
        a list of sub-lists containing the grouped images
    """ # sort images by time stamp
images
function
time