Research tools: who what which how?

We recently had an inconclusive discussion of computer languages over
on radiance-dev. At the end of it, I was left wondering what languages
people are using in their research, engineering, and design practices.

My impression is that Python has become something of a standard in the
research community, with tools like SciPy, NumPy, and SAGE widely
used, though Perl has a library comparable to NumPy in PDL, and there
is a SciRuby also, of course, LISP.

On the statistical side there is R and Excel and LibreOffice Calc.

Then there is MATLAB, Mathematica, MAPLE, and even Maxima is still around.

I suppose we might also have some Visual Basic and C# users around

So who is using what? What do people like?

Randolph

I would think that ruby would be a good candidate due to its close tie to OpenStudio and measure writing.

···

At 08:37 PM 12/04/2016, you wrote:

We recently had an inconclusive discussion of computer languages over
on radiance-dev. At the end of it, I was left wondering what languages
people are using in their research, engineering, and design practices.

My impression is that Python has become something of a standard in the
research community, with tools like SciPy, NumPy, and SAGE widely
used, though Perl has a library comparable to NumPy in PDL, and there
is a SciRuby also, of course, LISP.

On the statistical side there is R and Excel and LibreOffice Calc.

Then there is MATLAB, Mathematica, MAPLE, and even Maxima is still around.

I suppose we might also have some Visual Basic and C# users around

So who is using what? What do people like?

Randolph

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Christopher R. Jones, P.Eng.
14 Oneida Avenue
Toronto, ON
M5J 2E3
Tel. 416-203-7465
Fax. 416-946-1005

I started using Ruby because the SketchUp API is in that language, and I
think it is a great language with thousands of freely available modules,
tutorials, documentation, etc. It also allows multithreading, which is
awesome.

Some people say it is slow, but since I usually mix Ruby with Radiance, the
slowest parts are always due to the ray-tracing process (increasing
performance on the script will reduce the run time very little).

I understand a lot of people uses Python, though... I have not been able to
get used to that language.

Best,

···

2016-04-12 22:35 GMT-03:00 Chris Jones <[email protected]>:

I would think that ruby would be a good candidate due to its close tie to
OpenStudio and measure writing.

At 08:37 PM 12/04/2016, you wrote:

We recently had an inconclusive discussion of computer languages over
on radiance-dev. At the end of it, I was left wondering what languages
people are using in their research, engineering, and design practices.

My impression is that Python has become something of a standard in the
research community, with tools like SciPy, NumPy, and SAGE widely
used, though Perl has a library comparable to NumPy in PDL, and there
is a SciRuby also, of course, LISP.

On the statistical side there is R and Excel and LibreOffice Calc.

Then there is MATLAB, Mathematica, MAPLE, and even Maxima is still around.

I suppose we might also have some Visual Basic and C# users around

So who is using what? What do people like?

Randolph

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Christopher R. Jones, P.Eng.
14 Oneida Avenue
Toronto, ON
M5J 2E3
Tel. 416-203-7465
Fax. 416-946-1005

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

I'm under the impression that people choose programming languages based on
the APIs that make them necessary. Projects that allow us to start from
scratch using any language of our choosing are quite rare once we move past
the level of a school homework assignment.

I use C# for Rhino/Grasshopper, 3ds Max, and Autocad plug-ins, Ruby for
SketchUp, C for Radiance programming, and good old DOS and Bash for
Radiance scripting because those are the languages supported and/or
languages used in others' work that I've adapted. For small projects that I
really can start from scratch, I use Java because it's the first language I
learned.

My two cents on this thread: Pick the language that is appropriate to your
project, not the language that you've heard is "popular".

Nathaniel

···

On Wed, Apr 13, 2016 at 8:18 AM, Germán Molina Larrain <[email protected] > wrote:

I started using Ruby because the SketchUp API is in that language, and I
think it is a great language with thousands of freely available modules,
tutorials, documentation, etc. It also allows multithreading, which is
awesome.

