Skip to content

Commit 8bcd56a

Browse files
authored
Merge pull request #588 from astrorama/develop
Release 0.22
2 parents af90cdd + 5499068 commit 8bcd56a

37 files changed

+1185
-95
lines changed

.github/workflows/dependencies.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ $PYTHON-devel
22
$PYTHON-numpy
33
$PYTHON-pytest
44
$PYTHON-sphinx
5+
$PYTHON-setuptools
56
CCfits-devel
67
blas-devel
78
$BOOST-$PYTHON-devel

.github/workflows/run-litmus.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ TARGET_BRANCH=${GITHUB_BASE_REF:-$GITHUB_REF}
66
# In the case of pull requests, this is the origin branch
77
ORIGIN_BRANCH=${GITHUB_HEAD_REF:-$GITHUB_REF}
88

9+
export GIT_CLONE_PROTECTION_ACTIVE=false
10+
911
# Platform-specific configuration
1012
source /etc/os-release
1113

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.21 USE Alexandria 2.31.0 DESCRIPTION "SourceXtractor++, the next generation SExtractor")
9+
elements_project(SourceXtractorPlusPlus 0.22 USE Alexandria 2.31.0 DESCRIPTION "SourceXtractor++, the next generation SExtractor")

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ 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==0.19.2
20+
conda install -c conda-forge -c astrorama sourcextractor==0.21
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==0.19.2
26+
conda create -n sourcex -c astrorama -c conda-forge sourcextractor==0.21
2727
conda activate sourcex
2828
```
2929

SEFramework/SEFramework/Pipeline/SourceGrouping.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <memory>
2828
#include <set>
2929

30+
#include "SEFramework/Property/PropertyId.h"
3031
#include "SEFramework/Pipeline/PipelineStage.h"
3132
#include "SEFramework/Source/SourceGroupFactory.h"
3233
#include "SEFramework/Source/SourceGroupInterface.h"
@@ -81,14 +82,20 @@ class GroupingCriteria {
8182
virtual std::set<PropertyId> requiredProperties() const { return {}; }
8283
};
8384

85+
class SourceGroupingInterface : public PipelineEmitter<SourceGroupInterface>, public PipelineReceiver<SourceInterface> {
86+
public:
87+
/// Returns the set of required properties to compute the grouping
88+
virtual std::set<PropertyId> requiredProperties() const = 0;
89+
};
90+
8491
/**
8592
* @class SourceGrouping
8693
* @brief SourceGrouping takes Source, groups them together according to its GroupingCriteria and stores them.
8794
* When a ProcessSourcesEvent is received the sources that need to be processed are output together with the
8895
* sources they are grouped with as a SourceGroup.
8996
*
9097
*/
91-
class SourceGrouping : public PipelineEmitter<SourceGroupInterface>, public PipelineReceiver<SourceInterface> {
98+
class SourceGrouping : public SourceGroupingInterface {
9299
public:
93100

94101
/**
@@ -101,7 +108,7 @@ class SourceGrouping : public PipelineEmitter<SourceGroupInterface>, public Pipe
101108
unsigned int hard_limit);
102109

103110
/// Returns the set of required properties to compute the grouping
104-
std::set<PropertyId> requiredProperties() const;
111+
std::set<PropertyId> requiredProperties() const override;
105112

106113
/// Handles a new Source
107114
void receiveSource(std::unique_ptr<SourceInterface> source) override;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* RngConfig.h
3+
*
4+
* Created on: Mar 21, 2024
5+
* Author: mschefer
6+
*/
7+
8+
#ifndef _SEIMPLEMENTATION_CONFIGURATION_RNGCONFIG_H_
9+
#define _SEIMPLEMENTATION_CONFIGURATION_RNGCONFIG_H_
10+
11+
#include "Configuration/Configuration.h"
12+
#include "AlexandriaKernel/ThreadPool.h"
13+
14+
namespace SourceXtractor {
15+
16+
class RngConfig : public Euclid::Configuration::Configuration {
17+
public:
18+
explicit RngConfig(long manager_id);
19+
20+
virtual ~RngConfig() = default;
21+
22+
std::map<std::string, OptionDescriptionList> getProgramOptions() override;
23+
24+
void initialize(const UserValues& args) override;
25+
26+
unsigned int getSeed() const {
27+
return m_seed;
28+
}
29+
30+
private:
31+
unsigned int m_seed;
32+
};
33+
34+
35+
}
36+
37+
38+
#endif /* _SEIMPLEMENTATION_CONFIGURATION_RNGCONFIG_H_ */
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/** Copyright © 2019 - 2023 Université de Genève, LMU Munich - Faculty of Physics, IAP-CNRS/Sorbonne Université
2+
*
3+
* This library is free software; you can redistribute it and/or modify it under
4+
* the terms of the GNU Lesser General Public License as published by the Free
5+
* Software Foundation; either version 3.0 of the License, or (at your option)
6+
* any later version.
7+
*
8+
* This library is distributed in the hope that it will be useful, but WITHOUT
9+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10+
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11+
* details.
12+
*
13+
* You should have received a copy of the GNU Lesser General Public License
14+
* along with this library; if not, write to the Free Software Foundation, Inc.,
15+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16+
*/
17+
18+
#ifndef _SEIMPLEMENTATION_GROUPING_ASSOCGROUPING_H_
19+
#define _SEIMPLEMENTATION_GROUPING_ASSOCGROUPING_H_
20+
21+
#include <map>
22+
23+
#include "SEFramework/Pipeline/SourceGrouping.h"
24+
25+
namespace SourceXtractor {
26+
27+
class AssocGrouping : public SourceGroupingInterface {
28+
public:
29+
30+
AssocGrouping(std::shared_ptr<SourceGroupFactory> group_factory, unsigned int hard_limit);
31+
virtual ~AssocGrouping() = default;
32+
33+
std::set<PropertyId> requiredProperties() const override;
34+
35+
/// Handles a new Source
36+
void receiveSource(std::unique_ptr<SourceInterface> source) override;
37+
38+
/// Handles a ProcessSourcesEvent to trigger the processing of some of the Sources stored in SourceGrouping
39+
void receiveProcessSignal(const ProcessSourcesEvent& event) override;
40+
41+
private:
42+
std::shared_ptr<SourceGroupFactory> m_group_factory;
43+
std::map<unsigned int, std::unique_ptr<SourceGroupInterface>> m_source_groups;
44+
unsigned int m_hard_limit;
45+
46+
};
47+
48+
}
49+
50+
#endif /* _SEIMPLEMENTATION_GROUPING_ASSOCGROUPING_H_ */

SEImplementation/SEImplementation/Grouping/GroupingFactory.h

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,48 +42,24 @@ class GroupingFactory : public Configurable {
4242

4343
public:
4444

45-
explicit GroupingFactory(std::shared_ptr<SourceGroupFactory> source_group_factory)
46-
: m_source_group_factory(source_group_factory), m_hard_limit(0) {}
45+
explicit GroupingFactory(std::shared_ptr<SourceGroupFactory> source_group_factory);
4746

4847
virtual ~GroupingFactory() = default;
4948

50-
void reportConfigDependencies(Euclid::Configuration::ConfigManager& manager) const override {
51-
manager.registerConfiguration<GroupingConfig>();
52-
}
53-
54-
void configure(Euclid::Configuration::ConfigManager& manager) override {
55-
auto grouping_config = manager.getConfiguration<GroupingConfig>();
56-
switch (grouping_config.getAlgorithmOption()) {
57-
case GroupingConfig::Algorithm::NO_GROUPING:
58-
m_grouping_criteria = std::make_shared<NoGroupingCriteria>();
59-
break;
60-
case GroupingConfig::Algorithm::OVERLAPPING:
61-
m_grouping_criteria = std::make_shared<OverlappingBoundariesCriteria>();
62-
break;
63-
case GroupingConfig::Algorithm::SPLIT_SOURCES:
64-
m_grouping_criteria = std::make_shared<SplitSourcesCriteria>();
65-
break;
66-
case GroupingConfig::Algorithm::MOFFAT:
67-
m_grouping_criteria = std::make_shared<MoffatCriteria>(grouping_config.getMoffatThreshold(), grouping_config.getMoffatMaxDistance());
68-
break;
69-
case GroupingConfig::Algorithm::ASSOC:
70-
m_grouping_criteria = std::make_shared<AssocCriteria>();
71-
break;
72-
}
73-
m_hard_limit = grouping_config.getHardLimit();
74-
}
75-
76-
std::shared_ptr<SourceGrouping> createGrouping() const {
77-
assert(m_grouping_criteria != nullptr);
78-
assert(m_source_group_factory != nullptr);
79-
80-
return std::make_shared<SourceGrouping>(m_grouping_criteria, m_source_group_factory, m_hard_limit);
81-
}
49+
void reportConfigDependencies(Euclid::Configuration::ConfigManager& manager) const override;
50+
51+
void configure(Euclid::Configuration::ConfigManager& manager) override;
52+
53+
std::shared_ptr<SourceGroupingInterface> createGrouping() const;
8254

8355
private:
56+
std::shared_ptr<GroupingCriteria> getCriteria() const;
57+
58+
GroupingConfig::Algorithm m_algorithm;
8459
std::shared_ptr<GroupingCriteria> m_grouping_criteria;
8560
std::shared_ptr<SourceGroupFactory> m_source_group_factory;
8661
unsigned int m_hard_limit;
62+
double m_moffat_max_distance;
8763
};
8864

8965
} /* namespace SourceXtractor */
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/** Copyright © 2019-2024 Université de Genève, LMU Munich - Faculty of Physics, IAP-CNRS/Sorbonne Université
2+
*
3+
* This library is free software; you can redistribute it and/or modify it under
4+
* the terms of the GNU Lesser General Public License as published by the Free
5+
* Software Foundation; either version 3.0 of the License, or (at your option)
6+
* any later version.
7+
*
8+
* This library is distributed in the hope that it will be useful, but WITHOUT
9+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10+
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11+
* details.
12+
*
13+
* You should have received a copy of the GNU Lesser General Public License
14+
* along with this library; if not, write to the Free Software Foundation, Inc.,
15+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16+
*/
17+
18+
#ifndef _SEIMPLEMENTATION_GROUPING_MOFFATGROUPING_H_
19+
#define _SEIMPLEMENTATION_GROUPING_MOFFATGROUPING_H_
20+
21+
#include "SEFramework/Pipeline/SourceGrouping.h"
22+
#include "SEUtils/QuadTree.h"
23+
24+
#include <map>
25+
#include <vector>
26+
#include <functional>
27+
28+
namespace SourceXtractor {
29+
30+
class MoffatGrouping : public SourceGroupingInterface {
31+
public:
32+
struct SourceInfo {
33+
std::unique_ptr<SourceInterface> m_source;
34+
double m_x, m_y;
35+
size_t m_group_id;
36+
};
37+
38+
using Group = std::vector<std::shared_ptr<SourceInfo>>;
39+
40+
MoffatGrouping(std::shared_ptr<GroupingCriteria> grouping_criteria,
41+
std::shared_ptr<SourceGroupFactory> group_factory, unsigned int hard_limit, float max_range);
42+
virtual ~MoffatGrouping() = default;
43+
44+
std::set<PropertyId> requiredProperties() const override;
45+
46+
/// Handles a new Source
47+
void receiveSource(std::unique_ptr<SourceInterface> source) override;
48+
49+
/// Handles a ProcessSourcesEvent to trigger the processing of some of the Sources stored in SourceGrouping
50+
void receiveProcessSignal(const ProcessSourcesEvent& event) override;
51+
52+
private:
53+
void processGroup(unsigned int group_id);
54+
55+
std::shared_ptr<GroupingCriteria> m_grouping_criteria;
56+
std::shared_ptr<SourceGroupFactory> m_group_factory;
57+
unsigned int m_hard_limit;
58+
float m_max_range;
59+
60+
size_t m_group_counter;
61+
std::map<unsigned int, std::shared_ptr<Group>> m_groups;
62+
QuadTree<std::shared_ptr<SourceInfo>> m_tree;
63+
};
64+
65+
}
66+
67+
#endif /* _SEIMPLEMENTATION_GROUPING_MOFFATGROUPING_H_ */
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/** Copyright © 2019 - 2023 Université de Genève, LMU Munich - Faculty of Physics, IAP-CNRS/Sorbonne Université
2+
*
3+
* This library is free software; you can redistribute it and/or modify it under
4+
* the terms of the GNU Lesser General Public License as published by the Free
5+
* Software Foundation; either version 3.0 of the License, or (at your option)
6+
* any later version.
7+
*
8+
* This library is distributed in the hope that it will be useful, but WITHOUT
9+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10+
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11+
* details.
12+
*
13+
* You should have received a copy of the GNU Lesser General Public License
14+
* along with this library; if not, write to the Free Software Foundation, Inc.,
15+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16+
*/
17+
18+
#ifndef _SEIMPLEMENTATION_GROUPING_SPLITSOURCESGROUPING_H_
19+
#define _SEIMPLEMENTATION_GROUPING_SPLITSOURCESGROUPING_H_
20+
21+
#include "SEFramework/Pipeline/SourceGrouping.h"
22+
23+
#include <map>
24+
25+
namespace SourceXtractor {
26+
27+
class SplitSourcesGrouping : public SourceGroupingInterface {
28+
public:
29+
30+
SplitSourcesGrouping(std::shared_ptr<SourceGroupFactory> group_factory, unsigned int hard_limit);
31+
virtual ~SplitSourcesGrouping() = default;
32+
33+
std::set<PropertyId> requiredProperties() const override;
34+
35+
/// Handles a new Source
36+
void receiveSource(std::unique_ptr<SourceInterface> source) override;
37+
38+
/// Handles a ProcessSourcesEvent to trigger the processing of some of the Sources stored in SourceGrouping
39+
void receiveProcessSignal(const ProcessSourcesEvent& event) override;
40+
41+
private:
42+
std::shared_ptr<SourceGroupFactory> m_group_factory;
43+
std::map<unsigned int, std::unique_ptr<SourceGroupInterface>> m_source_groups;
44+
unsigned int m_hard_limit;
45+
46+
};
47+
48+
}
49+
50+
#endif /* _SEIMPLEMENTATION_GROUPING_SPLITSOURCESGROUPING_H_ */

0 commit comments

Comments
 (0)