Skip to content

Commit 5d8e42a

Browse files
committed
merge develop
2 parents d2c2be9 + 72bd304 commit 5d8e42a

File tree

7 files changed

+75
-31
lines changed

7 files changed

+75
-31
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ jobs:
5656
uses: actions/checkout@v3
5757
- name: Get package name and version
5858
id: package-version
59-
uses: astrorama/actions/elements-project@v3.3
59+
uses: astrorama/actions/elements-project@v3.4
6060
- name: Install dependencies
61-
uses: astrorama/actions/setup-dependencies@v3.3
61+
uses: astrorama/actions/setup-dependencies@v3.4
6262
with:
6363
dependency-list: .github/workflows/dependencies.txt
6464
- name: Build
6565
id: build
66-
uses: astrorama/actions/elements-build-rpm@v3.3
66+
uses: astrorama/actions/elements-build-rpm@v3.4
6767
- name: Upload RPM to GitHub
6868
uses: actions/upload-artifact@v2
6969
with:
@@ -72,7 +72,7 @@ jobs:
7272
retention-days: 1
7373
- name: Upload RPM to repository
7474
if: ${{ github.repository_owner == 'astrorama' }}
75-
uses: astrorama/actions/upload-rpm@v3.3
75+
uses: astrorama/actions/upload-rpm@v3.4
7676
env:
7777
REPOSITORY_USER: ${{ secrets.REPOSITORY_USER }}
7878
REPOSITORY_PASSWORD: ${{ secrets.REPOSITORY_PASSWORD }}

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ find_package(ElementsProject)
66
#---------------------------------------------------------------
77