Some people say it is slow, but since I usually mix Ruby with Radiance,
the slowest parts are always due to the ray-tracing process (increasing
performance on the script will reduce the run time very little).

I understand a lot of people uses Python, though... I have not been able
to get used to that language.

Best,

2016-04-12 22:35 GMT-03:00 Chris Jones <[email protected]>:

I would think that ruby would be a good candidate due to its close tie to
OpenStudio and measure writing.

At 08:37 PM 12/04/2016, you wrote:

We recently had an inconclusive discussion of computer languages over
on radiance-dev. At the end of it, I was left wondering what languages
people are using in their research, engineering, and design practices.

My impression is that Python has become something of a standard in the
research community, with tools like SciPy, NumPy, and SAGE widely
used, though Perl has a library comparable to NumPy in PDL, and there
is a SciRuby also, of course, LISP.

On the statistical side there is R and Excel and LibreOffice Calc.

Then there is MATLAB, Mathematica, MAPLE, and even Maxima is still around.

I suppose we might also have some Visual Basic and C# users around

So who is using what? What do people like?

Randolph

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Christopher R. Jones, P.Eng.
14 Oneida Avenue
Toronto, ON
M5J 2E3
Tel. 416-203-7465
Fax. 416-946-1005

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

I'm under the impression that people choose programming languages based on the APIs that make them necessary.

Bingo.

My two cents on this thread: Pick the language that is appropriate to your project, not the language that you've heard is "popular".

Bingo, again.

As for me I use Ruby for scripting (now), precisely for the API reason Nathaniel stated above. SketchUp's API is Ruby, so the OpenStudio team exports the C++ codebase to Ruby too, and that's how our internal scripts or "measures" are written. Prior to that though, I used Python, at Schorsch's urging (this goes all the way back to 2003). Still using bash too though. For stats and dataviz, I'm trying to use R and JavaScript libraries, but also fall back on Excel/VBA because I know it. R is great for large datasets though. If I was still doing a lot of Python, I imagine the same could be accomplished with matplotlib/numpy though. Nathaniel said all of this more succinctly. I'm out!

- Rob

···

On 4/13/16, 6:48 AM, "Nathaniel Jones" <[email protected]<mailto:[email protected]>> wrote:

I focus on bash because little snippets help just as much on the standard terminal as they do in a script. I'm not writing plugins so I've never thought about API compatibility, but only how quickly I can figure out how to do what I need. I had two intro courses to C++ long ago in high school and college, so as my "native tongue" of programming, anything I can relate to that tends to be most comfortable to me.

I've picked up a few python snippets from the web for large data file manipulation. I don't find the language very intuitive from the few examples I've used, but it definitely handles data well.

I've never even investigated Ruby or PERL. Do both handle large data sets quickly and efficiently? Is either one more relatable to bash or C++?

Regarding Randolph's original question, I suppose I've had some LISP exposure through AutoCAD but not at all recently. And more recent working experience with MATLAB and Mathematica.

-Chris

···

____________________________________________________________
Electronic mail messages entering and leaving Arup business
systems are scanned for acceptability of content and viruses

Ruby and Perl are both more relatable to Bash, as they all are interpreted
loosely-typed languages.

···

On 4/13/16, 9:28 AM, "Christopher Rush" <[email protected]> wrote:

I focus on bash because little snippets help just as much on the standard
terminal as they do in a script. I'm not writing plugins so I've never
thought about API compatibility, but only how quickly I can figure out
how to do what I need. I had two intro courses to C++ long ago in high
school and college, so as my "native tongue" of programming, anything I
can relate to that tends to be most comfortable to me.

I've picked up a few python snippets from the web for large data file
manipulation. I don't find the language very intuitive from the few
examples I've used, but it definitely handles data well.

I've never even investigated Ruby or PERL. Do both handle large data sets
quickly and efficiently? Is either one more relatable to bash or C++?

