Author Topic: PCL: Python Module  (Read 20028 times)

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: PCL: Python Module
« Reply #15 on: 2012 December 05 07:58:24 »
...You Sir are my hero.. ...
Well, the module is not yet ready, and there is still time to have a share of the fame: Join me in developing it  :)

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

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
0.2 alpha released
« Reply #16 on: 2012 December 30 04:37:09 »
New version available on BitBucket repository https://bitbucket.org/georgviehoever/pixinsight:

0.2, 2012-12-30
Porting to PCL2.0/PI1.8RC1
- updated for changed interfaces in PCL2.0
- using CodeEditor instead of TextBox for text field in GUI. Currently, this has only the advantage of
  showing line numbers. There is no Python Syntax support (yet)
- No extension of language bindings
- The problem with get_luminance is still there. Implemented fall back in python3DPlot
- added doxygen configuration for extended PCL documentation to root directory
- added script for setting up environment to root directory

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

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: 0.3 alpha released
« Reply #17 on: 2013 January 10 11:30:55 »
New version available on BitBucket repository https://bitbucket.org/georgviehoever/pixinsight:

- GetLuminance() is working now.
- Adapted helper files accordingly
- output redirection to PI Console in python temporarily disabled due to problem with threading
- Some steps toward separation of PI and interpreter process. Not functional yet.

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

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: PCL: Python Module
« Reply #18 on: 2013 January 10 11:53:22 »
Thanks for sharing your work, I follow it with interest. For the time being I am still trying to get PCL sample compiled on Windows 7/64, then I would like to see if I can run Python in that environment.
-- bitli

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
0.4 alpha released
« Reply #19 on: 2013 January 26 08:23:28 »
Minor changes for 1.8RC3. Visible change is Python syntax coloring.
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline kwiechen

  • PixInsight Addict
  • ***
  • Posts: 186
Re: PCL: Python Module
« Reply #20 on: 2014 December 28 03:43:39 »
Is there any news about the python bindings?

I have recently tried to start a project for analyzing histology images with PI/Javascript. But, most of this already implemented within numpy/scipy/matplotlib/scikit-image. So I have switched to Anaconda/IPython and it works out of the box with few lines of code and comprehensive documentation. 

 

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: PCL: Python Module
« Reply #21 on: 2014 December 28 04:14:42 »
No, unfortunately no progress due to lack of time and the complexity of the project. I would love to cooperate with someone on this, but so far nobody has volunteered :( .

Making the wealth of methods in Python available to PI and vice versa is one of the motives of this project. Currently, I usally help myself by exporting data via FITS from PI, running my procedures in Python/IPython/Anaconda, and later re-importing them to PI. Not the optimal workflow, but often good enough.

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

Offline kwiechen

  • PixInsight Addict
  • ***
  • Posts: 186
Re: PCL: Python Module
« Reply #22 on: 2014 December 28 09:13:16 »
I have found the python conversion of image data to multidimensional numpy.ndarray and reshaping extremely effcient. And working with ndarray objects is very fast.

Due to time restrictions, I can not help with PCL/C++ in the foreseeable future. Is it possible to compile the latest for Win7 64?




Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: PCL: Python Module
« Reply #23 on: 2014 December 28 13:08:05 »
I would not recommend to use the alpha version. Just not stable enough.
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline kwiechen

  • PixInsight Addict
  • ***
  • Posts: 186
Re: PCL: Python Module
« Reply #24 on: 2014 December 30 02:22:11 »
Is it possible to integrate this transparently to start python scripts directly from or within the script editor (in the future)?

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: PCL: Python Module
« Reply #25 on: 2014 December 31 06:31:05 »
Hi Kai,

you can already start other programs from within PI, for instance like "!grep 'hello' HelloWorld.js" in the console, see "help" in console. You can also use the ExternalProcess object from PJSR or PCL. Not very convenient though.

I was wondering if creating a PI process module that just allows to apply an external executable (such as a Python script, or a C executable such as Sextractor) to the current image would be helpful here. The idea is to create a module that allows to specify a command line, and that on pressing the  apply button will save the current image to a FITS file, run the command line, and read in the resulting image back into PI. That appears to cover a number of use cases that I so far did manually, and it would nicely integrate into PI, PCL, PJSR, ProcessContainers etc.

What do you think?

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

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1178
    • astrobin
Re: PCL: Python Module
« Reply #26 on: 2014 December 31 08:59:44 »
Georg,

Isn't that what sort of happens within Blink with the 'Crop and create video' selection? You can call a program and arguments to work with a selection of images.




Mike

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: PCL: Python Module
« Reply #27 on: 2014 December 31 11:21:19 »
Yes, thats very Close to what I have in mind. But it sees to be geared towards creating Videos.
Thanks for the hint!
Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1178
    • astrobin
Re: PCL: Python Module
« Reply #28 on: 2014 December 31 12:00:44 »
In this tool it is geared towards video but the code is there for working with an external process. I changed the program from FFMPEG to a different program that I placed in the PI folder. That program was called up and executed. As long as the external program was active Blink was waiting. If you use the cancel button on Blink then external program closed. So it seems the code is within Blink to do an external call with arguments. The wheel is all ready made. 


Mike

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: PCL: Python Module
« Reply #29 on: 2015 January 01 08:19:40 »
The use of an external process is a possibility if PixInsight rules them all. Maybe we could have some support script to do stuff like exporting a Fits Image, running an external process on it, importing the image back and overwrite the original image in a way that Undo could be used.  Not incredibly convenient, but manageable.

An alternative way would be to have a way to communicate between a PI script and an external process, for example by TCP/IP (on local host). This is possible from a C++ process but I am afraid that we lack the support for PI Javascript.
We could then either have PI being the master or the external process being a master (driver of operations). For example the external process could send commands like 'execute this process' or 'save this image in that file' and the JavaScript would execute it in PI. Possibilities are endless.
This could also be done using files and polling, but this get worse than ugly.  Any other way to make PI communicate with an external process that I missed ?
-- jm