Line data Source code
1 : #include <imageanalysis/ImageAnalysis/PixelValueManipulatorData.h> 2 : 3 : #include <casacore/casa/BasicSL/String.h> 4 : #include <casacore/casa/Exceptions/Error.h> 5 : 6 : using namespace casacore; 7 : namespace casa { 8 0 : PixelValueManipulatorData::SpectralType PixelValueManipulatorData::spectralType( 9 : const String& specString 10 : ) { 11 : 12 0 : String spec = specString; 13 0 : spec.downcase(); 14 0 : static const String def = "default"; 15 0 : static const String optical = "optical velocity"; 16 0 : static const String radio = "radio velocity"; 17 0 : static const String wave = "wavelength"; 18 0 : static const String air = "air wavelength"; 19 0 : static const String rel = "relativistic velocity"; 20 0 : static const String beta = "beta"; 21 0 : ThrowIf ( 22 : spec == "r", 23 : "Ambiguous, could be either radio or relativistic" 24 : ); 25 0 : if (spec.empty() || def.startsWith(spec)) { 26 0 : return DEFAULT; 27 : } 28 0 : else if (optical.startsWith(spec)) { 29 0 : return OPTICAL_VELOCITY; 30 : } 31 0 : else if (radio.startsWith(spec)) { 32 0 : return RADIO_VELOCITY; 33 : } 34 0 : else if (rel.startsWith(spec) || beta.startsWith(spec)) { 35 0 : return RELATIVISTIC; 36 : } 37 0 : else if (wave.startsWith(spec)) { 38 0 : return WAVELENGTH; 39 : } 40 0 : else if (air.startsWith(spec)) { 41 0 : return AIR_WAVELENGTH; 42 : } 43 : else { 44 0 : ThrowCc(specString + "does not identify a spectral type"); 45 : } 46 0 : } 47 : 48 : }