Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

The Center of PerlMonk Mass

by Masem (Monsignor)
on Jul 09, 2001 at 07:45 UTC ( #94908=CUFP: print w/ replies, xml ) Need Help??

Inspired by the Debian Developer's Center of Mass, I've taken the monk position list from PM Statistics via XML, parsed it and did some basic math calculations, then used the program XPlanet to generate the needed views, all to calculate and locate the center of mass for the registered Perlmonks.

Short story: ignoring the fact that it's probably buried a few miles into the earth, the center of mass is somewhere in northern Quebec, near the southern tip of Hudson Bay. The specific coordinates are 53.19 deg N, 75.25 deg W. Notice that there are a few monks with rather questionable locations (like, middle of the Indian/Pacific oceans), but these probably aren't pulling the average that far out of whack.

If you don't see what you think is you position, please visit PM Statistics to find out how to get yourself located, such that future generations of these images will include you.

Currently, you can see the maps here and here. jcwren has considered adding this to his PM Stats pages as well, since it's sort of an obvious extention to it.

Update - I've now done the NA and EU 'subsets' for center of mass; the maps are here for NA and here for EU. Respectively, the centers of mass are at 40.89N, 93.46W (About 40 miles south of Des Moines, Iowa), and 51.05N, 4.8E (About 20 miles NE of Bruselles, Belguim). Additionally, I worked out the 'depth' of these points, assuming about 3900 mile radius of the earth; The overall center of mass is about 829 miles deep, the NA one is 129 miles deep, and the EU one is only 25 miles deep.

For those interested, here's the code that I used to generate the maps above; the code that might end on jcwren's box might be subtly different.

#!/usr/bin/perl -w use strict; use LWP::Simple; use XML::Simple; use POSIX qw(atan2); my $xml = "http://www.tinymicros.com/pm/monks.xml"; # Step 1 : Get data my $data = get( $xml ); my $ref = XMLin( $data ); # Step 2 : Calculate Center of Mass, need to write out coordinates too my $coordfile = "monk.coord"; open FILE, ">$coordfile" or die $!; my ( $total, $avg_x, $avg_y, $avg_z ) = ( 0,0,0,0 ); foreach my $monk ( keys %{ $ref->{ monk } } ) { my $lat = $ref->{ monk }->{ $monk }->{ location }->{ latitude }; my $long = $ref->{ monk }->{ $monk }->{ location }->{ longitude }; print FILE "$lat $long color=white\n"; $lat *= 3.14159/180; $long *= 3.14159/180; $total++; $avg_x += cos( $lat ) * sin( $long ); $avg_y += -cos( $lat ) * cos( $long ); $avg_z += sin( $lat ); } $avg_x = $avg_x/$total; $avg_y = $avg_y/$total; $avg_z = $avg_z/$total; close FILE; my $lat_av = atan2( $avg_z, sqrt( $avg_x*$avg_x + $avg_y*$avg_y ) ); my $long_av = atan2( $avg_x, -$avg_y ); $lat_av *= 180/3.14159; $long_av *= 180/3.14159; # Step 3: Write arcs to file my $arcfile = "monk.arcs"; open FILE, ">$arcfile" or die $!; foreach my $monk ( keys %{ $ref->{ monk } } ) { my $lat = $ref->{ monk }->{ $monk }->{ location }->{ latitude }; my $long = $ref->{ monk }->{ $monk }->{ location }->{ longitude }; printf FILE "%+8.2f %+8.2f %+8.2f %+8.2f color=ForestGreen spacing +=0.5\n", $lat, $long, $lat_av, $long_av; } close FILE; my $avgfile = "monk.avg"; open FILE, ">$avgfile" or die $!; printf FILE "%+8.2f %+8.2f \"Average\" color=white\n", $lat_av, $long_ +av; close FILE; # Step 4 : Run xplanet my $mercator_map = "map1.png"; my $globe_map = "map2.png"; my $caption = "Copyright Michael K. Neylon -- Generated on " . localti +me(time); my $lat_long = sprintf "Average location: Latitude %+3.2f, Longitude %+3.2f", $lat_av, $lon +g_av; my $capfile = "monks.cap"; open FILE, ">$capfile" or die $!; print FILE "15 15 \"$caption\" image=none position=pixel color=yellow\ +n"; print FILE "580 15 \"$lat_long\" image=none position=pixel color=yello +w\n"; close FILE; my $capfile2 = "monks2.cap"; open FILE, ">$capfile2" or die $!; print FILE "15 15 \"$caption\" image=none position=pixel color=darkred +\n"; print FILE "580 15 \"$lat_long\" image=none position=pixel color=darkr +ed\n"; close FILE; my $mercator_command = qq( xplanet -markerfile $coordfile -markerfile $avgfile -long $long_ +av -greatarcfile $arcfile -shade 100 -output $mercator_map -geometry + 800x600 -grid -projection mercator -markerfile $capfile2 -grid1 6 -grid2 +5 ); my $globe_command = qq( xplanet -markerfile $coordfile -markerfile $avgfile -long $long_ +av -lat $lat_av -greatarcfile $arcfile -output $globe_map -geometry +800x600 -starfreq 0 -grid -proj hemisphere -shade 100 -markerfile $capfil +e -grid1 6 -grid2 5 ); # Strip those returns... I like my code neat. $mercator_command =~ s/\n/ /g; $globe_command =~ s/\n/ /g; system $mercator_command; system $globe_command; 1;


Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

Comment on The Center of PerlMonk Mass
Download Code
Re: The Center of PerlMonk Mass
by scain (Curate) on Jul 09, 2001 at 17:14 UTC
    Of course, the implicit assumption is that all monks have equal mass. That assumption could be different: perhaps monks could have mass proportial to their experience level.

    Joking asside, nice way to use the data :-)
    Scott

