SourceXtractor++ supports externally built plugins, loading them at run-time.
This means anyone can develop their own plugin, add it to the pipeline, and get their target measure - for instance - directly into the output catalog.
This is a particular example of such a plugin, which can be used as an example, or even as a baseline. You can just fork it, and modify it to your needs.
The repository is organized following the standard Elements' layout:
CMakeLists.txt
Project-level cmake build scriptMakefile
so you can typemake
directly. You could, of course, runcmake
out of the source treedoc
contains documentation about the projectPetrosian
is an Elements module. A single project could contain, for instance, the plugin itself, and a Python script that does something with the output. Those would be, ideally, two modules.doc
Module level documentationPetrosian
C++ headerssrc/lib
Library sources. You could havesrc/program
if you had a binary. In this case, we do not have any.
At the source level, we have split the functionality into two different
properties: PetrosianRadius
, and PetrosianPhotometry
.
The former works on the detection image, while the later works on the measurement frame, of which we can have multiple. We recommend to have a detailed look at the way both are computed: generally, there is no much difference, except that for the measurement frame one needs to keep track of which frame the task is working on via an index.
Shared between both, we have PetrosianPlugin
, which takes care of
registering the properties and their associated output columns; and
PetrosianConfig
, which handles the configuration of this particular
measure.
For more details, we recommend navigating through the source code, as each file is heavily commented.
For building the plugin you need, obviously, to install first
SourceXtractor++. You can do it via rpms
, or compiling directly
from sources. Either way, Elements should be able to find the required
components.
If you follow the rpm way, you will need to install the development packages:
dnf install Elements-devel Alexandria-devel SourceXtractor-devel
For how to compile, or get the necessary rpms, please, go to SourceXtractor++ and follow the instructions there.
Once you have the requirements installed, you can just type:
make
ls build*/lib*/libPetrosian.*
The plugin will be on a directory called build
(or starting with
build
), inside the folder lib64
(or lib
depending on your platform).
If you have installed the dependencies using rpms, Elements can easily generate an rpm with the compiled plugin. Just type:
make rpm
Note: This repository includes a .travis.yaml
file configured
to build the rpm.
SourceXtractor++ needs to be told where the plugins are located, and which plugins to load. As of today, it will not load them automatically. It can be done as follows:
From the source directory:
plugin_name="libPetrosian"
plugin_full_path=$(readlink -f build*/lib*/${plugin_name}.*)
plugin_dir=$(dirname "${plugin_full_path}")
Let's check it works:
sourcextractor++ --plugin-directory "${plugin_dir}" --plugin "${plugin_name}" --help
If everything went fine, you will be able to see the configuration registered by this plugin:
Petrosian photometry options:
--petrosian-eta arg (=0.20000000000000001)
Fraction of the isophote over the
surface brightness For the Petrosian
radius
--pretrosian-factor arg (=2) Scale factor for Petrosian photometry
--petrosian-minimum-radius arg (=3.5) Minimum radius for Petrosian photometry
--check-image-petrosian arg Check image for Petrosian apertures
Similarly, you can check the list of output properties:
sourcextractor++ --plugin-directory "${plugin_dir}" --plugin "${plugin_name}" --list-output-properties
AperturePhotometry
AutoPhotometry
ExternalFlags
FlexibleModelFitting
GroupInfo
GroupStamp
IsophotalFlux
KronRadius
MoffatModelFitting
NDetectedPixels
PeakValue
PetrosianPhotometry <<
PetrosianRadius <<
PixelBoundaries
PixelCentroid
ShapeParameters
SourceFlags
SourceIDs
WorldCentroid
Now, you can run sourcextractor++
in your data in the usual way.
As long as you pass --plugin-directory
and --plugin
, you will
be able to ask for the corresponding properties as you would any other.
If you need any help, do not hesitate to open an Issue on this project.
-
SourceXtractor major version is
0
. This means the API may change. We do not expect any major changes, but that does not mean a header file may change location, or one API call could change.In any case, your code will remain compatible with the version listed on the
CMakeLists.txt
file (if it is a released version!). -
This plugin implements the Petrosian aperture. It has been cross-checked with SExtractor 2, but do not expect it to be flawless.