88
# Declare project name and version
9-
elements_project(SourceXtractorPlusPlus 0.19 USE Alexandria 2.28 DESCRIPTION "SourceXtractor++, the next generation SExtractor")
9+
elements_project(SourceXtractorPlusPlus 0.20 USE Alexandria 2.28 DESCRIPTION "SourceXtractor++, the next generation SExtractor")

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,25 @@ Documentation: https://astrorama.github.io/SourceXtractorPlusPlus/
1717
SourceXtractor++ is available on [Anaconda Cloud for Linux and MacOSX](https://anaconda.org/astrorama/sourcextractor)
1818

1919
```bash
20-
conda install -c conda-forge -c astrorama sourcextractor
20+
conda install -c conda-forge -c astrorama sourcextractor==0.19
2121
```
2222

2323
We would recommend, however, to install it into its own environment.
2424

2525
```bash
26-
conda create -n sourcex -c astrorama -c conda-forge sourcextractor
26+
conda create -n sourcex -c astrorama -c conda-forge sourcextractor==0.19
2727
conda activate sourcex
2828
```
2929

3030
**Note:** If you want the development version to test a future functionality or bugfix, it can also be done with conda:
3131

3232
```bash
33-
conda create -n sourcex-dev -c astrorama/label/develop -c astrorama -c conda-forge sourcextractor
33+
conda create -n sourcex-dev -c astrorama/label/develop -c astrorama -c conda-forge sourcextractor=x.xx
3434
conda activate sourcex-dev
3535
```
3636

37+
We recommend always using an explicit version number as there is no guarantee that `conda` will install the latest version otherwise.
38+
3739
## Fedora / CentOS
3840

3941
SourceXtractor++ is shipped directly in Fedora and CentOS. It can be installed simply as follows:
@@ -76,11 +78,16 @@ And install with
7678
dnf install SourceXtractorPlusPlus
7779
```
7880

81+
## Test Data Set
82+
83+
A test data set covering various data reduction scenarios is available [here](https://cloud.physik.lmu.de/index.php/s/3K4KemBsw5y9yqd).
84+
I contains the input data, all relevant configuration files, the SourceXtractor++ commands and the expected output results for a reference.
85+
7986
## Discussion group for SourceXtractor++ users
8087

81-
In order to facilitaet an active disucssion among SourceXtractor++ users we have created
88+
In order to facilitate an active discussion among SourceXtractor++ users we have created
8289
a [users group](https://groups.google.com/g/sourcextractor_plusplus). We encourage all users to directly
83-
join the group (if a google account is at hand) or to ask us to add you as member
90+
join the group (if a google account is at hand) or to ask us to add you as a member
8491
(open an issue on the [github page](https://astrorama.github.io/SourceXtractorPlusPlus/).
8592

8693

SEFramework/src/lib/FITS/FitsFile.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ void FitsFile::open() {
126126
m_fits_ptr.reset(ptr);
127127
}
128128
if (status != 0) {
129-
throw Elements::Exception() << "Can't open FITS file: " << m_path << " status: " << status;
129+
char error_message[32];
130+
fits_get_errstatus(status, error_message);
131+
throw Elements::Exception()
132+
<< "Can't open FITS file: " << m_path << " status: " << status << " = " << error_message;
130133
}
131134
}
132135
assert(ptr->Fptr->open_count == 1);
@@ -144,7 +147,10 @@ void FitsFile::refresh() {
144147

145148
fits_open_image(&ptr, m_path.native().c_str(), m_is_writeable ? READWRITE : READONLY, &status);
146149
if (status != 0) {
147-
throw Elements::Exception() << "Can't close and reopen FITS file: " << m_path << " status: " << status;
150+
char error_message[32];
151+
fits_get_errstatus(status, error_message);
152+
throw Elements::Exception()
153+
<< "Can't close and reopen FITS file: " << m_path << " status: " << status << " = " << error_message;
148154
}
149155
assert(ptr->Fptr->open_count == 1);
150156
m_fits_ptr.reset(ptr);
@@ -165,7 +171,10 @@ void FitsFile::loadInfo() {
165171
m_image_hdus.clear();
166172
int number_of_hdus = 0;
167173
if (fits_get_num_hdus(ptr, &number_of_hdus, &status) < 0) {
168-
throw Elements::Exception() << "Can't get the number of HDUs in FITS file: " << m_path;
174+
char error_message[32];
175+
fits_get_errstatus(status, error_message);
176+
throw Elements::Exception() << "Can't get the number of HDUs in FITS file: " << m_path
177+
<< " status: " << status << " = " << error_message;
169178
}
170179
m_headers.clear();
171180
m_headers.resize(number_of_hdus);
@@ -175,7 +184,10 @@ void FitsFile::loadInfo() {
175184
for (int hdu_number = 1; hdu_number <= number_of_hdus; ++hdu_number) {
176185
fits_movabs_hdu(ptr, hdu_number, &hdu_type, &status);
177186
if (status != 0) {
178-
throw Elements::Exception() << "Can't switch HDUs while opening: " << m_path;
187+
char error_message[32];
188+
fits_get_errstatus(status, error_message);
189+
throw Elements::Exception() << "Can't switch HDUs while opening: " << m_path
190+
<< " status: " << status << " = " << error_message;
179191
}
180192

181193
if (hdu_type == IMAGE_HDU) {
@@ -309,8 +321,11 @@ std::vector<int> FitsFile::getDimensions(int hdu) const {
309321

310322
fits_get_img_param(m_fits_ptr.get(), 3, &bitpix, &naxis, naxes, &status);
311323
if (status != 0 || (naxis != 2 && naxis != 3)) {
324+
char error_message[32];
325+
fits_get_errstatus(status, error_message);
312326
throw Elements::Exception()
313-
<< "Can't find 2D image or data cube in FITS file: " << m_path << "[" << hdu << "]";
327+
<< "Can't find 2D image or data cube in FITS file: " << m_path << "[" << hdu << "]"
328+
<< " status: " << status << " = " << error_message;
314329
}
315330

316331
std::vector<int> dims;

SEFramework/src/lib/FITS/FitsImageSource.cpp

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,11 @@ FitsImageSource::FitsImageSource(const std::string& filename, int hdu_number,
9696

9797
fits_get_img_param(fptr, 2, &bitpix, &naxis, naxes, &status);
9898
if (status != 0 || (naxis != 2 && naxis != 3)) {
99+
char error_message[32];
100+
fits_get_errstatus(status, error_message);
99101
throw Elements::Exception()
100-
<< "Can't find 2D image or data cube in FITS file: " << filename << "[" << m_hdu_number << "]";
102+
<< "Can't find 2D image or data cube in FITS file: " << filename << "[" << m_hdu_number << "]"
103+
<< " status: " << status << " = " << error_message;
101104
}
102105

103106
m_width = naxes[0];
@@ -139,15 +142,21 @@ FitsImageSource::FitsImageSource(const std::string& filename, int width, int hei
139142
if (empty_primary && acc->m_fd.getImageHdus().empty()) {
140143
fits_create_img(fptr, FLOAT_IMG, 0, nullptr, &status);
141144
if (status != 0) {
142-
throw Elements::Exception() << "Can't create empty hdu: " << filename << " status: " << status;
145+
char error_message[32];
146+
fits_get_errstatus(status, error_message);
147+
throw Elements::Exception() << "Can't create empty hdu: " << filename
148+
<< " status: " << status << " = " << error_message;
143149
}
144150
}
145151

146152
long naxes[2] = {width, height};
147153
fits_create_img(fptr, getImageType(), 2, naxes, &status);
148154

149155
if (fits_get_hdu_num(fptr, &m_hdu_number) < 0) {
150-
throw Elements::Exception() << "Can't get the active HDU from the FITS file: " << filename << " status: " << status;
156+
char error_message[32];
157+
fits_get_errstatus(status, error_message);
158+
throw Elements::Exception() << "Can't get the active HDU from the FITS file: " << filename
159+
<< " status: " << status << " = " << error_message;
151160
}
152161

153162
int hdutype = 0;
@@ -164,9 +173,10 @@ FitsImageSource::FitsImageSource(const std::string& filename, int width, int hei
164173

165174
fits_update_card(fptr, padded_key.str().c_str(), str.c_str(), &status);
166175
if (status != 0) {
167-
char err_txt[31];
168-
fits_get_errstatus(status, err_txt);
169-
throw Elements::Exception() << "Couldn't write the WCS headers (" << err_txt << "): " << str << " status: " << status;
176+
char error_message[32];
177+
fits_get_errstatus(status, error_message);
178+
throw Elements::Exception() << "Couldn't write the WCS headers: " << filename
179+
<< " status: " << status << " = " << error_message;
170180
}
171181
}
172182
}
@@ -178,7 +188,10 @@ FitsImageSource::FitsImageSource(const std::string& filename, int width, int hei
178188
}
179189

180190
if (status != 0) {
181-
throw Elements::Exception() << "Couldn't allocate space for new FITS file: " << filename << " status: " << status;
191+
char error_message[32];
192+
fits_get_errstatus(status, error_message);
193+
throw Elements::Exception() << "Couldn't allocate space for new FITS file: " << filename
194+
<< " status: " << status << " = " << error_message;
182195
}
183196

184197
acc->m_fd.refresh(); // make sure changes to the file structure are taken into account
@@ -209,7 +222,10 @@ std::shared_ptr<ImageTile> FitsImageSource::getImageTile(int x, int y, int width
209222
fits_read_subset(fptr, getDataType(), first_pixel, last_pixel, increment,
210223
nullptr, tile->getDataPtr(), nullptr, &status);
211224
if (status != 0) {
212-
throw Elements::Exception() << "Error reading image tile from FITS file.";
225+
char error_message[32];
226+
fits_get_errstatus(status, error_message);
227+
throw Elements::Exception() << "Error reading image tile from FITS file."
228+
<< " status: " << status << " = " << error_message;
213229
}
214230

215231
return tile;
@@ -231,7 +247,10 @@ void FitsImageSource::saveTile(ImageTile& tile) {
231247

232248
fits_write_subset(fptr, getDataType(), first_pixel, last_pixel, tile.getDataPtr(), &status);
233249
if (status != 0) {
234-
throw Elements::Exception() << "Error saving image tile to FITS file.";
250+
char error_message[32];
251+
fits_get_errstatus(status, error_message);
252+
throw Elements::Exception() << "Error saving image tile to FITS file."
253+
<< " status: " << status << " = " << error_message;
235254
}
236255
fits_flush_buffer(fptr, 0, &status);
237256
}
@@ -243,8 +262,10 @@ void FitsImageSource::switchHdu(fitsfile *fptr, int hdu_number) const {
243262
fits_movabs_hdu(fptr, hdu_number, &hdu_type, &status);
244263

245264
if (status != 0) {
246-
throw Elements::Exception() << "Could not switch to HDU # " << hdu_number << " in file "
247-
<< m_filename;
265+
char error_message[32];
266+
fits_get_errstatus(status, error_message);
267+
throw Elements::Exception() << "Could not switch to HDU # " << hdu_number << " in file " << m_filename
268+
<< " status: " << status << " = " << error_message;
248269
}
249270
if (hdu_type != IMAGE_HDU) {
250271
throw Elements::Exception() << "Trying to access non-image HDU in file " << m_filename;
@@ -324,9 +345,10 @@ void FitsImageSource::setMetadata(const std::string& key, const MetadataEntry& v
324345
fits_update_card(fptr, padded_key.str().c_str(), str.c_str(), &status);
325346

326347
if (status != 0) {
327-
char err_txt[31];
328-
fits_get_errstatus(status, err_txt);
329-
throw Elements::Exception() << "Couldn't write the metadata (" << err_txt << "): " << str;
348+
char error_message[32];
349+
fits_get_errstatus(status, error_message);
350+
throw Elements::Exception() << "Couldn't write the metadata: " << str
351+
<< " status: " << status << " = " << error_message;
330352
}
331353

332354
// update the metadata

SEImplementation/src/lib/Configuration/DetectionImageConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void DetectionImageConfig::initialize(const UserValues& args) {
9797
continue;
9898
} else {
9999
if (m_extensions.size() == 0) {
100-
throw Elements::Exception() << "Can't find 2D image in FITS file: " << m_detection_image_path;
100+
throw;
101101
}
102102
break;
103103
}

SEImplementation/src/lib/Configuration/WeightImageConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void WeightImageConfig::initialize(const UserValues& args) {
156156
continue;
157157
} else {
158158
if (m_weight_images.size() == 0) {
159-
throw Elements::Exception() << "Can't find 2D image in FITS file: " << weight_image_filename;
159+
throw;
160160
}
161161
break;
162162
}

0 commit comments

Comments
 (0)