Author Topic: Graphing/plotting in PixInsight  (Read 6854 times)

Offline rga218

  • Newcomer
  • Posts: 37
Graphing/plotting in PixInsight
« on: 2012 February 23 10:15:04 »
Hi, my name is Roberto Abraham. I am a professional astronomer that is a bit sick of IRAF and have been playing around with PixInsight to see if I can use it for my own research, and perhaps also introduce it into my University's curriculum for our undergraduate classes on observational astronomy. So far I'm finding the software extremely interesting (although the lack of documentation poses some challenges).

I would like to try to build a PCL module that draws X-Y plots based on quantities computed from an image, such as apparent magnitude, size, etc. For the sake of simplicity, these quantities would probably be computed outside of PixInsight using something like SExtractor, which would produce a catalog. I would then like to read the catalog into a nice table in PixInsight, and then make X-Y plots (also within PixInsight) so that when I click on a data point on the graph up would pop up a PixInsight view (or perhaps preview) showing a small "postage stamp" image of the galaxy, which I could then manipulate in various ways. I've written software to do this at various points in my life using other packages (IDL, Matlab, IRAF, etc., not to mention in C calling PGPLOT) but PixInsight seems like it ought to allow me to do these kinds of things quite elegantly.

Before I embark upon this I would welcome some advice on how to handle the production of scientific graphics within PixInsight. Is there a recommended way to handle this? If not, my thinking was to link my module against something like PGPLOT, however this seems non-optimal because it would introduce awkward dependencies and it would make it difficult for others to build. Furthermore, I imagine that if I link against libraries there might be licensing issues to worry about that might prevent distribution of the module.

Thanks for any advice/suggestions,

Roberto Abraham
University of Toronto
Roberto Abraham
Professor of Astronomy & Astrophysics
University of Toronto

Offline marekc

  • PixInsight Addict
  • ***
  • Posts: 177
Re: Graphing/plotting in PixInsight
« Reply #1 on: 2012 February 23 23:48:54 »
Thanks, Roberto, for posting these questions!

I used Pixinsight for an imaging project in one of my classes for my Astronomy M.Sc. (Swinburne). I have never used IRAF, but I've always envied the people who know enough UNIX to use IRAF. However, everyone I know who has used it says `stay away if you can! It's difficult!'

The idea of using PI in astronomy education is very intriguing to me, since I teach astronomy. I teach introductory courses at a community college, and I wouldn't use it for anything beyond an introductory lab class, and possibly some sort of class on imaging. But... I will be very curious to see if any education-related functionality winds up getting built into PI. That would be neat! Being able to do something like CCD aperture photometry would be very cool. I've used MIRA for that, but I wish I could have used PI.

The DynamicPSF module might end up being an important part of research/education tools, such as for photometry. I'm glad that we have DynamicPSF now, it's very handy. Graphing, as you've described, would be great.

Offline Josh Lake

  • PixInsight Old Hand
  • ****
  • Posts: 424
Re: Graphing/plotting in PixInsight
« Reply #2 on: 2012 February 24 06:14:39 »
I, too, teach astronomy (at the high school level) and have made PixInsight a core part of my class. Being able to extract, plot, and analyze data within the PI platform would be a huge leap. I remember using IRAF in my undergrad research days, and I can absolutely relate to its tiresome workflow and foibles!

So you have another supporter in me, though I can't help with coding. If some PCL development results, I'd be happy to try working with students to use it.

Offline rga218

  • Newcomer
  • Posts: 37
Re: Graphing/plotting in PixInsight
« Reply #3 on: 2012 February 24 06:33:25 »
Hi Marek and jlake,

IRAF is powerful but archaic and the interface is so outdated I no longer feel comfortable asking my students to learn it. In my department there is a strong move away from IRAF and toward using IDL or Python (in the guise of a hybrid package called Pyraf) for image processing (as well as general scientific computing). In the undergraduate labs the trend is toward using things like CCDSoft or MaximDL for telescope control and data acquisition, and they are well-suited to this purpose. Unfortunately students also sometimes use these for image processing, but I discourage this.  I strongly dislike how they tend to emphasize applying non-linear transformations to the underlying data at an early stage. PixInsight's approach (retain linear data as much as possible and incorporate the non-linearity needed for visualization into screen transfer functions) strikes me as much more sensible and appropriate for data that will be used to measure things (though making pretty pictures is a very worthy goal too of course). So I'd like to see how far I can encourage the use of PixInsight in my local environment. Adding some basic things like data plotting would be helpful in this regard.

That said, I don't think PixInsight is intended to be a general computing environment, so if the answer to me wanting to generate plots within PixInsight is "use something else" I'll fully understand that.

Roberto
« Last Edit: 2012 February 24 08:43:28 by rga218 »
Roberto Abraham
Professor of Astronomy & Astrophysics
University of Toronto

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 881
Re: Graphing/plotting in PixInsight
« Reply #4 on: 2012 February 24 08:36:49 »
Hi Marek and jlake,

