Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: wrapping bash and astronomy

by Aldebaran (Curate)
on Mar 01, 2023 at 18:10 UTC ( [id://11150668] : note . print w/replies, xml ) Need Help??


in reply to Re: wrapping bash and astronomy
in thread wrapping bash and astronomy

Very nice, AM:,

fritz@laptop:~/Documents/gitlab1$ ./3.2023.pl Time is Wed Mar 1 10:38:05 2023 Julian day is 2460005.23478009 ./3.2023.pl Alnitak Alnilam Mintaka $VAR1 = 'Coordinates(ICRS,ep=J2000,eq=2000): 05 40 45.52666 -01 56 33 +.2649 (Opt ) A [5.19 2.29 90] 2007A&A...474..653V'; $VAR1 = 'Coordinates(ICRS,ep=J2000,eq=2000): 05 36 12.81335 -01 12 0 +6.9089 (Opt ) A [3.69 1.67 90] 2007A&A...474..653V'; $VAR1 = 'Coordinates(ICRS,ep=J2000,eq=2000): 05 32 00.40009 -00 17 5 +6.7424 (Opt ) A [4.92 2.38 90] 2007A&A...474..653V'; 05 40 45.52666, -01 56 33.2649 05 36 12.81335, -01 12 06.9089 05 32 00.40009, -00 17 56.7424 ====== 05:40:45.527, -01:56:33.26 85.1896944166667, -1.94257358333333 1.48684065633866, -0.0339043049914311 05:36:12.813, -01:12:06.91 84.0533889583333, -1.20191913888889 1.46700838478236, -0.0209774463163461 05:32:00.400, -00:17:56.74 83.0016670416667, -0.299095111111111 1.44865237452114, -0.00522019446550716 fritz@laptop:~/Documents/gitlab1$

Source:

#!/usr/bin/perl use v5.030; use Time::Piece; use Log::Log4perl; use IPC::System::Simple qw/systemx capturex/; use Astro::Coords; my $t = localtime; my $jd = $t->julian_day; my $log_conf4 = '/home/fritz/Documents/perlmonks/conf_files/4.conf'; Log::Log4perl::init($log_conf4); #info my $logger = Log::Log4perl->get_logger(); $logger->info("Time is $t"); $logger->info("Julian day is $jd"); $logger->info("$0"); my @belt = qw/ Alnitak Alnilam Mintaka/; $logger->info("@belt"); my ( @captured, @processed ); for (@belt) { my $stdout = capturex 'perl', '1.simbad.pl', "$_"; push @captured, $stdout; } $logger->info("@captured"); for (@captured) { # Q3: How do I capture the 3 numeric fields for declination and # Right Ascension, dealing with the potential minus sign? # Ignore the details, capture non-whitepsace: $_ =~ m/:\s(\S+)\s(\S+)\s(\S+)\s+(\S+)\s(\S+)\s(\S+)\s/; my $ra = "$1 $2 $3"; my $dec = "$4 $5 $6"; print "$ra, $dec \n"; my $c = Astro::Coords->new( ra => $ra, dec => $dec, type => 'J2000' ); push @processed, $c; } say '======'; for (@processed) { print # sexagesimal $_->ra( format => 'sex' ), ", ", $_->dec( format => 'sex' ), "\n"; print # degrees $_->ra( format => 'deg' ), ", ", $_->dec( format => 'deg' ), "\n"; print # radians $_->ra( format => 'rad' ), ", ", $_->dec( format => 'rad' ), "\n\n +"; } __END__

Here's a link to the wrapped, mini SIMBAD script for SSCCE purposes: 1.simbad.pl. I don't know what adding safeguards on failed matches might do, as I don't have another course than die'ing.

Let me restate questions with this result:

Q1) What is the best-fit "line" for the 3 Astro::Coords points of @processed?

Q2) From these data, can we make any arguments about "betweenness?"

Q2a) From these data, can we calculate the 3 angles formed of @processed? It seems to me that 2 of the angles are going to be less than 10 degrees, and the one with Alnilam at its vertex in the neighborhood of 160, and from this, we might say that Alnilam lies "between." (Distance from observer is not relevant in this view.)

Cheers,