Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate fitting results for beam deconvolved images #1364

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
317c119
Add a new class ImageFitter2
markccchiang Feb 29, 2024
2426275
Add a running test for ImageFitter2
markccchiang Feb 29, 2024
f083a3f
Move the ImageFitter2 tester
markccchiang Feb 29, 2024
71fe5b2
Add a test RunImageFitter in ImageFittingTest
markccchiang Mar 6, 2024
aff64e5
Minor changes
markccchiang Mar 7, 2024
bf9a00a
Fix the header guard style for ImageFitter2
markccchiang Mar 7, 2024
5901b09
Add a new class Deconvolver
markccchiang Mar 10, 2024
1b15ceb
Fix the code style
markccchiang Mar 10, 2024
0a6efa9
Fix the code style
markccchiang Mar 10, 2024
29903cf
Fix the code style
markccchiang Mar 10, 2024
0a06c95
Minor code changes
markccchiang Mar 11, 2024
ee502db
Claen up codes in Deconvolver
markccchiang Mar 11, 2024
e834939
Minor code changes
markccchiang Mar 12, 2024
43f221c
Remove the point source handler from Deconvolver and modify its function
markccchiang Mar 12, 2024
45048fe
Clean up the codes in Deconvolver
markccchiang Mar 12, 2024
4c3678a
Remove the template property of the Deconvolver class
markccchiang Mar 12, 2024
813f1cf
Add a function to get RMS of residual data from the fit
markccchiang Mar 13, 2024
66c48a6
Minor code changes
markccchiang Mar 14, 2024
a3467a5
Clean up codes in Deconvolver
markccchiang Mar 15, 2024
a47d362
Minor code changes
markccchiang Mar 15, 2024
b00855f
Minor code changes
markccchiang Mar 15, 2024
6937586
Refactor the codes in Deconvolver
markccchiang Mar 15, 2024
c5ad53c
Minor code changes
markccchiang Mar 15, 2024
e2f309a
Fix the problem of memory leaks
markccchiang Mar 15, 2024
c78f708
Modify the Deconvolver
markccchiang Mar 15, 2024
ed0bb94
Revert "Modify the Deconvolver"
markccchiang Mar 16, 2024
a0071ee
Add the info of deconvolved results to the fitting log
markccchiang Mar 17, 2024
1fcb069
Add errors of deconvolved results in the pixel coordinate
markccchiang Mar 17, 2024
3926114
Remove ImageFitter2
markccchiang Mar 17, 2024
82be623
Merge branch 'dev' of https://github.com/CARTAvis/carta-backend into …
markccchiang Apr 8, 2024
c8afd0d
Refactor the codes and remove casa code functions
markccchiang Apr 8, 2024
08627c9
Move the Deconvolver object under the ImageFitter
markccchiang Apr 8, 2024
7eeba1c
Refactor the codes
markccchiang Apr 9, 2024
27d1db7
Calculate the model image data from deconvolved fitting results
markccchiang Apr 10, 2024
63362c3
Merge branch 'dev' of https://github.com/CARTAvis/carta-backend into …
markccchiang Apr 10, 2024
d9f4cec
Enable to open the beam deconvolved model image
markccchiang Apr 11, 2024
42ac0fe
Parallelize the calculation for the deconvolved beam model image
markccchiang Apr 11, 2024
14f0813
Remove the beam info from the beam deconvolved model image
markccchiang Apr 11, 2024
077f5a0
Modify the function Deconvolver::GetDeconvolutionResults
markccchiang Apr 15, 2024
ad8c628
Modify the message FittingResponse
markccchiang Apr 16, 2024
2e62f8c
Update the protobuf
markccchiang May 14, 2024
b7056a8
Fix a bug in the calculation for the regional beam deconvolved image
markccchiang May 15, 2024
fcdb5e2
Minor code changes
markccchiang May 15, 2024
b560b4e
Fix bugs in the rendering of the beam deconvolved image
markccchiang May 15, 2024
88d8722
Add a check if the input image is masked
markccchiang May 15, 2024
f30acd2
Correct the PA for beam deconvolved image
markccchiang May 21, 2024
efd7e86
Normalize the expression of PA
markccchiang May 21, 2024
21e87f2
Do not create a beam deconvolved image if its component is a point so…
markccchiang May 22, 2024
afdcae8
Modify the FittingRequest message and add a boolean variable
markccchiang May 22, 2024
afb7067
Remove the creation of a beam deconvolved image
markccchiang May 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ set(SOURCE_FILES
src/ImageData/Hdf5Loader.cc
src/ImageData/PolarizationCalculator.cc
src/ImageData/StokesFilesConnector.cc
src/ImageFitter/Deconvolver.cc
src/ImageFitter/ImageFitter.cc
src/ImageGenerators/MomentGenerator.cc
src/ImageGenerators/PvGenerator.cc
src/ImageGenerators/PvPreviewCube.cc
Expand Down Expand Up @@ -264,8 +266,7 @@ set(SOURCE_FILES
src/Util/Message.cc
src/Util/Stokes.cc
src/Util/String.cc
src/Util/Token.cc
src/ImageFitter/ImageFitter.cc)
src/Util/Token.cc)

