Newbie needs help with Python

244 views
Skip to first unread message

Astro Keith

unread,
Jan 12, 2021, 5:24:34 AM1/12/21
to astrometry
Hoping for some pointers.
My end goal is to add 'exact-GoTo' to my homebrew 18" Dobsonian. It currently gets to within about 20arcmin.

I've started with Astroberry/Kstars/Ekos running on a RaspberryPi. So astrometry.net is bundled in with that.

Good news is I'm successfully locally plate-solving using Ekos and from the RPi command line. (So I discovered the documentation describing the use and syntax)

I want to plate-solve from within my own Python program, but cant find any documentation or examples to get me even started (I did say I was a newbie!). The excellent documentation I have found only seems to work from the command line for me.

Any pointers please!
TIA

Antônio Kanaan

unread,
Jan 12, 2021, 5:36:08 AM1/12/21
to Astro Keith, astrometry
hi Keith,

at my university we developed an OCS name 'chimera', it is on github.  I actually wrote  a module to do exactly what you want, it works just fine.  I think the actual code was rewritten by a student - I wrote "astronomer's code".

Anyway, here is the link to the module:


Will be glad to help as far as I remember what I did :-)

Antônio

--
You received this message because you are subscribed to the Google Groups "astrometry" group.
To unsubscribe from this group and stop receiving emails from it, send an email to astrometry+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/astrometry/c1972478-251c-4417-829f-66309f974ae7n%40googlegroups.com.

Astro Keith

unread,
Jan 12, 2021, 7:59:55 AM1/12/21
to astrometry
Thanks Antonio,
I'll take a look

I've also just worked out I can execute shell commands in python (said I was a newbie!)
As a 'lock-down' exercise I'd like to write the code my self, even if its not very elegant!!
Keith

Dustin Lang

unread,
Jan 12, 2021, 8:06:47 AM1/12/21
to Astro Keith, astrometry
Hi,

After running the "solve-field" program to get an astrometric solution for your images (use the --scale-low, --scale-high arguments to make it faster), there will be a WCS file containing the result.  You can set the output filename for that file using the "--wcs FILENAME" argument, if that makes it easier!  That WCS file is a FITS header.  You can read those in python using the fitsio package (there are other options, but I like fitsio the best); "pip install fitsio" should work, and the README has good intro documentation.  https://github.com/esheldon/fitsio.  Oh, actually, you may not even need that; the astrometry.net package includes the programs "wcs-rd2xy" and "wcs-xy2rd" that take a WCS file and allow you to convert between pixel positions and RA,Decs.  Running "wcs-rd2xy -w FILE.wcs -r RA -d DEC" will give you pixel coordinates of your target, and from there you should be able to decide how you need to move your telescope mount.

cheers,
--dustin



Astro Keith

unread,
Jan 12, 2021, 8:57:37 AM1/12/21
to astrometry
Thanks Dustin,
I've been using quite a lot of arguments with solve-field as i know precisely the field of view, and telescope expected position to within a degree. I'm getting solutions really quick even on the RPi4.

The tip on extracting the header info is most useful. 

Cheers
Keith

Astro Keith

unread,
Jan 12, 2021, 10:56:49 AM1/12/21
to astrometry
me again!
Couldn't get fitsio without a bunch of errors, but as you say astrometry.net includes those programs and I think astropy also has similar.

Still suffering from unclear documentation. (I'm using http://astrometry.net/doc/readme.html) which glosses over the detail I think.

In my original thinking I was hoping to just get the RA & Dec of the centre of the solved field, plus its rotation with respect to North. The Rotation is key as my scope being a Dobsonian needs moving in Azimuth & Altitude.

On the plus side, my python code is now grabbing images from my camera, loading them into the local plate-solver and seeing output files being created. 

TIA
Keith
On Tuesday, January 12, 2021 at 1:06:47 PM UTC dstn...@gmail.com wrote:

Dustin Lang

unread,
Jan 12, 2021, 11:05:38 AM1/12/21
to Astro Keith, astrometry
Well, instead of wcs-rd2xy you could also use the 'wcsinfo' program, which parses a WCS FITS file and prints out a bunch of information about the solve, including the RA,Dec center and rotation, in a form that is supposed to make it easy to parse for other programs.  Maybe that will be helpful.


Astro Keith

unread,
Jan 12, 2021, 11:09:15 AM1/12/21
to astrometry

Yes, I was just looking at wcsinfo. I'm sure all I want is there - I'll have to try it to see what format it all comes out in!
Message has been deleted
Message has been deleted

Astro Keith

unread,
Feb 9, 2021, 7:01:46 AM2/9/21
to astrometry
Just an update to report, all seems to be working fine now.
I used wcsinfo to retrieve the key parameters I needed.
I had to go back to school and re-learn spherical trigonometry as my RA,Dec to Az,Alt conversions didnt work in the west. 

There's nothing like a stretching project to force one to learn new skills!

Reply all
Reply to author
Forward
0 new messages