Author Topic: StarStatistics class and ReadPSF process module  (Read 32541 times)

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
StarStatistics class and ReadPSF process module
« on: 2010 May 03 21:34:26 »
StarStatistics is a PCL class (not included, yet) in development which performs a least squares fit of a gaussian or schwarzschild (asymmetrical) point spread functions.

To implement the class, and show examples of it's use, here is a process module designed for testing purposes, named ReadPSF. The user sets a initial (closer to the real one) center, and a few other parameters, and it gives the PSF statistics on the console.

Both codes are released under the GPL, with the intention to create a community development effort around them.

Download links:

Source code:   http://pteam.pixinsight.com/pcldev/starstatistics/ReadPSF-src-20100520.zip
Windows 32bits: http://pteam.pixinsight.com/pcldev/starstatistics/ReadPSF-pxm-20100520_win_32.zip
Windows 64bits: http://pteam.pixinsight.com/pcldev/starstatistics/ReadPSF-pxm-20100520_win_64.zip
Linux 64bits: http://pteam.pixinsight.com/pcldev/starstatistics/ReadPSF-pxm-20100520_x11_64.tar.gz
(Will include 32bits releases if asked).

Sample image (16bits fits): http://pteam.pixinsight.com/pcldev/starstatistics/startest.zip

Current state:
StarStatistics: 2.2.0 2010/05/20
ReadPSF: 1.0.4 2010/05/20 (Angle in degrees).

Known issues:
- No known issues. Need user input.

Check the date on the filename to see if you have the latest version (format: YYYYMMDD).

EDIT: Uploaded new StarStatistics.cpp file. Changed the initial least square errors matrix. New values should give more accurate results. Please test.
EDIT2: New StarStatistics class and ReadPSF process. Changed the whole algorithm to a maximum likelihood method. Better results, and more consistent. Included a Windows 64bits compilation, for testing.
EDIT3: Added a sample image.
EDIT4: Sigma correction added. Better results right now. Intensity/Flux calculations redesigned.
EDIT5: Lots of changes to the StarStatistics class. Added iterative functions that follows a convergence criteria to determine the centroid, peak intensity and standard deviations. Results are very consistent right now. Code fully commented. New correction factors added, due to differences between the discrete data and a continuous distribution model. Linux 64bits compilation added.
« Last Edit: 2010 May 27 09:20:25 by Carlos Milovic »
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline budguinn

  • PixInsight Addict
  • ***
  • Posts: 106
Re: StarStatistics class and ReadPSF process module
« Reply #1 on: 2010 May 05 21:29:55 »
Hi Carlos,

How is this installed?

bud
« Last Edit: 2010 May 05 21:45:24 by budguinn »

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: StarStatistics class and ReadPSF process module
« Reply #2 on: 2010 May 05 23:38:34 »
Hi Bud (and Carlos),

As I understand things, the zip file provided by Carlos needs to be COMPILED before it can be installed - and that means I am now WELL out of my 'comfort zone'.

What I would like is for someone (Carlos, Juan, Sander, etc.) to throw together a real simple 'step by step' tutorial to help the likes of me - who could at least 'read' the likes of your .c and .h files (and therefore can claim to 'understand' about 50% of the code at first pass through ;D) - and could then use your framework to be able to move on from the constraints of the PJSR world. If 'we' (i.e. the great unwashed) can figure out how to compile to PCL modules, then some more interesting stuff might get added to the world of PI (assuming we can also get a hold of the 28-hour days that Juan seems to use!).

Cheers,
« Last Edit: 2010 May 13 23:39:30 by Niall Saunders »
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline budguinn

  • PixInsight Addict
  • ***
  • Posts: 106
Re: StarStatistics class and ReadPSF process module
« Reply #3 on: 2010 May 06 05:08:17 »
Hi Niall

I kind of figured that it needed to be compiled.....I was/am going to ask my friend Mike Reid.....he is currently "test driving" the program and has quite a bit of programming experience.  Perhaps he could compile it for us to be used on a windows machine.....I'm on a fairly powerful Vista 64.

I'll point him to this thread....

bud

Offline budguinn

  • PixInsight Addict
  • ***
  • Posts: 106
Re: StarStatistics class and ReadPSF process module
« Reply #4 on: 2010 May 06 05:20:55 »
Hi guys,

