Skip to content

feat: implement timeline#985

Open
ZachDerocher wants to merge 37 commits into
mainfrom
feat/implement-timeline
Open

feat: implement timeline#985
ZachDerocher wants to merge 37 commits into
mainfrom
feat/implement-timeline

Conversation

@ZachDerocher

Copy link
Copy Markdown
Contributor

Description

Please provide a brief description of the changes made in this pull request.

Issue linked

Please mention the issue number or describe the problem this pull request addresses.

Checklist

  • [x ] I have tested my changes locally.
  • [x ] I have added necessary documentation or updated existing documentation.
  • [ x] I have followed the coding style guidelines of this project.
  • [ x] I have added appropriate tests (unit, integration, system).
  • [ x] I have reviewed my changes before submitting this pull request.
  • [x ] I have linked the issue or issues that are solved by the PR if any.
  • [x ] I have assigned this PR to myself.
  • [x ] I have made sure that the title of my PR follows Conventional commits style (e.g. feat: add optical property)
  • [x ] I have agreed with the Contributor License Agreement (CLA).

@github-actions github-actions Bot added the enhancement New features or code improvements label May 25, 2026
@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.14286% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.50%. Comparing base (041b2dd) to head (10aaf34).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/ansys/speos/core/simulation.py 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #985      +/-   ##
==========================================
- Coverage   89.98%   88.50%   -1.49%     
==========================================
  Files          45       47       +2     
  Lines       10685    10957     +272     
==========================================
+ Hits         9615     9697      +82     
- Misses       1070     1260     +190     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pluAtAnsys pluAtAnsys changed the title Feat: implement timeline feat: implement timeline May 26, 2026
@pluAtAnsys pluAtAnsys added documentation Improvements or additions to documentation testing Anything related to tests labels May 26, 2026
Comment thread src/ansys/speos/core/simulation.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds timeline support to the inverse simulation API, exposing a toggle and a start time that map to the underlying inverse_mc_simulation_properties.timeline protobuf field.

Changes:

  • Added timeline and start_time properties to SimulationInverse, including enabling/disabling behavior via protobuf HasField/ClearField.
  • Extended inverse simulation tests to cover default behavior, enable/disable, and start-time-driven re-enabling.
  • Added a changelog fragment documenting the new capability.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
tests/core/test_simulation.py Adds assertions covering timeline defaults and transitions for inverse simulations.
src/ansys/speos/core/simulation.py Implements timeline and start_time properties and wires defaults during inverse simulation initialization.
src/ansys/speos/core/generic/parameters.py Introduces timeline-related parameters for inverse simulations.
doc/changelog.d/985.added.md Documents the new timeline feature.

Comment thread src/ansys/speos/core/simulation.py
Comment thread src/ansys/speos/core/simulation.py
Comment on lines +942 to +945
timeline: bool = False
"""whether timeline is enabled"""
start_time: float = 0.00
"""timeline start time (s)"""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to make start_time optional, but retained the boolean field timeline.

Comment thread src/ansys/speos/core/generic/parameters.py Outdated
Comment thread tests/core/test_simulation.py Outdated
@StefanThoene

StefanThoene commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

@ZachDerocher Hi after review we found out that both lightbox timeline and source timeline functionality is not implemented

you can find the related properties in the scene instance and source template

lightbox is now implemented in main

StefanThoene and others added 2 commits June 2, 2026 08:22
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@ZachDerocher

Copy link
Copy Markdown
Contributor Author

@ZachDerocher Hi after review we found out that both lightbox timeline and source timeline functionality is not implemented

you can find the related properties in the scene instance and source template

lightbox is now implemented in main

As discussed, I will implement timeline for LB in this feature branch. Timeline support for source will be implemented as a separate feature.

ZachDerocher and others added 4 commits June 2, 2026 20:35
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Pengyuan LU <89462462+pluAtAnsys@users.noreply.github.com>
Comment on lines +1476 to +1495
def timeline(self) -> bool:
"""Switch to enable/disable the simulation timeline.

Returns
-------
bool
State of timeline activation.
"""
return self._job.inverse_mc_simulation_properties.HasField("timeline")

@timeline.setter
def timeline(self, value: bool) -> None:
props = self._job.inverse_mc_simulation_properties

if value:
if not props.HasField("timeline"):
timeline = props.timeline
timeline.start_time = 0.0
else:
props.ClearField("timeline")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are not using the boolean

why can a user set a timeline when the boolean is false -> either use the boolean or not have it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could make it read only

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpeosRPC doesn't have a "timeline" boolean, but the Speos UI does have it. My aim was to mimic the UI functionality, for consistency.

I expect a user to set timeline=True, and then set start_time. For disabling, they can set timeline=False. This behavior mimics the Speos UI.

Alternatively, since the timeline property I created here is just an intermediary, the user can optionally work solely with the start_time property. Setting start_time to any value enables timeline; setting start_time to None disables timeline.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In SpeosRPC, the "timeline" boolean is the presence or not of the field timeline in the job.
Exactly what you checked for the timeline property getter few lines above.

I think also that the timeline property can be useful for the client to understand that he is activating/deactivating the timeline.

But then, it is important that you check this property when setting the start_time one.
-> Error if the user tries to set start_time and that he didn't previously activated timeline.

Comment thread tests/core/test_simulation.py
Comment on lines +1063 to +1064
start_time: Optional[float] = None
"""Timeline start time in seconds. Set to ``None`` to disable the simulation timeline."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
start_time: Optional[float] = None
"""Timeline start time in seconds. Set to ``None`` to disable the simulation timeline."""
start_time: Optional[float] = 0.0
"""Timeline start time in seconds."""

I would rather separate notion of start_time, of the one of timeline (de)activation.
It can be weird for the user to set start_time to 0.0 in order to activate the timeline.
Instead, setting the default value to 0.0, will mimic SpaceClaim behavior.

Comment thread src/ansys/speos/core/simulation.py Outdated
Comment on lines +1706 to +1707
timeline = props.timeline
timeline.start_time = 0.0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is equivalent to:

Suggested change
timeline = props.timeline
timeline.start_time = 0.0
props.timeline.start_time = 0.0

Comment on lines +1476 to +1495
def timeline(self) -> bool:
"""Switch to enable/disable the simulation timeline.

Returns
-------
bool
State of timeline activation.
"""
return self._job.inverse_mc_simulation_properties.HasField("timeline")

@timeline.setter
def timeline(self, value: bool) -> None:
props = self._job.inverse_mc_simulation_properties

if value:
if not props.HasField("timeline"):
timeline = props.timeline
timeline.start_time = 0.0
else:
props.ClearField("timeline")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In SpeosRPC, the "timeline" boolean is the presence or not of the field timeline in the job.
Exactly what you checked for the timeline property getter few lines above.

I think also that the timeline property can be useful for the client to understand that he is activating/deactivating the timeline.

But then, it is important that you check this property when setting the start_time one.
-> Error if the user tries to set start_time and that he didn't previously activated timeline.

@echambla

echambla commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Would it be interesting to build a specific example notebook for timeline?
@ZachDerocher @StefanThoene
-> I will add one in the PR timeline for sources

Comment thread tests/local_config.json Outdated
Comment thread tests/core/test_simulation.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New features or code improvements testing Anything related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Implement timeline functionality (Speos RPC 2026R1sp1)

6 participants