Polar Alignment without Polaris (workflow)

Discussions on extending SharpCap using the built in Python scripting functionality
fly_n
Posts: 28
Joined: Wed Oct 02, 2019 7:54 pm

Polar Alignment without Polaris (workflow)

Post by fly_n »

Hello all,
using scripting in Sharpcap, plate solving and some math in R, I put together a workflow for myself on how to polar align without Polaris.

a) slew with Sharpcap to get regularly spaced pictures
b) use the same script to forward the pictures to plate solving and create a results file
c) fire up R to analyze the picture positions and calculate the offset in alignment
d) locate on a bright star
e) offset by the calculated value
f) manually recenter bright star
g) have fun (or redo to verify)

the scripts and a PDF in english can be found on the german astronomy forum:
https://forum.astronomie.de/threads/ein ... ow.283083/

If you find it interesting, drop me a note.
Norman
User avatar
admin
Site Admin
Posts: 5831
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Polar Alignment without Polaris (workflow)

Post by admin »

Hi Norman,

What a great use of scripting! I think that you have basically put together a version of what might be called accelerated drift aligning where you use go to movements in the RA direction rather than the passage of time to bring out any drift in declination that might be resulting from incorrect polar alignment.

Cheers, Robin
stelaras1
Posts: 2
Joined: Mon Aug 19, 2019 8:18 am

Re: Polar Alignment without Polaris (workflow)

Post by stelaras1 »

wow great

i'm also interested in drift alignment

i'll give it a try

thanks for sharing :)
Jean-Francois
Posts: 99
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

Re: Polar Alignment without Polaris (workflow)

Post by Jean-Francois »

Hello Norman and Robin,

I test the script for the polar alignment.

I can say that it was not easy to set the different part of software together.
Norman, please note that German link of the script contains only the "slewer183.py" and "astro_v22.R" script.
But, the video (https://youtu.be/FYEBOxvo1qk) shows that you use 3 scripts.
From the video I copy (image by image) the missing script.

Do I have a good result ? ... no.
Something seems to be wrong in the script function "collect(v1, v2)".
When I open the resulting text file, I have the following:

SIDEREAL;RA;DEC;ANGLE
21,9751577170;0,79688129;0,25989115;179,7,-1,00007
...
Do you remark ? ... 179,7,-1,0000 in place of 179,7;-1,0000

I modify the script function in:

import csv
...
def collect(v1, v2) :
mypath = ("C:\\Astro\\Align_Pics\\%03d_%03d.apm") % (v1, v2)
global SIDE
print(mypath)
plate = csv.reader(open(mypath, "rb"), delimiter = ",")
line_1 = next(plate)
line_2 = next(plate)

check = line_1[:3]
if check == '999' :
print(check)
else:
mytext = str(SIDE[v1]) + ";" + line_1[0] + ";" + line_1[1] + ";" + line_2[1] + ";" + line_2[2]
mytext2 = mytext.replace('.',',')
print(mytext2)

if check == '999' :
pass
else:
with open('C:\\Astro\\Align_Pics\\ps_positions.txt', "a") as myfile:
myfile.writelines(mytext2 + "\n")


I repeat with this modification ... but no good result.
The R script calculates the correction to several 10° ... My mount is not so bad oriented.
I have an EQ8 mount and I perform the 2 stars alignment followed by the polar alignment sequence of the mount.
In the last alignment, the mount mentions that the polar alignment is below 1 arcmin on both axis.

Additional question ?
Why do you program a script in R ? in place to stay in the Ironpython script ?
It makes the software use not really user friendly. (first a script A, then a script B, copy manually the values in a script C and start script C).

Do you have the intention to modify the scripts in "all in one" script ?
(I ask so then if you do, I will not start to do by myself ;) )

Other point ... your method use the mount movement for the setting of the polar angle.
I think that it could be better to use the live image on the camera directly in place of the mount movement (backslash error).
With the plate solve result, it is possible to calculate the displacement (direction and length) on the image itself.
The user can click on a star, the script insert a box at the wanted position, then the user adjust the mount until the star is centered in the box.
If the displacement is larger than the view, the script can repeat this several times.
(Like the method of King in the software Prism ... but it uses the stars near the polar star, what is not visible from my location)


Best regards,
Jean-Francois

Note: Norman, during reading your R-script, I remark that your location is very near to my location ... ~25 km.
A question for visualization of the script code ... how can I insert it ?
fly_n
Posts: 28
Joined: Wed Oct 02, 2019 7:54 pm

Re: Polar Alignment without Polaris (workflow)

Post by fly_n »

Hello Jean-Francois,

sorry you went to all the trouble to not have it work out.
The script and tools needed manual attention and presumably did not play well without intimate knowledge of what is going on.

Good news is that I found some time to play with the code and make it easier.
To do my alignment, I was using Stellarium to get the initial position, then SharpCap to get the data, RStudio, Stellarium and finally again SharpCap.

I've now rolled it into one GUI box in SharpCap, which I'm anxious to test in the field.
Many clouds and ground fog preventing that for now.

I'll put up a follow on post with some screenshots.

Kind regards,
Norman
fly_n
Posts: 28
Joined: Wed Oct 02, 2019 7:54 pm

Re: Polar Alignment without Polaris (workflow)

Post by fly_n »

Hello,