Regarding Randolph's original question, I suppose I've had some LISP
exposure through AutoCAD but not at all recently. And more recent working
experience with MATLAB and Mathematica.

-Chris
____________________________________________________________
Electronic mail messages entering and leaving Arup business
systems are scanned for acceptability of content and viruses

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

For a trivial example of transposing a matrix tab delimited data file... which of these is most easily understood, reproducible, and fastest. Also note, I couldn't find a working Ruby example...

perl -anF'\t|\n' -e'$n=@F-1if!$n;for(0..$n){push@{$$m[$_]},$F[$_]} END{print map{join"\t",@$_,"\n"}@$m}'
^^ this takes a quarter of a second on 148K file, and doesn't look particularly clean but I could probably figure it out by researching the documentation

python -c "import sys; print('\n'.join(' '.join(c) for c in zip(*(l.split() for l in sys.stdin.readlines() if l.strip()))))"
^^ this takes half a second on 148K file but looks a bit baffling to me

awk '{for (f=1;f<=NF;f++) col[f] = col[f]":"$f} END {for (f=1;f<=NF;f++) print col[f]}' | tr ':' ' '
^^ this takes 2 seconds on 148K file which isn't very good, but probably the easiest to interpret by eye, in my opinion

ruby -e 'puts readlines.map(&:split).transpose.map{|x|x*" "}'
^^ I couldn't make this or any other Ruby examples I found online work, which might mean I have a basic misunderstand of how to type this in a single line workflow on the terminal. And all the examples I could find look like a black box to me because apparently there are functions built in to do this task.

echo '' >tmp1; cat m.txt |while read l ; do paste tmp1 <(echo $l | tr -s ' ' \\n)>tmp2; cp tmp2 tmp1; done
^^ this series of commands is basically disqualified because it takes far too long

Taken from these threads:


···

____________________________________________________________
Electronic mail messages entering and leaving Arup business
systems are scanned for acceptability of content and viruses

In alphabetical order: bash, c, c++, clojure, haskell, java, R.

Haskell is often the quickest to write and and runs as compiled code --
comparable to intelligently written but un-optimized c, c++ and Java. The
learning curve is painfully steep.

···

On Wed, Apr 13, 2016 at 10:01 AM, Christopher Rush < [email protected]> wrote:

For a trivial example of transposing a matrix tab delimited data file...
which of these is most easily understood, reproducible, and fastest. Also
note, I couldn't find a working Ruby example...

perl -anF'\t|\n' -e'$n=@F-1if!$n;for(0..$n){push@{$$m[$_]},$F[$_]}
END{print map{join"\t",@$_,"\n"}@$m}'
^^ this takes a quarter of a second on 148K file, and doesn't look
particularly clean but I could probably figure it out by researching the
documentation

python -c "import sys; print('\n'.join(' '.join(c) for c in
zip(*(l.split() for l in sys.stdin.readlines() if l.strip()))))"
^^ this takes half a second on 148K file but looks a bit baffling to me

awk '{for (f=1;f<=NF;f++) col[f] = col[f]":"$f} END {for (f=1;f<=NF;f++)
print col[f]}' | tr ':' ' '
^^ this takes 2 seconds on 148K file which isn't very good, but probably
the easiest to interpret by eye, in my opinion

ruby -e 'puts readlines.map(&:split).transpose.map{|x|x*" "}'
^^ I couldn't make this or any other Ruby examples I found online work,
which might mean I have a basic misunderstand of how to type this in a
single line workflow on the terminal. And all the examples I could find
look like a black box to me because apparently there are functions built in
to do this task.

echo '' >tmp1; cat m.txt |while read l ; do paste tmp1 <(echo $l | tr -s
' ' \\n)>tmp2; cp tmp2 tmp1; done
^^ this series of commands is basically disqualified because it takes far
too long

Taken from these threads:
http://stackoverflow.com/questions/1729824/transpose-a-file-in-bash
http://stackoverflow.com/questions/3249508/transpose-in-perl

