Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Phd "clone" in Python


nameunknown

Recommended Posts

I've started to try and write a "tracker" program in Python (so it runs in Linux). So far, I can take a pic and find the centroid and track it (as this is experimental I'm using a HEQ and a webcam). Is anyone else interested in doing this? Ideally, I'd like to write something that tracks and shoots - webcam is not going to be fantastic, but guide and shoot witth a single cam does not seem hard. Any other Python programmers interested?

P

Link to comment
Share on other sites

I'm interested in this . I started assembly of the components to sit on a rpi using OCV etc it didn't get much time on it. Use of python and scipy or pillow allows the option of a gtk viewer when required but I really want it to run headless as a complete processing channel through to stacked video. I am sure we can assemble a set of modular scripts or functions to do this....

It is yet another project though when I have two ascom drivers mostly complete and a mirror on the bench.

Regs

Mike

Link to comment
Share on other sites

Hi Mike,

Grinning at you having drivers in the oven and a mirror on the bench - some things can be a long grind! I'm at the stage where I have image capture of a ROI (region of interest) as video (for stacking), with a lock onto a "guide" object (star) and tracking of it's centroid position to move the ROI. I'd like to work in Python for Linux with an "open" model. I'm using cheap webcams at first as it is easier than writing the "drivers" for astronomy cameras.

P

Link to comment
Share on other sites

"Sharpcap" is great but it doesn't work in Linux (so far as I can see) and I don't want to struggle with "Wine". So I have started writing a Python program that uses the openCV Python library (so it should run on anything that runs Python). It's fine working on my old Linux laptop, but I wanted to work on a Windows machine (bigger screens - and easier to have the documentation open). The problem I now have is that I can't install "numpy" - PIP and EasyInstall just bomb during installlation of numpy (notoriously fiddly) with standard Python (same with scipy). I tried WinPython, but that has Spyder (which doesn't have tkinter or openCV) - I can install openCV but not tkinter (they obviously want people to us Qt - and I don't want to learn another programming style...).

Does anyone know of a Python variant for windows where tkinter and numpy are installed and openCV can be added?

Back on the Linux laptop I have the capture up and running with a webcam (you select the Region of interest with the mouse in a cam view window) - its taken a while as I'm very limited on computer time due to arthritis. You also select your guide object with the mouse (either a star or a lunar feature). The software uses a centroids method to track the "center" of the guide "object" (or the shadow of one in the lunar case - inverted in b/w terms to give a suitable "mask") and displays how this moves in a guide window. For the present I haven't written the scope interface to move the scope (or explored plug-ins for any other camera), as for short exposures (to test it) I can just have the "guider" move the ROI on the tkinter "canvas". The webcam output is also dumped to a file as video.

P

P

Link to comment
Share on other sites

..and today, some primitive "plate-solving"

  • Point scope with cam attached at sky - click on buttton (in home-baked software) called "Where?"
  • PROG: "hey thats casterobourous alpha: RA=rrrrrr, DEC=ddddd !"
  • prog moves scope - PROG:"Jeeez, thats omega ceti beta - you say the polar star is  Cas-gamma?- tell me another one"
  • whir....click....click... (PROG works out how it is actuallly aligned)
  • PROG: "OK - so now I know how you plonked down this tripod..
  •  ..(other commands)
  • PROG:"Tracking, Video recording to ... "

so getting there, slowly

P

Link to comment
Share on other sites

I've come down to a fairly simple design model. The scope (in my case on  an HEQ5pro) does the tracking. The "guider" (a web-cam in the "cheap version") looks through the scope and sees both a region of interest (ROI) and a guide object (GID) then corrects for the GID by moving rgw ROI,

P

Link to comment
Share on other sites

There are no constant settings/ranges between webcams. You can check how SharpCap builds it webcam UI - it will be different for different webcams as each offer different settings or ranges. Usually they aren't usable as guiders as the exposure is very short.

Link to comment
Share on other sites

Hi, 

I find this rather interesting, I'm working on a set of python scripts to mimic AstroTortilla on my Mac. It's a small side-project to work on if I find the time, which currently is not too often. 

So far I have a basic class based on the LX200 command set that can interface with EQMac and control my mount as well as a basic script to call astrometry.net (locally). I need to implement a proper parser to get the current coordinates as well as a script to call gphoto2 for camera control. If this toolchain is up an running, maybe I implement a GUI using Qt and PyQt.

What do you use for plate solving?

Sven 

Link to comment
Share on other sites

Does anyoe know the "standard" ranges for the parameters of a web-cam? - i.e. is BRIGHTNESS 1-255?, and CONTRAST 1-10?. Any link to a site giving these data would be appreciated...

P

As Piotr says, there are no standard ranges at all.

On Linux some (for which read "very few" as far as astro use is concerned -- mostly I'd say the SPC900 and TIS DMK and Skyris models) cameras will be recognised by the V4L2 interface.  V4L2 provides a mechanism for querying the available controls (because different cameras support different controls) and what valid ranges they have.  You're not even guaranteed that a given control is of the same type on different cameras.  IIDC cameras do a similar thing, but ideally you need the dc1394 library to talk to those.  ZWO's SDK provides much the same functionality for their cameras.

Then there's a whole pile that you just have to write your own drivers for and know what controls are available and what values they can take.

For example, some controls on some cameras might just be "on/off" whereas on others they might allow a range of values, two of which will be "on" and "off".  Some only provide a "relative" control for exposure time or gain, so you know one setting is not as much as another, but what they mean in real terms is undefined.  Others allow you to set an exact exposure time or gain setting in dB.  And a few allow you to choose between the two.

It's a huge bundle of fun.  For some values of "fun".  Which also varies depending on the camera :)

James

Link to comment
Share on other sites

  As James noted, you may be able to find success with PHD2. I haven't used that one, though I've seen good results from PHD running under W7 in a virtual machine.

  A very good native Linux option is Edward Simonson's GoQat. It should work with most/all V4L cameras as well as a few other select models. I use GoQat with my Starlight Xpress Lodestar for field acquisition and guiding, and oaCapture for my science camera. A very effective combination.

  -- Mike --

Link to comment
Share on other sites

Really - you can code in Python and not in C ? If you can handle the freaky collections and range management in Python then I'm sure you can handle the equally freaky ptr dereferencing - especially for device driver type coding.

:> Mike

Link to comment
Share on other sites

:D

I've got to the point where pretty much all (procedural) programming languages seem the same these days.  It's mostly just the syntax that changes.  After the first half-dozen or so there's not much that's new.

I rather like C and C++ though.  Especially with the compiler in "facist" mode where any warning causes a compilation failure.  Granted if I want to hack something up quickly I'd still use shell script or Perl or Python or maybe even PHP if I want a web page out of it at the end, but there are times when I like to have strict variable typing and many of the other things that lots of people hate about C and C++ :)

James

Link to comment
Share on other sites

:D

I've got to the point where pretty much all (procedural) programming languages seem the same these days.  It's mostly just the syntax that changes.  After the first half-dozen or so there's not much that's new.

Me I like coding in assembly language. Not of that nasty casting nonsense when you can design your own variable types to suit  :grin: 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.