Commit 56503992 authored by vertighel's avatar vertighel
Browse files

Gain per teccam Mako end-to-end; fix unità offset guider (gradi/arcsec)



Gain: mako.py espone una property gain (get/set, come binning) al
posto di _set_gain(); nuova risorsa Gain (GET/PUT) in api/camera.py;
rotte /teccam2/gain e /teccam3/gain in api.ini (non su teccam1, STX/
Guider non ha concetto di gain). UI: teccam_panel(has_gain=True),
campo Gain nascosto su teccam1; control.js invia PUT /api/teccamN/gain
al cambio del valore.

Offset: guider.py e utils/coordinates.py sommavano un delta in gradi
(da _pixel_to_offset()/calculate_offset()) a devices.tel.offset, che è
in arcsec (astelco.py) — la correzione realmente applicata al mount
era ~3600 volte più piccola del dovuto. Convertiti i delta in arcsec
prima della somma in entrambi i punti; corrette anche 3 docstring/
commenti stale che dicevano "in degrees"/"[deg]" per valori in realtà
in arcsec (astelco.py, api/telescope.py, templates/fillheader.py).

Co-Authored-By: default avatarClaude Sonnet 5 <noreply@anthropic.com>
parent 14f35fbe
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -25,6 +25,26 @@ class FrameBinning(BaseResource):
        res = await self.run_blocking(action)
        return self.make_response(res)

class Gain(BaseResource):
    """Camera gain (dB)."""

    async def get(self):
        """Retrieve the current gain."""

        res = await self.run_blocking(lambda: getattr(self.dev, 'gain', None))
        return self.make_response(res)

    @expects(param_type="number", unit="dB", placeholder="1")
    async def put(self):
        """Set a new gain for the camera."""

        gain = await self.get_payload()
        def action():
            self.dev.gain = gain
            return self.dev.gain
        res = await self.run_blocking(action)
        return self.make_response(res)

class Cooler(BaseResource):
    """Manage the CCD cooler status"""

+1 −1
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ class CoordinatesOffset(BaseResource):

    @expects(param_type="array", count=2, unit="", placeholder="[-300, -300]")
    async def put(self):
        '''Apply to the telescope new offsets in degrees.'''
        '''Apply to the telescope new offsets in arcsec.'''
        
        offset = await self.get_payload()
        def action():
+8 −0
Original line number Diff line number Diff line
@@ -369,6 +369,10 @@ device = tec2
resource = Loop
device = tec2

[/teccam2/gain]
resource = Gain
device = tec2

##############
# teccam3 (Mako115 — station3)
##############
@@ -389,6 +393,10 @@ device = tec3
resource = Loop
device = tec3

[/teccam3/gain]
resource = Gain
device = tec3

##############
# webcam
##############
+1 −1
Original line number Diff line number Diff line
@@ -540,7 +540,7 @@ class Telescope(OpenTSI):
        Returns
        -------
        list
            A list containing [ZD offset, Az offset] in degrees.
            A list containing [ZD offset, Az offset] in arcsec.
        """

        cmd_id1, cmd_id2 = self._get_cmd_id(), self._get_cmd_id()
+16 −4
Original line number Diff line number Diff line
@@ -165,10 +165,6 @@ class Guider(Mako):
        if not self.put('ExposureTimeAbs', us):
            self.put('ExposureTime', us)

    def _set_gain(self, gain):
        self.put('GainAuto', 'Off')
        self.put('Gain', float(gain))

    def _set_binning(self, b):
        try:
            cam = self._check_connection()
@@ -334,6 +330,22 @@ class Guider(Mako):
        bx = int(b[0]) if isinstance(b, (list, tuple)) else int(b)
        self._set_binning(bx)

    # --- Gain ---

    @property
    def gain(self):
        """float : Current gain in dB (0-24)."""
        try:
            return float(self.get('Gain'))
        except Exception:
            return None

    @gain.setter
    def gain(self, value):
        """Set gain in dB (0-24)."""
        self.put('GainAuto', 'Off')
        self.put('Gain', float(value))

    # --- Image output ---

    @property
Loading