____________________________________________________________
Electronic mail messages entering and leaving Arup business
systems are scanned for acceptability of content and viruses

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

I would agree with a lot that's been said so far. My two cents:

Pick the language that's best for the project at hand, not one you just
"know".

For me, a quick script is best written in Python (I'm very familiar with
syntax/semantics of the language), but if I'm starting a "real" project, I
would look at the tasks needed to be done and how best to do them (e.g.
available data structures, API's, object oriented or not) then look at
different languages, first the ones I know, then even check out others.

Sometimes, however, with larger projects where speed is starting to be a
concern, you need to pick languages based on computation. For example, C
and Fortran are much faster than say Matlab for large matrix manipulation.

This is a very DEEP topic, which some EECS/CS people spend their whole
lives answering.

Good luck in your projects!

- Alex Mead

···

On Wed, Apr 13, 2016 at 9:05 AM, Guglielmetti, Robert < [email protected]> wrote:

Ruby and Perl are both more relatable to Bash, as they all are interpreted
loosely-typed languages.

On 4/13/16, 9:28 AM, "Christopher Rush" <[email protected]> wrote:

>I focus on bash because little snippets help just as much on the standard
>terminal as they do in a script. I'm not writing plugins so I've never
>thought about API compatibility, but only how quickly I can figure out
>how to do what I need. I had two intro courses to C++ long ago in high
>school and college, so as my "native tongue" of programming, anything I
>can relate to that tends to be most comfortable to me.
>
>I've picked up a few python snippets from the web for large data file
>manipulation. I don't find the language very intuitive from the few
>examples I've used, but it definitely handles data well.
>
>I've never even investigated Ruby or PERL. Do both handle large data sets
>quickly and efficiently? Is either one more relatable to bash or C++?
>
>Regarding Randolph's original question, I suppose I've had some LISP
>exposure through AutoCAD but not at all recently. And more recent working
>experience with MATLAB and Mathematica.
>
>-Chris
>____________________________________________________________
>Electronic mail messages entering and leaving Arup business
>systems are scanned for acceptability of content and viruses
>
>
>_______________________________________________
>Radiance-general mailing list
>[email protected]
>http://www.radiance-online.org/mailman/listinfo/radiance-general

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

--
Alex Mead
(616) 901-2479, UC Berkeley Systems Engineering Ph.D. (expected 2016),
www.alex-mead.com

www.CEEphotos.com <http://www.ceephotos.com> - web master, creator

Oh, my! I wasn't trying to start a "Which language is best"
discussion, truly, I wasn't.

Personally, in participating in a large long-standing research,
engineering, or design community I'm inclined to stick with the common
languages of the community, at least when I can afford them.
(Autodesk, I'm looking at you.) So that was the basis of my question;
what would fit in in this community? The answer, so far, seems to be
that there are multiple communities of Radiance users who use varied
tools. Hunh. Some tools that aren't being spoken for here: I know
there are people using MATLAB with Radiance, for instance, and none of
them have spoken up.

I'm surprised that higher-level tools aren't getting any play in this
discussion; things NumPy, SciPy, and SciRuby. Why, after all, write
your own transpose routine when you can download a tested one, and
also get a tested package that includes more difficult operations like
inversion and calculation of eigenvalues? Perhaps only Greg and Andy
and a few others need the really fancy math here?

Randolph

My first "major" language was Autolisp (the veterans here will remember).
That got me hooked on the functional approach, which I still value today
in other languages.

Then I found that the API had a very nasty bug (IRRC, "(entget)" without
picking anything crashed Autocad R7 on SunOS), which made me look into C.
There I learned that even a seemingly "simple" language can give you
tremendous power.

Next I learned the object oriented approach with Oberon. Directly at
the source and on the original Oberon hardware (never met Wirth himself,
though). Since then, encapsulation and inheritance come naturally to me,
but I also detected that I didn't like the overly verbose Pascal syntax.

While working on a Radiance GUI in Autolisp (yes, that's a thing),
I discovered a then rather new and largely unknown language. It combined
functional and object oriented features (both optional), and had a simple
syntax that would not get into the way.
The current incarnation of Python is still my language of choice.
Fortunately, most relevant 3D software (minus Sketchup) has a Python
API nowadays.

Working on code from others, I gradually acquired the basics of C++.
While that one makes memory management simpler than in C (using
predefined classes and templates), I'll probably never manage to dig
into most of the more complicated features in there.

And more recently, I did some deeper excursions into JavaScript.
That's the price to pay when you want to bring interactive 3D
graphics to the web...

Cheers
-schorsch

···

Am 2016-04-13 02:37, schrieb Randolph M. Fritz:

We recently had an inconclusive discussion of computer languages over
on radiance-dev. At the end of it, I was left wondering what languages
people are using in their research, engineering, and design practices.

My impression is that Python has become something of a standard in the
research community, with tools like SciPy, NumPy, and SAGE widely
used, though Perl has a library comparable to NumPy in PDL, and there
is a SciRuby also, of course, LISP.

On the statistical side there is R and Excel and LibreOffice Calc.

Then there is MATLAB, Mathematica, MAPLE, and even Maxima is still around.

I suppose we might also have some Visual Basic and C# users around

So who is using what? What do people like?

Randolph

--
Georg Mischler -- simulations developer -- schorsch at schorsch com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/

Somewhat off-topic, but...

Out of curiosity, I played around with those examples a bit.
I had to slightly modify all of them, first to get Perl and Ruby to run
at all, and then to make sure all of them produce tabs instead of spaces.
Btw: The Perl version adds an extra tab at the end of each line.

perl -anF'\t|\n' -e'$n=@F-1 if \!$n;for(0..$n){push@{$$m[$_]},$F[$_]} END{print map{join"\t",@$_,"\n"}@$m}'

python -c "import sys; print('\n'.join('\t'.join(c) for c in zip(*(l.split() for l in sys.stdin.readlines() if l.strip()))))"

ruby -e 'puts readlines.map(&:split).transpose.map(){|x|x*"\t"}'

The result shows (as expected) that this kind of comparison is utterly
meaningless. There are simply too many factors out of your control
that can influence the result. Between Perl and Python, the
executables that happen to be installed on my box pretty much get the
opposite result than you reported. Maybe my Python is in better shape
than yours, because it gets more exercise... :wink:

I'm actually a bit surprised by the bad performance of Perl. One of
the reasons may be the suboptimal algorithm, which explicitly loops
through the data in the interpreter. The other two use a functional
approach, where the heavy lifting is handled in C. Ruby has a slower
startup time, but its operating performance is much closer to Python.
I also didn't expect that much of a speed-up with Python 3 over 2.

The Python version is easy to understand, once you know that the
builtin function zip() is equivalent to Rubys transpose(). The rest
is IO and string manipulation. You also may not be familiar with
generator expressions. Very powerful stuff!

150 Kb (160 x 160 matrix)

0.2 perl 5
0.1 python 2.7
0.02 python 3.4
0.4 ruby

6 Mb (1000 x 1000 matrix)

1.02 perl 5
0.36 python 2.7
0.22 python 3.4
0.48 ruby 2.1

24 Mb (2000 x 2000 matrix)

4.11 perl 5
1.74 python 2.7
1.13 python 3.4
2.41 ruby 2.1

Cheers
-schorsch

···

Am 2016-04-13 19:01, schrieb Christopher Rush:

For a trivial example of transposing a matrix tab delimited data
file... which of these is most easily understood, reproducible, and
fastest. Also note, I couldn't find a working Ruby example...

perl -anF'\t|\n' -e'$n=@F-1if!$n;for(0..$n){push@{$$m[$_]},$F[$_]}
END{print map{join"\t",@$_,"\n"}@$m}'
^^ this takes a quarter of a second on 148K file, and doesn't look
particularly clean but I could probably figure it out by researching
the documentation

python -c "import sys; print('\n'.join(' '.join(c) for c in
zip(*(l.split() for l in sys.stdin.readlines() if l.strip()))))"
^^ this takes half a second on 148K file but looks a bit baffling to me

awk '{for (f=1;f<=NF;f++) col[f] = col[f]":"$f} END {for
(f=1;f<=NF;f++) print col[f]}' | tr ':' ' '
^^ this takes 2 seconds on 148K file which isn't very good, but
probably the easiest to interpret by eye, in my opinion

