libs/data/utils.py
def extract_pages(sequence, pages_indices, page_size, border_size=0):
    """Extracts and returns the given set of pages from the sequence.

    Args:
        sequence: (1-D Array) sequence from where to extract data.
        pages_indices: (1-D Array) array of indices of pages to be extracted.
        page_size: (int) number in samples of each page.
        border_size: (Optional, int,, defaults to 0) number of samples to be
            added at each border.

    Returns:
        pages_data: (2-D Array) array of shape [n_pages,page_size+2*border_size]
            that contains the extracted data.
    """
    pages_list = []
    for page in pages_indices:
        sample_start = page * page_size - border_size
        sample_end = (page + 1) * page_size + border_size
        page_signal = sequence[sample_start:sample_end]
        pages_list.append(page_signal)
    pages_data = np.stack(pages_list, axis=0)
    return pages_data
Extracts and returns the given set of pages from the sequence.

    Args:
        sequence: (1-D Array) sequence from where to extract data.
        pages_indices: (1-D Array) array of indices of pages to be extracted.
        page_size: (int) number in samples of each page.
        border_size: (Optional, int,, defaults to 0) number of samples to be
            added at each border.

    Returns:
        pages_data: (2-D Array) array of shape [n_pages,page_size+2*border_size]
            that contains the extracted data.
    
Extracts and returns the given set of pages from the sequence.
Extracts and returns the given set of pages from the sequence .
def extract_pages(sequence, pages_indices, page_size, border_size=0):
    pages_list = []
    for page in pages_indices:
        sample_start = page * page_size - border_size
        sample_end = (page + 1) * page_size + border_size
        page_signal = sequence[sample_start:sample_end]
        pages_list.append(page_signal)
    pages_data = np.stack(pages_list, axis=0)
    return pages_data
def extract_pages ( sequence , pages_indices , page_size , border_size = 0 ) : pages_list = [ ] for page in pages_indices : sample_start = page * page_size - border_size sample_end = ( page + 1 ) * page_size + border_size page_signal = sequence [ sample_start : sample_end ] pages_list . append ( page_signal ) pages_data = np . stack ( pages_list , axis = 0 ) return pages_data
Extracts and returns the given set of pages from the sequence.
Extracts and returns the given set of pages from the sequence .
"""Extracts and returns the given set of pages from the sequence.

    Args:
        sequence: (1-D Array) sequence from where to extract data.
        pages_indices: (1-D Array) array of indices of pages to be extracted.
        page_size: (int) number in samples of each page.
        border_size: (Optional, int,, defaults to 0) number of samples to be
            added at each border.

    Returns:
        pages_data: (2-D Array) array of shape [n_pages,page_size+2*border_size]
            that contains the extracted data.
    """
(2-D Array) array of shape [n_pages,page_size+2*border_size]
that contains the extracted data.
( 2 - D Array ) array of shape [ n_pages page_size + 2 * border_size ] that contains the extracted data .
pages_data
sequence
(1-D Array) sequence from where to extract data.
( 1 - D Array ) sequence from where to extract data .
pages_indices
(1-D Array) array of indices of pages to be extracted.
( 1 - D Array ) array of indices of pages to be extracted .
page_size
(int) number in samples of each page.
( int ) number in samples of each page .
border_size
(Optional, int,, defaults to 0) number of samples to be
added at each border.
( Optional int defaults to 0 ) number of samples to be added at each border .