Author Topic: Pixel Math question  (Read 1983 times)

Offline John Massey

  • Newcomer
  • Posts: 46
Pixel Math question
« on: 2018 September 18 11:58:08 »
I would like to understand pixelmath programming so I can take advantage of this powerful tool in PI. What programming language is the best to begin the learning? Java, c++ etc? I can't seem to find much about the topic on the internet. I have done virtually no programming in my life I'm just an old dog wanting to learn a new trick so to speak.

Thanks in advance.

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Pixel Math question
« Reply #1 on: 2018 September 18 12:32:28 »
pixelmath does not really require any knowledge of any specific programming language, and whatever it has in common with actual programming languages is just sort of the general syntax of different math operations, variable assignments and function calls.

there are tutorials available around the web... here are some videos that oldwexi made:

http://www.werbeagentur.org/oldwexi/PixInsight/PixInsight.html

https://pixinsight.com/forum/index.php?topic=11829.0

https://jonrista.com/the-astrophotographers-guide/pixinsights/narrow-band-combinations-with-pixelmath-hoo/

http://www.deepskycolors.com/PixInsight/PixelMath.html

rob



Offline John Massey

  • Newcomer
  • Posts: 46
Re: Pixel Math question
« Reply #2 on: 2018 September 18 12:52:45 »
Thanks for the clarification Rob. I have looked at Geralds videos and have found them useful and have attempted generating some expressions with some success, but I get lost with some of the errors generated when parsing. Is trial by error the best means for learning PM?

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Pixel Math question
« Reply #3 on: 2018 September 18 14:08:06 »
well i suppose so... generally PM will show you something like this in the console when something is wrong with an expression:

Code: [Select]
*** Error: Mismatched right parenthesis:
$T*0.6+Image140_clone)
.....................^
<* failed *>

for simple errors like that one, it's pretty obvious what's going on. but when you have a complex expression that has an error, sometimes the error the parser spits out first is not necessarily an error, but is the result of some other error in the expression. some editors have special modes for different programming languages which will highlight in real time which braces/brackets match with one another so it's a bit easier to see where your syntax error is. if you go into the pixelmath expression editor you'll see for instance that when you close a parenthesis, the corresponding opening parenthesis is highlighted. if you have a bad expression with parenthesis in them, it might help to add and delete close parens to your expression and watch the highlighting to try to figure out what's wrong.

rob

Offline John Massey

  • Newcomer
  • Posts: 46
Re: Pixel Math question
« Reply #4 on: 2018 September 18 14:19:47 »
Thanks again Rob for the quick response. The error messages remind me of SQL errors, with the same issue of experimenting to find out exactly what is needed to correct the expression. The result was the more you used the editors the more you understood the error messages.

Offline ngc1535

  • PixInsight Old Hand
  • ****
  • Posts: 326
Re: Pixel Math question
« Reply #5 on: 2018 September 18 22:34:47 »
Hi John,

I do of course make a go at explaining Pixel Math as part of my courses on my website.

You might get a little kick out the initial learning experience I chose on my own path to using it:

https://pixinsight.com/forum/index.php?topic=11613.msg71775#msg71775

-adam

Offline John Massey

  • Newcomer
  • Posts: 46
Re: Pixel Math question
« Reply #6 on: 2018 September 19 06:53:24 »
Thanks Adam, I will give that a read.