Difference: LogBookAstronomyEntry0007 (1 vs. 3)

Revision 306 Sep 2013 - PedroPaiva

Line: 1 to 1
 
META TOPICPARENT name="LogBookAstronomy"

Log Book Entry No.7

Days, Calendar Created: 04 Sep 2013 16:35:24 Days, Calendar Last Revised: 06 Sep 2013 17:18:38 Person PedroPaiva Text Connecting MaximDL and FocusMax to Python
Line: 14 to 14
 And almost everything you need to know about Python and COM objects here.
(If you just want the basics, check this link and this Quick Guide.)
Changed:
<
<
From iPython run the following commands:
>
>
From iPython run the following commands as apropriate:
 
Changed:
<
<
import win32com.client
>
>
import win32com.client

 
Changed:
<
<
try:
   # Try to load MaximDL module
   maxim = win32com.client.gencache.EnsureDispatch('Maxim.Application')
except:
   # If makepy fails, generate manually and override
   # Generate MaximDL module*
   modMax = win32com.client.gencache.EnsureModule('{B4955EC7-F7F2-11D2-AA9C-444553540000}', 0, 1, 0)

   maxim = win32com.client.Dispatch('Maxim.Application')
   maxim = modMax.IApplication(maxim)
   camera = win32com.client.Dispatch('Maxim.CCDCamera')
   camera= modMax.ICCDCamera(camera)
   document = win32com.client.Dispatch('Maxim.Document')
   document = modMax.IDocument(document)
else:
   # Else, load camera and document
   camera = win32com.client.gencache.EnsureDispatch('Maxim.CCDCamera')
   document = win32com.client.gencache.EnsureDispatch('Maxim.Document')

try:
   # Analogous with focuser
   focuser = win32com.client.gencache.EnsureDispatch('FocusMax.Focuser')
except:
   # Generate FocusMax module*
   modFM = win32com.client.gencache.EnsureModule('{12E053C4-A4BE-42FF-A680-AA72EDB68FA4}', 0, 1, 0)

   focuser = win32com.client.Dispatch('FocusMax.Focuser')
   focuser = modFM._Focuser(focuser)
   focusControl = win32com.client.Dispatch('FocusMax.FocusControl')
   focusControl = modFM._FocusControl(focusControl)
   focuserRate = win32com.client.Dispatch('FocusMax.Rate')
   focuserRate = modFM._Rate(focuserRate)
   telescope = win32com.client.Dispatch('FocusMax.Telescope')
   telescope = modFM._Telescope(telescope)
else:
   focusControl = win32com.client.gencache.EnsureDispatch('FocusMax.FocusControl')
   focuserRate = win32com.client.gencache.EnsureDispatch('FocusMax.Focuser')
   telescope = win32com.client.gencache.EnsureDispatch('FocusMax.Telescope')

>
>
try: # Try to load MaximDL module maxim = win32com.client.gencache.EnsureDispatch('Maxim.Application') except: # If makepy fails, generate manually and override # Generate MaximDL module* modMax = win32com.client.gencache.EnsureModule('{B4955EC7-F7F2-11D2-AA9C-444553540000}', 0, 1, 0) maxim = win32com.client.Dispatch('Maxim.Application') maxim = modMax.IApplication(maxim) camera = win32com.client.Dispatch('Maxim.CCDCamera') camera= modMax.ICCDCamera(camera) document = win32com.client.Dispatch('Maxim.Document') document = modMax.IDocument(document) else: # Else, load camera and document camera = win32com.client.gencache.EnsureDispatch('Maxim.CCDCamera') document = win32com.client.gencache.EnsureDispatch('Maxim.Document')

try: # Analogous with focuser focuser = win32com.client.gencache.EnsureDispatch('FocusMax.Focuser') except: # Generate FocusMax module*
modFM = win32com.client.gencache.EnsureModule('{12E053C4-A4BE-42FF-A680-AA72EDB68FA4}', 0, 1, 0) focuser = win32com.client.Dispatch('FocusMax.Focuser') focuser = modFM._Focuser(focuser) focusControl = win32com.client.Dispatch('FocusMax.FocusControl') focusControl = modFM._FocusControl(focusControl) focuserRate = win32com.client.Dispatch('FocusMax.Rate') focuserRate = modFM._Rate(focuserRate) telescope = win32com.client.Dispatch('FocusMax.Telescope') telescope = modFM._Telescope(telescope) else: focusControl = win32com.client.gencache.EnsureDispatch('FocusMax.FocusControl') focuserRate = win32com.client.gencache.EnsureDispatch('FocusMax.Rate') telescope = win32com.client.gencache.EnsureDispatch('FocusMax.Telescope')