add_definitions(-DHAVE_HDF5 -DPUGIXML_COMPACT)
add_executable(carta_backend ${SOURCE_FILES})
Expand Down
2 changes: 1 addition & 1 deletion carta-protobuf
19 changes: 14 additions & 5 deletions src/Frame/Frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,9 @@ bool Frame::FitImage(const CARTA::FittingRequest& fitting_request, CARTA::Fittin

if (stokes_region != nullptr) {
casacore::IPosition region_shape = GetRegionShape(*stokes_region);
spdlog::info("Creating region subimage data with shape {} x {}.", region_shape(0), region_shape(1));
size_t width = region_shape(0);
size_t height = region_shape(1);
spdlog::info("Creating region subimage data with shape {} x {}.", width, height);

std::vector<float> region_data;
if (!GetRegionData(*stokes_region, region_data)) {
Expand All @@ -1862,15 +1864,22 @@ bool Frame::FitImage(const CARTA::FittingRequest& fitting_request, CARTA::Fittin
casacore::IPosition origin(2, 0, 0);
casacore::IPosition region_origin = stokes_region->image_region.asLCRegion().expand(origin);

success = _image_fitter->FitImage(region_shape(0), region_shape(1), region_data.data(), beam_size, unit, initial_values,
fixed_params, fitting_request.offset(), fitting_request.solver(), fitting_request.create_model_image(),
success = _image_fitter->FitImage(width, height, region_data.data(), beam_size, unit, initial_values, fixed_params,
fitting_request.offset(), fitting_request.solver(), fitting_request.create_model_image(),
fitting_request.create_residual_image(), fitting_response, progress_callback, region_origin(0), region_origin(1));
if (success) {
_image_fitter->GetDeconvolvedResults(
image, width, height, CurrentZ(), CurrentStokes(), fitting_response, region_origin(0), region_origin(1));
}
} else {
FillImageCache();

success = _image_fitter->FitImage(_width, _height, _image_cache.get(), beam_size, unit, initial_values, fixed_params,
fitting_request.offset(), fitting_request.solver(), fitting_request.create_model_image(),
fitting_request.create_residual_image(), fitting_response, progress_callback);
if (success) {
_image_fitter->GetDeconvolvedResults(image, _width, _height, CurrentZ(), CurrentStokes(), fitting_response);
}
}

if (success && (fitting_request.create_model_image() || fitting_request.create_residual_image())) {
Expand All @@ -1881,9 +1890,9 @@ bool Frame::FitImage(const CARTA::FittingRequest& fitting_request, CARTA::Fittin
} else {
GetImageRegion(file_id, AxisRange(CurrentZ()), CurrentStokes(), output_stokes_region);
}
casa::SPIIF image(_loader->GetStokesImage(output_stokes_region.stokes_source));
casa::SPIIF in_image(_loader->GetStokesImage(output_stokes_region.stokes_source));
success = _image_fitter->GetGeneratedImages(
image, output_stokes_region.image_region, GetFileName(), model_image, residual_image, fitting_response);
in_image, output_stokes_region.image_region, GetFileName(), model_image, residual_image, fitting_response);
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/Frame/Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
SPDX-License-Identifier: GPL-3.0-or-later
*/

//# Frame.h: represents an open image file. Handles slicing data and region calculations
//# (profiles, histograms, stats)
// # Frame.h: represents an open image file. Handles slicing data and region calculations
// # (profiles, histograms, stats)

#ifndef CARTA_SRC_FRAME_FRAME_H_
#define CARTA_SRC_FRAME_FRAME_H_
Expand All @@ -23,6 +23,7 @@
#include "DataStream/Tile.h"
#include "DataStream/VectorField.h"
#include "ImageData/FileLoader.h"
#include "ImageFitter/Deconvolver.h"
#include "ImageFitter/ImageFitter.h"
#include "ImageGenerators/ImageGenerator.h"
#include "ImageGenerators/MomentGenerator.h"
Expand Down
Loading
Loading