ruby -e 'puts readlines.map(&:split).transpose.map{|x|x*" "}'
^^ I couldn't make this or any other Ruby examples I found online
work, which might mean I have a basic misunderstand of how to type
this in a single line workflow on the terminal. And all the examples I
could find look like a black box to me because apparently there are
functions built in to do this task.

echo '' >tmp1; cat m.txt |while read l ; do paste tmp1 <(echo $l | tr
-s ' ' \\n)>tmp2; cp tmp2 tmp1; done
^^ this series of commands is basically disqualified because it takes
far too long

Taken from these threads:
http://stackoverflow.com/questions/1729824/transpose-a-file-in-bash
http://stackoverflow.com/questions/3249508/transpose-in-perl

--
Georg Mischler -- simulations developer -- schorsch at schorsch com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/

Schorsch, Thanks! Precisely the type of response I was trying to poke for. I threw something together in a few minutes from a quick google search just to steer the conversation. I certainly didn't do much quality comparison, and zero thinking about if any of these are really the right way to do it. My primary note is that we can debate the optimal, but the collective mental barriers and user-group predisposition, and size or quality of searchable online resources should be considered. I'm not the best person to consider them since I have very little depth in any language, but just noting to keep novices like me in mind. I honestly don't know if those make a case for any one language, but I felt compelled to add my two cents - since everyone else was talking about APIs which I have no concern for.

