Getting Started?

varmint

Active member
I apologize in advance if this is the wrong forum, please redirect if necessary.

I would like to learn how to program some scripts, but don't know how to get started.  It has been ~15 years since I last programmed in Fortran and C++, and I've never done any script generation (aside from possibly debugging an Excel Macro way back when, if that counts).  Over the last year at work I've done some simple programming in Industrial Control System applications (Function Block and Structured Text, debugged Ladder Logic, for those who may know what those are), but I won't claim to be a really proficient programmer.

I'd like to know what tools I'd need to get started, in the hopes I can help out with some future scripts for PI (I've already got a few ideas that I see other folks are working on, but I'd like to learn too).

Do I need a compiler and/or linker application?
Other tools (aside from text editor)?

Thanks,

Jim
 
Hi Jim:

You only need a text editor, and some knowledge on Javascript. Read scripts already done. When you want to add a process module just throw it in a ProcessContainer and you get the source code.

Silvercup
 
Thanks Silvercup,

I just borrowed one of my coworker's Java Programming books, I hope to learn the syntax from it.
 
Hi Jim,

I am from a very similar background to you - although I certainly find it VERY difficult to start 'from the beginning', and certainly not 'from a book'.

So, when I wanted to see what I could do in PJSR - out of a need that nobody else could be bothered to resolve (i.e. deBayering CMYG images from a DSI Colour camera), I started with code written by others - all of whom were far more skillful than I.

The result, after months of hard graft, was my Batch deBayer script, now included as part of the 'standard distribution' - thanks to Juan.

Now, the only reason that I am mentioning it is that I spent a LOT of effort trying to comment the ENTIRE script - mostly for my own benefit, as I learned each new step. But I also realised that, with Juan's intention to include it in the standard distribution, the effort into adding these comments might be helpful to others.

So, please, feel free to start with my script (and the efforts of others) - and rip it into manageable chunks to suit your needs.

Don't ask 'me' too many questions though - it has been a year since I last looked at the code in detail, and I probably have a LOT of re-learning to do already :'(

Good luck - and have fun!

Cheers,
 
Nocturnal said:
Java isn't quite javascript so watch out :)

Thanks for that.  I did wonder based on some conversations with my IT fellows at work who live in Java and Javascript land (but are too busy to throw me a bone...go figure).
 
Niall Saunders said:
So, please, feel free to start with my script (and the efforts of others) - and rip it into manageable chunks to suit your needs.

Don't ask 'me' too many questions though - it has been a year since I last looked at the code in detail, and I probably have a LOT of re-learning to do already :'(

Good luck - and have fun!

Cheers,

Niall, thanks for your offer.  I was planning on dissecting some of the current scripts to learn and understand the nuances.  Code Comments are quite valuable as well (I can tend to go overboard on comments sometimes), so thanks for letting me know about a target to start with.  And I'll ask the forum and not pester individuals much (if I can avoid it).  :angel:
 
I should add that since javascript is very popular for all kinds of web stuff there should be no shortage of online tutorials.
 
Code:
And I'll ask the forum and not pester individuals much

In fact, the Forum is always your 'best' arena for posing questions - that way you can reach a FAR larger audience, and you might be surprised just how quickly a reply comes back!

Have fun,
 
Niall Saunders said:
The result, after months of hard graft, was my Batch deBayer script, now included as part of the 'standard distribution' - thanks to Juan.

Now, the only reason that I am mentioning it is that I spent a LOT of effort trying to comment the ENTIRE script - mostly for my own benefit, as I learned each new step. But I also realised that, with Juan's intention to include it in the standard distribution, the effort into adding these comments might be helpful to others.

So, please, feel free to start with my script

I decided to give it a whirl tonight and take a look at some scripts, but I can't seem to find the Batch Debayer script in the list of scripts.  I was using the Edit Scripts function off of the pulldown and it defaults to the PCL\include\pjsr folder but none include debayer...

Also, I only have PixInsight Core installed, should I also install the PCL?  Sorry if this question is daft...I'm not used to doing this yet.
 
varmint said:
I can't seem to find the Batch Debayer script in the list of scripts.  I was using the Edit Scripts function off of the pulldown and it defaults to the PCL\include\pjsr folder but none include debayer...
Read :pixInsight Forum > General > Announcements | Anuncios > PixInsight 1.6.0 Released  ;)

Also, I only have PixInsight Core installed, should I also install the PCL? 
Use PCL version if you like to see the source code of some PCL module. For scripting it's not important.
 
NKV said:
Read :pixInsight Forum > General > Announcements | Anuncios > PixInsight 1.6.0 Released  ;)

Thanks, I guess this refers to Juan's comments about not including the Debayer script?  I find that a little odd as I have it in the Core application under Scripts\Utilities\BatchDebayer, but I can't find the source code using the "Edit Script" function.

Does this mean that the BatchDebayer script is embedded into the Core application, but the source code/files are not available yet?
 
Hi Jim,

Assuming that you have installed to the 'default' PixInsight directory (and assuming Windoze as well), then the path to the CMYG Batch deBayer script should be as follows:-

C:\PCL\src\scripts
or
C:\PCL64\src\scripts
(if you have installed a 64-bit version)

I seem to have 23 script files in that directory, not including extras that I have been downloading and testing (for example the excellent Animator scripts from Nikolay)

My particular script is called <CMYG Batch deBayer v1_16.js> and is 149KB (huge, simply because of the extensive inclusion of comments throughout the script).

If you still do not have this, or cannot find it, then drop me a line and I will email it to you directly.

Cheers,
 
I am thinking learning some programming. Which is most useful in PI? Javascript or C++. I toyed with Basic some years ago. But have no real experience. 
Any books to get started.

Max
 
Max,
mmirot said:
I am thinking learning some programming. Which is most useful in PI? Javascript or C++.

if you are not into C++, I would recommend to start with JavaScript. Much easier, but (some) small limitations. A good starting point are the existing PI scripts. You'll get the idea of that language pretty fast by just looking at examples. Then start with some of the web tutorials (google is your friend here).

Georg
 
Hi guys

I started along time ago programing with Visual Basic (mostly self-teaching). Then I learned C (formal course). The change between both languages at a "basic" level is just a matter of knowing the syntax. Then, moving forward C++ is pretty much straightforward. I repeat, at a basic level. So, I would say that modifying current code, and compiling new simple modules is an quite easy task.
I agree that PJSR would be an even easier approach. But it has limitations. As a matter of personal tastes, I think that C++ code is more elegant, nicer, than JS, but that's only my own p.o.v. :) Also, I believe (I might be wrong) that it gives more control over what's happening behind curtains.

Anyway, I think (or believe) that in the med-term both ways of expanding PI would merge into some state where for a final user it would be hard to find if a process has been implemented as a c++ module or an "advanced" script. So, I wouldn't care too much about the path to follow. Also, you may go both-ways :) JS is a great choice to test new, rough code, which would later be implemented in c++.


PS: Sorry for being away from the forum. The academic life has much higher priorities this month.
 
I would still like a "How to Compile PCL for Dummies" to be written.

I am sure that I have all the necessary bit and pieces to manage this, but I haven't really got a clue how to 'join them all up together'. I know that there have been postings in the past, but every one that I have read seem to assume that I have some knowledge, experience, or operational setup that already works.

Basically, I have 'some' of the above requirements, but not 'all'. And this must affect a lot of contributors, who 'could' make the transition from PJSR to PCL - or who could even leap into the 'Sandbox' in PCL and just 'get going' - but who are not quite sure if the 'compilation hoops' that they are going to have to jump through are all properly lined up.

I know it is a lot to ask, but, "any offers"? As I have said, I will make my PC available over TeamViewer for anyone willing to take the time to try and help me, and would try to 'VideoCapture' the session to help others in the future.

Cheers,
 
Back
Top