As I understand this.....much of this stuff needs to be beta tested.
Why not put it in a form that it can be installed?...ie precompiled as a module/process that the PI core program can recognize from...where?...the .bin folder"?

I have pointed my friend Mike at this thread and he might be able to help us non-programmers, but if you're needing beta testers to find those things that don't seem to work this might get a few more involved.

best regards,

bud


Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: StarStatistics class and ReadPSF process module
« Reply #5 on: 2010 May 06 05:42:54 »
Hey, this is a good idea indeed. Maybe Juan can provide a repository of "Beta"-modules that the more advanturous amongst os can test at their own risk.

From my own experience I can say that it is almost impossible for a hobby programmer to compile modules for all those platforms that PI supports. Who of us has a build farm with Win32+Win64+Lin32+Lin64+Mac+FreeBSD plus assorted development tools available? Not me, for sure.

Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: StarStatistics class and ReadPSF process module
« Reply #6 on: 2010 May 06 06:13:16 »
Hi Georg, Bud,

In fact I think that you have both got some valid points.

Yes, we COULD be doing with a 'BETA Bin' - somehwere for pre-compiled 'beta' modules to reside. Those of us who are able to compile such modules could simply 'make them available' for others to use, but they would at least be 'pre-compiled' with a name that advises which OS they should function with.

Then for others - perhaps like me - we would be happy to tinker with the C-level source code (generously provided by others, perhaps encouraging us to 'move up' to creating a new module from scratch). However, 'we' would need to be guided as to how to 'compile' such code into a useable module.

Importantly though, we would only need to compile it for our OWN Operating System (perhaps a second, if available, and if 'we' feel so inclined). The benefit then being that, if the code is taken up by someone else - who can compile it for a different OS, then this 'extra' compiled version could be added to the 'Beta Bin'.

Right now I see a gulf between PJSR and PCL, and I don't know how to cross it, because I don't have the skills. Whilst I 'can' write code in PJSR, and I (most likely) can get by coding in C (although it is a truly DREADFUL, and utterly NON-intuitive language to work with - IMHO, of course :P), I would definitely need someone to 'hold my hand' through the first attempts at compiling a PCL module.

Perhaps (Bud?) your you and chum could 'document' the steps needed - by actually installing all the necessary software components on YOUR computer (or mine - I am happy to make myself available at the end of a TeamViewer link). Alternatively - if the 'skilled programmers' amongst us could put together a quick and simple tutorial, the PixInsight community is bound to benefit in the long term.

Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: StarStatistics class and ReadPSF process module
« Reply #7 on: 2010 May 06 06:17:59 »
Niall,

...
Perhaps (Bud?) your you and chum could 'document' the steps needed - by actually installing all the necessary software components on YOUR computer (or mine - I am happy to make myself available at the end of a TeamViewer link). Alternatively - if the 'skilled programmers' amongst us could put together a quick and simple tutorial, the PixInsight community is bound to benefit in the long term.
...

Is a recipe like http://pixinsight.com/forum/index.php?topic=1791.msg11361#msg11361 sufficient?

Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline budguinn

  • PixInsight Addict
  • ***
  • Posts: 106
Re: StarStatistics class and ReadPSF process module
« Reply #8 on: 2010 May 06 06:19:46 »
Hi Georg, Bud,

In fact I think that you have both got some valid points.

Yes, we COULD be doing with a 'BETA Bin' - somehwere for pre-compiled 'beta' modules to reside. Those of us who are able to compile such modules could simply 'make them available' for others to use, but they would at least be 'pre-compiled' with a name that advises which OS they should function with.

Then for others - perhaps like me - we would be happy to tinker with the C-level source code (generously provided by others, perhaps encouraging us to 'move up' to creating a new module from scratch). However, 'we' would need to be guided as to how to 'compile' such code into a useable module.

Importantly though, we would only need to compile it for our OWN Operating System (perhaps a second, if available, and if 'we' feel so inclined). The benefit then being that, if the code is taken up by someone else - who can compile it for a different OS, then this 'extra' compiled version could be added to the 'Beta Bin'.

Right now I see a gulf between PJSR and PCL, and I don't know how to cross it, because I don't have the skills. Whilst I 'can' write code in PJSR, and I (most likely) can get by coding in C (although it is a truly DREADFUL, and utterly NON-intuitive language to work with - IMHO, of course :P), I would definitely need someone to 'hold my hand' through the first attempts at compiling a PCL module.

