1 | //#---------------------------------------------------------------------------
|
---|
2 | //# FITSreader.cc: ATNF single-dish FITS reader.
|
---|
3 | //#---------------------------------------------------------------------------
|
---|
4 | //# livedata - processing pipeline for single-dish, multibeam spectral data.
|
---|
5 | //# Copyright (C) 2000-2009, Australia Telescope National Facility, CSIRO
|
---|
6 | //#
|
---|
7 | //# This file is part of livedata.
|
---|
8 | //#
|
---|
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
|
---|
15 | //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
---|
16 | //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
---|
17 | //# more details.
|
---|
18 | //#
|
---|
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/>.
|
---|
21 | //#
|
---|
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
|
---|
28 | //# AUSTRALIA
|
---|
29 | //#
|
---|
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 $
|
---|
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 |
|
---|
43 | using 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 |
|
---|
51 | int FITSreader::select(
|
---|
52 | const int startChan[],
|
---|
53 | const int endChan[],
|
---|
54 | const int refChan[],
|
---|
55 | const int getSpectra,
|
---|
56 | const int getXPol,
|
---|
57 | const int getFeedPos,
|
---|
58 | const int getPointing,
|
---|
59 | const int coordSys)
|
---|
60 | {
|
---|
61 | int maxNChan = 0;
|
---|
62 |
|
---|
63 | for (int iIF = 0; iIF < cNIF; iIF++) {
|
---|
64 | if (!cIFs[iIF]) {
|
---|
65 | continue;
|
---|
66 | }
|
---|
67 |
|
---|
68 | cStartChan[iIF] = startChan[iIF];
|
---|
69 | cEndChan[iIF] = endChan[iIF];
|
---|
70 | cRefChan[iIF] = refChan[iIF];
|
---|
71 |
|
---|
72 | if (cStartChan[iIF] <= 0) {
|
---|
73 | cStartChan[iIF] += cNChan[iIF];
|
---|
74 | } else if (cStartChan[iIF] > cNChan[iIF]) {
|
---|
75 | cStartChan[iIF] = cNChan[iIF];
|
---|
76 | }
|
---|
77 |
|
---|
78 | if (cEndChan[iIF] <= 0) {
|
---|
79 | cEndChan[iIF] += cNChan[iIF];
|
---|
80 | } else if (cEndChan[iIF] > cNChan[iIF]) {
|
---|
81 | cEndChan[iIF] = cNChan[iIF];
|
---|
82 | }
|
---|
83 |
|
---|
84 | maxNChan = max(maxNChan, abs(cEndChan[iIF] - cStartChan[iIF]) + 1);
|
---|
85 | }
|
---|
86 |
|
---|
87 | cGetSpectra = getSpectra && cHaveSpectra;
|
---|
88 | cGetXPol = getXPol && cGetXPol;
|
---|
89 | cGetFeedPos = getFeedPos;
|
---|
90 | cCoordSys = coordSys;
|
---|
91 |
|
---|
92 |
|
---|
93 | return maxNChan;
|
---|
94 | }
|
---|