Skip to content

Multiband periodic_fit documents nterms, but takes nterms_base and nterms_band #20207

Open

Description

@darkdi

Following up on #20205, where @pllim asked me to open one issue per remaining problem. Different subpackage from #20206.

periodic_fit in the multiband Lomb-Scargle MLE implementation documents nterms:

def periodic_fit(
    t, y, dy, bands, frequency, t_fit, bands_fit,
    center_data=True,
    nterms_base=1,
    nterms_band=1,
    ...
):
    """...
    nterms : int (default=1)
        The number of Fourier terms to include in the fit

There is no nterms parameter. The function takes two separate term counts, nterms_base and nterms_band, and neither is documented — so a reader following the docstring would pass nterms=... and get a TypeError, while the two knobs that do exist are invisible.

Looks like the docstring was carried over from the single-band periodic_fit, which does take a single nterms.

The fix would be to replace the entry with the two real parameters, but the wording for each depends on what the multiband model does with them (base terms shared across bands vs. per-band terms), so I would rather not guess at the description. Happy to send a PR if you tell me how you would phrase the two.

Found with a static checker comparing numpydoc parameter names against the signature below them; each finding was read by hand.

Activity

  1. pllim commented on Aug 5, 2026

    @pllim
    Member

    Looks like this has been an issue since it was originally written in #14016 . Perhaps @dougbrn or @astrofrog could clarify. Thanks!

  2. dougbrn commented on Aug 5, 2026

    @dougbrn
    Contributor

    It certainly looks like the periodic_fit docstring was not fully updated for it's multiband version, and that would certainly have happened in the original PR, apologies that slipped through. These kwargs have descriptions in the docstring of the main class, so I would expect they can be used directly in periodic_fit as well: https://github.com/astropy/astropy/blob/main/astropy/timeseries/periodograms/lombscargle_multiband/core.py#L33

    Beyond just nterms, it looks like there are several kwargs not represented in the docstring (reg_base, reg_band, regularize_by_trace, bands_fit). You should again be able to use the main docstring above to populate these, with the exception of bands_fit, which I would suggest just using the definition for that found in various places within the sub-module:

    bands_fit : array-like, or str
                Bands to use in fitting, must be subset of bands in input data.
    
  3. darkdi commented on Aug 5, 2026

    @darkdi
    ContributorAuthor

    Thanks — that's much more useful than just the one tag. Sent #20212 with all seven: nterms_base, nterms_band, reg_base, reg_band, regularize_by_trace and bands_fit added, nterms dropped, entries ordered to match the signature.

    Descriptions are taken verbatim from LombScargleMultiband as you suggested, and bands_fit uses the phrasing from the submodule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions