App-SourcePlot

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

    },
    requires => {
        'Tk' => '804.0',
        'Astro::PAL' => '1.00',
        'Astro::Catalog' => 2.01,
        'Tk::AstroCatalog' => 0.12,
        'Astro::Coords' => 0.13,
        'Astro::Coords::Planet' => 0.05,
        'Astro::Telescope' => 0.71,
        'Config::IniFiles' => 2.62,
        'DateTime' => 0,
        'File::HomeDir' => 0,
        'File::ShareDir' => 1.03,
        'File::Spec' => 0,
    },
    configure_requires => {
        'Module::Build' => 0.30,
    },
    build_requires => {
        'Test::More' => 0,
        'Test::Number::Delta' => 0,

META.json  view on Meta::CPAN

         }
      },
      "runtime" : {
         "requires" : {
            "Astro::Catalog" : "2.01",
            "Astro::Coords" : "0.13",
            "Astro::Coords::Planet" : "0.05",
            "Astro::PAL" : "1.00",
            "Astro::Telescope" : "0.71",
            "Config::IniFiles" : "2.62",
            "DateTime" : "0",
            "File::HomeDir" : "0",
            "File::ShareDir" : "1.03",
            "File::Spec" : "0",
            "Tk" : "804.0",
            "Tk::AstroCatalog" : "0.12"
         }
      }
   },
   "provides" : {
      "App::SourcePlot" : {

META.yml  view on Meta::CPAN

  App::SourcePlot::VO::SAMP:
    file: lib/App/SourcePlot/VO/SAMP.pm
    version: '1.32'
requires:
  Astro::Catalog: '2.01'
  Astro::Coords: '0.13'
  Astro::Coords::Planet: '0.05'
  Astro::PAL: '1.00'
  Astro::Telescope: '0.71'
  Config::IniFiles: '2.62'
  DateTime: '0'
  File::HomeDir: '0'
  File::ShareDir: '1.03'
  File::Spec: '0'
  Tk: '804.0'
  Tk::AstroCatalog: '0.12'
resources:
  homepage: https://github.com/eaobservatory/perl-App-SourcePlot/tree/master
  license: http://opensource.org/licenses/gpl-3.0.html
  repository: https://github.com/eaobservatory/perl-App-SourcePlot.git
version: '1.32'

README  view on Meta::CPAN


Requirements
------------

  Tk
  Astro::Coords
  Astro::Catalog
  Astro::Telescope
  Astro::PAL
  Config::IniFiles
  DateTime
  File::HomeDir
  File::ShareDir
  File::Spec

Building
--------

  perl Build.PL
  ./Build
  ./Build test

lib/App/SourcePlot.pm  view on Meta::CPAN

use strict;
#use warnings;

our $VERSION = '1.32';

use Config::IniFiles;
use Tk;
use Tk::Balloon;
use Tk::FileSelect;
use App::SourcePlot::Plotter::Tk;
use DateTime;
use DateTime::Format::Strptime;
use App::SourcePlot::Source;
use File::HomeDir;
use File::ShareDir qw/dist_file/;
use File::Spec;
use Tk::AstroCatalog;
use Astro::PAL;
use Astro::Telescope;
use Math::Trig;
use Astro::Coords::Planet 0.05;

lib/App/SourcePlot.pm  view on Meta::CPAN

    my $dayEnt = $topFrame->Entry(
        -relief => 'sunken',
        -width => 10,
    )->grid(-column => 1, -row => 0, -padx => 10, -pady => 5);

    # create the month menu button
    $topFrame->Label(
        -text => "Month:",
    )->grid(-column => 0, -row => 1, -padx => 5, -pady => 5);

    my $strp = DateTime::Format::Strptime->new(
        pattern => '%Y/%m/%d',
        time_zone => 'UTC',
        on_error => 'croak');

    my $dt = $strp->parse_datetime($DATE);
    my $monthEnt = $months[$dt->month() - 1];

    my $mb = $topFrame->Menubutton(
        -text => $monthEnt,
        -relief => 'raised',

lib/App/SourcePlot.pm  view on Meta::CPAN

    # create the year entry
    $topFrame->Label(
        -text => 'Year:',
    )->grid(-column => 0, -row => 2, -padx => 5, -pady => 5);

    my $yearEnt = $topFrame->Entry(
        -relief => 'sunken',
        -width => 10,
    )->grid(-column => 1, -row => 2, -padx => 10, -pady => 5);
    $yearEnt->bind('<KeyPress-Return>' => sub {
        my $strp = DateTime::Format::Strptime->new(
            pattern => '%Y %B %d',
            on_error => 'croak');

        my $dt = $strp->parse_datetime(
            $monthEnt
            . ' ' . $dayEnt->get()
            . ' ' . $yearEnt->get());

        $DATE = $dt->strftime('%Y/%m/%d');

        destroy $Top;
    });

    # create the update subroutine
    my $complete = sub {
        my $strp = DateTime::Format::Strptime->new(
            pattern => '%B %d %Y',
            on_error => 'croak');

        my $dt = $strp->parse_datetime(
            $monthEnt
            . ' ' . $dayEnt->get()
            . ' ' . $yearEnt->get());

        $DATE = $dt->strftime('%Y/%m/%d');

lib/App/SourcePlot.pm  view on Meta::CPAN

    $XSpaceForTime = $xborder if $Y_AXIS =~ /time/i;
    $YSpaceForTime = $yborder if $X_AXIS =~ /time/i;
    $timeH += $min / 60 + $sec / 3600;

    #clear the plot
    $plotter->clean();

    # calc the world coords
    print "    Calculating the world coordinate system\n" if $locateBug;
    if ($X_AXIS =~ /time/i) {
        my $strp = DateTime::Format::Strptime->new(
            pattern => '%Y/%m/%d %H:%M:%S',
            on_error => 'croak');

        my $dt = $strp->parse_datetime($DATE . ' ' . $TIME);

        $dt->subtract(hours => 2);

        my ($lst, $mjd) = ut2lst(
            $dt->year(), $dt->month(), $dt->day(),
            $dt->hour(), $dt->minute(), $dt->second(),

lib/App/SourcePlot.pm  view on Meta::CPAN

        $minX = -180;
        $maxX = 180;
        print "x-axis is az\n" if $debug;
    }
    else {
        print "ERROR:  X axis undefined!!\n\n";
        $minX = 0;
        $maxX = 0;
    }
    if ($Y_AXIS =~ /time/i) {
        my $strp = DateTime::Format::Strptime->new(
            pattern => '%Y/%m/%d %H:%M:%S',
            on_error => 'croak');

        my $dt = $strp->parse_datetime($DATE . ' ' . $TIME);

        $dt->subtract(hours => 2);

        my ($lst, $mjd) = ut2lst(
            $dt->year(), $dt->month(), $dt->day(),
            $dt->hour(), $dt->minute(), $dt->second(),

lib/App/SourcePlot.pm  view on Meta::CPAN

    $ss = '0' . $ss if length($ss) < 2;
    $yr += 1900;
    my ($sety, $setm, $setd) = split(/\//, $DATE);

    if ((! $yr =~ /$sety/) || $setm != $mo || $setd != $md) {
        return;
    }
    print "The gm time is $hh:$mm:$ss and date is $yr\/$mo\/$md\n" if $timeBug;

    #calculate the local time
    my $strp = DateTime::Format::Strptime->new(
        pattern => '%Y/%m/%d %H:%M:%S',
        on_error => 'croak');

    my $dt = $strp->parse_datetime("$yr\/$mo\/$md $hh:$mm:$ss");

    $dt->subtract(hours => 10);

    my $t = $dt->strftime('%H:%M:%S');
    my $d = $dt->strftime('%Y/%m/%d');

lib/App/SourcePlot/Source.pm  view on Meta::CPAN

application.

=cut

use 5.004;
use Carp;
use strict;

use Astro::Coords;
use Math::Trig qw/pi/;
use DateTime;
use DateTime::Format::Strptime;

our $VERSION = '1.32';

my $locateBug = 0;

=head1 METHODS

=head2 Constructor

=over 4

lib/App/SourcePlot/Source.pm  view on Meta::CPAN

    my $TIME = shift;
    my $numPoints = shift;
    my $MW = shift;
    my $tel = shift;
    my $timeBug = 0;

    my $coords = $self->coords();
    $coords->telescope($tel);
    my $dt_save = $coords->datetime();

    my $strp = DateTime::Format::Strptime->new(
        pattern => '%Y/%m/%d %H:%M:%S',
        time_zone => 'UTC',
        on_error => 'croak');

    my $dt = $strp->parse_datetime($DATE . ' ' . $TIME);

    my $dt_running = $dt->clone();

    my $tlen = @{$self->{TIME_ELE_POINTS}} if defined $self->{TIME_ELE_POINTS};
    if (defined $tlen && $tlen > 0) {

lib/App/SourcePlot/Source.pm  view on Meta::CPAN

    ($lst, $ele, $az, $pa) = $obs->calcPoint($date, $time, $tel);

=cut

sub calcPoint {
    my $self = shift;
    my $DATE = shift;
    my $TIME = shift;
    my $tel = shift;

    my $strp = DateTime::Format::Strptime->new(
        pattern => '%Y/%m/%d %H:%M:%S',
        time_zone => 'UTC',
        on_error => 'croak');

    my $dt = $strp->parse_datetime($DATE . ' ' . $TIME);

    $dt->add(hours => 10);

    return $self->_calcPoint($dt, $tel);
}



( run in 0.349 second using v1.01-cache-2.11-cpan-05444aca049 )