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

Home » Public Forums » archive » Re: Greek Symbols in Plot Annotations
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: Greek Symbols in Plot Annotations [message #69271] Tue, 12 January 2010 08:30
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst writes:

> Crikey, Dave, don't be so hard on yourself. You're making me feel bad. I posted my
> comments to the newsgroup rather than private email because a) my "reply-all" didn't seem
> to give me a valid email for your post and b) I figured your ego could take it. :o)

My ego is fine. :-)

I like ideas that are so incredibly simple, but useful,
that you slap yourself on the forehead and think, "Crikey,
why didn't I think of that!" I've actually had, in a lifetime
of programming, a couple of those kind of ideas. It always
amazes me.

And what also amazes me is how quickly someone else can see
immediately how that great, simple idea can be improved upon.
And it is usually the first person you show it to!

But (at least for me), even simple ideas don't occur
full-blown and complete. They are organic. You are
working on one small thing, and all of a sudden you see
a larger connection, a more general approach, the bigger
picture, as it were. And the idea is just THERE.

But, unfortuately, it is there with all the baggage of the
past two hours work. So the program grows from that, and
not always in the best possible way. It is just something
I have noticed, that's all. And it spills a little bit
of wind out of your sails when it does. I wasn't really
complaining (heck, this is what make programming worth
doing!) so much as I was making what I hoped was a wry
observation. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: Greek Symbols in Plot Annotations [message #69279 is a reply to message #69271] Tue, 12 January 2010 07:17 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
David Fanning wrote:
> Have you even noticed that it is a hell of lot easier
> to write code after the fact then it is while you are
> actually doing it?
>
> What I should do is wait three days after writing a new program
> and e-mailing it to Maarten Sneep and Matt Savoie before
> I let anyone else see it. If I did that, I'd be considered
> a genius, probably. Those boys sure know how to pick good
> ideas apart. And now Paul is piling on.
>
> This is not starting out to be a good week. :-(
>
> Cheers,
>
> David
>
> P.S. Of course, you are right. I'll see what I can do
> do when I get over the embarrassment. :-)

Crikey, Dave, don't be so hard on yourself. You're making me feel bad. I posted my
comments to the newsgroup rather than private email because a) my "reply-all" didn't seem
to give me a valid email for your post and b) I figured your ego could take it. :o)

I mean, you *are* the same David Fanning that runs the "Coyote's Guide to IDL Programming"
website, right? If not, my profuse apologies. :oD

And, anyway, as you pointed out in another followup the list of greek letter octal values
are different for the different !D.NAME cases -- which I didn't notice -- so my argument
falls apart. *Now* who needs to get over their embarrassment? :o/

cheers,

paulv
Re: Greek Symbols in Plot Annotations [message #69281 is a reply to message #69279] Mon, 11 January 2010 15:32 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst writes:

> The only thing the CASE construct should be doing is selecting the right string element,
> right? All the other stuff (prefixing and suffixing with the escape sequences, testing for
> PS or not) can be done outside. Then you only need one CASE construct and the code is not
> so wet[*]. :o)

Now that I look at this more carefully, maybe the code
is not as bad as I thought. I still need two case statements,
since the octal values for a specific Greek character are
often not the same for !4 and !9 fonts. (If they were,
no one would be thinking about writing this function,
probably.)

I could probably write this code slightly more compactly,
but I'm not sure it is worth the trouble. It *is* formatted
nicely. ;-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: Greek Symbols in Plot Annotations [message #69282 is a reply to message #69281] Mon, 11 January 2010 15:14 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst writes:

> Excellent. I no longer need to do stuff like
>
> Delta = !D.NAME EQ 'PS' ? '!9D!X' : '!4D!X'
> epsilon = !D.NAME EQ 'PS' ? '!9e!X' : '!4e!X'
>
> in my code! Woohoo!
>
> BTW, why not do something like
>
> IF !D.NAME EQ 'PS' THEN BEGIN
> DEVICE, /ISOLATIN1
> esc = '!9'
> ENDIF ELSE BEGIN
> esc = '!4'
> ENDELSE
>
> CASE StrLowCase(letter) OF
> 'alpha': greekLetter = (capital) ? String("101B) : String("141B)
> 'beta': greekLetter = (capital) ? String("102B) : String("142B)
> ...etc...
> ENDCASE
> greekLetter = esc + greekLetter + '!X'
>
> ?
>
> The only thing the CASE construct should be doing is selecting the right string element,
> right? All the other stuff (prefixing and suffixing with the escape sequences, testing for
> PS or not) can be done outside. Then you only need one CASE construct and the code is not
> so wet[*]. :o)

Have you even noticed that it is a hell of lot easier
to write code after the fact then it is while you are
actually doing it?

What I should do is wait three days after writing a new program
and e-mailing it to Maarten Sneep and Matt Savoie before
I let anyone else see it. If I did that, I'd be considered
a genius, probably. Those boys sure know how to pick good
ideas apart. And now Paul is piling on.

This is not starting out to be a good week. :-(

Cheers,

David

P.S. Of course, you are right. I'll see what I can do
do when I get over the embarrassment. :-)

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: Greek Symbols in Plot Annotations [message #69283 is a reply to message #69282] Mon, 11 January 2010 15:02 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Excellent. I no longer need to do stuff like

Delta = !D.NAME EQ 'PS' ? '!9D!X' : '!4D!X'
epsilon = !D.NAME EQ 'PS' ? '!9e!X' : '!4e!X'

in my code! Woohoo!

BTW, why not do something like

IF !D.NAME EQ 'PS' THEN BEGIN
DEVICE, /ISOLATIN1
esc = '!9'
ENDIF ELSE BEGIN
esc = '!4'
ENDELSE

CASE StrLowCase(letter) OF
'alpha': greekLetter = (capital) ? String("101B) : String("141B)
'beta': greekLetter = (capital) ? String("102B) : String("142B)
...etc...
ENDCASE
greekLetter = esc + greekLetter + '!X'

?

The only thing the CASE construct should be doing is selecting the right string element,
right? All the other stuff (prefixing and suffixing with the escape sequences, testing for
PS or not) can be done outside. Then you only need one CASE construct and the code is not
so wet[*]. :o)

cheers,

paulv


[*] http://en.wikipedia.org/wiki/Don't_repeat_yourself


David Fanning wrote:
> wlandsman writes:
>
>> Those of us who know LateX have probably been using the TeXtoIDL
>> package for this task. (The original version is at
>> http://physweb.mnstate.edu/mcraig/textoidl/ ; a slightly improved
>> package is available in the excellent Sloan Digital Sky Survey (SDSS)
>> library http://code.google.com/p/sdssidl/ ). One finds the string
>> for the Greek alpha symbol as string = textoidl('\alpha'). But I
>> don't believe that TeXtoIDL handles true-type fonts, so greek.pro
>> should still be useful even for TeXtoIDL users -- thanks.
>
> Maarten Sneep gave me a great suggestion this morning. As
> an alternative to setting the CAPITAL keyword to getting
> the uppercase Greek letter, you can now also capitalize
> the first letter of the Greek name. So, before to get
> a capital letter you did this:
>
> Print, Greek('omega', /CAPITAL)
>
> But now you can also do this:
>
> Print, Greek('Omega')
>
> The program is here:
>
> http://www.dfanning.com/programs/greek.pro
>
> Cheers,
>
> David
>
>
>
Re: Greek Symbols in Plot Annotations [message #69293 is a reply to message #69283] Mon, 11 January 2010 05:44 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
wlandsman writes:

> Those of us who know LateX have probably been using the TeXtoIDL
> package for this task. (The original version is at
> http://physweb.mnstate.edu/mcraig/textoidl/ ; a slightly improved
> package is available in the excellent Sloan Digital Sky Survey (SDSS)
> library http://code.google.com/p/sdssidl/ ). One finds the string
> for the Greek alpha symbol as string = textoidl('\alpha'). But I
> don't believe that TeXtoIDL handles true-type fonts, so greek.pro
> should still be useful even for TeXtoIDL users -- thanks.

Maarten Sneep gave me a great suggestion this morning. As
an alternative to setting the CAPITAL keyword to getting
the uppercase Greek letter, you can now also capitalize
the first letter of the Greek name. So, before to get
a capital letter you did this:

Print, Greek('omega', /CAPITAL)

But now you can also do this:

Print, Greek('Omega')

The program is here:

http://www.dfanning.com/programs/greek.pro

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: Greek Symbols in Plot Annotations [message #69294 is a reply to message #69293] Mon, 11 January 2010 05:26 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
> You can find the Greek program here:
>
>   http://www.dfanning.com/programs/greek.pro
>

Those of us who know LateX have probably been using the TeXtoIDL
package for this task. (The original version is at
http://physweb.mnstate.edu/mcraig/textoidl/ ; a slightly improved
package is available in the excellent Sloan Digital Sky Survey (SDSS)
library http://code.google.com/p/sdssidl/ ). One finds the string
for the Greek alpha symbol as string = textoidl('\alpha'). But I
don't believe that TeXtoIDL handles true-type fonts, so greek.pro
should still be useful even for TeXtoIDL users -- thanks.

--Wayne
Re: Greek Symbols in Plot Annotations [message #69296 is a reply to message #69294] Sun, 10 January 2010 12:15 Go to previous message
cgguido is currently offline  cgguido
Messages: 195
Registered: August 2005
Senior Member
My reaction to your post is: what's a few days late for Christmas (or
the Epiphany) for a present like this!?!?! Thank you very much!

Gianguido
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Removing if then else loop for efficiency
Next Topic: Re: pointer & structure

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

Current Time: Wed Oct 08 19:32:50 PDT 2025

Total time taken to generate the page: 0.00469 seconds