Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: perl in the stars

by Anonymous Monk
on Dec 23, 2022 at 16:50 UTC ( [id://11149048]=note: print w/replies, xml ) Need Help??


in reply to Re: perl in the stars
in thread perl in the stars

Thank you for all your good work for Perl on CPAN! I use your Astro modules constantly to power my planetariums and clocks. I'd like to see your 30 lines. Here is one that puts SIMBAD data in a perl hash:
perl -MAstro::SIMBAD::Client -MData::Dumper -le '$s=Astro::SIMBAD::Cli +ent->new;@s=split/\n/,$s->url_query(id => Ident => "$ARGV[0]", NbIden +t => 1);splice(@s,0,7);splice(@s,20,$#s+1);%s=map{/([^:]+\S)\s?:\s+(\ +S.*)/;$1=>$2}@s;@s=grep/^Coord/,keys%s;print"$_: $s{$_}"for@s;print q +q[\n$s{"Proper motions"}\n];print Dumper\%s;' sirius
Prints coordinates and proper motions and dumps the hash:
Coordinates(Gal,ep=J2000,eq=2000): 227.23029126 -08.89028121 Coordinates(ICRS,ep=J2000,eq=2000): 06 45 08.91728 -16 42 58.0171 (Op +t ) A [11.70 10.90 90] 2007A&A...474..653V Coordinates(FK4,ep=B1950,eq=1950): 06 42 56.72452 -16 38 45.4080 -546.01 -1223.07 [1.33 1.24 0] A 2007A&A...474..653V $VAR1 = { 'Angular size' => '~ ~ ~ (~) ~ ~', 'Coordinates(Gal,ep=J2000,eq=2000)' => '227.23029126 -08.89 +028121 ', 'Spectral type' => 'A0mA1Va C 2003AJ....126.2048G', 'Parallax' => '379.21 [1.58] A 2007A&A...474..653V', 'Flux V' => '-1.46 [~] C 2002yCat.2237....0D', 'Flux I' => '-1.43 [~] C 2002yCat.2237....0D', 'Flux J' => '-1.36 [~] C 2002yCat.2237....0D', 'Flux R' => '-1.46 [~] C 2002yCat.2237....0D', 'Redshift' => '-0.000018 [0.000001] A 2006AstL...32..759G', 'Proper motions' => '-546.01 -1223.07 [1.33 1.24 0] A 2007A& +A...474..653V', 'Flux K' => '-1.35 [~] C 2002yCat.2237....0D', 'Morphological type' => '~ ~ ~', 'Flux H' => '-1.33 [~] C 2002yCat.2237....0D', 'cz' => '-5.50 [0.40] A 2006AstL...32..759G', 'Flux U' => '-1.51 [~] C 2002yCat.2237....0D', 'Radial Velocity' => '-5.50 [0.4] A 2006AstL...32..759G', 'Flux B' => '-1.46 [~] C 2002yCat.2237....0D', 'Coordinates(ICRS,ep=J2000,eq=2000)' => '06 45 08.91728 -16 + 42 58.0171 (Opt ) A [11.70 10.90 90] 2007A&A...474..653V', 'Coordinates(FK4,ep=B1950,eq=1950)' => '06 42 56.72452 -16 +38 45.4080', 'hierarchy counts' => '#parents=0, #children=0, #siblings=0' };
PS - I think the easiest way to get deg2rad (and rad2deg) is a core module:
use Math::Trig 'deg2rad';

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11149048]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-23 20:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found