From 5a1acc6e9c674099ff88be5ec98d3599cbdb4607 Mon Sep 17 00:00:00 2001 From: Cheng-Chin Chiang Date: Mon, 20 Jun 2022 16:46:58 +0800 Subject: [PATCH] Fix the bug of spectral profiles for computed stokes (#1123) * fix the bug of spectral profiles for computed stokes * modify the change log --- CHANGELOG.md | 1 + src/Frame/Frame.cc | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d0e1f55c..cde7219fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Stopped calculating per-cube histogram unnecessarily when switching to a new Stokes value ([#1013](https://github.com/CARTAvis/carta-backend/issues/1013)). * Ensured that HTTP server returns error codes correctly ([#1011](https://github.com/CARTAvis/carta-backend/issues/1011)). * Fixed crash problems for compressed FITS files ([#999](https://github.com/CARTAvis/carta-backend/issues/999) and [#1014](https://github.com/CARTAvis/carta-backend/issues/1014)). +* Fixed incorrect spectral profiles for computed stokes ([#1122](https://github.com/CARTAvis/carta-backend/issues/1122)). ## [3.0.0-beta.3] diff --git a/src/Frame/Frame.cc b/src/Frame/Frame.cc index 4fc783b04..15e814d76 100644 --- a/src/Frame/Frame.cc +++ b/src/Frame/Frame.cc @@ -2211,8 +2211,9 @@ casacore::Slicer Frame::GetExportRegionSlicer(const CARTA::SaveFile& save_file_m bool Frame::GetStokesTypeIndex(const string& coordinate, int& stokes_index) { // Coordinate could be profile (x, y, z), stokes string (I, Q, U), or combination (Ix, Qy) bool is_stokes_string = StokesStringTypes.find(coordinate) != StokesStringTypes.end(); + bool is_combination = (coordinate.size() > 1 && (coordinate.back() == 'x' || coordinate.back() == 'y' || coordinate.back() == 'z')); - if (coordinate.size() == 2 || coordinate.size() == 3 || is_stokes_string) { + if (is_combination || is_stokes_string) { bool stokes_ok(false); std::string stokes_string;