Perhaps (Bud?) your you and chum could 'document' the steps needed - by actually installing all the necessary software components on YOUR computer (or mine - I am happy to make myself available at the end of a TeamViewer link). Alternatively - if the 'skilled programmers' amongst us could put together a quick and simple tutorial, the PixInsight community is bound to benefit in the long term.

Cheers,


dit, dit, dit, dit, dittos.....

bud

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: StarStatistics class and ReadPSF process module
« Reply #9 on: 2010 May 06 06:30:27 »
Hi Georg,

Thanks (also) for your quick reply. However - in the second sentence you had used the word "Linux" - and I had to stop there. Because I don't have time to learn Linux as well :'( (even though I have an old ex-works PC 'box' that I literally pulled out of the waste skip in the carpark, which I have allowed to drip-dry, and which has been set aside to try running Linux in - eventually).

So, I will re-read the link (trying to ignore the Linux references) and see if it means anything. But I still feel that I will (obviously) have to start with the 'freebie' Microsoft Visual C++ compiler - and so I need to know what I should be looking to download.

Then I need to take something like the StarStatistics / ReadPSF zip-file data, and be guided (for I doubt that I would 'figure it out myself' ::)) through the compilation process. (Yes, I know that, somewhere, there exists the SandBox code as well, but I can't even remember where that is hidden >:()

Heck, if someone want to link through to my machine, I could try grabbing the whole session on Camtasia and releasing THAT as a video tutorial ;D

Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: StarStatistics class and ReadPSF process module
« Reply #10 on: 2010 May 06 06:55:08 »
Georg made a fine recipe for linux.
In windows, things are easier :P
1.- You have to install Microsoft Visual C++ Express 2008 (freeware, needs registration after trial time, but is costless; all you need is a live id account).
2.-Then, define all the environment variables (see Georg's post). They are under System (Control Panel), I believe in the advanced category. Just have to create a new variable, and enter the path. About the lib variables, since you'll have only one OS bit system, replace the other path with the current one (i.e. if you are in a 64bits system, set PCLLIBDIR32=$PCLDIR/lib/x86_64 since there is no x86 folder.).
3.- Run PixInsight, and open the Makefile script (development category). If all environment variables were successfully established, the window will open. Create the project for the code.
4.- Now you should have a MSVC project file inside a subfolder in the code directory. Run it to open MSVC.
5- To compile the code, select the Release option (change it from Debug), and then click on "Build Solution".
6.- If successful, the new module should be created in PixInsight's bin folder.
7.- Open PI and install the module.


I'll upload compiled versions to PI's server. Unfortunately, I'm having some problems linking the code with most OS, so I may provide only Win32 files right now.
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: StarStatistics class and ReadPSF process module
« Reply #11 on: 2010 May 06 07:03:06 »
Hi Niall

You really should try Linux. I'm enjoying a lot the new Ubuntu release. Also, you'll find that PI "orientation" is very similar to an Linux OS.

About Sandbox, look in the src/modules/processes folder under PinInsight (you need the PCL package, not just the PI Core). Take a good look at that folder, since there are lots of sample codes. I must confess that I always start a new project working over an existing one, which is the most similar to mine. Also, Sandbox provides nice examples on how to handle the most common variables.
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline budguinn

  • PixInsight Addict
  • ***
  • Posts: 106
Re: StarStatistics class and ReadPSF process module
« Reply #12 on: 2010 May 06 07:10:23 »
Carlos,

Will it work with the Visual Basic 2010 Express.....or should I download the full deal?
A search for the 2008 redirects to the 2010 version.

bud


Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: StarStatistics class and ReadPSF process module
« Reply #13 on: 2010 May 06 07:10:32 »
Thanks all,

Now, if one of you could send me a good excuse for me to use with my darling wife :-* - who will now not see me for the next few days, whilst I try and find time to 'play' with this new possibility.

And Georg, I think I am saving Linux for my retirement - I have used all the expansion slots in my Mk1 Brain at the moment, and feel that I will have to offload and archive my "Daily Grind" soft-drive before I can upload a new environment such as Linux.

Either that, or I will have to shell out for the 'Brain Overdrive' conversion - O0 - as used by Juan

Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: StarStatistics class and ReadPSF process module
« Reply #14 on: 2010 May 06 07:12:18 »
Hi Bud,

Quote
Visual Basic 2010 Express

I think it would HAVE to be Visual C++, after all, the code is written in C.

Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC