Astro-FITS-HdrTrans

 view release on metacpan or  search on metacpan

lib/Astro/FITS/HdrTrans/SCUBA2.pm  view on Meta::CPAN

sub this_instrument {
  return "SCUBA-2";
}

=back

=head1 COMPLEX CONVERSIONS

These methods are more complicated than a simple mapping. We have to
provide both from- and to-FITS conversions All these routines are
methods and the to_ routines all take a reference to a hash and return
the translated value (a many-to-one mapping) The from_ methods take a
reference to a generic hash and return a translated hash (sometimes
these are many-to-many)

=over 4

=item B<to_OBSERVATION_MODE>

If Observation type is SCIENCE, return the sample mode, else
return the sample mode and observation type. For example, "STARE",
"SCAN", "SCAN_POINTING".

Do not currently take into account polarimeter or FTS.

=cut

sub to_OBSERVATION_MODE {
  my $self = shift;
  my $FITS_headers = shift;

  my $return;
  if ( exists( $FITS_headers->{'SAM_MODE'} ) &&
       exists( $FITS_headers->{'OBS_TYPE'} ) ) {
    my $sam_mode = $FITS_headers->{'SAM_MODE'};
    $sam_mode =~ s/\s//g;
    my $obs_type = $FITS_headers->{'OBS_TYPE'};
    $obs_type =~ s/\s//g;

    $return = $sam_mode;
    if ($obs_type !~ /science/i) {
      if ($obs_type =~ /(setup)/i) {
        $return = lc($1);
      } else {
        $return .= "_$obs_type";
      }
    }
  }
  return $return;
}

=item B<to_SUBSYSTEM_IDKEY>

=cut

sub to_SUBSYSTEM_IDKEY {
  my $self = shift;
  my $FITS_headers = shift;

  # Try the general headers first
  my $general = $self->SUPER::to_SUBSYSTEM_IDKEY( $FITS_headers );
  return ( defined $general ? $general : "FILTER" );
}

=item B<to_DR_RECIPE>

Fix up recipes that were incorrect in the early years of the
observing tool.

Converts SASSy survey data to use the SASSy recipe.

=cut

sub to_DR_RECIPE {
  my $class = shift;
  my $FITS_headers = shift;
  my $dr = $FITS_headers->{RECIPE};
  my $survey = $FITS_headers->{SURVEY};

  if (defined $survey && $survey =~ /sassy/i) {
    if ($dr !~ /sassy/i) {
      $dr = "REDUCE_SASSY";
    }
  }
  return $dr;
}

=item B<to_POLARIMETER>

Determine if POL-2 is in the beam, based on the INBEAM header.

=cut

sub to_POLARIMETER {
  my $class = shift;
  my $FITS_headers = shift;

  my $inbeam = $FITS_headers->{'INBEAM'};

  return 0 unless defined $inbeam;

  return ($inbeam =~ /\bpol/i) ? 1 : 0;
}

=item B<from_POLARIMETER>

Attempt to recreate the INBEAM header.  Since this also
depends on FTS-2, use the _reconstruct_INBEAM method.

=cut

sub from_POLARIMETER {
  my $class = shift;
  my $generic_headers = shift;

  return $class->_reconstruct_INBEAM($generic_headers);
}

=item B<to_FOURIER_TRANSFORM_SPECTROMETER>

Determine if FTS-2 is in the beam, based on the INBEAM header.



( run in 1.623 second using v1.01-cache-2.11-cpan-98e64b0badf )