I always wish that threads like this one gave me more definitive suggestions for putting more effort in any one language (which, of course, is asking too much!).

···

-----Original Message-----
From: Georg Mischler [mailto:[email protected]]

Somewhat off-topic, but...

Out of curiosity, I played around with those examples a bit.
I had to slightly modify all of them, first to get Perl and Ruby to run
at all, and then to make sure all of them produce tabs instead of
spaces.
Btw: The Perl version adds an extra tab at the end of each line.

perl -anF'\t|\n' -e'$n=@F-1 if \!$n;for(0..$n){push@{$$m[$_]},$F[$_]}
END{print map{join"\t",@$_,"\n"}@$m}'

python -c "import sys; print('\n'.join('\t'.join(c) for c in
zip(*(l.split() for l in sys.stdin.readlines() if l.strip()))))"

ruby -e 'puts readlines.map(&:split).transpose.map(){|x|x*"\t"}'

The result shows (as expected) that this kind of comparison is utterly
meaningless. There are simply too many factors out of your control
that can influence the result. Between Perl and Python, the
executables that happen to be installed on my box pretty much get the
opposite result than you reported. Maybe my Python is in better shape
than yours, because it gets more exercise... :wink:

I'm actually a bit surprised by the bad performance of Perl. One of
the reasons may be the suboptimal algorithm, which explicitly loops
through the data in the interpreter. The other two use a functional
approach, where the heavy lifting is handled in C. Ruby has a slower
startup time, but its operating performance is much closer to Python.
I also didn't expect that much of a speed-up with Python 3 over 2.

The Python version is easy to understand, once you know that the
builtin function zip() is equivalent to Rubys transpose(). The rest
is IO and string manipulation. You also may not be familiar with
generator expressions. Very powerful stuff!

150 Kb (160 x 160 matrix)

0.2 perl 5
0.1 python 2.7
0.02 python 3.4
0.4 ruby

6 Mb (1000 x 1000 matrix)

