comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Map Function Question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Map Function Question [message #79852] Thu, 19 April 2012 08:10
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On 19 avr, 16:31, David Fanning <n...@idlcoyote.com> wrote:
> alx writes:
>> Maybe I do not fully understand what you exactly want.
>> But I think that everything can be obtained with an adequate
>> combination of POSITION, ASPECT_RATIO keywords and CONVERTCOORD, SCALE
>> and TRANSLATE functions (even ROTATE if you like).
>> For example, with the yesterday example, you can exactly and entirely
>> fill your window by doing:
>> im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, ASPECT_RATIO=0, $
>>     XRANGE=xrange, YRANGE=yrange, GRID_UNITS='degrees',
>> POSITION=[0.0,0.0,1.0,1.0])
>> map = map('EQUIRECTANGULAR', LIMIT=limit, ASPECT_RATIO=0,
>> POSITION=[0.0,0.0,1.0,1.0], /CURRENT)
>> Is'nt it ?
>
> Yes, the key point is the undocumented ASPECT_RATIO keyword
> on the map projection. It only took me 15 minutes to think of
> trying *that*. Maybe I'm beginning to think like a
> Function Graphics expert!
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>

We are getting closer and closer of what I said a few messages ago:
Graphics is working not too bad and, even, might be quite useful
(after correction of some flaw as, for instance, the COLORBAR
function).
But the present documentation is so poor that we have to experiment
for each keyword, for each called function, before to find the right
statement. It is unacceptable!
Exelis MUST correct the situation as soon as possible.
alain.
Re: Map Function Question [message #79855 is a reply to message #79852] Thu, 19 April 2012 07:31 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
alx writes:

> Maybe I do not fully understand what you exactly want.
> But I think that everything can be obtained with an adequate
> combination of POSITION, ASPECT_RATIO keywords and CONVERTCOORD, SCALE
> and TRANSLATE functions (even ROTATE if you like).
> For example, with the yesterday example, you can exactly and entirely
> fill your window by doing:
> im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, ASPECT_RATIO=0, $
> XRANGE=xrange, YRANGE=yrange, GRID_UNITS='degrees',
> POSITION=[0.0,0.0,1.0,1.0])
> map = map('EQUIRECTANGULAR', LIMIT=limit, ASPECT_RATIO=0,
> POSITION=[0.0,0.0,1.0,1.0], /CURRENT)
> Is'nt it ?

Yes, the key point is the undocumented ASPECT_RATIO keyword
on the map projection. It only took me 15 minutes to think of
trying *that*. Maybe I'm beginning to think like a
Function Graphics expert!

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Map Function Question [message #79856 is a reply to message #79855] Thu, 19 April 2012 07:16 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On 19 avr, 15:58, David Fanning <n...@idlcoyote.com> wrote:
> alx writes:
>> When ASPECT_RATIO is not specified, the IMAGE function scales the
>> (nx,ny) image array with equal pixel sizes in x and y, in accordance
>> with POSITION keyword (i.e. the overall scale is given by (pos[1]-
>> pos[0])/nx > (pos[3]-pos[2])/ny). Your POSITION values are therefore
>> satisfied in only one direction.
>> When ASPECT_RATIO=0, the image function scales the array in both x and
>> y direction, independently. But the image is distorted.
>> All this makes sense, but is not really  explained in EXELIS doc.
>
> Well, let's leave aside the fact that the documentation
> for the ASPECT_RATIO seems to be describing an alternative
> Universe.
>
> If setting ASPECT_RATIO=0 does what you say it does, I
> would be *extremely* happy. I don't mind a distorted
> image. That's what I'm trying for. I'm just saying,
> the Image() function is distorting the image, but not
> in any way that even vaguely resembles what I have asked
> it to do!
>
> I'm using the code from the other day. I'm just trying
> to make a display that I can compare with the display
> I created with Coyote Graphics. I can *easily* make
> the Coyote Graphics display look like the function
> graphics display (just set the Keep_Aspect keyword
> on the image). But, it this case, I don't want to do
> that. I want to fill up the goddamn window!
>
> How hard can it be to make an image the proper size?
> I've been doing nothing but that for 20 years! I would
> be happy to supply Excels my cgImage code, if they
> can't find it on the Internet on their own.
>
> Sheesh! The main reason I can't work with Function Graphics
> is that my blood pressure gets out of control. :-(
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>

Maybe I do not fully understand what you exactly want.
But I think that everything can be obtained with an adequate
combination of POSITION, ASPECT_RATIO keywords and CONVERTCOORD, SCALE
and TRANSLATE functions (even ROTATE if you like).
For example, with the yesterday example, you can exactly and entirely
fill your window by doing:
im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, ASPECT_RATIO=0, $
XRANGE=xrange, YRANGE=yrange, GRID_UNITS='degrees',
POSITION=[0.0,0.0,1.0,1.0])
map = map('EQUIRECTANGULAR', LIMIT=limit, ASPECT_RATIO=0,
POSITION=[0.0,0.0,1.0,1.0], /CURRENT)
Is'nt it ?
alx.
Re: Map Function Question [message #79857 is a reply to message #79856] Thu, 19 April 2012 07:16 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> OK, I *finally* figured this out. It turns out that
> I need to set the ASPECT_RATIO=0 keyword on the
> map projection, too, to make this work!

I probably don't need to mention that ASPECT_RATIO
is an undocumented keyword to the Map() function.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Map Function Question [message #79858 is a reply to message #79857] Thu, 19 April 2012 07:14 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> How hard can it be to make an image the proper size?
> I've been doing nothing but that for 20 years! I would
> be happy to supply Excels my cgImage code, if they
> can't find it on the Internet on their own.
>
> Sheesh! The main reason I can't work with Function Graphics
> is that my blood pressure gets out of control. :-(

OK, I *finally* figured this out. It turns out that
I need to set the ASPECT_RATIO=0 keyword on the
map projection, too, to make this work!

scaledData = Byte(Value_Locate(levels, data))
im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, XRANGE=xrange, $
YRANGE=yrange, GRID_UNITS='degrees', $
POSITION=[0.1,0.1,0.9,0.9], ASPECT_RATIO=0)
mp = map('EQUIRECTANGULAR', LIMIT=limit, LABEL_POSITION=0, $
POSITION=[0.1,0.1,0.9,0.9], /CURRENT, ASPECT_RATIO=0)
mc = MapContinents(FILL_COLOR='dark gray', LIMIT=limit)
grid = mp.mapgrid
grid.color='dark gray'
grid.label_color='black'
grid.linestyle = 2
grid.transparency = 25

One and a half days to do this. You must have infinite
patience, my friend!

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Map Function Question [message #79859 is a reply to message #79858] Thu, 19 April 2012 06:58 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
alx writes:

> When ASPECT_RATIO is not specified, the IMAGE function scales the
> (nx,ny) image array with equal pixel sizes in x and y, in accordance
> with POSITION keyword (i.e. the overall scale is given by (pos[1]-
> pos[0])/nx > (pos[3]-pos[2])/ny). Your POSITION values are therefore
> satisfied in only one direction.
> When ASPECT_RATIO=0, the image function scales the array in both x and
> y direction, independently. But the image is distorted.
> All this makes sense, but is not really explained in EXELIS doc.

Well, let's leave aside the fact that the documentation
for the ASPECT_RATIO seems to be describing an alternative
Universe.

If setting ASPECT_RATIO=0 does what you say it does, I
would be *extremely* happy. I don't mind a distorted
image. That's what I'm trying for. I'm just saying,
the Image() function is distorting the image, but not
in any way that even vaguely resembles what I have asked
it to do!

I'm using the code from the other day. I'm just trying
to make a display that I can compare with the display
I created with Coyote Graphics. I can *easily* make
the Coyote Graphics display look like the function
graphics display (just set the Keep_Aspect keyword
on the image). But, it this case, I don't want to do
that. I want to fill up the goddamn window!

How hard can it be to make an image the proper size?
I've been doing nothing but that for 20 years! I would
be happy to supply Excels my cgImage code, if they
can't find it on the Internet on their own.

Sheesh! The main reason I can't work with Function Graphics
is that my blood pressure gets out of control. :-(

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Map Function Question [message #79860 is a reply to message #79859] Thu, 19 April 2012 06:27 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On 19 avr, 14:35, David Fanning <n...@idlcoyote.com> wrote:
> alx writes:
>> Well, it seems that the IMAGE function implicitly uses ASPECT_RATIO=1
>> and then adjust the position.
>> You can get the correct position by forcing ASPECT_RATIO=0 in the
>> call.
>
>> im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, XRANGE=xrange,
>> YRANGE=yrange, GRID_UNITS='degrees', POSITION=[0.1,0.1,0.9,0.9])
>> print,im.convertCoord(x[0],y[0],/DATA,/TO_NORMAL)
>>       0.10000000      0.24925925      0.00000000
>> im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, ASPECT_RATIO=0,
>> XRANGE=xrange, YRANGE=yrange, GRID_UNITS='degrees',
>> POSITION=[0.1,0.1,0.9,0.9])
>> print,im.convertCoord(x[0],y[0],/DATA,/TO_NORMAL)
>>       0.10000000      0.10000000      0.00000000
>
>> One more thing being not clearly documented and which cannot be
>> guessed !
>
> Well, putting ASPECT_RATIO=0 in the call certainly
> changes the aspect ratio to *something*, although
> God only knows what it is. It is certainly not to
> what I asked for. And, whatever it is, the map
> I'm trying to put on top of the image seems
> to ignore it, too.
>
> Tell me again how you are using these routines
> to do science. It does seem a wonder to me!
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>

What I understand:
When ASPECT_RATIO is not specified, the IMAGE function scales the
(nx,ny) image array with equal pixel sizes in x and y, in accordance
with POSITION keyword (i.e. the overall scale is given by (pos[1]-
pos[0])/nx > (pos[3]-pos[2])/ny). Your POSITION values are therefore
satisfied in only one direction.
When ASPECT_RATIO=0, the image function scales the array in both x and
y direction, independently. But the image is distorted.
All this makes sense, but is not really explained in EXELIS doc.
alx.
Re: Map Function Question [message #79865 is a reply to message #79860] Thu, 19 April 2012 05:35 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
alx writes:

> Well, it seems that the IMAGE function implicitly uses ASPECT_RATIO=1
> and then adjust the position.
> You can get the correct position by forcing ASPECT_RATIO=0 in the
> call.
>
> im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, XRANGE=xrange,
> YRANGE=yrange, GRID_UNITS='degrees', POSITION=[0.1,0.1,0.9,0.9])
> print,im.convertCoord(x[0],y[0],/DATA,/TO_NORMAL)
> 0.10000000 0.24925925 0.00000000
> im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, ASPECT_RATIO=0,
> XRANGE=xrange, YRANGE=yrange, GRID_UNITS='degrees',
> POSITION=[0.1,0.1,0.9,0.9])
> print,im.convertCoord(x[0],y[0],/DATA,/TO_NORMAL)
> 0.10000000 0.10000000 0.00000000
>
> One more thing being not clearly documented and which cannot be
> guessed !

Well, putting ASPECT_RATIO=0 in the call certainly
changes the aspect ratio to *something*, although
God only knows what it is. It is certainly not to
what I asked for. And, whatever it is, the map
I'm trying to put on top of the image seems
to ignore it, too.

Tell me again how you are using these routines
to do science. It does seem a wonder to me!

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Map Function Question [message #79866 is a reply to message #79865] Thu, 19 April 2012 02:34 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On 18 avr, 18:20, David Fanning <n...@idlcoyote.com> wrote:
> David Fanning writes:
>> I have a question about the Map() function. I've read the
>> documentation for the POSITION keyword and it suggests the
>> map should go into the specified position in the window.
>> And yet, it doesn't. It positions itself in the window
>> is a way that preserves the aspect ratio of the map.
>> This is a good thing, sometimes, but it's not what I
>> want just at the moment!
>
>> Is there some way to turn this feature off?
>
> Sorry, I just realized it's not the map that is doing
> this, it is the image!
>
>  im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, $
>     POSITION=[0.1,0.1,0.9,0.9])
>
> This image is not going into this position. The map
> is going over the top of the image. Is there a way
> to get the image to honor the POSITION keyword?
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>

Well, it seems that the IMAGE function implicitly uses ASPECT_RATIO=1
and then adjust the position.
You can get the correct position by forcing ASPECT_RATIO=0 in the
call.

im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, XRANGE=xrange,
YRANGE=yrange, GRID_UNITS='degrees', POSITION=[0.1,0.1,0.9,0.9])
print,im.convertCoord(x[0],y[0],/DATA,/TO_NORMAL)
0.10000000 0.24925925 0.00000000
im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, ASPECT_RATIO=0,
XRANGE=xrange, YRANGE=yrange, GRID_UNITS='degrees',
POSITION=[0.1,0.1,0.9,0.9])
print,im.convertCoord(x[0],y[0],/DATA,/TO_NORMAL)
0.10000000 0.10000000 0.00000000

One more thing being not clearly documented and which cannot be
guessed !
alx.
Re: Map Function Question [message #79875 is a reply to message #79866] Wed, 18 April 2012 09:20 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> I have a question about the Map() function. I've read the
> documentation for the POSITION keyword and it suggests the
> map should go into the specified position in the window.
> And yet, it doesn't. It positions itself in the window
> is a way that preserves the aspect ratio of the map.
> This is a good thing, sometimes, but it's not what I
> want just at the moment!
>
> Is there some way to turn this feature off?

Sorry, I just realized it's not the map that is doing
this, it is the image!

im = IMAGE(scaledData, x, y, RGB_TABLE=rgb, $
POSITION=[0.1,0.1,0.9,0.9])

This image is not going into this position. The map
is going over the top of the image. Is there a way
to get the image to honor the POSITION keyword?

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: PyMOL in IDL
Next Topic: What color should it be?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:46:05 PDT 2025

Total time taken to generate the page: 0.00530 seconds