Astro-Catalog

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

        'Astro::Coords'       => 0.12,
        'File::Spec'          => 0.84,
        'Astro::Telescope'    => 0.50,
        'Time::Piece'         => 1.08,
        'SOAP::Lite'          => 0.00,
        'Carp'                => 1.01,
        'Data::Dumper'        => 2.12,
        'Scalar::Util'        => 1.14,
        'File::Temp'          => 0.14,
        'Class::Struct'       => 0.63,
        'Number::Uncertainty' => 0.01,
        'Misc::Quality'       => 0.01,
        'DateTime'            => 0,
        'DateTime::Format::ISO8601' => 0,
        'Astro::Flux'         => 0.01
    },
    recommends => {
        'Astro::FITS::CFITSIO'=> 1.03,
        'Astro::VO::VOTable' => 0.90,
        'Astro::VEX' => 0,
        'Text::CSV' => 0,

META.json  view on Meta::CPAN

            "Carp" : "1.01",
            "Class::Struct" : "0.63",
            "Data::Dumper" : "2.12",
            "DateTime" : "0",
            "DateTime::Format::ISO8601" : "0",
            "File::Spec" : "0.84",
            "File::Temp" : "0.14",
            "LWP" : "5.53",
            "Misc::Quality" : "0.01",
            "Net::Domain" : "2.13",
            "Number::Uncertainty" : "0.01",
            "Pod::Usage" : "1.14",
            "SOAP::Lite" : "0",
            "Scalar::Util" : "1.14",
            "Time::Piece" : "1.08"
         }
      }
   },
   "provides" : {
      "Astro::Catalog" : {
         "file" : "lib/Astro/Catalog.pm",

META.yml  view on Meta::CPAN

  Carp: '1.01'
  Class::Struct: '0.63'
  Data::Dumper: '2.12'
  DateTime: '0'
  DateTime::Format::ISO8601: '0'
  File::Spec: '0.84'
  File::Temp: '0.14'
  LWP: '5.53'
  Misc::Quality: '0.01'
  Net::Domain: '2.13'
  Number::Uncertainty: '0.01'
  Pod::Usage: '1.14'
  SOAP::Lite: '0'
  Scalar::Util: '1.14'
  Time::Piece: '1.08'
resources:
  homepage: https://github.com/timj/perl-Astro-Catalog/tree/master
  license: http://opensource.org/licenses/gpl-2.0.php
  repository: https://github.com/timj/perl-Astro-Catalog.git
version: '4.38'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

README  view on Meta::CPAN

  Math::Libm
  Net::Domain
  LWP::UserAgent
  SOAP::Lite
  Test
  Test::More
  Data::Dumper
  Carp
  Astro::VO::VOTable
  Astro::Flux
  Number::Uncertainty
  Misc::Quality

See http://heasarc.gsfc.nasa.gov/classx/votable/index.html to obtain the GSFC
Astro::VO::VOTable package. You need V0.9 or later of this module.

Provides
--------

The package provides the following user level classes

TODO  view on Meta::CPAN


To Do (16th June 2004)
---------------------

 * Introduce support for quality flags with Astro::Catalog::Item::Quality
   object.

 * Fix things so all "values" are represented by the new Number::Uncertainty
   object and can have associated errors. Currently only flux values use the
   new Number::Uncertainty class.

 * Add output support for FITS binary tables.

 * Support the VOTable V1.1 standard.

 * Fix Astro::Catalog::Query::CMC module to correctly parse the CMC TST files,
   currently support is somewhat broken. The module itself may no longer work
   at all under the new V4 API.

 * Add writing support for TST files to Astro::Catalog::IO::TST

lib/Astro/Catalog.pm  view on Meta::CPAN


If no options are specified the method does nothing, assumes you will
be supplying stars at a later time.

The options are case-insensitive.

Note that in some cases (when reading a catalog) this method will
act as a constructor. In any case, always returns a catalog object
(either the same one that went in or a modified one).

API uncertainty - in principal Data is not needed since File
could be overloaded (in a similar way to write_catalog).

=cut

sub configure {
    my $self = shift;

    # return unless we have arguments
    return $self unless @_;

lib/Astro/Catalog.pm  view on Meta::CPAN

=item B<filter_by_distance>

Retrieve all targets that are within the specified distance of the
reference position.

    @selected = $catalog->filter_by_distance( $radius, $refpos );

The radius is in radians. The reference position defaults to
the value returned by the C<reference> method if none supplied.

API uncertainty:

    - Should the radius default to the get_radius() method?
    - Should this method take hash arguments?
    - Should there be a units argument? (radians, arcmin, arcsec, degrees)

=cut

sub filter_by_distance {
    my $self = shift;
    croak "Must be at least one argument"

lib/Astro/Catalog/IO/ASSM.pm  view on Meta::CPAN

        # Go through the passbands and create the Astro::Flux object for
        # this magnitude.
        my $waveband;
        my $filtnum = 2;
        my @mags;
        foreach my $filter (@allfilters) {
            print "Filter=$filter, " if $DEBUG;
            $waveband = new Astro::WaveBand(Filter => $filter);
            # Create the Astro::Flux object for this magnitude.
            my $flux = new Astro::Flux(
                new Number::Uncertainty(Value => $fields[$filtnum]),
                'MAG_CATALOG',
                $waveband);
            push @mags, $flux;
            $filtnum++;
        }
        print "\n" if $DEBUG;
        my $fluxes = new Astro::Fluxes(@mags);
        # and push the fluxes into the catalog
        $star->fluxes($fluxes);
        $star->preferred_magnitude_type('MAG_CATALOG');

lib/Astro/Catalog/IO/Cluster.pm  view on Meta::CPAN

use Carp;

use Astro::Catalog;
use Astro::Catalog::Item;
use Astro::Coords;

use Astro::FluxColor;
use Astro::Flux;
use Astro::Fluxes;

use Number::Uncertainty;

use base qw/Astro::Catalog::IO::ASCII/;

use Data::Dumper;

our $VERSION = '4.38';

=begin __PRIVATE_METHODS__

=head1 Private methods

lib/Astro/Catalog/IO/Cluster.pm  view on Meta::CPAN

        my @quality;
        my (@colors, @fluxes);
        foreach my $j (0 .. $#colours) {
            # colours have minus signs
            if (lc($colours[$j]) =~ "-") {
                # build a colour object and push it into the @colors array
                my @filters = split "-", $colours[$j];
                my $color = new Astro::FluxColor(
                        upper => new Astro::WaveBand(Filter => $filters[0]),
                        lower => new Astro::WaveBand(Filter => $filters[1]),
                        quantity => new Number::Uncertainty(
                            Value => $separated[3*$j+10],
                            Error => $separated[3*$j+11]));
                push @colors, $color;

                # quality flags
                $quality[$j] = $separated[3*$j+12];
            }
            else {
                my $mag = new Astro::Flux(
                        new Number::Uncertainty(
                            Value => $separated[3*$j+10],
                            Error => $separated[3*$j+11]),
                        'mag', $colours[$j]);
                push @fluxes, $mag;

                # quality flags
                $quality[$j] = $separated[3*$j+12];

                # increment counter
                $j = $j + 2;

lib/Astro/Catalog/IO/LCOGTFITSTable.pm  view on Meta::CPAN

                if ($x_column != -1) {
                    $star->x($x_pos_value);
                }
                if ($y_column != -1) {
                    $star->y($y_pos_value);
                }

                # Set up the Astro::Flux objects.
                if ($iso_flux_column != -1) {
                    my $num;
                    $num = new Number::Uncertainty(Value => $iso_flux_value);
                    my $flux_iso = new Astro::Flux($num, 'isophotal_flux', $waveband,
                            datetime => $datetime, obsid => $obsid);
                    $star->fluxes(new Astro::Fluxes($flux_iso));
                }

                if ($total_flux_column != -1) {
                    my $num;
                    $num = new Number::Uncertainty(Value => $total_flux_value);
                    my $flux_total = new Astro::Flux($num, 'total_flux', $waveband,
                            datetime => $datetime, obsid => $obsid );
                    $star->fluxes(new Astro::Fluxes($flux_total));
                }

                if ($core_flux_column != -1) {
                    my $num;
                    $num = new Number::Uncertainty(Value => $core_flux_value);
                    my $core_flux_obj = new Astro::Flux($num, 'core_flux', $waveband,
                            datetime => $datetime, obsid => $obsid );
                    $star->fluxes(new Astro::Fluxes($core_flux_obj));
                }

                if ($core1_flux_column != -1) {
                    my $num;
                    $num = new Number::Uncertainty(Value => $core1_flux_value);
                    my $core1_flux_obj = new Astro::Flux($num, 'core1_flux', $waveband,
                            datetime => $datetime, obsid => $obsid );
                    $star->fluxes(new Astro::Fluxes($core1_flux_obj));
                }

                if ($core2_flux_column != -1) {
                    my $num;
                    $num = new Number::Uncertainty(Value => $core2_flux_value);
                    my $core2_flux_obj = new Astro::Flux($num, 'core2_flux', $waveband,
                            datetime => $datetime, obsid => $obsid );
                    $star->fluxes(new Astro::Fluxes($core2_flux_obj));
                }

                if ($core3_flux_column != -1) {
                    my $num;
                    $num = new Number::Uncertainty(Value => $core3_flux_value);
                    my $core3_flux_obj = new Astro::Flux($num, 'core3_flux', $waveband,
                            datetime => $datetime, obsid => $obsid );
                    $star->fluxes(new Astro::Fluxes($core3_flux_obj));
                }

                if ($core4_flux_column != -1) {
                    my $num;
                    $num = new Number::Uncertainty(Value => $core4_flux_value);
                    my $core4_flux_obj = new Astro::Flux($num, 'core4_flux', $waveband,
                        datetime => $datetime, obsid => $obsid);
                    $star->fluxes(new Astro::Fluxes($core4_flux_obj));
                }

                # Compute a magnitude and mag. error from the total flux value and total
                # flux error (if available).
                if ($total_flux_value > 0.0 and $total_flux_err_value > 0.0) {
                    my $mag = -2.5 * log10($total_flux_value);
                    my $num;
                    if ($total_flux_err_column != -1) {
                        my $magerr = 2.5 / log(10) * $total_flux_err_value / $total_flux_value;
                        $num = new Number::Uncertainty(
                            Value => $mag,
                            Error => 2.0 * $magerr);
                    }
                    else {
                        $num = new Number::Uncertainty(Value => $mag);
                    }
                    my $mag_obj = new Astro::Flux($num, 'MAG',  $waveband,
                        datetime => $datetime, obsid => $obsid);
                    $star->fluxes(new Astro::Fluxes($mag_obj));
                }
                # And set up the Astro::Catalog::Item::Morphology object.
                my $morphology = new Astro::Catalog::Item::Morphology(
                    area => $isoarea_value,
                    ellipticity => $ell_value,
                    position_angle_pixel => $posang_value,

lib/Astro/Catalog/IO/RITMatch.pm  view on Meta::CPAN

use warnings::register;
use strict;

use Carp;

use Astro::Catalog;
use Astro::Catalog::Item;

use Astro::Flux;
use Astro::Fluxes;
use Number::Uncertainty;

use base qw/Astro::Catalog::IO::ASCII/;

our $VERSION = '4.38';
our $DEBUG = 0;

=head1 METHODS

=head2 Private methods

lib/Astro/Catalog/IO/RITMatch.pm  view on Meta::CPAN

    my @lines = @$lines;
    for (@lines) {
        my $line = $_;

        $line =~ s/^\s+//;

        my ($id, $x, $y, $mag) = split /\s+/, $line, 4;

        # Create the Astro::Flux object for this magnitude.
        my $flux = new Astro::Flux(
            new Number::Uncertainty(Value => $mag),
            'mag',
            $filter );
        my @mags;
        push @mags, $flux;
        my $fluxes = new Astro::Fluxes(@mags);

        # Create the Astro::Catalog::Item object.
        my $item = new Astro::Catalog::Item(
            ID      => $id,
            X       => $x,

lib/Astro/Catalog/IO/SExtractor.pm  view on Meta::CPAN

use warnings;
use warnings::register;
use Carp;
use strict;

use Astro::Catalog;
use Astro::Catalog::Item;
use Astro::Catalog::Item::Morphology;
use Astro::Coords;

use Number::Uncertainty;
use Astro::Flux;
use Astro::FluxColor;
use Astro::Fluxes;

use base qw/Astro::Catalog::IO::ASCII/;

our $VERSION = '4.38';
our $DEBUG = 0;

=begin __PRIVATE_METHODS__

lib/Astro/Catalog/IO/SExtractor.pm  view on Meta::CPAN

        }

        if ($id_column != -1) {
            $star->id($fields[$id_column]);
        }

        # Set up the various flux and magnitude measurements.
        if ($mag_iso_column != -1) {
            my $num;
            if ($magerr_iso_column != -1) {
                $num = new Number::Uncertainty(Value => $fields[$mag_iso_column],
                        Error => $fields[$magerr_iso_column]);
            }
            else {
                $num = new Number::Uncertainty(Value => $fields[$mag_iso_column]);
            }
            my $mag_iso = new Astro::Flux($num, 'MAG_ISO', $filter);
            $star->fluxes(new Astro::Fluxes($mag_iso));
        }
        if ($flux_iso_column != -1) {
            my $num;
            if ($fluxerr_iso_column != -1) {
                $num = new Number::Uncertainty(Value => $fields[$flux_iso_column],
                        Error => $fields[$fluxerr_iso_column]);
            }
            else {
                $num = new Number::Uncertainty(Value => $fields[$flux_iso_column]);
            }
            my $flux_iso = new Astro::Flux($num, 'FLUX_ISO', $filter);
            $star->fluxes(new Astro::Fluxes($flux_iso));
        }

        if ($mag_isocor_column != -1) {
            my $num;
            if ($magerr_isocor_column != -1) {
                $num = new Number::Uncertainty(Value => $fields[$mag_isocor_column],
                        Error => $fields[$magerr_isocor_column]);
            }
            else {
                $num = new Number::Uncertainty(Value => $fields[$mag_isocor_column]);
            }
            my $mag_isocor = new Astro::Flux($num, 'MAG_ISOCOR', $filter);
            $star->fluxes(new Astro::Fluxes($mag_isocor));
        }
        if ($flux_isocor_column != -1) {
            my $num;
            if ($fluxerr_isocor_column != -1) {
                $num = new Number::Uncertainty(Value => $fields[$flux_isocor_column],
                        Error => $fields[$fluxerr_isocor_column]);
            }
            else {
                $num = new Number::Uncertainty(Value => $fields[$flux_isocor_column]);
            }
            my $flux_isocor = new Astro::Flux($num, 'FLUX_ISOCOR', $filter);
            $star->fluxes(new Astro::Fluxes($flux_isocor));
        }

        if ($mag_aper1_column != -1) {
            my $num;
            if ($magerr_aper1_column != -1) {
                $num = new Number::Uncertainty(Value => $fields[$mag_aper1_column],
                        Error => $fields[$magerr_aper1_column]);
            }
            else {
                $num = new Number::Uncertainty(Value => $fields[$mag_aper1_column]);
            }
            my $mag_aper1 = new Astro::Flux($num, 'MAG_APER1', $filter);
            $star->fluxes(new Astro::Fluxes($mag_aper1));
        }
        if ($flux_aper1_column != -1) {
            my $num;
            if ($fluxerr_aper1_column != -1) {
                $num = new Number::Uncertainty(Value => $fields[$flux_aper1_column],
                        Error => $fields[$fluxerr_aper1_column]);
            }
            else {
                $num = new Number::Uncertainty(Value => $fields[$flux_aper1_column]);
            }
            my $flux_aper1 = new Astro::Flux($num, 'FLUX_APER1', $filter);
            $star->fluxes(new Astro::Fluxes($flux_aper1));
        }

        if ($mag_auto_column != -1) {
            my $num;
            if ($magerr_auto_column != -1) {
                $num = new Number::Uncertainty(Value => $fields[$mag_auto_column],
                        Error => $fields[$magerr_auto_column]);
            }
            else {
                $num = new Number::Uncertainty(Value => $fields[$mag_auto_column]);
            }
            my $mag_auto = new Astro::Flux($num, 'MAG_AUTO', $filter);
            $star->fluxes(new Astro::Fluxes($mag_auto));
        }
        if ($flux_auto_column != -1) {
            my $num;
            if ($fluxerr_auto_column != -1) {
                $num = new Number::Uncertainty(Value => $fields[$flux_auto_column],
                        Error => $fields[$fluxerr_auto_column]);
            }
            else {
                $num = new Number::Uncertainty(Value => $fields[$flux_auto_column]);
            }
            my $flux_auto = new Astro::Flux($num, 'FLUX_AUTO', $filter);
            $star->fluxes(new Astro::Fluxes($flux_auto));
        }

        if ($mag_best_column != -1) {
            my $num;
            if ($magerr_best_column != -1) {
                $num = new Number::Uncertainty(Value => $fields[$mag_best_column],
                        Error => $fields[$magerr_best_column]);
            }
            else {
                $num = new Number::Uncertainty(Value => $fields[$mag_best_column]);
            }
            my $mag_best = new Astro::Flux($num, 'MAG_BEST', $filter);
            $star->fluxes(new Astro::Fluxes($mag_best));
        }
        if ($flux_best_column != -1) {
            my $num;
            if ($fluxerr_best_column != -1) {
                $num = new Number::Uncertainty(Value => $fields[$flux_best_column],
                        Error => $fields[$fluxerr_best_column]);
            }
            else {
                $num = new Number::Uncertainty(Value => $fields[$flux_best_column]);
            }
            my $flux_best = new Astro::Flux($num, 'FLUX_BEST', $filter);
            $star->fluxes(new Astro::Fluxes($flux_best));
        }

        # Set the x and y coordinates. Preferentially use the NDF pixel
        # coordinates, then the windowed coordinates, then the standard
        # coordinates.
        if ($x_pixel_column != -1) {
            $star->x($fields[$x_pixel_column]);

lib/Astro/Catalog/IO/SExtractor.pm  view on Meta::CPAN

        my $position_angle_pixel;
        my $position_angle_world;
        my $major_axis_pixel;
        my $minor_axis_pixel;
        my $major_axis_world;
        my $minor_axis_world;
        my $fwhm_pixel;
        my $fwhm_world;
        my $area;
        if ($ell_column != -1) {
            $ellipticity = new Number::Uncertainty(Value => $fields[$ell_column]);
        }
        if ($posang_pixel_column != -1) {
            if($posangerr_pixel_column != -1) {
                $position_angle_pixel = new Number::Uncertainty(Value => $fields[$posang_pixel_column],
                        Error => $fields[$posangerr_pixel_column]);
            }
            else {
                $position_angle_pixel = new Number::Uncertainty(Value => $fields[$posang_pixel_column]);
            }
        }
        if ($posang_world_column != -1) {
            if($posangerr_world_column != -1) {
                $position_angle_world = new Number::Uncertainty(Value => $fields[$posang_world_column],
                        Error => $fields[$posangerr_world_column]);
            }
            else {
                $position_angle_world = new Number::Uncertainty(Value => $fields[$posang_world_column]);
            }
        }
        if ($major_pixel_column != -1) {
            if($majorerr_pixel_column != -1) {
                $major_axis_pixel = new Number::Uncertainty(Value => $fields[$major_pixel_column],
                        Error => $fields[$majorerr_pixel_column]);
            }
            else {
                $major_axis_pixel = new Number::Uncertainty(Value => $fields[$major_pixel_column]);
            }
        }
        if ($major_world_column != -1) {
            if($majorerr_world_column != -1) {
                $major_axis_world = new Number::Uncertainty(Value => $fields[$major_world_column],
                        Error => $fields[$majorerr_world_column]);
            }
            else {
                $major_axis_world = new Number::Uncertainty(Value => $fields[$major_world_column]);
            }
        }
        if ($minor_pixel_column != -1) {
            if($minorerr_pixel_column != -1) {
                $minor_axis_pixel = new Number::Uncertainty(Value => $fields[$minor_pixel_column],
                        Error => $fields[$minorerr_pixel_column]);
            }
            else {
                $minor_axis_pixel = new Number::Uncertainty(Value => $fields[$minor_pixel_column]);
            }
        }
        if ($minor_world_column != -1) {
            if($minorerr_world_column != -1) {
                $minor_axis_world = new Number::Uncertainty(Value => $fields[$minor_world_column],
                        Error => $fields[$minorerr_world_column]);
            }
            else {
                $minor_axis_world = new Number::Uncertainty(Value => $fields[$minor_world_column]);
            }
        }
        if ($area_column != -1) {
            $area = new Number::Uncertainty(Value => $fields[$area_column]);
        }
        if ($fwhm_pixel_column != -1) {
            $fwhm_pixel = new Number::Uncertainty(Value => $fields[$fwhm_pixel_column]);
        }
        if ($fwhm_world_column != -1) {
            $fwhm_world = new Number::Uncertainty(Value => $fields[$fwhm_world_column]);
        }
        my $morphology = new Astro::Catalog::Item::Morphology(
            ellipticity => $ellipticity,
            position_angle_pixel => $position_angle_pixel,
            position_angle_world => $position_angle_world,
            major_axis_pixel => $major_axis_pixel,
            minor_axis_pixel => $minor_axis_pixel,
            major_axis_world => $major_axis_world,
            minor_axis_world => $minor_axis_world,
            area => $area,

lib/Astro/Catalog/IO/TST.pm  view on Meta::CPAN

                # Assume it is a filter
                $construct{magnitudes}->{$filter} = $star->{$key};
                print "Found filter $filter ...\n" if $DEBUG;
            }
        }

        my (@fluxes, @colors);
        foreach my $fkey (keys %{$construct{magnitudes}}) {
            my $num;
            if (defined $construct{magerr}->{$fkey}) {
                $num = new Number::Uncertainty(
                    Value => $construct{magnitudes}->{$fkey},
                    Error => $construct{magerr}->{$fkey});
            }
            else {
                $num = new Number::Uncertainty(
                    Value => $construct{magnitudes}->{$fkey});
            }
            my $mag = new Astro::Flux($num, 'mag', "$fkey");
            push @fluxes, $mag;
        }
        delete $construct{magnitudes};
        delete $construct{magerr} if defined $construct{magerr};

        # Colors: Look for B-V
        $construct{colours} = {};
        for my $key (keys %$star) {
            next unless $key =~ /^(\w)-(\w)$/; # non-greedy
            $construct{colours}->{uc($key)} = $star->{$key};
            print "Found colour ".uc($key)." ... \n" if $DEBUG;
        }
        foreach my $ckey (keys %{$construct{colours}}) {
            my @filters = split "-", $ckey;
            my $color = new Astro::FluxColor(
                upper => new Astro::WaveBand(Filter => $filters[0]),
                lower => new Astro::WaveBand(Filter => $filters[1]),
                quantity => new Number::Uncertainty(Value => $construct{colours}->{$ckey}));
            push @colors, $color;
        }
        delete $construct{colours};

        # build the fluxes object from the available data
        if (defined $fluxes[0]  && defined $colors[0]) {
            $construct{fluxes} = new Astro::Fluxes(@fluxes, @colors);
        }
        elsif (defined $colors[0] ) {
            $construct{fluxes} = new Astro::Fluxes(@colors);

lib/Astro/Catalog/Item/Morphology.pm  view on Meta::CPAN

=head1 DESCRIPTION

Stores information about an astronomical object's morphology.

=cut

use strict;
use warnings;
use Carp;

use Number::Uncertainty;

use warnings::register;

our $VERSION = '4.38';

=head1 METHODS

=head2 Constructor

=over 4

lib/Astro/Catalog/Item/Morphology.pm  view on Meta::CPAN


The ellipticity of the object.

=cut

sub ellipticity {
    my $self = shift;
    if (@_) {
        my $ell = shift;
        if (defined($ell) &&
                ! UNIVERSAL::isa($ell, "Number::Uncertainty")) {
            $ell = new Number::Uncertainty(Value => $ell);
        }
        $self->{ELLIPTICITY} = $ell;
    }
    return $self->{ELLIPTICITY};
}

=item B<position_angle_pixel>

Position angle using the pixel frame as a reference. Measured counter-
clockwise from the positive x axis.

=cut

sub position_angle_pixel {
    my $self = shift;
    if (@_) {
        my $ang = shift;
        if (defined($ang) &&
                ! UNIVERSAL::isa($ang, "Number::Uncertainty")) {
            $ang = new Number::Uncertainty(Value => $ang);
        }
        $self->{POSITION_ANGLE_PIXEL} = $ang;
    }
    return $self->{POSITION_ANGLE_PIXEL};
}

=item B<position_angle_world>

Position angle using the world coordinate system as a reference. Measured
east of north.

=cut

sub position_angle_world {
    my $self = shift;
    if (@_) {
        my $ang = shift;
        if (defined($ang) &&
                ! UNIVERSAL::isa( $ang, "Number::Uncertainty")) {
            $ang = new Number::Uncertainty(Value => $ang);
        }
        $self->{POSITION_ANGLE_WORLD} = $ang;
    }
    return $self->{POSITION_ANGLE_WORLD};
}

=item B<major_axis_pixel>

Length of the semi-major axis in units of pixels.

=cut

sub major_axis_pixel {
    my $self = shift;
    if (@_) {
        my $axis = shift;
        if (defined($axis) &&
                ! UNIVERSAL::isa($axis, "Number::Uncertainty")) {
            $axis = new Number::Uncertainty(Value => $axis);
        }
        $self->{MAJOR_AXIS_PIXEL} = $axis;
    }
    return $self->{MAJOR_AXIS_PIXEL};
}

=item B<minor_axis_pixel>

Length of the semi-minor axis in units of pixels.

=cut

sub minor_axis_pixel {
    my $self = shift;
    if (@_) {
        my $axis = shift;
        if (defined($axis) &&
                ! UNIVERSAL::isa( $axis, "Number::Uncertainty")) {
            $axis = new Number::Uncertainty(Value => $axis);
        }
        $self->{MINOR_AXIS_PIXEL} = $axis;
    }
    return $self->{MINOR_AXIS_PIXEL};
}

=item B<major_axis_world>

Length of the semi-major axis in units of degrees.

=cut

sub major_axis_world {
    my $self = shift;
    if (@_) {
        my $axis = shift;
        if (defined($axis) &&
                ! UNIVERSAL::isa($axis, "Number::Uncertainty")) {
            $axis = new Number::Uncertainty(Value => $axis);
        }
        $self->{MAJOR_AXIS_WORLD} = $axis;
    }
    return $self->{MAJOR_AXIS_WORLD};
}

=item B<minor_axis_world>

Length of the semi-minor axis in units of degrees.

=cut

sub minor_axis_world {
    my $self = shift;
    if (@_) {
        my $axis = shift;
        if (defined($axis) &&
                ! UNIVERSAL::isa( $axis, "Number::Uncertainty")) {
            $axis = new Number::Uncertainty(Value => $axis);
        }
        $self->{MINOR_AXIS_WORLD} = $axis;
    }
    return $self->{MINOR_AXIS_WORLD};
}

=item B<area>

Area of the object, usually by using isophotal techniques, in square
pixels.

=cut

sub area {
    my $self = shift;
    if (@_) {
        my $area = shift;
        if (defined($area) &&
                ! UNIVERSAL::isa($area, "Number::Uncertainty")) {
            $area = new Number::Uncertainty(Value => $area);
        }
        $self->{AREA} = $area;
    }
    return $self->{AREA};
}

=item B<fwhm_pixel>

FWHM of the object in pixels.

=cut

sub fwhm_pixel {
    my $self = shift;
    if (@_) {
        my $fwhm = shift;
        if (defined($fwhm) &&
                ! UNIVERSAL::isa($fwhm, "Number::Uncertainty")) {
            $fwhm = new Number::Uncertainty(Value => $fwhm);
        }
        $self->{FWHM_PIXEL} = $fwhm;
    }
    return $self->{FWHM_PIXEL};
}

=item B<fwhm_world>

FWHM of the object in arcseconds.

=cut

sub fwhm_world {
    my $self = shift;
    if (@_) {
        my $fwhm = shift;
        if (defined($fwhm) &&
                ! UNIVERSAL::isa($fwhm, "Number::Uncertainty")) {
            $fwhm = new Number::Uncertainty(Value => $fwhm);
        }
        $self->{FWHM_WORLD} = $fwhm;
    }
    return $self->{FWHM_WORLD};
}

=back

=head1 PRIVATE METHODS

lib/Astro/Catalog/Query/GSC.pm  view on Meta::CPAN

use warnings;
use base qw/Astro::Catalog::Transport::REST/;

use File::Spec;
use Carp;

use Astro::Catalog;
use Astro::Catalog::Item;
use Astro::Flux;
use Astro::Fluxes;
use Number::Uncertainty;

our $VERSION = '4.38';

=begin __PRIVATE_METHODS__

=head2 Private methods

These methods are for internal use only.

=over 4

lib/Astro/Catalog/Query/GSC.pm  view on Meta::CPAN

                    $star->coords(new Astro::Coords(
                            ra => $objra,
                            dec => $objdec,
                            units => 'sex',
                            type => 'J2000',
                            name => $id,
                            ),
                        );

                    $star->fluxes(new Astro::Fluxes(new Astro::Flux(
                                new Number::Uncertainty(
                                    Value => $separated[10],
                                    Error => $separated[11]),
                                'mag', "B")));

                    # Quality
                    my $quality = $separated[13];
                    $quality = 1 if $quality == 3; # 3 == non-stellar
                    $star->quality($quality);

                    # Field

lib/Astro/Catalog/Query/MPC.pm  view on Meta::CPAN


use File::Spec;
use Time::Piece ':override';
use Carp;

use Astro::Catalog;
use Astro::Catalog::Item;

use Astro::Flux;
use Astro::Fluxes;
use Number::Uncertainty;

our $VERSION = '4.38';

=begin __PRIVATE_METHODS__

=head2 Private Methods

These methods are for internal use only.

=over 4

lib/Astro/Catalog/Query/MPC.pm  view on Meta::CPAN


                if (defined $ra) {
                    $star = new Astro::Catalog::Item();

                    $name =~ s/^\s+//;
                    $star->id( $name );

                    $vmag =~ s/^\s+//;

                    $star->fluxes(new Astro::Fluxes(new Astro::Flux(
                                new Number::Uncertainty(
                                    Value => $vmag ),
                                'mag', "V" )));

                    $comment =~ s/^\s+//;
                    $star->comment( $comment );

                    # Deal with the coordinates. RA and Dec are almost in the
                    # right format (need to replace separating spaces with colons).
                    $ra =~ s/^\s+//;
                    $ra =~ s/ /:/g;

lib/Astro/Catalog/Query/SuperCOSMOS.pm  view on Meta::CPAN

use File::Spec;
use Carp;

# generic catalog objects
use Astro::Catalog;
use Astro::Catalog::Item;

use Astro::Flux;
use Astro::FluxColor;
use Astro::Fluxes;
use Number::Uncertainty;

our $VERSION = '4.38';
our $DEBUG = 0;

# Controls whether we follow 'directory' config entries and recursively
# expand those. Default to false at the moment.
our $FOLLOW_DIRS = 0;

# This is the name of the config file that was used to generate
# the content in %CONFIG. Can be different to the contents ofg_file

lib/Astro/Catalog/Query/SuperCOSMOS.pm  view on Meta::CPAN

            $err = 0.04 if $star->get_magnitude( "BJ" ) > 15.0;
            $err = 0.05 if $star->get_magnitude( "BJ" ) > 17.0;
            $err = 0.06 if $star->get_magnitude( "BJ" ) > 19.0;
            $err = 0.07 if $star->get_magnitude( "BJ" ) > 20.0;
            $err = 0.12 if $star->get_magnitude( "BJ" ) > 21.0;
            $err = 0.08 if $star->get_magnitude( "BJ" ) > 22.0;
        }
        else {
            $err = 99.999;
        }
        $mag = new Astro::Flux(new Number::Uncertainty(
                    Value => $star->get_magnitude("BJ"),
                    Error => $err ),
                'mag', 'BJ' );
        push @mags, $mag;

        $err = 0.06;
        if ( $star->get_magnitude( "R1" ) != 99.999 ) {
            $err = 0.06 if $star->get_magnitude( "R1" ) > 11.0;
            $err = 0.03 if $star->get_magnitude( "R1" ) > 12.0;
            $err = 0.09 if $star->get_magnitude( "R1" ) > 13.0;
            $err = 0.10 if $star->get_magnitude( "R1" ) > 14.0;
            $err = 0.12 if $star->get_magnitude( "R1" ) > 18.0;
            $err = 0.18 if $star->get_magnitude( "R1" ) > 19.0;
        }
        else {
            $err = 99.999;
        }
        $mag = new Astro::Flux(new Number::Uncertainty(
                    Value => $star->get_magnitude("R1"),
                    Error => $err),
                'mag', 'R1' );
        push @mags, $mag;

        $err = 0.02;
        if ( $star->get_magnitude( "R2" ) != 99.999 ) {
            $err = 0.02 if $star->get_magnitude( "R2" ) > 12.0;
            $err = 0.03 if $star->get_magnitude( "R2" ) > 13.0;
            $err = 0.04 if $star->get_magnitude( "R2" ) > 15.0;
            $err = 0.05 if $star->get_magnitude( "R2" ) > 17.0;
            $err = 0.06 if $star->get_magnitude( "R2" ) > 18.0;
            $err = 0.11 if $star->get_magnitude( "R2" ) > 19.0;
            $err = 0.16 if $star->get_magnitude( "R2" ) > 20.0;
        }
        else {
            $err = 99.999;
        }
        $mag = new Astro::Flux( new Number::Uncertainty(
                    Value => $star->get_magnitude("R2"),
                    Error => $err ),
                'mag', 'R2' );
        push @mags, $mag;

        $err = 0.05;
        if ( $star->get_magnitude( "I" ) != 99.999 ) {
            $err = 0.05 if $star->get_magnitude( "I" ) > 15.0;
            $err = 0.06 if $star->get_magnitude( "I" ) > 16.0;
            $err = 0.09 if $star->get_magnitude( "I" ) > 17.0;
            $err = 0.16 if $star->get_magnitude( "I" ) > 18.0;
        }
        else {
            $err = 99.999;
        }
        $mag = new Astro::Flux( new Number::Uncertainty(
                    Value => $star->get_magnitude("I"),
                    Error => $err ),
                'mag', 'I' );
        push @mags, $mag;

        # calculate colours UKST Bj - UKST R, UKST Bj - UKST I

        if ($star->get_magnitude( "BJ" ) != 99.999 &&
                $star->get_magnitude( "R2" ) != 99.999) {
            my $bj_minus_r2 = $star->get_magnitude( "BJ" ) -

lib/Astro/Catalog/Query/SuperCOSMOS.pm  view on Meta::CPAN

            $cval = $bj_minus_r2;
            $err = $delta_bjmr;
        }
        else {
            $cval = 99.999;
            $err = 99.999;
        }
        $col = new Astro::FluxColor(
                upper => 'BJ',
                lower => "R2",
                quantity => new Number::Uncertainty(
                    Value => $cval,
                    Error => $err ) );
        push @cols, $col;

        if ($star->get_magnitude( "BJ" ) != 99.999 &&
                $star->get_magnitude( "I" ) != 99.999) {

            my $bj_minus_i = $star->get_magnitude( "BJ" ) -
                $star->get_magnitude( "I" );
            $bj_minus_i =  sprintf("%.4f", $bj_minus_i );

lib/Astro/Catalog/Query/SuperCOSMOS.pm  view on Meta::CPAN

            $err = $delta_bjmi;

        }
        else {
            $cval = 99.999;
            $err = 99.999;
        }
        $col = new Astro::FluxColor(
                upper => 'BJ',
                lower => "I",
                quantity => new Number::Uncertainty(
                    Value => $cval,
                    Error => $err ) );
        push @cols, $col;

        # Push the data back into the star object, overwriting ther previous
        # values we got from the initial Skycat query. This isn't a great
        # solution, but it wasn't easy in version 3 syntax either, so I guess
        # your milage may vary.

        my $fluxes = new Astro::Fluxes( @mags, @cols );

lib/Astro/Catalog/Query/USNOA2.pm  view on Meta::CPAN

use File::Spec;
use Carp;

use Astro::Coords;
use Astro::Catalog;
use Astro::Catalog::Item;

use Astro::Flux;
use Astro::Fluxes;
use Astro::FluxColor;
use Number::Uncertainty;

our $VERSION = '4.38';

=begin __PRIVATE_METHODS__

=head2 Private methods

These methods are for internal use only.

=over 4

lib/Astro/Catalog/Query/USNOA2.pm  view on Meta::CPAN

                #
                #   Delta.(B-R) = sqrt( Delta.R**2 + Delta.B**2 )

                my $b_minus_r = $separated[9] - $separated[8];

                # delta.(B-R)
                my $delta_bmr = ( ( $delta_r ** 2.0 ) + ( $delta_b ** 2.0 ) ) ** (1.0/2.0);

                $star->fluxes(new Astro::Fluxes(
                            new Astro::Flux(
                                new Number::Uncertainty(
                                    Value => $separated[8],
                                    Error => $delta_r ),
                                'mag', "R"),
                            new Astro::Flux(
                                new Number::Uncertainty(
                                    Value => $separated[9],
                                    Error => $delta_b),
                                'mag', "B"),
                            new Astro::FluxColor(
                                lower => "R",
                                upper => "B",
                                quantity => new Number::Uncertainty(
                                    Value => $b_minus_r,
                                    Error => $delta_bmr)),
                        ));

                # Push the star into the catalog

                # only push the star if the Astro::Coords object is
                # correctly defined. The Dec might be bogus since the
                # USNO-A2 catalog has its seconds field out of
                # normal range (0-59.9) in some cases.

t/2_jcmt.t  view on Meta::CPAN

*   CRL2688, NGC7027, section above) are left unchanged, but these are not
*   inconsistent with Loup.
*   Note that we still have not gone through all the sources in the list.!!
*
*   The catalogue gives T_A* (peak) for the 2-1 line. More informative, however, are the integrated line intensities
*   in the comment line (in K km/s), which largely determine how easy it is to detect a line. Note that JCMT 2-1
*   data followed by J are typically low by about a factor of 1.3 - 1.5 (telescope heavily deformed due to conebar
*   welding.
*
* 20070717 Notes reflect new positional accuracies : L1 L2 L3 original Loup qualities (<1", 1-5", >5");
*                                                  : /H and /T reflect updates by Hipparcos & Tycho (uncertainty of <1")
* 20060530 Notes reflect new positional accuracies : /2M reflect updates by 2MASS (catalog II/246)
*
* 20140910 Modifications based on M13BN01 and M14AN01:
*          Vlsr, Tpeak, Vrange derived from HARP CO(3-2) spectra
*          Under comments is indicated whether source is good for RxA, HARP, or both: A, H, AH
*          and Tpeak, Integrated intensity for CO(2-1) and CO(3-2)
*
*
*               RA & DEC                   Eq  Vlsr     Tpeak   Vrange           JCMT   comments
*- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

t/2_votable.t  view on Meta::CPAN

do $p."helper.pl" or die "Error reading test functions: $!";

# GENERATE A CATALOG

my @star;

# STAR 1

# magnitude and colour hashes
my $flux1 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.1,
            Error => 0.1),
        'mag', 'R');
my $flux2 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.4,
            Error => 0.4),
        'mag', 'B');
my $flux3 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.3,
            Error => 0.3),
        'mag', 'V');
my $col1 = new Astro::FluxColor(
        upper => 'B', lower => 'V',
        quantity => new Number::Uncertainty(
            Value => 0.1,
            Error => 0.02));
my $col2 = new Astro::FluxColor(
        upper => 'B', lower => 'R',
        quantity => new Number::Uncertainty(
            Value => 0.3,
            Error => 0.05));
my $fluxes1 = new Astro::Fluxes($flux1, $flux2, $flux3, $col1, $col2);


# create a star
$star[0] = new Astro::Catalog::Item(
        ID         => 'U1500_01194794',
        RA         => '09 55 39',
        Dec        => '+60 07 23.6',

t/2_votable.t  view on Meta::CPAN

        Distance   => '0.09',
        PosAngle   => '50.69',
        Field      => '00080');

isa_ok($star[0], "Astro::Catalog::Item");

# STAR 2

# magnitude and colour hashes
my $flux4 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 9.5,
            Error => 0.6),
        'mag', 'R');
my $flux5 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 9.3,
            Error => 0.2),
        'mag', 'B');
my $flux6 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 9.1,
            Error => 0.1),
        'mag', 'V' );
my $col3 = new Astro::FluxColor(
        upper => 'B', lower => 'V',
        quantity => new Number::Uncertainty(
            Value => -0.2,
            Error => 0.05));
my $col4 = new Astro::FluxColor(
        upper => 'B', lower => 'R',
        quantity => new Number::Uncertainty(
            Value => 0.2,
            Error => 0.07));
my $fluxes2 = new Astro::Fluxes($flux4, $flux5, $flux6, $col3, $col4);

# create a star
$star[1] = new Astro::Catalog::Item(
        ID         => 'U1500_01194795',
        RA         => '10 44 57',
        Dec        => '+12 34 53.5',
        Fluxes     => $fluxes2,

t/2_votable.t  view on Meta::CPAN

my $read_catalog = new Astro::Catalog(Format => 'VOTable', File => $tempfile);

# Generate a catalog

my @star2;

# STAR 3

# magnitude and colour hashes
my $flux7 = new Astro::Flux(
        new Number::Uncertainty (
            Value => 16.1),
        'mag', 'R');
my $flux8 = new Astro::Flux(
        new Number::Uncertainty (
            Value => 16.4),
        'mag', 'B');
my $flux9 = new Astro::Flux(
        new Number::Uncertainty (
            Value => 16.3),
        'mag', 'V');
my $col5 = new Astro::FluxColor(
        upper => 'B', lower => 'V',
        quantity => new Number::Uncertainty(
            Value => 0.1));
my $col6 = new Astro::FluxColor(
        upper => 'B', lower => 'R',
        quantity => new Number::Uncertainty(
            Value => 0.3));
my $fluxes3 = new Astro::Fluxes($flux7, $flux8, $flux9, $col5, $col6);

# create a star
$star2[0] = new Astro::Catalog::Item(
        ID         => 'U1500_01194794',
        RA         => '09 55 39',
        Dec        => '+60 07 23.6',
        Fluxes     => $fluxes3,
        Quality    => '0' );
isa_ok($star2[0], "Astro::Catalog::Item");

# STAR 4

# magnitude and colour hashes
my $flux10 = new Astro::Flux(
        new Number::Uncertainty (
            Value => 9.5),
        'mag', 'R');
my $flux11 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 9.3),
        'mag', 'B');
my $flux12 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 9.1),
        'mag', 'V');
my $col7 = new Astro::FluxColor(
        upper => 'B', lower => 'V',
        quantity => new Number::Uncertainty(
            Value => -0.2));
my $col8 = new Astro::FluxColor(
        upper => 'B', lower => 'R',
        quantity => new Number::Uncertainty(
            Value => 0.2));
my $fluxes4 = new Astro::Fluxes($flux10, $flux11, $flux12, $col7, $col8);

# create a star
$star2[1] = new Astro::Catalog::Item(
        ID         => 'U1500_01194795',
        RA         => '10 44 57',
        Dec        => '+12 34 53.5',
        Fluxes     => $fluxes4,
        Quality    => '0');

t/3_catalog.t  view on Meta::CPAN

    use_ok "Astro::Catalog";
    use_ok "Astro::Catalog::Item";
}

my @star;

# STAR 1

# magnitude and colour hashes
my $flux1 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.1,
            Error => 0.1),
        'mag', 'R');
my $flux2 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.4,
            Error => 0.4),
        'mag', 'B');
my $flux3 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.3,
            Error => 0.3),
        'mag', 'V');
my $col1 = new Astro::FluxColor(
        upper => 'B', lower => 'V',
        quantity => new Number::Uncertainty(
            Value => 0.1,
            Error => 0.02));
my $col2 = new Astro::FluxColor(
        upper => 'B', lower => 'R',
        quantity => new Number::Uncertainty(
            Value => 0.3,
            Error => 0.05));
my $fluxes1 = new Astro::Fluxes($flux1, $flux2, $flux3, $col1, $col2);

# create a star
$star[0] = new Astro::Catalog::Item(
        ID         => 'U1500_01194794',
        RA         => '09 55 39',
        Dec        => '+60 07 23.6',
        Fluxes     => $fluxes1,
        Quality    => '0',
        GSC        => 'FALSE',
        Distance   => '0.09',
        PosAngle   => '50.69',
        Field      => '00080');

# STAR 2

# magnitude and colour hashes
my $flux4 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 9.5,
            Error => 0.6 ),
        'mag', 'R' );
my $flux5 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 9.3,
            Error => 0.2 ),
        'mag', 'B' );
my $flux6 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 9.1,
            Error => 0.1),
        'mag', 'V');
my $col3 = new Astro::FluxColor(
        upper => 'B', lower => 'V',
        quantity => new Number::Uncertainty(
            Value => -0.2,
            Error => 0.05));
my $col4 = new Astro::FluxColor(
        upper => 'B', lower => 'R',
        quantity => new Number::Uncertainty(
            Value => 0.2,
            Error => 0.07));
my $fluxes2 = new Astro::Fluxes($flux4, $flux5, $flux6, $col3, $col4);

# create a star
$star[1] = new Astro::Catalog::Item(
        ID         => 'U1500_01194795',
        RA         => '10 44 57',
        Dec        => '+12 34 53.5',
        Fluxes     => $fluxes2,

t/3_item.t  view on Meta::CPAN



BEGIN {
    use_ok("Astro::Catalog::Item")
};
use Data::Dumper;
use DateTime;

# magnitude and colour hashes
my $flux1 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.1,
            Error => 0.1),
        'mag', 'R');
my $flux2 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.4,
            Error => 0.4),
        'mag', 'B');
my $flux3 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.3,
            Error => 0.3),
        'mag', 'V');
my $col1 = new Astro::FluxColor(
        upper => 'B', lower => 'V',
        quantity => new Number::Uncertainty(
            Value => 0.1,
            Error => 0.02));
my $col2 = new Astro::FluxColor(
        upper => 'B', lower => 'R',
        quantity => new Number::Uncertainty(
            Value => 0.3,
            Error => 0.05));
my $fluxes = new Astro::Fluxes($flux1, $flux2, $flux3, $col1, $col2);

# create a star
my $star = new Astro::Catalog::Item(
        ID         => 'U1500_01194794',
        RA         => '17.55398',
        Dec        => '60.07673',
        Fluxes     => $fluxes,

t/3_morphology.t  view on Meta::CPAN

# Set up a Morphology object.
my $morph = new Astro::Catalog::Item::Morphology;
isa_ok($morph, "Astro::Catalog::Item::Morphology");

# Set up one with scalar attributes.
my $morph2 = new Astro::Catalog::Item::Morphology(
        ellipticity => 0.75,
        area => 25 );
isa_ok($morph2, "Astro::Catalog::Item::Morphology");

# Check to see if attributes have been cast to Number::Uncertainty
# objects.
my $area2 = $morph2->area;
isa_ok($area2, "Number::Uncertainty");
is($area2->value, 25, "Object area");
is($area2->error, 0, "Object area error");

# Now set up a Morphology object with Number::Uncertainty attributes.
my $area3 = new Number::Uncertainty(
        Value => 10,
        Error => 0.1,
    );
my $position_angle_pixel = new Number::Uncertainty(
        Value => 74.5,
        Error => 0.13,
    );
my $morph3 = new Astro::Catalog::Item::Morphology(
        area => $area3,
        position_angle_pixel => $position_angle_pixel,
    );
isa_ok($morph3, "Astro::Catalog::Item::Morphology");

# Make sure attributes are still correct.
isa_ok($morph3->area, "Number::Uncertainty");
is($morph3->area->value, 10, "Object area");
is($morph3->area->error, 0.1, "Object area error");

# Check setting of undefined values.
my $morph4 = new Astro::Catalog::Item::Morphology(area => undef);
isa_ok($morph4, "Astro::Catalog::Item::Morphology");
is($morph4->area, undef, "Object area is undefined");

t/3_star.t  view on Meta::CPAN


use Test::More tests => 17;

BEGIN {
    use_ok("Astro::Catalog::Item")
};
use Data::Dumper;

# magnitude and colour hashes
my $flux1 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.1,
            Error => 0.1),
        'mag', 'R');
