scexao-org / camstack

EDT cam stack - python + minimal imgtake.c
5 stars 2 forks source link

[idea] plugins for viewers #8

Open mileslucas opened 1 year ago

mileslucas commented 1 year ago

I can think of at least one example where we want to use optional behavior for certain viewers in camstack that could still be modularized and shared code. As an example, consider an "astrometry" plugin. This plugin enables the additional compass rose with the parallactic angle and uses the plate scale for whatever calculations could use it (like the scale bar).

For the implementation, this would require a little architecting. These plugins would be classes, the AstrometryPlugin class would have some code like

    def add_compass(self):
        if self.backend_obj.flag_compass:
            # code to generate pygame lines 
            # use vars like self.PLATE_SCALE, self.PUPIL_OFFSET

and a custom viewer might look like

class MyViewer(GenericViewerFrontent, AstrometryPlugin):
    PLATE_SCLAE = 6.24 # mas / px
    PUPIL_OFFSET = 140.4 # deg relative to D_IMRPAD

Then there's some question about how to get that add_compass function actually called inside the viewer loop. Maybe some kind of self._plugin_methods = [] list? That's about as far as I've thought.

mileslucas commented 1 year ago

Other plugin ideas: