Skip to content

Commit

Permalink
Deal with bias exposure times
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Jul 10, 2023
1 parent 8ba2302 commit 8ee7789
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/gort/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ async def expose(
)

count: int = kwargs.pop("count", 1)
exposure_time: float = kwargs.pop("exposure_time", 10)

exposure_time = kwargs.pop("exposure_time", 10)
if kwargs.get("bias", False) or kwargs.get("flavour", "object") == "bias":
exposure_time = 0.0

exp_nos: list[int] = []

Expand All @@ -135,7 +138,7 @@ async def expose(
header = None

if show_progress:
timer = tqdm_timer(exposure_time + READOUT_TIME)
timer = tqdm_timer(float(exposure_time) + READOUT_TIME)
else:
timer = None

Expand Down
4 changes: 2 additions & 2 deletions src/gort/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def is_notebook() -> bool:
return False # Probably standard Python interpreter


def tqdm_timer(seconds: int):
def tqdm_timer(seconds: float):
"""Creates a task qith a tqdm progress bar."""

if is_notebook():
Expand All @@ -325,7 +325,7 @@ def tqdm_timer(seconds: int):
bar_format = "{l_bar}{bar}| {n_fmt}/{total_fmt}s"

async def _progress():
for _ in tqdm(range(seconds), bar_format=bar_format):
for _ in tqdm(range(int(seconds)), bar_format=bar_format):
await asyncio.sleep(1)

return asyncio.create_task(_progress())
Expand Down

0 comments on commit 8ee7789

Please sign in to comment.