<commit_before>#! /usr/bin/env python

"""
Module with a frame differencing algorithm for ADI post-processing.
"""

__author__ = '<NAME>'
__all__ = ['xloci']

import numpy as np
import scipy as sp
import pandas as pn
from multiprocessing import cpu_count
from sklearn.metrics import pairwise_distances
from ..var import get_annulus_segments
from ..preproc import (cube_derotate, cube_collapse, check_pa_vector,
                       check_scal_vector)
from ..preproc.rescaling import _find_indices_sdi
from ..conf import time_ini, timing
from ..preproc import cube_rescaling_wavelengths as scwave
from ..preproc.derotation import _find_indices_adi, _define_annuli
from ..conf.utils_conf import pool_map, iterable, Progressbar


def xloci(cube, angle_list, scale_list=None, fwhm=4, metric='manhattan',
          dist_threshold=100, delta_rot=0.5, delta_sep=(0.1, 1), radius_int=0,
          asize=4, n_segments=4, nproc=1, solver='lstsq', tol=1e-3,
          optim_scale_fact=2, adimsdi='skipadi', imlib='opencv',
          interpolation='lanczos4', collapse='median', verbose=True,
          full_output=False):
    """ LOCI style algorithm that models a PSF (for ADI data) with a
    least-square combination of neighbouring frames (solving the equation
    a x = b by computing a vector x of coefficients that minimizes the
    Euclidean 2-norm || b - a x ||^2).

    Parameters
    ----------
    cube : array_like, 3d or 4d<commit_msg>updating docstring<commit_after>#! /usr/bin/env python

"""
Module with a frame differencing algorithm for ADI and ADI+mSDI post-processing.
"""

__author__ = '<NAME>'
__all__ = ['xloci']

import numpy as np
import scipy as sp
import pandas as pn
from multiprocessing import cpu_count
from sklearn.metrics import pairwise_distances
from ..var import get_annulus_segments
from ..preproc import (cube_derotate, cube_collapse, check_pa_vector,
                       check_scal_vector)
from ..preproc.rescaling import _find_indices_sdi
from ..conf import time_ini, timing
from ..preproc import cube_rescaling_wavelengths as scwave
from ..preproc.derotation import _find_indices_adi, _define_annuli
from ..conf.utils_conf import pool_map, iterable, Progressbar


def xloci(cube, angle_list, scale_list=None, fwhm=4, metric='manhattan',
          dist_threshold=100, delta_rot=0.5, delta_sep=(0.1, 1), radius_int=0,
          asize=4, n_segments=4, nproc=1, solver='lstsq', tol=1e-3,
          optim_scale_fact=2, adimsdi='skipadi', imlib='opencv',
          interpolation='lanczos4', collapse='median', verbose=True,
          full_output=False):
    """ LOCI style algorithm that models a PSF (for ADI and ADI+mSDI) with a
    least-square combination of neighbouring frames (solving the equation
    a x = b by computing a vector x of coefficients that minimizes the
    Euclidean 2-norm || b - a x ||^2).

    Parameters
    ----------
    cube : array_like, 3d or 4d
{'fraction_non_alphanumeric': 0.09841706813489333, 'fraction_numerical': 0.014452856159669649, 'mean_word_length': 3.8530884808013357, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1046105', 'n_tokens_mistral': 971, 'n_tokens_neox': 932, 'n_words': 285}