try: # "Direct" connect to telescope vias ASCOM telescope = win32com.client.gencache.EnsureDispatch('MeadeLX200GPS.Telescope') except: # Generate Meade module* modMeade = win32com.client.gencache.EnsureModule('{ACC9C081-8A1D-4A76-A86E-F2BAC88C8BA1}', 0, 1, 0) telescope = win32com.client.Dispatch('MeadeLX200GPS.Telescope') telescope = modMeade._Telescope(telescope) focuser = win32com.client.Dispatch('MeadeLX200GPS.Focuser') focuser = modMeade._Focuser(focuser) axisRate = win32com.client.Dispatch('MeadeLX200GPS.AxisRates') axisRate = modMeade._FocusControl(axisRate) focuserRate = win32com.client.Dispatch('MeadeLX200GPS.Rate') focuserRate = modMeade._Rate(focuserRate) else focuser = win32com.client.gencache.EnsureDispatch('MeadeLX200GPS.Focuser') axisRate = win32com.client.gencache.EnsureDispatch('MeadeLX200GPS.AxisRate') focuserRate = win32com.client.gencache.EnsureDispatch('MeadeLX200GPS.Focuser')

 

* this lines can be obtained from "makepy.py -i" command on your lib/site-packages/win32com/client folder under your python installation directory

Revision 204 Sep 2013 - PedroPaiva

Line: 1 to 1
 
META TOPICPARENT name="LogBookAstronomy"

Log Book Entry No.7

Days, Calendar Created: 04 Sep 2013 16:35:24 Days, Calendar Last Revised: 06 Sep 2013 17:18:38 Person PedroPaiva Text Connecting MaximDL and FocusMax to Python
Line: 10 to 10
 
Changed:
<
<
From iPython run the following commands:
>
>
Basic information on automating astrophotography with python here
And almost everything you need to know about Python and COM objects here.
(If you just want the basics, check this link and this Quick Guide.)
 
Added:
>
>
From iPython run the following commands:
 
import win32com.client

Revision 104 Sep 2013 - PedroPaiva

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="LogBookAstronomy"

Log Book Entry No.7

Days, Calendar Created: 04 Sep 2013 16:35:24 Days, Calendar Last Revised: 06 Sep 2013 17:18:38 Person PedroPaiva Text Connecting MaximDL and FocusMax to Python

<-- 
Please DO NOT alter or remove the line below this line. 
  • Set EDITMETHOD = wysiwyg
Please DO NOT alter or remove the line above this line. -->

From iPython run the following commands:

import win32com.client

try:
   # Try to load MaximDL module
   maxim = win32com.client.gencache.EnsureDispatch('Maxim.Application')
except:
   # If makepy fails, generate manually and override
   # Generate MaximDL module*
   modMax = win32com.client.gencache.EnsureModule('{B4955EC7-F7F2-11D2-AA9C-444553540000}', 0, 1, 0)

   maxim = win32com.client.Dispatch('Maxim.Application')
   maxim = modMax.IApplication(maxim)
   camera = win32com.client.Dispatch('Maxim.CCDCamera')
   camera= modMax.ICCDCamera(camera)
   document = win32com.client.Dispatch('Maxim.Document')
   document = modMax.IDocument(document)
else:
   # Else, load camera and document
   camera = win32com.client.gencache.EnsureDispatch('Maxim.CCDCamera')
   document = win32com.client.gencache.EnsureDispatch('Maxim.Document')

try:
   # Analogous with focuser
   focuser = win32com.client.gencache.EnsureDispatch('FocusMax.Focuser')
except:
   # Generate FocusMax module*
   modFM = win32com.client.gencache.EnsureModule('{12E053C4-A4BE-42FF-A680-AA72EDB68FA4}', 0, 1, 0)

   focuser = win32com.client.Dispatch('FocusMax.Focuser')
   focuser = modFM._Focuser(focuser)
   focusControl = win32com.client.Dispatch('FocusMax.FocusControl')
   focusControl = modFM._FocusControl(focusControl)
   focuserRate = win32com.client.Dispatch('FocusMax.Rate')
   focuserRate = modFM._Rate(focuserRate)
   telescope = win32com.client.Dispatch('FocusMax.Telescope')
   telescope = modFM._Telescope(telescope)
else:
   focusControl = win32com.client.gencache.EnsureDispatch('FocusMax.FocusControl')
   focuserRate = win32com.client.gencache.EnsureDispatch('FocusMax.Focuser')
   telescope = win32com.client.gencache.EnsureDispatch('FocusMax.Telescope')

* this lines can be obtained from "makepy.py -i" command on your lib/site-packages/win32com/client folder under your python installation directory

Obs. Object info can be obtained via the "combrowse.py" command on your lib/site-packages/win32com/client folder under your python installation directory.
Objects should be under "Registered Type Libraries" and they contain more information of available methods and property. MaximDL information are also available here and on MaximDL Help.
FocusMax information are also available on FocusMax Help

Back to: LogBookAstronomy

META FORM name="%25SYSTEMWEB%25.LogBookForm"
FORM FIELD Subject Subject Connecting MaximDL and FocusMax to Python
FORM FIELD Status Status blank
FORM FIELD Author Author PedroDeCarvalhoPaiva
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding RHUL Physics Department TWiki? Send feedback