That said, I don't think PixInsight is intended to be a general computing environment, so if the answer to me wanting to generate plots within PixInsight is "use something else" I'll fully understand that.

Roberto

I think the authors might disagree. Graphical plots and analytical tools for astronomy are on most like clear on wish list.
Priorty has been given to development of image process tool since this is the main user base.
However, there has been increasing interest by professional astromomers in PI over the last couple years  so I am sure all comments here will get attention. 

Max

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Graphing/plotting in PixInsight
« Reply #5 on: 2012 February 24 13:35:59 »
Hi Roberto,

Welcome to PixInsight Forum.

Quote
That said, I don't think PixInsight is intended to be a general computing environment, so if the answer to me wanting to generate plots within PixInsight is "use something else" I'll fully understand that.

Just the contrary. We do support your project and encourage you to start it. We'll be glad to help you. In fact, a data/function plotting tool or toolset is already in our list of medium-term priorities, so your initiative is very welcome.

Quote
Before I embark upon this I would welcome some advice on how to handle the production of scientific graphics within PixInsight.

As you probably know we have two development frameworks in PixInsight: The PixInsight JavaScript Runtime (PJSR) and the PixInsight Class Library (PCL). I don't see any problem to develop your project on any of both frameworks. However, given the potential complexity of a plotting tool, I think PCL may be your best choice.

PixInsight is a modular system. PCL is essentially a collection of C++ classes that allow you to define a module that communicates with the core PixInsight application. Besides this infrastructure, PCL provides a reasonable set of image processing algorithms and tools, including convolutions, morphological transformations, Fourier transforms, pixel interpolations, geometric transformations, wavelet transforms, etc. We have some Doxygen documentation on PCL here:

http://pixinsight.com/developer/pcl/doc/html/

Among the set of PCL classes you'll find Graphics and VectorGraphics, which derive from the GraphicsContextBase class (both classes are nearly identical; the difference is that Graphics works with integer coordinates while VectorGraphics uses real coordinates). These classes along with Bitmap and SVG provide access to most of the graphics generation functionality of the PixInsight platform. Unfortunately, Graphics and VectorGraphics are poorly documented, but both are rather self-explanatory and you can count on us to help you solve any doubt on this forum.

We are currently working on version 2.0 of PCL, which hopefully will be available in 2-3 months. PCL 2.0 will be an open-source library (PCL 1.x is only partially open) under PCL License. PCL 2.0 will introduce many improvements, some C++11 support (optional), a more elegant and efficient object model and more image processing power, but it will be fully compatible with modules written around PCL 1.x.

The best way to get started out with PCL programming is to begin playing with the Sandbox module. You have Sandbox's source code in the standard PCL distribution, which in turn is available from our software distribution site. In the first and only issue of PixInsight Magazine (too bad we haven't been able to continue this project!) you'll find also an introductory article on PCL and the architecture of the PixInsight platform.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline rga218

  • Newcomer
  • Posts: 37
Re: Graphing/plotting in PixInsight
« Reply #6 on: 2012 February 24 15:04:42 »
Hola Juan, it's encouraging to see how ambitious you are for PixInsight. I hope you succeed, and will try to help.

Thanks for pointing me to the Doxygen documentation for Graphics and VectorGraphics. This ought to be good enough to get me started. I have some code I wrote in Objective-C to draw plots based on Mac OS X Aqua primitives; perhaps I can translate some of that into useful C++ based on the methods in the classes you've pointed me to.

Are you envisioning support for FITS data tables at some point in PixInsight? If you are contemplating expanding the scope of PixInsight to encompass tabular data manipulation then this might not be a bad idea. I notice that PixInsight already links to CFITSIO, so its table manipulation routines (row and column filtering etc) are presumably already accessible. If FITS data tables are in your future plans then I will probably focus on getting PixInsight to simply draw two columns of a FITS data table, otherwise I'll have to concoct some sort of abstract DataTable class to store tabular information and use that as the data source.

Regards,

Roberto
Roberto Abraham
Professor of Astronomy & Astrophysics
University of Toronto

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Graphing/plotting in PixInsight
« Reply #7 on: 2012 March 01 02:31:57 »
Hi Roberto,

Quote
it's encouraging to see how ambitious you are for PixInsight

Along with the fact that I tend to be ambitious by nature, I have no alternative. This is a very small and highly specialized market that has been conquered by (1) general purpose applications supported by multinational companies, and (2) professional applications supported by governmental entities. Given our small size, scarce human resources and lack of support, we have to be somewhat aggressive :)

Quote
Are you envisioning support for FITS data tables at some point in PixInsight?

Not for now. Maybe in the long term. As you perhaps have noticed from this forum, I am not a big fan of the FITS format, and an even less fan of FITSIO. A DataTable class sounds nice and can be very efficient and elegant if you base it on C++ templates.

Please keep us informed on your progress. And count on us if you need information or help with PCL.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/