my $flux2 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.4,
            Error => 0.4),
        'mag', 'B');
my $flux3 = new Astro::Flux(
        new Number::Uncertainty(
            Value => 16.3,
            Error => 0.3),
        'mag', 'V');
my $col1 = new Astro::FluxColor(
        upper => 'B', lower => 'V',
        quantity => new Number::Uncertainty(
            Value => 0.1,
            Error => 0.02));
my $col2 = new Astro::FluxColor(
        upper => 'B', lower => 'R',
        quantity => new Number::Uncertainty(
            Value => 0.3,
            Error => 0.05));
my $fluxes = new Astro::Fluxes($flux1, $flux2, $flux3, $col1, $col2);

# create a star
my $star = new Astro::Catalog::Item(
        ID         => 'U1500_01194794',
        RA         => '17.55398',
        Dec        => '60.07673',
        Fluxes     => $fluxes,

t/4_gsc.t  view on Meta::CPAN

use Data::Dumper;

# Catalog modules need to be loaded first
BEGIN {
    use_ok( "Astro::Catalog::Item");
    use_ok( "Astro::Catalog");
    use_ok( "Astro::Catalog::Query::GSC");
}
use Astro::Flux;
use Astro::Fluxes;
use Number::Uncertainty;

# Load the generic test code
my $p = (-d "t" ? "t/" : "");
do $p."helper.pl" or die "Error reading test functions: $!";


# Grab GSC sample from the DATA block
my @buffer = <DATA>;
chomp @buffer;

t/4_gsc.t  view on Meta::CPAN

        $star->coords(new Astro::Coords(
                name => $id,
                ra => $objra,
                dec => $objdec,
                units => 'sex',
                type => 'J2000',
            ));

        $star->fluxes(new Astro::Fluxes(
                    new Astro::Flux(
                        new Number::Uncertainty(
                            Value => $separated[10],
                            Error => $separated[11]),
                        'mag', "B")));

        # Quality
        my $quality = $separated[13];
        $star->quality($quality);

        # Field
        my $field = $separated[12];

t/4_mpc.t  view on Meta::CPAN

#!perl
# Astro::Catalog::Query::MPC test harness

use strict;

use Test::More tests => 202;
use Data::Dumper;

use Astro::Flux;
use Astro::Fluxes;
use Number::Uncertainty;

# Catalog modules need to be loaded first
BEGIN {
    use_ok( "Astro::Catalog::Item");
    use_ok( "Astro::Catalog");
    use_ok( "Astro::Catalog::Query::MPC");
}


# Load the generic test code

t/4_mpc.t  view on Meta::CPAN


    if (defined $ra) {
        $star = new Astro::Catalog::Item();

        $name =~ s/^\s+//;
        $star->id( $name );

        $vmag =~ s/^\s+//;

        $star->fluxes(new Astro::Fluxes(new Astro::Flux(
            new Number::Uncertainty(Value => $vmag),
            'mag', "V")));

        $comment =~ s/^\s+//;
        $star->comment($comment);

        # Deal with the coordinates. RA and Dec are almost in the
        # right format (need to replace separating spaces with colons).
        $ra =~ s/^\s+//;
        $ra =~ s/ /:/g;
        $dec =~ s/^\s+//;

t/4_skycat_gsc.t  view on Meta::CPAN


BEGIN {
    # load modules
    use_ok("Astro::Catalog::Item");
    use_ok("Astro::Catalog");
    use_ok("Astro::Catalog::Query::SkyCat");
}

use Astro::Fluxes;
use Astro::Flux;
use Number::Uncertainty;

# Load the generic test code
my $p = (-d "t" ? "t/" : "");
do $p."helper.pl" or die "Error reading test functions: $!";

# Grab GSC sample from the DATA block
my @buffer = <DATA>;
chomp @buffer;

# test catalog

t/4_skycat_gsc.t  view on Meta::CPAN


       $star->coords(new Astro::Coords(
                   name => $id,
                   ra => $objra,
                   dec => $objdec,
                   units => 'sex',
                   type => 'J2000',
               ));

       $star->fluxes(new Astro::Fluxes(new Astro::Flux(
                       new Number::Uncertainty(
                           Value => $separated[10]),
                       'mag', "R" )));
       # Quality
       my $quality = $separated[13];
       $star->quality(undef);

       # Field
       my $field = $separated[12];
       $star->field(undef);

t/4_usnoa2.t  view on Meta::CPAN

# strict
use strict;

#load test
use Test::More tests => 351;
use Data::Dumper;

use Astro::Flux;
use Astro::Fluxes;
use Astro::FluxColor;
use Number::Uncertainty;

BEGIN {
  # load modules
  use_ok("Astro::Catalog::Item");
  use_ok("Astro::Catalog");
  use_ok("Astro::Catalog::Query::USNOA2");
}

# Load the generic test code
my $p = ( -d "t" ?  "t/" : "");

t/4_usnoa2.t  view on Meta::CPAN


    my $b_minus_r = $separated[10] - $separated[9];

    # delta.(B-R)
    my $delta_bmr = (($delta_r ** 2.0) + ($delta_b ** 2.0)) ** (1.0 / 2.0);

    # Build the fluxes object

    $star->fluxes(new Astro::Fluxes(
                new Astro::Flux(
                    new Number::Uncertainty(
                        Value => $separated[9],
                        Error => $delta_r ),
                    'mag', "R"),
                new Astro::Flux(
                    new Number::Uncertainty(
                        Value => $separated[10],
                        Error => $delta_b),
                    'mag', "B" ),
                new Astro::FluxColor(
                    lower => "R",
                    upper => "B",
                    quantity => new Number::Uncertainty(
                        Value => $b_minus_r,
                        Error => $delta_bmr) ),
                ));

    # Push the star into the catalog
    $catalog_data->pushstar($star);

}

# field centre



( run in 0.674 second using v1.01-cache-2.11-cpan-4e96b696675 )