Skip to content

Conversation

LuisFSegalla
Copy link
Contributor

This Pull Request aims at adding a new spec class Duration that contains only a Float. This class is now used in fly and step as a new Dimension that is zipped with the other ones.

@LuisFSegalla LuisFSegalla linked an issue Jul 10, 2025 that may be closed by this pull request
@LuisFSegalla LuisFSegalla requested a review from coretl July 11, 2025 14:44
Copy link
Contributor

@coretl coretl left a comment

Choose a reason for hiding this comment

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

Please can you also remove all references to DURATION and the Static.duration classmethod

@LuisFSegalla LuisFSegalla marked this pull request as draft July 18, 2025 12:54
@LuisFSegalla LuisFSegalla requested a review from coretl July 18, 2025 12:54
@LuisFSegalla
Copy link
Contributor Author

Changed this PR to be a draft for the time being as I'm not sure this is the right way to implement what was discussed with @coretl.

@LuisFSegalla LuisFSegalla requested a review from coretl July 23, 2025 15:20
Copy link
Contributor

@coretl coretl left a comment

Choose a reason for hiding this comment

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

Hmm, I'm still a little unsure about whether we've got the typing right, but if you do these bits then we can explore in a different ticket

@LuisFSegalla
Copy link
Contributor Author

LuisFSegalla commented Jul 24, 2025

It was decided that in a Product only the inner spec can define the duration.
We'll try to default spec in ConstantDuration to None and move it to the second argument and see if typing will complain.
Change ConsntantDuration.calculate to create a new empty Dimension with only the duration if no spec was provided.
Change ConsntatDuration.calculate if fly == False to call self.spec.calculate(bounds=False) and set duration on the last Dimension, changing the lenght to be based on .gap not .midpoints

@LuisFSegalla LuisFSegalla requested a review from coretl July 25, 2025 07:33
Copy link
Contributor

@coretl coretl left a comment

Choose a reason for hiding this comment

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

One more suggestion, then I think the code is done.

Please could you add unit tests for all the if branches in the new code that are not currently covered:
https://app.codecov.io/gh/bluesky/scanspec/pull/176?dropdown=coverage&src=pr&el=h1

Copy link
Contributor

@coretl coretl left a comment

Choose a reason for hiding this comment

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

Found a few more...

@LuisFSegalla LuisFSegalla requested a review from coretl July 25, 2025 14:20
@LuisFSegalla LuisFSegalla marked this pull request as ready for review July 28, 2025 08:00
LuisFSegalla and others added 15 commits July 29, 2025 10:53
Default value of the bounds argument is now `False`. Needed to change
the `frames` method in the `Spec` class so that it would call calculate
with the correct bounds, otherwise it wouls break some tests.

Made it so that the `duration` method in the base class `Spec` returned
None by default and removed the implementations from classes that would
always return None.
Added support for __rmatmul__

Added fly function back but put a deprecation warning on it and the step
function
tests_cli needed to be changed because previously, the default value for
bounds was `True` which would imply now that we're doing a fly scan.
This is not the default anymore.

Updated specs tests so that they would also catch the error messages
Added new tests for fly, step and get_constant_duration functions.

Also updated their warning messages
@LuisFSegalla LuisFSegalla force-pushed the 172-create-duration-spec-and-update-fly-and-step branch from 59a8d92 to 0322a09 Compare July 29, 2025 11:45
Reverting test_rect_region_difference to a fly scan
Added return values to duration method on Fly class
@shihab-dls
Copy link
Contributor

"Anywhere in the tests where gap output has changed, can we put it back, and change the spec so the gap output is the same?"

Copy link
Contributor

@coretl coretl left a comment

Choose a reason for hiding this comment

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

Almost there...

@LuisFSegalla LuisFSegalla merged commit 117d295 into main Jul 31, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Duration spec and update fly and step
3 participants