pyActigraphy.analysis.Cosinor.fit_reader

Cosinor.fit_reader(reader, params=None, method='leastsq', nan_policy='raise', reduce_fcn=None, verbose_fit=False, n_jobs=1, prefer=None, verbose_parallel=0)[source]

Batch cosinor fit

Fit the actigraphy data contained in a reader using a cosinor function.

Parameters
  • reader (instance of RawReader) – Raw measurements to be fitted.

  • params (instance of Parameters [1], optional.) – Initial fit parameters. If None, use the default parameters. Default is None.

  • method (str, optional) – Name of the fitting method to use [1]. Default is ‘leastsq’.

  • nan_policy (str, optional) –

    Specifies action if the objective function returns NaN values. One of:

    • ’raise’: a ValueError is raised

    • ’propagate’: the values returned from userfcn are un-altered

    • ’omit’: non-finite values are filtered

    Default is ‘raise’.

  • reduce_fcn (str, optional) –

    Function to convert a residual array to a scalar value for the scalar minimizers. Optional values are:

    • None : sum of squares of residual

    • negentropy : neg entropy, using normal distribution

    • neglogcauchy: neg log likelihood, using Cauchy distribution

    Default is None.

  • verbose_fit (bool.) – If True, print the fit summary. Default is False.

  • n_jobs (int) – Number of CPU to use for parallel fitting

  • prefer (str) – Soft hint to choose the default backendself. Supported option:’processes’, ‘threads’. See joblib package documentation for more info. Default is None.

  • verbose_parallel (int) – Display a progress meter if set to a value > 0. Default is 0.

References

1(1,2)

Non-Linear Least-Squares Minimization and Curve-Fitting for Python. https://lmfit.github.io/lmfit-py/index.html