Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Searching for exoplanets

by GrandFather (Sage)
on Aug 24, 2017 at 06:53 UTC ( #1197907=CUFP: print w/replies, xml ) Need Help??

Wearing a different hat I do the odd spot of astronomy observation. One of the observation areas I'm interested in is recording data for microlensing events which can be used for discovering exoplanets. Detected candidate events are published in various places around the internet, but a chunk of digging and analysis is required to find events that are interesting to observe "tonight". The following code scrapes one of the sites and uses heuristics involving the brightness of the event and various other parameters to choose and prioritize interesting current events from the thousand or so listed.

use strict; use warnings; use File::Copy; use HTML::Tree; use Astro::Time qw(); my $nowJD = Astro::Time::mjd2jd(Astro::Time::now2mjd()); my $root = HTML::TreeBuilder->new_from_url( ''); my @elements = $root->guts(); my @tables = $root->find('table'); my @rows = $tables[-1]->find('tr'); my @events; for my $row (@rows) { my @cells = $row->find('td'); my $flag = shift @cells; my ( $event, $field, $starNo, $ra, $dec, $tmaxHJD, $tmaxUT, $tau, $Umin, $Amax, $Dmag, $fbl, $ibl, $i0 ) = map {$_->as_text()} @cells; next if !$event || !$flag->find('img') || $Amax < 20; my $delta = abs($nowJD - $tmaxHJD); my $minMag = $i0 - $Dmag; next if $tau > 300 || $delta > $tau || $minMag > 16; $delta ||= 0.0001; $Umin ||= 0.0001; my $tRoot = $delta / $tau; my $uNow = sqrt($Umin * $Umin + $tRoot * $tRoot); my $aNow = ($uNow * $uNow + 2) / ($uNow * sqrt($uNow * $uNow + 4)) +; my $magNow = $i0 - 5 * log($aNow) / log(100); next if $magNow > 17; $magNow = sprintf "%.4f", $magNow; push @events, [$event, $tmaxUT, $tRoot, $tau, $ra, $dec, $Dmag, $m +agNow, $i0]; } for my $eventData (sort {$a->[2] <=> $b->[2]} @events) { my ($event, $tmaxUT, $tRoot, $tau, $ra, $dec, $Dmag, $magNow, $i0) + = map {s/^\s+|\s+$//g; $_} @$eventData; my $minMag = sprintf "%.3f", $i0 - $Dmag; print <<EVENT; $event: peak at $tmaxUT (tau $tau) RA $ra Dec $dec Mag $i0 - $minMag ( +now $magNow) EVENT }

Run at 6:29 UT 2017/08/24 printed:

2017-BLG-1600: peak at 2017-08-25.34 (tau 9.350) RA 17:43:38.19 Dec -2 +6:54:38.8 Mag 16.982 - 6.688 (now 14.6269) 2017-BLG-0019: peak at 2017-06-22.58 (tau 134.989) RA 17:52:18.74 Dec +-33:00:04.0 Mag 14.798 - 11.277 (now 13.8859)
Premature optimization is the root of all job security

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://1197907]
Front-paged by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2018-07-17 23:28 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (381 votes). Check out past polls.