Skip to content

gangof4_plot(response) rejects precomputed responses with default options #1264

Open

Description

@huxiaoyi-ovo

Title: gangof4_plot(response) rejects precomputed responses with default options

Problem

The documented gangof4_plot(response) call appears to fail when passed a precomputed Gang of Four response.

Minimal reproducer:

import control as ct

P = ct.tf([1], [1, 1])
C = ct.tf([2], [1])

response = ct.gangof4_response(P, C)
ct.gangof4_plot(response)

Expected: Plot the precomputed 2×2 frequency response.

Problem in current main: The frequency-option check treats the default Hz=False as an invalid override because False is not None evaluates to True. This forces a ValueError even when no frequency options were supplied.

There is also a separate argument-forwarding issue: the same branch calls response.plot(kwargs) instead of response.plot(**kwargs), passing the options dictionary as a positional argument.

Both issues are visible in control/freqplot.py. The control-flow condition has been checked independently; I have not executed the complete unmodified package locally.

Would you consider these bugs in the documented response-first API? If so, I can provide a focused fix and regression tests.

Related: #1261, following the request to discuss the behavior in an issue before submitting a PR.

Activity

  1. slivingston commented on Oct 28, 2026

    @slivingston
    Member

    @huxiaoyi-ovo Please add the AI disclosure if you used it to write this issue etc.

  2. huxiaoyi-ovo commented on Oct 29, 2026

    @huxiaoyi-ovo
    Author

    AI disclosure: ChatGPT-6 astra ultra assisted with code analysis and drafting this issue.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions