Re: Greek Symbols in Plot Annotations [message #69271] |
Tue, 12 January 2010 08:30 |
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  |
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  |
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  |
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  |
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  |
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.")
|
|
|
|
|