Author Topic: Pixel intensity graph  (Read 3545 times)

Offline ADGlassby

  • Newcomer
  • Posts: 2
Pixel intensity graph
« on: 2017 January 06 15:13:40 »
OK, I've been trawling the forum and I'm not making any headway. A little history, I've decided that I want to use my telescope set up more scientifically so I want to do some entry level spectroscopy using a diffraction grating in the light path and then manipulate the images of the spectra I take back in the warmth of the house!

I'm working on a Mac so my analysis/manipulation won't include things like Rspec-astro etc. So, having Pixinsight in my arsenal I decided to look into using it to do some initial analysis but I'm just not getting my head around the logic of writing a script to do the necessary.

What I want to do is take the spectrum image, turn it into grey scale, so that I'm just looking at one channel, then follow a line across the new image picking out the intensity of each pixel along this line, put it into a vector (output to a .dat file) then throw it at gnuplot so draw a spline through the points.

I've looked at the example jscript in the forum but this outputs a 3d surface using SurfaceSplines. I don't seem to be able to tell the script interpreter about splines?? I've looked at the 3DPlot script which comes with PixInsight but I just can't see what it is doing.

Has anyone done this kind of script before?? At least the spline plotting, I should be able to figure out the rest!

Along the way I would like to annotate the x-axis with wavelength values for the colours, any suggestions how I might create this dataset from the colour pixel information? is there a transform from RGB to wavelength??

Hope someone can set me in the right direction 😞

Best Regards

Andrew

Offline ADGlassby

  • Newcomer
  • Posts: 2
Re: Pixel intensity graph
« Reply #1 on: 2017 January 14 10:37:38 »
OK.... bit silent here, probably because it's been done in PixelMaths which I found and have used. So my follow up question is this:

Is there a way of outputting the raw data to a .csv, or perhaps just outputting the data as a line graph rather than as the output the PixelMaths method gives??

Would welcome some ideas

Regards

Andrew

Offline bulrichl

  • PixInsight Guru
  • ****
  • Posts: 524
Re: Pixel intensity graph
« Reply #2 on: 2017 January 15 02:38:18 »
OK.... bit silent here, probably because it's been done in PixelMaths which I found and have used. So my follow up question is this:

Is there a way of outputting the raw data to a .csv, or perhaps just outputting the data as a line graph rather than as the output the PixelMaths method gives??

It's not exactly what you're looking for, but Oldwexi has created two short PixelMath expressions that plot the intensity of a row, e. g.:

1) pixel($T, x(), row)
2) iif((abs(1-4*$T)*height() > y()), 0, $T)

In the first expression replace 'row' by the y-coordinate of the row you want to plot.

Maybe you better have a look at ImageJ and its derivatives. It is able to plot intensity data and you can output them into a text file. (However, I must admit that I am not familiar with scripting in PI - maybe it's possible that way.)

Bernd

Offline IanL

  • PixInsight Addict
  • ***
  • Posts: 116
    • The Imaging Toolbox
Re: Pixel intensity graph
« Reply #3 on: 2017 January 19 05:32:15 »
Take a look at the SubframeSelector script as an example. That has functionality that will analyze images, record the results and display them as a table, output the table to a CSV and plot graphs of the results interactively. It might get you going in the right direction if you strip it back and add your own analysis and plotting requirements.