Where to get/import PlateSolvePurpose

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
rl_kabi
Posts: 7
Joined: Fri Jul 28, 2023 10:41 pm

Where to get/import PlateSolvePurpose

#1

Post by rl_kabi »

Hi there, this is my first post on the forums. I'm kind of a beginner to astronomy so forgive me if I am not aware about some things!

I've been working on a little project of mine and it entails running a script to plate solve (no syncing) a capture and work with the resulting RA/Dec coordinates. After looking through forum posts and trying things with the log and API, I have arrived at trying to use the following:

Code: Select all

SharpCap.BlindSolver.Solve(...)
However, I am not sure about what to put in the arguments. I understand that this function requires at least two arguments, with all parameters and their types being the following:
- self: PlateSolveOnly (this one I think can just be ignored)
- frt: PlateSolvePurpose
- cancellationToken: CancellationToken
- radius: float
- hintPosition: RADecPosition
- setPixelPositionData: bool

I wasn't sure how to go about interpreting PlateSolvePurpose and CancellationToken, though I did figure out how I could get the latter by importing it from System.Threading. However, I believe I need to somehow have an argument for the frt: PlateSolvePurpose? I am guessing it should be something along the lines of "PlateSolveOnly", but I don't know where to import that from for usage.

Hoping someone can point me in the right direction! And also let me know if I've misunderstood something. I'm not sure if the cancellation token is necessary, but I feel like I definitely need the PlateSolvePurpose thing and the radius.

Here's where my (relevant) code is at for reference. There's some stuff that's just commented out as placeholders so those can be disregarded. Also, I'm using Astap as my plate solving application if that helps.

Code: Select all

# A script to automate the process of plate solving to obtain RA/Dec coordinates for a specified position

import time
from System.Threading import CancellationToken

def connect_synscan():
	for x in SharpCap.Mounts:
		if x.Name == "SynScan App Driver":
			SharpCap.Mounts.SelectedMount = x


#_____ connect to the camera
SharpCap.SelectedCamera = SharpCap.Cameras.Find(lambda x : x.DeviceName == "Test Camera 1 (Deep Sky)")
#SharpCap.SelectedCamera.Controls.OutputFormat.Value = "PNG Files (*.png)"


#_____ connect to the SynScan Pro app
connect_synscan()
print SharpCap.Mounts.SelectedMount


#_____ move telescope to specified position /// set necessary values
#SharpCap.Mounts.SelectedMount.SlewToAltAz(..., ...) #floats for alt value and az value
#SharpCap.SelectedCamera.GetControl(CommonPropertyIDs.Exposure).Value = 300 
#SharpCap.SelectedCamera.GetControl(CommonPropertyIDs.Gain).Value = 1.00


#_____ take photos (capture)
#SharpCap.SelectedCamera.CaptureSingleFrame()


#_____ use platesolving to obtain the RA/Dec coordinates of the capture
#SharpCap.Mounts.SelectedMount.SolveAndSync()
SharpCap.BlindSolver.Solve(CancellationToken.None, 180) # <----------------------------------- what to put here?


#_____ pass the calculated RA/Dec coordinates to SynScan Pro
print SharpCap.Mounts.SelectedMount.RA
print SharpCap.Mounts.SelectedMount.Coordinates.RightAscension
print SharpCap.Mounts.SelectedMount.Dec
print SharpCap.Mounts.SelectedMount.Coordinates.Declination
# i know these are the same, just keeping them here as reference

#Solution : RA=05:35:20,Dec=-05:18:32 (J2000)
#Field of View : 1.5528x1.1402 degrees
#Time : Tue, 22 Aug 2023 19:03:08 GMT
#Orientation : up is 87.2 degrees E of N


#_____ close the camera / exit application
#SharpCap.ExitApplication
Cheers,
RL
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Where to get/import PlateSolvePurpose

#2

Post by admin »

Hi,

you need to add a

Code: Select all

from SharpCap.Interfaces import PlateSolvePurpose
to be able to access the required enumeration for that parameter. The two values are 'MountSync' and 'Annotation'. It only really makes a difference if live stacking, in which case 'MountSync' will solve a frame from the camera to allow the current pointing of the telescope to be worked out. 'Annotation' will solve an image of the stack to allow deep sky annotation data to be in the right places.

For the cancellationToken, you can pass CancellationToken.None as the simplest solution.

Note that the call is asynchronous, so it will return as soon as the plate solve starts. If you want to wait for it to finish, use

Code: Select all

SharpCap.BlindSolver.Solve(...).Wait()
cheers,

Robin
rl_kabi
Posts: 7
Joined: Fri Jul 28, 2023 10:41 pm

Re: Where to get/import PlateSolvePurpose

#3

Post by rl_kabi »

Hi Robin,

Thank you for your assistance! The blind solving I wanted to try works now.

I have another question about the functioning of solve only versus solving and syncing. I found that when I plate solve (solve only), the radius search area is 180 degrees. However, when I plate solve and sync, the search area is only 15 degrees. Is there any way to make it so that when I solve and sync, I can search an area of 180 degrees as well? Not sure if that would be in SharpCap settings, Astap, or if I can set that somehow in the scripting console.

Solve only
Screenshot 2023-08-29 121425.png
Screenshot 2023-08-29 121425.png (2.99 KiB) Viewed 6249 times
Solve and sync
Screenshot 2023-08-29 121028.png
Screenshot 2023-08-29 121028.png (2.94 KiB) Viewed 6249 times
rl_kabi
Posts: 7
Joined: Fri Jul 28, 2023 10:41 pm

Re: Where to get/import PlateSolvePurpose

#4

Post by rl_kabi »

Hi,

Hold on, never mind. I found a post that I believe answers my questions - I'll just do a plate solve (solve only) and then manually re-do the sync through the scripting console as shown in viewtopic.php?t=6775.

Cheers!

RL
Post Reply