SC4/AOX Calibration Binning Misbehavior (scripted)

Discussion in 'Guiding and Adaptive Optics - StarChaser and AO' started by Rick McAlister, Mar 15, 2025.

  1. Rick McAlister

    Rick McAlister Cyanogen Customer

    Joined:
    Oct 10, 2014
    Messages:
    81
    (MDL 7.14)

    In an SC4/AOX hardware configuration, when scripting a guider calibration (CCDCamera.GuiderCalibration()), a guider binning change (CCDCamera.GuiderBinning) does not appear to propagate to the Binning field of the DLImaging AO Control window.

    This field will change only if a star locate (CCDCamera.GuiderExpose(duration)) is executed prior to guider calibration (which is also the work-around). The state of autostar selection (CCDCamera.GuiderAutoSelectStar) has no effect on whether the field is updated during calibration.

    This behavior might explain the reports that scripted guider calibrations of greater than 1x1 are unsuccessful, assuming that 1x1 guider binning is default.
     
  2. Colin Haig

    Colin Haig Staff Member

    Joined:
    Oct 27, 2014
    Messages:
    8,290
    Location:
    Earth
    Rick, can you clarify this a bit?
    Are you trying to calibrate the guider, then after successfully completing that, you change the binning prior to doing what steps exactly?
     
  3. Rick McAlister

    Rick McAlister Cyanogen Customer

    Joined:
    Oct 10, 2014
    Messages:
    81
    Colin, thanks for looking into this.

    No, I'm trying to change the binning, then calibrate: The steps (in pseudo-code) are:

    1. CCDCamera.LinkEnabled = true
    2. CCDCamera.GuiderBinning = <something different from the current DLImaging AO Control Window binning>
    3. CCDCamera.GuiderCalibration(some duration)

    After step 2 and throughout step 3 the DLImaging AO Control Window binning does not change its prior value to the value set in step 2.

    Example:
    1. CCDCamera.LinkEnabled = true
    //Current DLImaging AO Control Window binning field reads "1"
    2. CCDCamera.GuiderBinning = 3
    //Current DLImaging AO Control Window binning field reads "1"
    3. CCDCamera.GuiderCalibration(some duration)
    //Current DLImaging AO Control Window binning field reads "1" (Grayed out during calibration, as expected)

    Another example:
    1. CCDCamera.LinkEnabled = true
    //Current DLImaging AO Control Window binning field reads "4"
    2. CCDCamera.GuiderBinning = 1
    //Current DLImaging AO Control Window binning field reads "4"
    3. CCDCamera.GuiderCalibration(some duration)
    //Current DLImaging AO Control Window binning field reads "4"


    I've written a Windows forms app that runs unit tests on the guider calibration interfaces if you'd like to have a look at the code itself. Just let me know.
     
  4. Colin Haig

    Colin Haig Staff Member

    Joined:
    Oct 27, 2014
    Messages:
    8,290
    Location:
    Earth
    Would you mind zipping it up and sending it over? Or Send a Private Message and point me to it.
     
  5. Rick McAlister

    Rick McAlister Cyanogen Customer

    Joined:
    Oct 10, 2014
    Messages:
    81
  6. Rick McAlister

    Rick McAlister Cyanogen Customer

    Joined:
    Oct 10, 2014
    Messages:
    81
    Additional observation:

    When scripting a guider locate or calibration, a master dark frame does not appear to be generated and applied despite that option being selected in DLImaging AO Control -> Setup tab -> Options -> Enable AutoDark.
     
  7. Colin Haig

    Colin Haig Staff Member

    Joined:
    Oct 27, 2014
    Messages:
    8,290
    Location:
    Earth
    Ok, what should I be looking for? eg what did you see that gives you this idea?
     
  8. Rick McAlister

    Rick McAlister Cyanogen Customer

    Joined:
    Oct 10, 2014
    Messages:
    81
    Evidence? Hah! You want evidence??? My word is no good???

    Well, OK.

    Try this experiment (can be done with or without actual stars to look at, but simulators don't work.).

    1. Open MDL with SC4/AO hardware configured. Connect to open DLImaging AO Control window.
    2. In DLImaging AOControl window -> Setup tab -> Options -> Enable Autodark (select)
    3. In DLImaging AO Control window -> Locate tab -> Exposure: set to 1
    4. In DLImaging AO Control window -> Locate tab -> Binning: set to 1
    5. In DLImaging AO Control window -> Locate tab -> Mode: set to Locate
    6. In DLImaging AO Control window -> Start
    Note that status line will read "Preparing Master Darkframe". If not, then change the binning and take another shot at it. It will. In fact, this reduction frame will be taken every time the binning or exposure is changed -- and that's a good thing.

    However, if you do steps 1-2 then use the scripting interface to do the same functions, i.e.

    CCDCamera.GuiderBinning = 1
    CCDCamera.GuiderAutoSelectStar = true
    CCDCamera.GuiderExpose(1)

    Then locate function runs, but the same "Preparing Master Darkframe" does not appear in the status line nor does the guider image appear to have been dark reduced, even if binning and exposure are changed to other values in the scripting. At least, that's my observation.
     
    Last edited: Mar 18, 2025
  9. Colin Haig

    Colin Haig Staff Member

    Joined:
    Oct 27, 2014
    Messages:
    8,290
    Location:
    Earth
    Thanks for your help.
    Just so we're on the same page, I'd like to share a comment about the "After step 2 and..." :

    The MaxIm CCD "engine" will execute exposure of a guide image with binning specified by the thing that is controlling it at the moment.

    The "engine" does not push a new value to the GUI if a new value is received from scripting.
    The GUI does not continually poll the data model to see if it changed by some other "boss".

    The correct place to look for what is going on is the Log Window.
    For example:
    Code:
    20:18:08    Started   1.000s 164x123 exposure, binned 3x3, ROI (0, 0)
    
    So when step 2 and 3 happen, that AO Control window binning field will be the value last set by the HUMAN, not the SCRIPT.
    Under the hood, the "engine" will start with the GUI 1x1 value on link; then it will get the GuiderBinning 3x3 from the script, replacing the 1x1 from the GUI, and the GUI will not be updated to 3x3 because the script does not have any power over the GUI, and the engine and it's data model do not push a change to the GUI.
    (In other words, it's NOT a full model-view-controller arrangement; the GUI runs separately from the imaging engine, and the data model does not propagate updates to all attached views).

    What should be happening is the GuiderBinning value should be showing in all guide actions once the action is commanded.
    That's what I need to check next, and it means getting my equipment setup and some clear sky.

    I really appreciate the effort you've put in, and hopefully I can reproduce what is going on in the next few days.
     
  10. Rick McAlister

    Rick McAlister Cyanogen Customer

    Joined:
    Oct 10, 2014
    Messages:
    81
    Awesome. What threw me was that with the equivalent GUI vs scripted comparison for the Locate function, the GUI Binning field does update to the value commanded by scripted binning. All good to know.

    If I have clear skies before you have clear skies, a setup and the time, I will try to run that check and report back.
     
  11. Colin Haig

    Colin Haig Staff Member

    Joined:
    Oct 27, 2014
    Messages:
    8,290
    Location:
    Earth
    BTW I was able to successfully build your Forms app in VS2022. Reminds me of Visual Basic from the good (bad) old days...
    I appreciate the fresh thinking on this.
     

Share This Page