SourceXtractorPlusPlus  0.19
SourceXtractor++, the next generation SExtractor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
compat.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 
3 # Copyright © 2019-2022 Université de Genève, LMU Munich - Faculty of Physics, IAP-CNRS/Sorbonne Université
4 #
5 # This library is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation; either version 3.0 of the License, or (at your option)
8 # any later version.
9 #
10 # This library is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with this library; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 import sys
19 
20 import _SourceXtractorPy as cpp
21 
22 from .measurement_config import MeasurementConfig, global_measurement_config
23 from .model_fitting import ModelFitting
24 
25 Aperture = cpp.Aperture
26 
27 
28 def _compat_doc_helper(copy_doc_from):
29  """
30  Decorate a method setting its docstring to the one from `copy_doc_from`
31  """
32 
33  def _decorate(func):
34  func.__doc__ = copy_doc_from.__doc__
35  return func
36 
37  return _decorate
38 
39 
40 @_compat_doc_helper(copy_doc_from=MeasurementConfig.add_aperture_photometry)
41 def add_aperture_photometry(target, apertures):
42  global_measurement_config.add_measurement_image(target)
43  return global_measurement_config.add_aperture_photometry(target, apertures)
44 
45 
46 @_compat_doc_helper(copy_doc_from=MeasurementConfig.print_measurement_images)
47 def print_measurement_images(file=sys.stderr):
48  global_measurement_config.print_measurement_images(file)
49 
50 
51 @_compat_doc_helper(copy_doc_from=MeasurementConfig.load_fits_image)
52 def load_fits_image(image, psf=None, weight=None, **kwargs):
53  return global_measurement_config.load_fits_image(image, psf, weight, **kwargs)
54 
55 
56 @_compat_doc_helper(copy_doc_from=MeasurementConfig.load_fits_images)
57 def load_fits_images(images, psfs=None, weights=None, **kwargs):
58  return global_measurement_config.load_fits_images(images, psfs, weights, **kwargs)
59 
60 
61 @_compat_doc_helper(copy_doc_from=MeasurementConfig.load_fits_data_cube)
62 def load_fits_data_cube(image, psf=None, weight=None, image_cube_hdu=-1,
63  weight_cube_hdu=-1, **kwargs):
64  return global_measurement_config.load_fits_data_cube(image, psf, weight, image_cube_hdu,
65  weight_cube_hdu, **kwargs)
66 
67 
68 @_compat_doc_helper(copy_doc_from=MeasurementConfig.print_output_columns)
69 def print_output_columns(file=sys.stderr):
70  global_measurement_config.print_output_columns(file)
71 
72 
73 @_compat_doc_helper(copy_doc_from=MeasurementConfig.add_output_column)
74 def add_output_column(name, params):
75  global_measurement_config.add_output_column(name, params)
76 
77 
78 @_compat_doc_helper(copy_doc_from=ModelFitting.add_prior)
79 def add_prior(param, value, sigma):
80  global_measurement_config.model_fitting.add_prior(param, value, sigma)
81 
82 
83 @_compat_doc_helper(copy_doc_from=ModelFitting.add_model)
84 def add_model(group, model):
85  global_measurement_config.add_measurement_image(group)
86  global_measurement_config.model_fitting.add_model(group, model)
87 
88 
89 @_compat_doc_helper(copy_doc_from=ModelFitting.set_engine)
90 def set_engine(engine):
91  global_measurement_config.model_fitting.set_engine(engine)
92 
93 
94 @_compat_doc_helper(copy_doc_from=ModelFitting.set_max_iterations)
95 def set_max_iterations(max_iter):
96  global_measurement_config.model_fitting.set_max_iterations(max_iter)
97 
98 
99 @_compat_doc_helper(copy_doc_from=ModelFitting.set_meta_iteration_stop)
100 def set_meta_iterations(max_iter):
101  global_measurement_config.model_fitting.set_meta_iterations(max_iter)
102 
103 
104 @_compat_doc_helper(copy_doc_from=ModelFitting.set_meta_iteration_stop)
106  global_measurement_config.model_fitting.set_meta_iteration_stop(stop)
107 
108 
109 @_compat_doc_helper(copy_doc_from=ModelFitting.set_deblend_factor)
110 def set_deblend_factor(factor):
111  global_measurement_config.model_fitting.set_deblend_factor(factor)
112 
113 
114 @_compat_doc_helper(copy_doc_from=ModelFitting.set_modified_chi_squared_scale)
116  global_measurement_config.model_fitting.set_modified_chi_squared_scale(scale)
117 
118 
119 @_compat_doc_helper(copy_doc_from=ModelFitting.use_iterative_fitting)
121  global_measurement_config.model_fitting.use_iterative_fitting(use)