1.02 perl 5
0.36 python 2.7
0.22 python 3.4
0.48 ruby 2.1

24 Mb (2000 x 2000 matrix)

4.11 perl 5
1.74 python 2.7
1.13 python 3.4
2.41 ruby 2.1

Cheers
-schorsch

____________________________________________________________
Electronic mail messages entering and leaving Arup business
systems are scanned for acceptability of content and viruses

The "definitive suggestions" you're hoping for will always necessarily
be highly subjective. If you want help deciding which language to
learn next, you'll have to ask more specific questions.

My personal preference is no secret. Now the discussion here (and on
radiance-dev) has prompted me to finally have a much closer look at
Ruby than before. Unfortunately, that hasn't really improved my
opinion about it...

But is that relevant to you? Since I don't know what you're actually
looking for, I have no idea.

Cheers
-schorsch

···

Am 2016-04-18 16:31, schrieb Christopher Rush:

Schorsch, Thanks! Precisely the type of response I was trying to poke
for. I threw something together in a few minutes from a quick google
search just to steer the conversation. I certainly didn't do much
quality comparison, and zero thinking about if any of these are really
the right way to do it. My primary note is that we can debate the
optimal, but the collective mental barriers and user-group
predisposition, and size or quality of searchable online resources
should be considered. I'm not the best person to consider them since I
have very little depth in any language, but just noting to keep
novices like me in mind. I honestly don't know if those make a case
for any one language, but I felt compelled to add my two cents - since
everyone else was talking about APIs which I have no concern for.

I always wish that threads like this one gave me more definitive
suggestions for putting more effort in any one language (which, of
course, is asking too much!).

-----Original Message-----
From: Georg Mischler [mailto:[email protected]]

Somewhat off-topic, but...

Out of curiosity, I played around with those examples a bit.
I had to slightly modify all of them, first to get Perl and Ruby to run
at all, and then to make sure all of them produce tabs instead of
spaces.
Btw: The Perl version adds an extra tab at the end of each line.

perl -anF'\t|\n' -e'$n=@F-1 if \!$n;for(0..$n){push@{$$m[$_]},$F[$_]}
END{print map{join"\t",@$_,"\n"}@$m}'

python -c "import sys; print('\n'.join('\t'.join(c) for c in
zip(*(l.split() for l in sys.stdin.readlines() if l.strip()))))"

ruby -e 'puts readlines.map(&:split).transpose.map(){|x|x*"\t"}'

The result shows (as expected) that this kind of comparison is utterly
meaningless. There are simply too many factors out of your control
that can influence the result. Between Perl and Python, the
executables that happen to be installed on my box pretty much get the
opposite result than you reported. Maybe my Python is in better shape
than yours, because it gets more exercise... :wink:

I'm actually a bit surprised by the bad performance of Perl. One of
the reasons may be the suboptimal algorithm, which explicitly loops
through the data in the interpreter. The other two use a functional
approach, where the heavy lifting is handled in C. Ruby has a slower
startup time, but its operating performance is much closer to Python.
I also didn't expect that much of a speed-up with Python 3 over 2.

The Python version is easy to understand, once you know that the
builtin function zip() is equivalent to Rubys transpose(). The rest
is IO and string manipulation. You also may not be familiar with
generator expressions. Very powerful stuff!

150 Kb (160 x 160 matrix)

0.2 perl 5
0.1 python 2.7
0.02 python 3.4
0.4 ruby

6 Mb (1000 x 1000 matrix)

1.02 perl 5
0.36 python 2.7
0.22 python 3.4
0.48 ruby 2.1

24 Mb (2000 x 2000 matrix)

4.11 perl 5
1.74 python 2.7
1.13 python 3.4
2.41 ruby 2.1

Cheers
-schorsch

--
Georg Mischler -- simulations developer -- schorsch at schorsch com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/

I had recently been assuming python would become our go-to for data manipulation based on popularity, but I'm learning that shouldn't be my assumption within the Radiance community - which I bet was Randolph's original intent in this thread.

