source: trunk/external/atnf/PKSIO/FITSreader.cc@ 2230

Last change on this file since 2230 was 1720, checked in by Malte Marquarding, 15 years ago

Update from livedata CVS repository

File size: 3.1 KB
RevLine 
[1325]1//#---------------------------------------------------------------------------
2//# FITSreader.cc: ATNF single-dish FITS reader.
3//#---------------------------------------------------------------------------
[1720]4//# livedata - processing pipeline for single-dish, multibeam spectral data.
5//# Copyright (C) 2000-2009, Australia Telescope National Facility, CSIRO
[1325]6//#
[1720]7//# This file is part of livedata.
[1325]8//#
[1720]9//# livedata is free software: you can redistribute it and/or modify it under
10//# the terms of the GNU General Public License as published by the Free
11//# Software Foundation, either version 3 of the License, or (at your option)
12//# any later version.
13//#
14//# livedata is distributed in the hope that it will be useful, but WITHOUT
[1325]15//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
[1720]16//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17//# more details.
[1325]18//#
[1720]19//# You should have received a copy of the GNU General Public License along
20//# with livedata. If not, see <http://www.gnu.org/licenses/>.
[1325]21//#
[1720]22//# Correspondence concerning livedata may be directed to:
23//# Internet email: mcalabre@atnf.csiro.au
24//# Postal address: Dr. Mark Calabretta
25//# Australia Telescope National Facility, CSIRO
26//# PO Box 76
27//# Epping NSW 1710
[1325]28//# AUSTRALIA
29//#
[1720]30//# http://www.atnf.csiro.au/computing/software/livedata.html
31//# $Id: FITSreader.cc,v 19.4 2009-09-29 07:33:38 cal103 Exp $
[1325]32//#---------------------------------------------------------------------------
33//# The FITSreader class is an abstract base class for the Parkes Multibeam
34//# RPFITS and SDFITS readers.
35//#
36//# Original: 2000/07/28 Mark Calabretta
37//#---------------------------------------------------------------------------
38
39#include <atnf/PKSIO/FITSreader.h>
40
41#include <algorithm>
42
43using namespace std;
44
45//--------------------------------------------------------- FITSreader::select
46
47// Set data selection criteria. Note that cBeams and cIFs, the addresses of
48// int arrays, are returned by open() thereby allowing their elements to be
49// modified directly elsewhere (specifically by PKSFITSreader::select()).
50
51int FITSreader::select(
52 const int startChan[],
53 const int endChan[],
54 const int refChan[],
55 const int getSpectra,
56 const int getXPol,
[1452]57 const int coordSys)
[1325]58{
59 int maxNChan = 0;
60
61 for (int iIF = 0; iIF < cNIF; iIF++) {
62 if (!cIFs[iIF]) {
63 continue;
64 }
65
66 cStartChan[iIF] = startChan[iIF];
67 cEndChan[iIF] = endChan[iIF];
68 cRefChan[iIF] = refChan[iIF];
69
70 if (cStartChan[iIF] <= 0) {
71 cStartChan[iIF] += cNChan[iIF];
72 } else if (cStartChan[iIF] > cNChan[iIF]) {
73 cStartChan[iIF] = cNChan[iIF];
74 }
75
76 if (cEndChan[iIF] <= 0) {
77 cEndChan[iIF] += cNChan[iIF];
78 } else if (cEndChan[iIF] > cNChan[iIF]) {
79 cEndChan[iIF] = cNChan[iIF];
80 }
81
82 maxNChan = max(maxNChan, abs(cEndChan[iIF] - cStartChan[iIF]) + 1);
83 }
84
85 cGetSpectra = getSpectra && cHaveSpectra;
86 cGetXPol = getXPol && cGetXPol;
[1452]87 cCoordSys = coordSys;
[1325]88
89 return maxNChan;
90}
Note: See TracBrowser for help on using the repository browser.