1066 - | void ImagePolarimetry::_findFrequencyAxis (Int& spectralCoord, Int& fAxis, |
1067 - | const CoordinateSystem& cSys, Int spectralAxis) const |
1068 - | { |
1069 - | LogIO os(LogOrigin("ImagePolarimetry", __func__, WHERE)); |
1070 - | spectralCoord = -1; |
1071 - | fAxis = -1; |
1072 - | if (spectralAxis >=0) { |
1073 - | if (spectralAxis < Int(cSys.nPixelAxes())) { |
1074 - | fAxis = spectralAxis; |
1075 - | Int axisInCoordinate; |
1076 - | cSys.findPixelAxis(spectralCoord, axisInCoordinate, fAxis); |
1077 - | |
1078 - | |
1079 - | |
1080 - | Bool ok = cSys.type(spectralCoord)==Coordinate::TABULAR || |
1081 - | cSys.type(spectralCoord)==Coordinate::LINEAR || |
1082 - | cSys.type(spectralCoord)==Coordinate::SPECTRAL; |
1083 - | if (!ok) { |
1084 - | os << "The specified axis of type " << cSys.showType(spectralCoord) |
1085 - | << " cannot be a frequency axis" << LogIO::EXCEPTION; |
1086 - | } |
1087 - | } else { |
1088 - | os << "Illegal spectral axis " << spectralAxis+1 << " given" << LogIO::EXCEPTION; |
1089 - | } |
1090 - | } else { |
1091 - | spectralCoord = _findSpectralCoordinate(cSys, os, false); |
1092 - | if (spectralCoord < 0) { |
1093 - | for (uInt i=0; i<cSys.nCoordinates(); i++) { |
1094 - | if (cSys.type(i)==Coordinate::TABULAR || |
1095 - | cSys.type(i)==Coordinate::LINEAR) { |
1096 - | Vector<String> axisNames = cSys.coordinate(i).worldAxisNames(); |
1097 - | String tmp = axisNames(0); |
1098 - | tmp.upcase(); |
1099 - | if (tmp.contains(String("FREQ"))) { |
1100 - | spectralCoord = i; |
1101 - | break; |
1102 - | } |
1066 + | void ImagePolarimetry::_findFrequencyAxis( |
1067 + | Int& spectralCoord, Int& fAxis, const CoordinateSystem& cSys, |
1068 + | Int spectralAxis |
1069 + | ) const { |
1070 + | LogIO os(LogOrigin("ImagePolarimetry", __func__, WHERE)); |
1071 + | spectralCoord = -1; |
1072 + | fAxis = -1; |
1073 + | if (spectralAxis >= 0) { |
1074 + | ThrowIf( |
1075 + | spectralAxis >= Int(cSys.nPixelAxes()), |
1076 + | "Illegal spectral axis " + String::toString(spectralAxis) +" given" |
1077 + | ); |
1078 + | fAxis = spectralAxis; |
1079 + | Int axisInCoordinate; |
1080 + | cSys.findPixelAxis(spectralCoord, axisInCoordinate, fAxis); |
1081 + | |
1082 + | ThrowIf( |
1083 + | ! ( |
1084 + | cSys.type(spectralCoord)==Coordinate::TABULAR |
1085 + | || cSys.type(spectralCoord)==Coordinate::LINEAR |
1086 + | || cSys.type(spectralCoord)==Coordinate::SPECTRAL |
1087 + | ), |
1088 + | "The specified axis of type " + cSys.showType(spectralCoord) |
1089 + | + " cannot be a frequency axis" |
1090 + | ); |
1091 + | } |
1092 + | else { |
1093 + | spectralCoord = _findSpectralCoordinate(cSys, os, false); |
1094 + | if (spectralCoord < 0) { |
1095 + | for (uInt i=0; i<cSys.nCoordinates(); ++i) { |
1096 + | if ( |
1097 + | cSys.type(i)==Coordinate::TABULAR |
1098 + | || cSys.type(i)==Coordinate::LINEAR |
1099 + | ) { |
1100 + | const auto axisNames = cSys.coordinate(i).worldAxisNames(); |
1101 + | String tmp = axisNames[0]; |
1102 + | tmp.upcase(); |
1103 + | if (tmp.contains(String("FREQ"))) { |
1104 + | spectralCoord = i; |
1105 + | break; |
1106 + | } |
1107 + | } |