Re: The Center of PerlMonk Mass
by pmas (Hermit) on Jul 09, 2001 at 18:09 UTC
    Thank you, Masem.

    Will be interesting to see North American and European Mass centers, too. Then, we can meet there some Sunday morning and have a real mass, as monks should have... :)

    As a compromise between 'one man - one vote' and XP points, you can use monk's level - otherwise center may soon closely follow merlyn :)

    Update: Sorry I mis-read scain's post - he already said about levels, not XP points.

    pmas

    To make errors is human. But to make million errors per second, you need a computer.

      Well, it's certainly not a big problem to do the NA and Euro centers; simply define some bounding box of lat/long to select said points, repeat calculations, and have xplanet center appropriately.

      XP weighting might be interesting; it's not as easy as the .xml file I get from jcwren doesn't have that info in it, but I'm sure there's ways of getting it in a couple more steps. I'd take Merlyn & vroom out specific only to avoid such problems. Fortunately, the method of generating this stuff is simple once you have the data.


      Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
      If merlyn were to be weighted by his XP (and severely influenced the center of mass), maybe someone should try to parse his itenerary and keep track of him.

      He seems to be a pretty mobile Monk ;)

Re: The Center of PerlMonk Mass
by John M. Dlugosz (Monsignor) on Jul 10, 2001 at 02:39 UTC
    My first impression is that I think it should consider the mass of the monk, rather than each as a unit.

    However, I like the idea of using levels as weights (pun intended) too. This would reflect better the business aspects of where to find Perl talent.

    Looking at the map, it seems that the distribution is bimodal. Perhaps you should show two distinct centers, one for each "atom"?

Re: The Center of PerlMonk Mass
by Jouke (Curate) on Jul 11, 2001 at 15:56 UTC
    Not too surprising to see that Brussels is the center of Europe.... even on your map...The European Capital :)

    Jouke Visser, Perl 'Adept'
    Using Perl to help the disabled: pVoice and pStory
Re: The Center of PerlMonk Mass
by Ratazong (Prior) on Apr 30, 2010 at 08:37 UTC

    FYI: bart has re-activated a similar project, which is running now: PMplanet.

    You can see a detailed description on that project here: PMplanet has a new home.

    Rata
    (who stumbled on this thread by clicking in the Selected Best Nodes-list ... and thinks that a little advertisement for the 2010-version is fitting nicely here ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://94908]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2014-07-14 09:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (257 votes), past polls