Skip to content

run_pipeline() crashes when line_names=None (default) #31

Description

@fcotizelati

In src/pypetal/pipeline.py, run_pipeline() documents line_names=None as the default, but the function currently can’t run in that mode. The problem is that len(line_names) is evaluated before handling the None case:

if len(line_names) != len(fnames):

so with the default argument this immediately raises:

TypeError: object of type 'NoneType' has no len()

Even beyond that, the later “fallback” block for generating default names is also broken: it creates a NumPy array and then tries to use .append(), and it doesn’t include the continuum, so the resulting list would have the wrong length anyway.

A simple fix is to generate sensible default names first, and only then check consistency, e.g.:

if line_names is None:
    line_names = ["continuum"] + [f"line{i+1}" for i in range(len(line_fnames))]

This makes the documented default actually usable and keeps the naming consistent with the number of light curves.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions