Staff Assigned: Adam Robichaud Script Subframing

Discussion in 'Scripting and Programming' started by Richard Gray, Dec 25, 2019.

  1. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    Hi,

    I seem to have run across an error similar to the one reported above. I have upgraded to version 6.16 (the highest version I can download) from 6.13. The behavior has changed but still not fixed. I am connecting to an Apogee camera (main) which has 1024 X 256 pixels, and the guide camera is an STF-8300 which I am using binned 3X3. I also want to read out a subframe from the guide camera. There are two possibly related problems:

    1) MaxIm DL does not seem to pass the subframe parameters to the script. The subframe I have defined in the guider tab is 347:257:424:284 (left,top,width,height), whereas after connecting to the camera and verifying that the LinkEnabled is True, MaxIm passes back 0:0:1117:844, which is the whole 3X3 binned frame. When I take an image manually, the subframe is correct, but when taken with a script, the full frame is returned. I am running MaxIm in administrator mode.

    2) To attempt to fix this, I added the lines:
    $Cam.GuiderStartX = 347
    $Cam.GuiderStartY = 257
    $Cam.GuiderNumX = 424
    $Cam.GuiderNumY = 284

    MaxIm correctly picks up all of these EXCEPT for the GuiderNumX, which it returns as 770

    Here is the relevant code (written in AutoIt3):

    $Cam = ObjCreate("MaxIm.CCDCamera")
    $Cam.LinkEnabled = True

    Sleep(5000)


    If $Cam.LinkEnabled == False Then
    MsgBox(0,"","2) Camera not ready")
    Exit
    EndIf

    $Cam.DisableAutoShutdown = True

    $Cam.GuiderStartX = 347
    $Cam.GuiderStartY = 257
    $Cam.GuiderNumX = 424
    $Cam.GuiderNumY = 284
    Sleep(2000)
    GUICtrlSetData($Status,"Guider Param = " & $Cam.GuiderStartX & " " & $Cam.GuiderStartY & " " & $Cam.GuiderNumX & " " & $Cam.GuiderNumY)

    The output is: Guider Param = 347 257 770 284

    We are dead in the water until we can resolve this. Any help you can give would be most appreciated. We encountered this problem because we had to replace an old ST-402 camera (which bit the dust) with a new STF-8300.

    Richard Gray
     
  2. Doug

    Doug Staff Member

    Joined:
    Sep 25, 2014
    Messages:
    6,869
    Please sign up for software support. See Step #2 at https://forum.diffractionlimited.com/pages/TechSupportHowTo/

    We strongly recommend against Administrator mode when scripting, because it means every object that is running also has to be in Administrator mode. Also it is a security risk.

    1 - Yes that is how it works. The script interface does not reflect GUI subframe settings; if you want to manipulate subframes then you should do everything from the scripting side.

    2 - @Adam Robichaud will have to check this when he returns from holidays
     
  3. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    Ok, thank you.

    1) Hmm, that seems to be contrary to what it says in the documentation.

    2) Any idea when Adam might be back from holidays?

    Richard
     
  4. Doug

    Doug Staff Member

    Joined:
    Sep 25, 2014
    Messages:
    6,869
  5. Adam Robichaud

    Adam Robichaud Staff Member

    Joined:
    Sep 29, 2014
    Messages:
    775
    Location:
    Ottawa
    Hi Richard. This is just to let you know I'm back in the office and am catching up on tech support. I've queued this up for an investigation ASAP.
     
  6. Adam Robichaud

    Adam Robichaud Staff Member

    Joined:
    Sep 29, 2014
    Messages:
    775
    Location:
    Ottawa
    I'm unable to reproduce the subframe setting issue with the MaxIm DL (neither 6.13 or the current 6.21 Beta 2) using our built-in simulator in dual-chip mode. Can you confirm whether the issue persists on your PC if you use the simulator?
     
  7. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    Hi Adam,
    For some reasons your posts are not coming to my email.

    Did you bin the guide camera 3X3?

    At the moment the spectrograph is off the telescope, and the setup is for photometry, so I can't test using the original code. But I can try to simulate the problem on my laptop but will not be able to do that today (I am in South Africa, and the telescope is in North Carolina).

    Richard
     
  8. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    Hi Adam,

    Ok, yes I am able to reproduce the error with the simulator:

    Here is the complete code (in Autoit3):

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    #RequireAdmin


    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 615, 218, 192, 124)
    $Button1 = GUICtrlCreateButton("Connect Everything", 24, 40, 185, 49)
    $Label1 = GUICtrlCreateLabel("Status", 16, 120, 586, 17, $SS_SUNKEN)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    Case $Button1
    $Cam = ObjCreate("MaxIm.CCDCamera")
    $Cam.LinkEnabled = True

    Sleep(5000)

    If $Cam.LinkEnabled == False Then
    MsgBox(0,"","2) Camera not ready")
    Exit
    EndIf

    $Cam.DisableAutoShutdown = True

    $Cam.GuiderStartX = 347
    $Cam.GuiderStartY = 257
    $Cam.GuiderNumX = 424
    $Cam.GuiderNumY = 284
    Sleep(2000)
    GUICtrlSetData($Label1,"Guider Param = " & $Cam.GuiderStartX & " " & $Cam.GuiderStartY & " " & $Cam.GuiderNumX & " " & $Cam.GuiderNumY)

    EndSwitch
    WEnd


    The output is 347 257 761 284
     
  9. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    Hi Adam,

    I have run the above script with the guide camera binned 1X1 and it works properly. But binned 3X3 it gives the error indicated.

    Richard
     
  10. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    Hi Adam,

    If I add the line

    Cam.GuiderBinning = 3

    It does not help. The error persists.

    Richard
     
  11. Adam Robichaud

    Adam Robichaud Staff Member

    Joined:
    Sep 29, 2014
    Messages:
    775
    Location:
    Ottawa
    Hi Richard,

    MaxIm DL's scripting interface keeps a separate tally of the exposure binning and subframe dimensions. It defaults to 1x1, and the full frame unless otherwise set. In 6.20 beta 2 and above, we default the binning to reflect the GUI's binning until set by the scripting interface.
    The 770 comes from an attempt to set the subframe's size to something out-of-bounds—i.e. if (subframeWidth + subframeXStart) > (ccdWidth / binning). In that case, we set the subframe width to: (ccdWidth / binning) - subframeXStart.
    I'm still working out why MaxIm DL thinks your subframe's width is out-of-bounds. As it stands, 347 + 424 should not exceed 1117. In my tests, the source code is correctly calculating the subframe widths, and isn't triggering an out-of-bounds override.

    Do you add the `Cam.GuiderBinning = 3` line *before* you set the subframe dimensions?

    Cheers,
    -A
     
  12. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    Before. But it made no difference. I set the binning in the GUI. If the GUI binning is 1X1 and I include $Cam.GuiderBinning = 3, the same error arises.

    When you discover the error, you may want to check if there is a similar error in the "Crop" method under the Maxim DL Document object.

    Richard
     
  13. Adam Robichaud

    Adam Robichaud Staff Member

    Joined:
    Sep 29, 2014
    Messages:
    775
    Location:
    Ottawa
    Can you zip up your settings directory and send it to me for inspection? It's in "My Documents\MaxIm DL 6"
     
  14. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    Here it is.
     

    Attached Files:

  15. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    By the way, I translated the autoit3 code into python and I get exactly the same error, so it is not a problem with autoit3.

    Richard
     
  16. Adam Robichaud

    Adam Robichaud Staff Member

    Joined:
    Sep 29, 2014
    Messages:
    775
    Location:
    Ottawa
    I've officially reproduced the issue in both 6.16 and my nightly build. I'll let you know when I've worked out a solution.

    Cheers,
    -A
     
  17. Adam Robichaud

    Adam Robichaud Staff Member

    Joined:
    Sep 29, 2014
    Messages:
    775
    Location:
    Ottawa
    FYI: I've got a fix queued for the next release, which should land some time next week (Doug, who handles MaxIm DL releases, is in Hawaii this week for a conference).
     
  18. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    Ok, thank you. I will look forward to that. I have another query about another potential bug in Maxim dealing with the guider, but I shall begin a new thread for that.
     

Share This Page