Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time plans with no delay #156

Open
tlambert03 opened this issue Feb 29, 2024 · 0 comments
Open

Time plans with no delay #156

tlambert03 opened this issue Feb 29, 2024 · 0 comments

Comments

@tlambert03
Copy link
Member

It should be possible to specify a time plan with no delay but some known duration of number of loops (e.g. time_plan=TIntervalDuration(interval=0, duration=3)) ... and it is possible to instantiate it... but when you iterate over it in an MDASequence, you'll get an error:

File ~/dev/self/useq-schema/src/useq/_time.py:72, in TimePlan.deltas(self)
     70 def deltas(self) -> Iterator[datetime.timedelta]:
     71     current = timedelta(0)
---> 72     for _ in range(self.loops):  # type: ignore  # TODO
     73         yield current
     74         current += self.interval

File ~/dev/self/useq-schema/src/useq/_time.py:145, in TIntervalDuration.loops(self)
    143 @property
    144 def loops(self) -> int:
--> 145     return self.duration // self.interval + 1

ZeroDivisionError: integer division or modulo by zero

For this to work, I think the consumer (such as MDARunner.run) might actually need to special case an MDASequence with a TIntervalDuration plan of interval 0... or we should add something to MDAEvent like a kill_time: a total duration after which the experiment should be stopped.

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

No branches or pull requests

1 participant