23#include <Pyston/Exceptions.h>
24#include <Pyston/GIL.h>
25#include <Pyston/Module.h>
29#include <boost/python/dict.hpp>
30#include <boost/python/exec.hpp>
31#include <boost/python/extract.hpp>
32#include <boost/python/import.hpp>
33#include <boost/python/object.hpp>
36#include <system_error>
61#if PY_VERSION_HEX < 3090000
79#if PY_MAJOR_VERSION == 2
81#define py_argv_assign(d, s, l) d = strndup(s, l)
84#define py_argv_assign(d, s, l) d = Py_DecodeLocale(s, &(l))
88 size_t wlen = filename.size();
90 for (
size_t i = 0;
i < argv.size(); ++
i) {
91 wlen = argv[
i].size();
97 py::import(
"_SourceXtractorPy");
105 py::setattr(
main_module,
"__file__", py::object(filename));
117 }
catch (
const py::error_already_set& e) {
127 m_measurement_config = py::import(
"sourcextractor.config.measurement_config").attr(
"global_measurement_config");
128 }
catch (
const py::error_already_set& e) {
140 for (
int i = 0;
i < py::len(
ids); ++
i) {
141 int id = py::extract<int>(
ids[
i]);
146 }
catch (
const py::error_already_set& e) {
156 py::list
ids = apertures.keys();
158 for (
int i = 0;
i < py::len(
ids); ++
i) {
159 int id = py::extract<int>(
ids[
i]);
164 }
catch (
const py::error_already_set& e) {
175 for (
int i = 0;
i < py::len(
output); ++
i) {
176 py::tuple t = py::extract<py::tuple>(
output[
i]);
183 for (
int j = 0;
j < py::len(
cs); ++
j) {
184 int c = py::extract<int>(
cs[
j].
attr(
"id"));
188 int c = py::extract<int>(t[1]);
194 }
catch (
const py::error_already_set& e) {
205 for (
int i = 0;
i < py::len(
output); ++
i) {
206 py::tuple t = py::extract<py::tuple>(
output[
i]);
212 for (
int j = 0;
j < py::len(
cs); ++
j) {
213 int c = py::extract<int>(
cs[
j].
attr(
"id"));
217 int c = py::extract<int>(t[1]);
222 }
catch (
const py::error_already_set& e) {
237 for (
int i = 0;
i < py::len(
ids); ++
i) {
238 int id = py::extract<int>(
ids[
i]);
243 }
catch (
const py::error_already_set& e) {
249 return getMapFromDict(
"model_fitting",
"constant_parameter_dict");
257 return getMapFromDict(
"model_fitting",
"dependent_parameter_dict");
269 return getMapFromDict(
"model_fitting",
"point_source_model_dict");
281 return getMapFromDict(
"model_fitting",
"de_vaucouleurs_model_dict");
293 py::dict
frame_dict = py::extract<py::dict>(model_fitting.attr(
"frame_models_dict"));
304 }
catch (
const py::error_already_set& e) {
313 py::dict
parameters = py::extract<py::dict>(model_fitting.attr(
"params_dict"));
317 for (
int i = 0;
i < py::len(
ids); ++
i) {
#define PYSTON_MODULE_INIT
static Elements::Logging stdout_logger
#define py_argv_assign(d, s, l)
static Elements::Logging logger
static Elements::Logging stderr_logger
static Logging getLogger(const std::string &name="")
void info(const std::string &logMessage)
const Exception & log(log4cpp::Priority::Value level, Elements::Logging &logger) const
static size_t getLockCount()
static Elements::Logging logger
T system_category(T... args)