Re: Creating colour-coded plots of spectra [message #67532] |
Mon, 03 August 2009 07:30 |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
Jimmy wrote:
>> Hi Jimmy,
>>
>> if you are happy with linear scale for the x and y axis,
>> any of the numerous program to plot images with axes will
>> do, but if it matters to you to have log scales as in the
>> Ulysses plots, I suggest to use
>>
>> http://hea-www.cfa.harvard.edu/~pgrigis/idl_stuff/pg_plotima ge.pro
>>
>> Example of usage:
>>
>> pg_plotimage,dist(512,512),findgen(512),findgen(512)/10+1,/y log,/
>> xstyle,/ystyle
>>
>> Ciao,
>> Paolo
>
> Hi,
>
> Thanks for the advice! I will need to put log scales in, so that
> sounds like it'll be very useful.
>
> However (and this is my fault for not being clear) I'm not really at
> that stage yet- I'm still trying to convert a line spectral plot into
> a colour coded image, prior to plotting it. I basically have an array
> with a range of values in representing an 8 second piece of data, then
> a load of zeros, then another load of data, then zeros, etc... for an
> hour or so. When plotting this prints out as many, many spectra all in
> a line, and I'm trying to get idl to display them vertically and in
> color (as in the Ulysses plots).
>
> It may be that I need to write something to do this (I'm thinking
> something that bins the data accoring to its value, then assigns it a
> color based on intensity...) but as I've seen these plots around and
> the seem fairly standard I was hoping someone might know of function
> or program to do it for me- with my IDL skills it's likely to take a
> fair bit of time/cursing!
Hi, the format you describe seems a bit strange,
but assuming that your data really look like this,
this code should get you started (but please try
to understand every step of the code before you
try to apply something like that to your data).
IDL> a=[1,2,3,0,0,0,4,4,2,0,0,0,1,1,1,0,0,0,1,2,5]
IDL> ind=where(a NE 0)
IDL> b=reform(a[ind],3,4)
IDL> print,b
1 2 3
4 4 2
1 1 1
1 2 5
Ciao,
Paolo
>
> Thanks,
> Jimmy
|
|
|
Re: Creating colour-coded plots of spectra [message #67534 is a reply to message #67532] |
Mon, 03 August 2009 05:24  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Jimmy writes:
> However (and this is my fault for not being clear) I'm not really at
> that stage yet- I'm still trying to convert a line spectral plot into
> a colour coded image, prior to plotting it. I basically have an array
> with a range of values in representing an 8 second piece of data, then
> a load of zeros, then another load of data, then zeros, etc... for an
> hour or so. When plotting this prints out as many, many spectra all in
> a line, and I'm trying to get idl to display them vertically and in
> color (as in the Ulysses plots).
>
> It may be that I need to write something to do this (I'm thinking
> something that bins the data accoring to its value, then assigns it a
> color based on intensity...) but as I've seen these plots around and
> the seem fairly standard I was hoping someone might know of function
> or program to do it for me- with my IDL skills it's likely to take a
> fair bit of time/cursing!
It sounds to me like you need to use REFORM to
turn your 1D array into a 2D array, and then use
BYTSCL to convert your data into something you
can display with TV. I think the "program" you
are looking for is at most 3 or 4 lines long. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Creating colour-coded plots of spectra [message #67535 is a reply to message #67534] |
Mon, 03 August 2009 00:35  |
jimmybobs
Messages: 9 Registered: January 2009
|
Junior Member |
|
|
> Hi Jimmy,
>
> if you are happy with linear scale for the x and y axis,
> any of the numerous program to plot images with axes will
> do, but if it matters to you to have log scales as in the
> Ulysses plots, I suggest to use
>
> http://hea-www.cfa.harvard.edu/~pgrigis/idl_stuff/pg_plotima ge.pro
>
> Example of usage:
>
> pg_plotimage,dist(512,512),findgen(512),findgen(512)/10+1,/y log,/
> xstyle,/ystyle
>
> Ciao,
> Paolo
Hi,
Thanks for the advice! I will need to put log scales in, so that
sounds like it'll be very useful.
However (and this is my fault for not being clear) I'm not really at
that stage yet- I'm still trying to convert a line spectral plot into
a colour coded image, prior to plotting it. I basically have an array
with a range of values in representing an 8 second piece of data, then
a load of zeros, then another load of data, then zeros, etc... for an
hour or so. When plotting this prints out as many, many spectra all in
a line, and I'm trying to get idl to display them vertically and in
color (as in the Ulysses plots).
It may be that I need to write something to do this (I'm thinking
something that bins the data accoring to its value, then assigns it a
color based on intensity...) but as I've seen these plots around and
the seem fairly standard I was hoping someone might know of function
or program to do it for me- with my IDL skills it's likely to take a
fair bit of time/cursing!
Thanks,
Jimmy
|
|
|
Re: Creating colour-coded plots of spectra [message #67556 is a reply to message #67535] |
Fri, 31 July 2009 07:38  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
On Jul 31, 4:54 am, Jimmy <jimmyb...@gmail.com> wrote:
> Hi there,
>
> I have a large amount of line plots of x-ray spectra (looking a little
> bit like this one -http://www.jaxa.jp/press/2005/08/img/20050817_suzaku_pic02- e.gif
> ). I'd like to convert them into something a bit more user friendly- a
> colour coded spectral plot (looking rather like this-http://swepam.lanl.gov/Figures/Figure08.JPG), with intensity shown by
> different colour values. This plot also makes it easy to see how
> intensities of a particular energy (y-axis) change with time (x-axis).
>
> Has anyone heard of a program that will do this for me? Its possibly
> I'm being dense, and don't know the correct term to google for. If
> there's nothing out there I have an inkling (a faint one!) on how to
> do it myself, but no doubt someone has done it better than I could?
>
> Thanks!
> Jimmy
Hi Jimmy,
if you are happy with linear scale for the x and y axis,
any of the numerous program to plot images with axes will
do, but if it matters to you to have log scales as in the
Ulysses plots, I suggest to use
http://hea-www.cfa.harvard.edu/~pgrigis/idl_stuff/pg_plotima ge.pro
Example of usage:
pg_plotimage,dist(512,512),findgen(512),findgen(512)/10+1,/y log,/
xstyle,/ystyle
Ciao,
Paolo
|
|
|