Commit 94fadf85 authored by vertighel's avatar vertighel
Browse files

fix binning halving bug in snapshot template



- Don't fall back to cam.xystart/xyend (binned coords) when set_window
  expects unbinned: caused progressive pixel-count halving each exposure
- Fix int vs [int,int] binning comparison so ArtemisBin isn't called
  redundantly on every exposure

Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent c72fe983
Loading
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -49,8 +49,8 @@ class Template(BaseTemplate):
            binning = params.get("binning") or cam.binning
            filt = params.get("filter") or (
                filter_name.get(cam.filter) if hasattr(cam, 'filter') else None)
            xystart = params.get("xystart") or cam.xystart
            xyend = params.get("xyend") or cam.xyend
            xystart = params.get("xystart")
            xyend = params.get("xyend")
            exptime = params["exptime"]
            self.domeslewing = params.get("domeslewing") or False
            self.recenter = params.get("recenter") or False
@@ -88,9 +88,10 @@ class Template(BaseTemplate):
        log.info(f"Camera is {camera_state[cam.state]}")

        # Changing binning if not the same as the current one
        if binning != cam.binning:
            log.info(f"Changing binning to {binning}")
            cam.binning = [binning, binning]
        target_binning = [binning, binning] if isinstance(binning, int) else binning
        if target_binning != cam.binning:
            log.info(f"Changing binning to {target_binning}")
            cam.binning = target_binning
            sleep(0.1)

        log.info(f"Camera is {camera_state[cam.state]}")
@@ -134,8 +135,8 @@ class Template(BaseTemplate):
                        log.warning(f"Filter {filter_state[status]}")
                        sleep(0.75)

        # Changing windowing
        if xystart and xyend:
        # Changing windowing (only when explicitly provided in params)
        if xystart is not None and xyend is not None:
            log.info(
                f"Changing windowing to xystart:{xystart}, xyend:{xyend}")
            cam.set_window(xystart[0],
@@ -143,11 +144,6 @@ class Template(BaseTemplate):
                           xyend[0]-xystart[0],
                           xyend[1]-xystart[1])

        else:
            msg = f"No windowing: full frame in bininng {binning}"
            log.warning(msg)
            cam.full_frame()

        #########################
        ##### Exposure loop #####
        #########################