Commit afa3727d authored by vertighel's avatar vertighel
Browse files

Fix teccam loop: squeeze matrix before viridis broadcast



Mako.matrix returns (H,W,1) for mono cameras; passing it through
_apply_viridis produces (H,W,1,3) which array_to_png cannot unpack.
Squeeze to 2D in _run_loop and in STX Camera.matrix.

Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent 26bd8150
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -200,7 +200,7 @@ async def _run_loop(device, exposure: float, station: str, camera: str):

            data = await ev.run_in_executor(None, lambda: device.matrix)
            if data is not None:
                await streamer._broadcast_preview(station, camera, data)
                await streamer._broadcast_preview(station, camera, np.squeeze(data))

            if not is_stx:
                # Mako: broadcast first frame immediately, then wait before next
+2 −2
Original line number Diff line number Diff line
@@ -206,7 +206,7 @@ class Camera(STX):

    @property
    def matrix(self):
        """Fetch the current image as a float32 numpy array without writing to disk."""
        """Fetch the current image as a 2-D float32 numpy array without writing to disk."""
        self._wait_if_needed()
        try:
            res = requests.get(f"{self.addr}/{self.element}.FIT", timeout=self.timeout)
@@ -217,7 +217,7 @@ class Camera(STX):
            data = hdul[0].data
            if data is None:
                return None
            return data.astype(np.float32)
            return np.squeeze(data).astype(np.float32)

    def download(self, filepath=None):
        """