Commit 99e90d52 authored by vertighel's avatar vertighel
Browse files

refactor: aggiorna layer Python ai nuovi nomi device



constants.py: viewer_fits_path legge cameras.ini invece di viewer.ini.
guider.py + api/guider.py: default camera tec1 (era teccam).
api/guider.py: re-export FrameBinning/SnapshotRaw/SnapshotState per dynamic_import teccam1/2/3.
templates snapshot_imaging/spectro: default cam1/cam2.
stx.py: docstring aggiornato (cameras.ini).

Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent 4c479058
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@ from quart import Blueprint, jsonify, request
from noctua.api.guider_instance import guider
from noctua.utils.logger import log

from .camera import FrameBinning, SnapshotRaw, SnapshotState  # noqa: F401 — re-exported for dynamic_import (tec1/2/3 class=Guider → module noctua.api.guider)

guider_api = Blueprint("guider", __name__)


@@ -50,10 +52,10 @@ async def calibrate_ao():
    box     = int(params.get("box",     200))

    ao  = getattr(devices, "ao",      None)
    tec = getattr(devices, "teccam",  None)
    tec = getattr(devices, "tec1", None)

    if ao is None or tec is None:
        return jsonify({"error": "ao or teccam device not found"}), 503
        return jsonify({"error": "ao or tec1 device not found"}), 503

    loop = asyncio.get_running_loop()

+4 −4
Original line number Diff line number Diff line
@@ -9,19 +9,19 @@ import configparser
from pathlib import Path

_DATA_DIR = Path(__file__).parents[2] / "data"
_VIEWER_INI = Path(__file__).parent / "viewer.ini"
_CAMERAS_INI = Path(__file__).parent / "cameras.ini"


def viewer_fits_path(viewer_key):
    """Return the absolute FITS path for a viewer key from viewer.ini.
    """Return the absolute FITS path for a cam_id from cameras.ini.

    Falls back to temp_fits if the key is absent or not configured.
    """
    if not viewer_key:
        return temp_fits
    cfg = configparser.ConfigParser()
    cfg.read(_VIEWER_INI)
    raw = cfg.get(viewer_key, 'path', fallback=None)
    cfg.read(_CAMERAS_INI)
    raw = cfg.get(viewer_key, 'fits_path', fallback=None)
    if raw is None:
        return temp_fits
    return str(_DATA_DIR / raw)
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ class Camera(STX):
        ----------
        filepath : str, optional
            The local path to save the FITS file to.
            Defaults to the path configured in viewer.ini for this device.
            Defaults to the path configured in cameras.ini for this device.
        """

        if filepath is None:
+3 −3
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ class Guider:
    def __init__(self):

        self.active        = False
        self.camera        = "teccam"
        self.camera        = "tec1"
        self.actuator      = "telescope"
        self.exptime       = 1.0
        self.box           = 300
@@ -364,8 +364,8 @@ def cli():
        description="Noctua guiding loop — run standalone for manual testing.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    parser.add_argument("--camera",   default="teccam",
                        help="Guide camera device name (e.g. teccam, cam)")
    parser.add_argument("--camera",   default="tec1",
                        help="Guide camera device name (e.g. tec1, tec2, cam1)")
    parser.add_argument("--actuator", default="telescope",
                        choices=["telescope", "ao_x"],
                        help="Correction actuator")
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ class Template(BaseTemplate):
        ########################

        try:
            camera_name = params.get("camera") or "cam"
            camera_name = params.get("camera") or "cam1"
            cam = getattr(_dev, camera_name)
            fits_file = viewer_fits_path(getattr(cam, '_viewer_key', None))

Loading