I've updated many things to make the process easier.
First of all, following the examples on this forum, I created a GUI to handle the interaction. So no modifications of any script are needed, with the exception of the paths.
What else has changed?
a) The script checks if every tool can be found (path) and gives you a green ball if so.
b) Switching between Stellarium and SharpCap should not be necessary for the alignment. I've implemented a small library of bright stars one can move to. If you press "bright star SE" it will look for the brightest star round AZ = 135° and close to DEC = 0°. I find this practical for a first sync and to set focus.
c) After slewing it will indicate the number of pictures taken with white balls.
d) Moving on to plate solving. If the picture can be solved the ball turns green - otherwise red.
e) Not all pictures have to be solved to move on. I'd recommend 7ish successful ones, but haven't tested how few are possible.
f) Plate solving is now done in ASTAP. Platesolve2 was difficult to parse and took a long time, if the initial sync was not close, which led to further issues of having incomplete result tables.
g) If the plate solve is unsuccessful based on the function return code, other downsampling parameters are checked again.
h) The R code does not have to be modified and executed in RStudio anymore. The R code is executed from SharpCap and only requires R to be installed along with the pracma library.
i) The correction angles coming from R are read into SharpCap, so nothing to do for the user.
j) To align the mount, a bright star close to South is recommended. Again with the push of a button one is brought into sight.
k) Finally the ALT and AZ alignment code is integrated. The idea is to center a star in the SharpCap viewer, call up the cross hairs on that star and do the ALT offset first, bringing the star back to center with the ALT knob on the mount and then do the same for the ALT & AZ, only turning the AZ alignment knob on the mount.

The functionality is already there. Some cleanups are still required, but it should be ready for brave individuals within days.

I've attached some pictures to show the functions one by one.
Kind regards, Norman

No Polaris, no problem - polar alignment
Version 02. Jan 2021
align_01.JPG
align_01.JPG (73.75 KiB) Viewed 600 times
align_02.JPG
align_02.JPG (80.02 KiB) Viewed 600 times
align_03.JPG
align_03.JPG (87.7 KiB) Viewed 600 times
align_04.JPG
align_04.JPG (91.46 KiB) Viewed 600 times
The next one is running with the Simulator Camera, which is why no plate solve is possible
align_05.JPG
align_05.JPG (92.64 KiB) Viewed 600 times
This one is using the test images, which are actual pictures using the tool. 240mm with ASI120MM
align_06.JPG
align_06.JPG (92.13 KiB) Viewed 600 times
align_07.JPG
align_07.JPG (88.99 KiB) Viewed 600 times
fly_n
Posts: 28
Joined: Wed Oct 02, 2019 7:54 pm

Re: Polar Alignment without Polaris (workflow)

Post by fly_n »

Goto a bright star in the South
align_09.JPG
align_09.JPG (140.48 KiB) Viewed 599 times
move the to a RA/DEC position that represents the ALT correction relative to the star we are looking at.
Bring the star back manually with the ALT adjustment knob on the mount.
align_10.JPG
align_10.JPG (140.6 KiB) Viewed 599 times
move the to a RA/DEC position that represents the ALT & AZ correction relative to the star we are looking at.
Bring the star back manually with the AZadjustment knob on the mount.
align_11.JPG
align_11.JPG (139.48 KiB) Viewed 599 times
Jean-Francois
Posts: 99
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

Re: Polar Alignment without Polaris (workflow)

Post by Jean-Francois »

Hello Norman,

Glad to see you back on the SharpCap forum.

I do not continue to work on the polar alignment script ... while I do a lot of tests for the QHY-174-GPS camera.
But, I have now a new telescope with a new mount (3 and 1 weeks old), so I will be more time outside.
And if I use my Berlebach tripod, then I need to install the telescope each time on the terrace and a polar alignment is necessary each time.

You do a lot of programming, a new GUI is nice ... no more necessary to scroll in a python script.

OK, you have some changes ... ASTAP in place of PlateSolve2 (that simplify), Stellarium (that complicate) and a help for a starting alignment position.
And what is not changed ... the use of R. Why can you not perform the calculation in the Ironpython script ? (yes, I know that some Python libraries are not accessible in Ironpython). I think that you can solve some equation with a "simple" linear least square method (with the assumption that the small error angle calculation can be done with the Taylor series of the trigonometric functions).

One thing is missing in your message, the script :D

One other thing that can simplify your tests, look at this old message: viewtopic.php?p=16439#p16439
If you have some questions about this Sky-Simulator, you can ask me.

Concerning the many clouds and ground fog ... I have the same problem as you ... while we have the same clouds and fog.
fly_n
Posts: 28
Joined: Wed Oct 02, 2019 7:54 pm

Re: Polar Alignment without Polaris (workflow)

Post by fly_n »

Hello Jean-Francois,

thank you for making me aware of Sky-Simulator. Had I only known earlier :-)
I tried it at once with the Sky-Simulator and it works, which gives me some more confidence.

Ah the use of R. I assume one could solve the math in Python, even as NumPy and SciPy are not available.
R just comes more natural to me... as everyone has his favorite tools. It does vectors and matrices exceedingly well and the available 2d list in Python just isn't the same. Also in RStudio you can see the results evolve line by line, which is super convenient.
At the end of the day it's still a hobby.

One more evil bug to remove, then I'll upload.
Funny with the repetitive setup I have been aligning the whole last year, I did not notice an error in the code as for my special case the error was close to zero. cos(90°) x error is not that bad.

Kind regards, Norman
User avatar
admin
Site Admin
Posts: 5831
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Polar Alignment without Polaris (workflow)

Post by admin »

Hi Norman,

that looks incredibly sophisticated - I really love seeing all the great things that people build with the SharpCap scripting language :D

cheers,

Robin
Post Reply