{"id":149,"date":"2020-09-13T21:49:37","date_gmt":"2020-09-13T21:49:37","guid":{"rendered":"https:\/\/texasstarcave.com\/?p=149"},"modified":"2020-11-16T17:26:59","modified_gmt":"2020-11-16T17:26:59","slug":"python-scripting-in-sharpcap-for-jupiter-saturn-and-mars","status":"publish","type":"post","link":"https:\/\/texasstarcave.com\/index.php\/2020\/09\/13\/python-scripting-in-sharpcap-for-jupiter-saturn-and-mars\/","title":{"rendered":"Python Scripting in SharpCap for Jupiter, Saturn, and Mars"},"content":{"rendered":"<figure id=\"attachment_152\" aria-describedby=\"caption-attachment-152\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-152\" src=\"https:\/\/i0.wp.com\/texasstarcave.com\/wp-content\/uploads\/2020\/09\/Mars.png?resize=300%2C300&#038;ssl=1\" alt=\"Mars captured using a Python script in SharpCap\" width=\"300\" height=\"300\" srcset=\"https:\/\/i0.wp.com\/texasstarcave.com\/wp-content\/uploads\/2020\/09\/Mars.png?resize=300%2C300&amp;ssl=1 300w, https:\/\/i0.wp.com\/texasstarcave.com\/wp-content\/uploads\/2020\/09\/Mars.png?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/texasstarcave.com\/wp-content\/uploads\/2020\/09\/Mars.png?resize=600%2C600&amp;ssl=1 600w, https:\/\/i0.wp.com\/texasstarcave.com\/wp-content\/uploads\/2020\/09\/Mars.png?resize=100%2C100&amp;ssl=1 100w, https:\/\/i0.wp.com\/texasstarcave.com\/wp-content\/uploads\/2020\/09\/Mars.png?w=720&amp;ssl=1 720w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-152\" class=\"wp-caption-text\">Mars captured with Python in SharpCap<\/figcaption><\/figure>\n<p>SharpCap allows users to add Python scripts to setup and control captures and perform other functions.\u00a0 I recently wrote a Python script to capture Jupiter, Saturn, and Mars.\u00a0 Specifically for Mars, it prompts the user to manually select an IR filter, captures nine sequences of 120 seconds each, prompts the user to manually select a L filter, and captures another three sequences of 120 second.\u00a0 This script will be discussed in am upcoming video of my methods for capturing Jupiter, Saturn, and Mars using the ZWO ASI462MC.\u00a0 Here is the script:<\/p>\n<blockquote>\n<pre># SharpCap script to capture Jupiter, Saturn, and Mars with the ASI462\r\n# Values tested with the ASI462MC, Astronomik IR807 and Optolong L-Pro filters\r\n\r\ndef captureASI462( planet_name, IR_seq, OSC_seq, seq_time ) :\r\nimport clr, time\r\nfrom System import TimeSpan, Console\r\n\r\nclr.AddReference(\"System.Windows.Forms\")\r\nimport System.Windows.Forms as WinForms\r\n\r\nclr.AddReference(\"SharpCap\")\r\nfrom SharpCap.UI import CaptureLimitType\r\n\r\n# Make sure we have a camera\r\nif not SharpCap.IsCameraSelected :\r\nConsole.Beep()\r\nWinForms.MessageBox.Show( \"Ensure the camera is connected and try again\", \"Error\", WinForms.MessageBoxButtons(0) )\r\nreturn\r\n\r\n# Last minute check for the IR filter\r\nConsole.Beep()\r\nif WinForms.MessageBox.Show(\"Ensure InfraRed filter is installed\", \"IR Capture\", WinForms.MessageBoxButtons(1) ) != WinForms.DialogResult.OK :\r\nreturn\r\n\r\n# Retain Gain and Color Balance Settings\r\nCameraGain = SharpCap.SelectedCamera.Controls.Gain.Value\r\nWhiteBalB = SharpCap.SelectedCamera.Controls[16].Value\r\nWhiteBalR = SharpCap.SelectedCamera.Controls[17].Value\r\n\r\n# Set Color Balance to gray and set Target Name\r\nSharpCap.SelectedCamera.Controls[16].Value = 50 # White Bal B: Set WB to gray for IR\r\nSharpCap.SelectedCamera.Controls[17].Value = 50 # White Bal R: Set WB to gray for IR\r\nSharpCap.TargetName = planet_name + \"_IR\"\r\n\r\nfor i in range( IR_seq ) : # Capture sequences of IR\r\nSharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.TimeLimited\r\nSharpCap.SelectedCamera.CaptureConfig.CaptureLimitTime = TimeSpan.FromSeconds( seq_time )\r\n\r\nSharpCap.SelectedCamera.PrepareToCapture()\r\nSharpCap.SelectedCamera.RunCapture()\r\nwhile SharpCap.SelectedCamera.Capturing: # Wait for capture to complete\r\ntime.sleep( 0.1 )\r\ntime.sleep( 1 ) # Pause between captures\r\n\r\ntime.sleep( 1 ) # Pause between sequences\r\n\r\n# Prompt user to change filter\r\nConsole.Beep()\r\nif WinForms.MessageBox.Show(\"Ensure Luminence filter is installed\", \"OSC Capture\", WinForms.MessageBoxButtons(1) ) != WinForms.DialogResult.OK :\r\nreturn\r\n\r\n# Set Color Balance for OSC, decrease gain by one stop, and change Target Name\r\nSharpCap.SelectedCamera.Controls.Gain.Value = CameraGain - 60 # Adjust gain minus one stop (gain of 60 = 6dB)\r\nSharpCap.SelectedCamera.Controls[16].Value = 64 # White Bal B: Set WB to color balance for OSC\r\nSharpCap.SelectedCamera.Controls[17].Value = 64 # White Bal R: Set WB to color balance for OSC\r\nSharpCap.TargetName = planet_name + \"_OSC\"\r\n\r\nfor i in range( OSC_seq ) : # Capure sequences of One Shot Color\r\nSharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.TimeLimited\r\nSharpCap.SelectedCamera.CaptureConfig.CaptureLimitTime = TimeSpan.FromSeconds( seq_time )\r\n\r\nSharpCap.SelectedCamera.PrepareToCapture()\r\nSharpCap.SelectedCamera.RunCapture()\r\nwhile SharpCap.SelectedCamera.Capturing: # Wait for capture to complete\r\ntime.sleep( 0.1 )\r\ntime.sleep( 1 ) # Pause between captures\r\n\r\ntime.sleep( 1 ) # Pause between sequences\r\n\r\n# Restore Gain and White Balance\r\nSharpCap.SelectedCamera.Controls[16].Value = WhiteBalB\r\nSharpCap.SelectedCamera.Controls[17].Value = WhiteBalR\r\nSharpCap.SelectedCamera.Controls.Gain.Value = CameraGain\r\n\r\nConsole.Beep()\r\nConsole.Beep()\r\n\r\n#captureASI462( \"Jupiter\", 9, 3, 30 )\r\n#captureASI462( \"Saturn\", 9, 3, 90 )\r\n#captureASI462( \"Mars\", 9, 3, 120 ) # Good seeing for Mars\r\n#captureASI462( \"Mars\", 5, 1, 120 ) # Normal or bad seeing for Mars<\/pre>\n<\/blockquote>\n<p>To use this, Open SharpCap, select Show Console from the Scripting menu.\u00a0 Now copy the Python script above, and paste it into the editing window.\u00a0 Save it as JSM_462.py.\u00a0 Now you can run it by selecting Run Script from the Scripting menu, and opening the JSM_462.py file.\u00a0 With minor modifications, this script is used to capture Jupiter, Saturn, and Mars.\u00a0 As I said, this will be further discussed in an upcoming video.\u00a0 Stay tuned for more!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SharpCap allows users to add Python scripts to setup and control captures and perform other functions.\u00a0 I recently wrote a Python script to capture Jupiter, . . .<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[16],"tags":[18,40,42,44,41,39,45],"class_list":["post-149","post","type-post","status-publish","format-standard","hentry","category-astrophotography-capture","tag-astrophotography","tag-jupiter","tag-mars","tag-python","tag-saturn","tag-sharpcap","tag-zwo-asi462mc"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/texasstarcave.com\/index.php\/wp-json\/wp\/v2\/posts\/149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/texasstarcave.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/texasstarcave.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/texasstarcave.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/texasstarcave.com\/index.php\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":7,"href":"https:\/\/texasstarcave.com\/index.php\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":209,"href":"https:\/\/texasstarcave.com\/index.php\/wp-json\/wp\/v2\/posts\/149\/revisions\/209"}],"wp:attachment":[{"href":"https:\/\/texasstarcave.com\/index.php\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/texasstarcave.com\/index.php\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/texasstarcave.com\/index.php\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}