Maybe I'll attempt Ruby for the next solution I need to sort out.

For me personally, I'll probably never really "learn" any of these, I'll just Google search snippets to cobble together whatever I need - but only when bash can't do it well and the internet can present a better solution : ) I suppose I could say I've "learned" bash because I've examined enough snippets and written enough from scratch for multiple years, but unless I attempted to abandon bash and tried to do all of my six-scripts-per-year in python/ruby/etc I'll remain a newbie in each one.

Sorry - didn't mean to hijack the thread - just throwing in an extra perspective. I don't really need any specific guidance at the moment.

-Chris

···

____________________________________________________________
Electronic mail messages entering and leaving Arup business
systems are scanned for acceptability of content and viruses

Hi Chris,

I have the same issue with passing familiarity with too many languages. Despite having written a whole GUI in Tcl/Tk, I have a horrible time understanding even what I've written in the language. In contrast, even the most obfuscated bit of code in C seems easy enough to follow.

Perl is somewhere in-between for me. It's a bit ugly, but similar enough to C for me to follow along without having to struggle too much. I can't say the same for Python or even C++, mostly because I never really got comfortable with the object-oriented approach, despite having spent more than half my programming career employing it. I'm definitely one of those reluctant adopters, where most of my C++ code follows a strong procedural bent.

I agree with what you said earlier about the advantage of scripting is that you can go freely between command-line and batch file. It makes the evolution from running a few commands until you get it right to putting what you need in a script so much easier. Unfortunately, there isn't one command interpreter that works cross-platform, which is why we have the issue with too many C-shell utilities in Radiance.

-Greg

···

From: Christopher Rush <[email protected]>
Subject: Re: [Radiance-general] Research tools: who what which how?
Date: April 18, 2016 3:16:39 PM PDT

I had recently been assuming python would become our go-to for data manipulation based on popularity, but I'm learning that shouldn't be my assumption within the Radiance community - which I bet was Randolph's original intent in this thread.

Maybe I'll attempt Ruby for the next solution I need to sort out.

For me personally, I'll probably never really "learn" any of these, I'll just Google search snippets to cobble together whatever I need - but only when bash can't do it well and the internet can present a better solution : ) I suppose I could say I've "learned" bash because I've examined enough snippets and written enough from scratch for multiple years, but unless I attempted to abandon bash and tried to do all of my six-scripts-per-year in python/ruby/etc I'll remain a newbie in each one.

Sorry - didn't mean to hijack the thread - just throwing in an extra perspective. I don't really need any specific guidance at the moment.

-Chris

I wouldn't jump to any conclusions about overall "popularity" from the
few responses to this thread. Of the people out there who have actually
written and published tools for Radiance, most did not respond.

On the other hand, Python versions of a number of the common scripts
in Radiance will be added to the distribution in the near future.
That will simplify a few things, especially for Windows users.
Of course that still doesn't mean that anyone has to learn the language
who doesn't otherwise care about it.

Cheers
-schorsch

···

Am 2016-04-19 00:16, schrieb Christopher Rush:

I had recently been assuming python would become our go-to for data
manipulation based on popularity, but I'm learning that shouldn't be
my assumption within the Radiance community - which I bet was
Randolph's original intent in this thread.

Maybe I'll attempt Ruby for the next solution I need to sort out.

For me personally, I'll probably never really "learn" any of these,
I'll just Google search snippets to cobble together whatever I need -
but only when bash can't do it well and the internet can present a
better solution : ) I suppose I could say I've "learned" bash
because I've examined enough snippets and written enough from scratch
for multiple years, but unless I attempted to abandon bash and tried
to do all of my six-scripts-per-year in python/ruby/etc I'll remain a
newbie in each one.

Sorry - didn't mean to hijack the thread - just throwing in an extra
perspective. I don't really need any specific guidance at the moment.

-Chris

--
Georg Mischler -- simulations developer -- schorsch at schorsch com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/