Astro-Catalog

 view release on metacpan or  search on metacpan

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

These methods are usually called automatically from the C<Astro::Catalog>
constructor, but are available for public use.

=over 4

=item B<input_format>

Returns the requested input format for the FITSTable class, which is
'name', meaning the name of the file to be turned into an C<Astro::Catalog>
object.

    $input_format = Astro::Catalog::IO::LCOGTFITSTable->input_format;

=cut

sub input_format {
    return "name";
}

=back

=begin __PRIVATE_METHODS__

=head1 PRIVATE METHODS

These methods are usually called automatically from the C<Astro::Catalog>
constructor.

=item B<_read_catalog>

Parses the binary FITS table and returns a new C<Astro::Catalog> object
containing the catalog entries.

    $cat = Astro::Catalog::IO::LCOGTFITSTable->_read_catalog($whatever);

The current translations from FITS table column names to
C<Astro::Catalog::Item> properties are:

=over 4

=item No. - ID

=item X_coordinate - X

=item Y_coordinate - Y

=item RA & DEC - Coords

=item Isophotal_flux, Total_flux, Total_flux_err, Core_flux, Core1_flux, Core2_flux,
 Core3_flux, Core4_flux - C<Astro::Flux> objects pushed into
 the C<Astro::Catalog::Item> fluxes accessor.

=item Isoarea, Ellipticity & Position_angle - Morphology

=item Flags - Quality

=back

RA and Dec are assumed to be in J2000 coordinates, and are in units
of degrees. The total flux is assumed to be in units of counts,
and is converted into a magnitude through the formula -2.5 * log10( flux ).
The position angle is assumed to be the angle measured counter-
clockwise from the positive x axis, in degrees.

An attempt to read in the DATE-OBS header is made so that flux measurements
can be timestamped. If the DATE-OBS header does not exist, then the current
date and time will be used for the flux timestamps.

There are optional named parameters. These are case-sensitive, and are:

=item Filter - An Astro::WaveBand object denoting the waveband that
the catalog values were measured in.

=cut

sub _read_catalog {
    my $class = shift;
    my %args = @_;

    unless (defined $args{'filename'}) {
        croak "Must supply a filename to read";
    }
    my $filename = $args{'filename'};

    my $obsid;
    if (defined $args{'obsid'}) {
        $obsid = $args{'obsid'};
    }
    else {
        $obsid = [];
    }

    if ((defined $args{'Filter'}) &&
            ! UNIVERSAL::isa($args{'Filter'}, "Astro::WaveBand")) {
        croak "Filter as passed to LCOGTFITSTable->_read_catalog must be an Astro::WaveBand object";
    }

    my $filter;
    if (defined $args{'Filter'}) {
        print "Filter defined\n" if $DEBUG;
        $filter = $args{'Filter'}->natural;
    }
    else {
        $filter = 'unknown';
    }
    print "Input Filter=$filter\n" if $DEBUG;
    # A lookup table for column name mappings.
    my %column_name = (
        'ID' => 'NUMBER',
        'X' => 'X_IMAGE',
        'Y' => 'Y_IMAGE',
        'RA' => 'ALPHA_J2000',
        'Dec' => 'DELTA_J2000',
        'isophotal_flux' => 'FLUX_ISO',
        'total_flux' => 'FLUX_AUTO',
        'total_flux_err' => 'FLUXERR_AUTO',
        'core_flux' => 'FLUX_APER',
        'core1_flux' => 'FLUX_APER1',
        'core2_flux' => 'FLUX_APER2',
        'core3_flux' => 'FLUX_APER3',
        'core4_flux' => 'FLUX_APER4',



( run in 0.867 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )