Skip to content

Polynomial signal titles should use mathematical notation instead of parameter listing #3

@PierreRaybaut

Description

@PierreRaybaut

GitHub Issue: Polynomial Signal Title Formatting

Title: Polynomial signal titles should use mathematical notation instead of parameter listing

Labels: bug, enhancement, UX


Description

When creating polynomial signals in DataLab, the signal titles display verbose parameter listings like:

polynomial(a0=1,a1=2,a2=-3,a3=4,a4=0,a5=0)

This format is difficult to read and doesn't follow standard mathematical conventions. Instead, polynomials should be displayed as mathematical expressions:

1+2x-3x²+4x³

Expected Behavior

Polynomial signal titles should:

  • Display in standard mathematical notation (e.g., 1+2x-3x²+4x³)
  • Omit zero coefficients (e.g., 1+x+x³ when a2=0)
  • Handle coefficient simplification (e.g., x instead of 1x, -x instead of -1x)
  • Use proper sign handling (e.g., 1-2x+3x² not 1+-2x++3x²)
  • Use ^ for exponents (e.g., displayed as x^2)
  • Return "0" for all-zero polynomials

Actual Behavior

The PolyParam.generate_title() method currently returns a verbose format listing all six coefficients (a0-a5), even when some are zero, making the titles unnecessarily long and hard to parse visually.

Proposed Solution

Modify the PolyParam.generate_title() method in sigima/objects/signal/creation.py to:

  1. Iterate through coefficients (a0-a5)
  2. Skip zero coefficients
  3. Format each term with proper coefficient and exponent handling
  4. Join terms with correct sign operators

Use Case

This improvement benefits users working with polynomial signals in DataLab by:

  • Making signal lists more readable
  • Following standard mathematical notation
  • Reducing visual clutter in the GUI
  • Improving quick identification of polynomial characteristics

Related Files

  • sigima/objects/signal/creation.py (PolyParam class, line ~1276)
  • datalab/gui/actionhandler.py (uses PolyParam for signal creation)

Additional Context

This is a presentation-layer fix that doesn't affect:

  • Signal data storage or processing
  • Polynomial coefficient values
  • Mathematical operations
  • Serialization/deserialization
  • Existing tests or functionality

The fix only changes how polynomial signals are displayed to users.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions