SEP

SEP: Source Extractor as a library - Published in JOSS (2016)

https://github.com/sep-developers/sep

Science Score: 59.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 12 DOI reference(s) in README
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
    2 of 20 committers (10.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary

Scientific Fields

Engineering Computer Science - 60% confidence
Last synced: 6 months ago · JSON representation

Repository

Python and C library for source extraction and photometry

Basic Info
  • Host: GitHub
  • Owner: sep-developers
  • Language: C
  • Default Branch: main
  • Homepage:
  • Size: 1.48 MB
Statistics
  • Stars: 201
  • Watchers: 22
  • Forks: 64
  • Open Issues: 27
  • Releases: 19
Created almost 12 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License Authors Codemeta

README.md

SEP

Python and C library for Source Extraction and Photometry.

PyPI PyPI - Downloads Build Status Documentation Status JOSS

"... [it's] an SEP: Somebody Else's Problem." "Oh, good. I can relax then."

SEP, SEP-PJW, and Package Names

sep was originally released by Kyle Barbary, at kbarbary/sep (sep<=1.2.1). For a brief period, the package was maintained by Peter Watson, under the sep-pjw package name, at PJ-Watson/sep-pjw and PyPI/sep-pjw (1.3.0<=sep-pjw<=1.3.8). Both of these repositories will be archived, and future development will take place at sep-developers/sep (sep>=1.4.0). Note that there may be some incompatibilities between sep==1.2.1 and sep==1.4.0 when using the C-API directly (to fix an indexing bug arising with large arrays) - all changes are documented here.

About

Source Extractor (Bertin & Arnouts 1996) is a widely used command-line program for segmentation and analysis of astronomical images. It reads in FITS format files, performs a configurable series of tasks, including background estimation, source detection, deblending and a wide array of source measurements, and finally outputs a FITS format catalog file.

While Source Extractor is highly useful, the fact that it can only be used as an executable can limit its applicability or lead to awkward workflows. There is often a desire to have programmatic access to perform one or more of the above tasks on in-memory images as part of a larger custom analysis.

SEP makes the core algorithms of Source Extractor available as a library of stand-alone functions and classes. These operate directly on in-memory arrays (no FITS files or configuration files). The code is derived from the Source Extractor code base (written in C) and aims to produce results compatible with Source Extractor whenever possible. SEP consists of a C library with no dependencies outside the standard library, and a Python module that wraps the C library in a Pythonic API. The Python wrapper operates on NumPy arrays with NumPy as its only dependency. See below for language-specfic build and usage instructions.

Python

Documentation: http://sep.readthedocs.io

Requirements:

  • Python 3.9+
  • numpy 1.23+

Install release version:

SEP can be installed with pip:

python -m pip install sep

If you get an error about permissions, you are probably using your system Python. In this case, we recommend using pip's "user install" option to install sep into your user directory:

python -m pip install --user sep

Do not install sep or other third-party Python packages using sudo unless you are fully aware of the risks.

Install development version:

Building the development version (from github) requires Cython. Build and install in the usual place:

python -m pip install --editable .

Run tests: Tests require the pytest Python package. To run the tests, execute ./test.py in the top-level directory. Some tests require a FITS reader (either fitsio or astropy) and will be skipped if neither is present.

C Library

Note: The build process only works on Linux and OS X.

CMake: To build using CMake, enter these commands:

cd sep mkdir -p build cd build cmake -DCMAKE_INSTALL_PREFIX=/usr ../ and follow next steps from the build folder

Build: To build the C library from source:

make

Run tests:

make test

Install The static library and header can be installed with

make install make PREFIX=/path/to/prefix install

This will install the shared and static library in /path/to/prefix/lib and header file in /path/to/prefix/include. The default prefix is /usr/local.

API: The C library API is documented in the header file sep.h.

Rust bindings: Low-level Rust wrapper for the C library can be found at https://crates.io/crates/sep-sys

Contributing

  • Report a bug or documentation issue: http://github.com/sep-developers/issues
  • Ask (or answer) a question: https://github.com/sep-developers/sep/discussions/categories/q-a

Development of SEP takes place on GitHub at sep-developers/sep. Contributions of bug fixes, documentation improvements and minor feature additions are welcome via GitHub pull requests. For major features, it is best to discuss the change first via GitHub Discussions.

Citation

If you use SEP in a publication, please cite the following article in the Journal of Open Source Software:

JOSS

Please also cite the original Source Extractor paper (Bertin & Arnouts 1996).

The DOI for the sep v1.0.0 code release is:

DOI

License

The license for all parts of the code derived from Source Extractor is LGPLv3. The license for code derived from photutils (src/overlap.h) is BSD 3-clause. Finally, the license for the Python wrapper (sep.pyx) is MIT. The license for the library as a whole is therefore LGPLv3. The license for each file is explicitly stated at the top of the file and the full text of each license can be found in licenses.

FAQ

Why isn't the C library part of Source Extractor?

Source Extractor is not designed as a library with an executable built on top of the library. In Source Extractor, background estimation, object detection and photometry are deeply integrated into the Source Extractor executable. Many changes to the code were necessary in order to put the functionality in stand-alone C functions. It's too much to ask of the Source Extractor developer to rewrite large parts of the core of the Source Extractor program with little gain for the executable.

What sort of changes?

  • Source Extractor reads in only a small portion of each image at a time. This allows it to keep its memory footprint extremely low and to operate on images that are much larger than the system's physical memory. It also means that a FITS reader is deeply integrated into the code. SEP operates on images in memory, so all the FITS I/O machinery in Source Extractor is not used here.

  • Error handling: When it encounters a problem, Source Extractor immediately exits with an error message. This is fine for an executable, but a library function doesn't have that luxury. Instead it must ensure that allocated memory is freed and return an error code.

  • Options: Source Extractor has many options that affect its behavior. These are stored in a global structure used throughout the executable. In SEP, options for a particular function are passed as function parameters.

  • Array types: Source Extractor can operate on FITS images containing various types of data (float, double, int, etc). Internally, it does this by converting all data to float immediately when reading from disk. SEP does something similar, but in memory: SEP functions typically convert input arrays to float on the fly within each function, then perform all operations as floating point.

Is SEP as fast as Source Extractor?

It's fast. It should be similar to Source Extractor as a lot of the code is identical. Source Extractor has the advantage of doing all the operations (detection and analysis) simultaneously on each image section, which may confer CPU cache advantages, but this hasn't been tested at all. On the other hand, depending on your usage SEP might let you avoid writing files to disk, which is likely to be a bigger win.

What happens when Source Extractor is updated in the future?

SEP can be considered a fork of the Source Extractor code base: it's development will not track that of Source Extractor in any automated way. However, the algorithms implemented so far in SEP are stable in Source Extractor: the SEP code was forked from v2.18.11, yet it is tested against the results of v2.8.6. This indicates that the algorithms have not changed in Source Extractor over the last few years.

In the Python interface, why do I have to byte swap data when using astropy.io.fits?

This occurs because FITS files have big-endian byte order, whereas most widely used CPUs have little-endian byte order. In order for the CPU to operate on the data, it must be byte swapped at some point. Some FITS readers such as fitsio do the byte swap immediately when reading the data from disk to memory, returning numpy arrays in native (little-endian) byte order. However, astropy.io.fits does not (for reasons having to do with memory mapping). Most of the time you never notice this because when you do any numpy operations on such arrays, numpy uses an intermediate buffer to byte swap the array behind the scenes and returns the result as a native byte order array. Internally, SEP is not using numpy operations; it's just getting a pointer to the data in the array and passing it to C code. As the C code does not include functionality to do buffered byte swapping, the input array must already be in native byte order.

It would be possible to add buffered byte swapping capability to the SEP code, but it would increase the code complexity. A simpler alternative would be to make a byte swapped copy of the entire input array, whenever necessary. However, this would significantly increase memory use, and would have to be done repeatedly in multiple SEP functions: Background, extract, sum_circle, etc. Each would make a copy of the entire data array. Given these considerations, it seemed best to just explicitly tell the user to do the byte swap operation themselves so they could just do it once, immediately after reading in the data.

I have more questions!

Open a discussion on the GitHub Discussions page!

Owner

  • Name: sep-developers
  • Login: sep-developers
  • Kind: organization

CodeMeta (codemeta.json)

{
  "@context": "https://raw.githubusercontent.com/mbjones/codemeta/master/codemeta.jsonld",
  "@type": "Code",
  "author": [
    {
      "@id": "http://orcid.org/0000-0002-2532-3696",
      "@type": "Person",
      "email": "kylebarbary@gmail.com",
      "name": "Kyle Barbary",
      "affiliation": "University of California, Berkeley"
    }
  ],
  "identifier": "http://dx.doi.org/10.5281/zenodo.159035",
  "codeRepository": "https://github.com/kbarbary/sep",
  "datePublished": "2016-09-30",
  "dateModified": "2016-09-30",
  "dateCreated": "2016-09-30",
  "description": "Python and C library for Source Extraction and Photometry",
  "keywords": "astronomy, Python, image analysis",
  "license": "LGPL v3.0",
  "title": "SEP",
  "version": "v1.0.0"
}

GitHub Events

Total
  • Create event: 4
  • Release event: 1
  • Issues event: 12
  • Watch event: 10
  • Delete event: 2
  • Issue comment event: 15
  • Push event: 13
  • Pull request event: 14
  • Fork event: 4
Last Year
  • Create event: 4
  • Release event: 1
  • Issues event: 12
  • Watch event: 10
  • Delete event: 2
  • Issue comment event: 15
  • Push event: 13
  • Pull request event: 14
  • Fork event: 4

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 363
  • Total Committers: 20
  • Avg Commits per committer: 18.15
  • Development Distribution Score (DDS): 0.35
Past Year
  • Commits: 23
  • Committers: 1
  • Avg Commits per committer: 23.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Kyle Barbary k****y@g****m 236
Peter Watson 5****n 57
Ingvar Stepanyan me@r****m 17
Gabriel Brammer g****r@g****m 13
Kyle Boone k****e@b****u 8
Curtis McCully c****y@l****t 5
ysBach d****5@g****m 5
Ilia Platone i****o@i****m 3
Matthew Craig m****g@g****m 3
Sergio Pascual s****r@f****s 2
Matthew R. Becker b****r@g****m 2
Julio Campagnolo j****o@g****m 2
Christoph Deil D****h@g****m 2
Michael m****r@t****e 2
Benjamin Rose b****3@n****u 1
Bookaflok 1****k 1
Curtis McCully c****y@l****l 1
Evert Rol e****l@g****m 1
buslov b****m@g****m 1
jdl j****n@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 68
  • Total pull requests: 52
  • Average time to close issues: 5 months
  • Average time to close pull requests: 14 days
  • Total issue authors: 39
  • Total pull request authors: 21
  • Average comments per issue: 3.25
  • Average comments per pull request: 2.48
  • Merged pull requests: 44
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 5
  • Pull requests: 10
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 9 days
  • Issue authors: 4
  • Pull request authors: 4
  • Average comments per issue: 1.6
  • Average comments per pull request: 0.2
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • kbarbary (10)
  • cmccully (5)
  • cdeil (3)
  • juliotux (3)
  • jmccormac01 (3)
  • stefanocovino (3)
  • ysBach (2)
  • fockez (2)
  • kboone (2)
  • RReverser (2)
  • MickaelRigault (2)
  • aroy244 (2)
  • mwcraig (2)
  • Lyalpha (1)
  • astrosumit (1)
Pull Request Authors
  • kbarbary (13)
  • RReverser (8)
  • kboone (5)
  • PJ-Watson (5)
  • SonofaBookaflok (3)
  • SeverinDenisenko (2)
  • juliotux (2)
  • ysBach (2)
  • cdeil (2)
  • evertrol (1)
  • benjaminrose (1)
  • ryanmich251 (1)
  • iliaplatone (1)
  • gbrammer (1)
  • mworion (1)
Top Labels
Issue Labels
question (4) help-wanted (2)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 25,057 last-month
  • Total dependent packages: 42
    (may contain duplicates)
  • Total dependent repositories: 77
    (may contain duplicates)
  • Total versions: 27
  • Total maintainers: 2
pypi.org: sep

Astronomical source extraction and photometry library

  • Versions: 20
  • Dependent Packages: 34
  • Dependent Repositories: 76
  • Downloads: 25,057 Last month
  • Docker Downloads: 0
Rankings
Dependent packages count: 0.4%
Dependent repos count: 1.7%
Downloads: 3.5%
Average: 3.6%
Docker downloads count: 4.3%
Stargazers count: 5.7%
Forks count: 5.8%
Maintainers (2)
Last synced: 6 months ago
conda-forge.org: sep

SEP makes the core algorithms of Source Extractor available as a library of stand-alone functions and classes. These operate directly on in-memory arrays (no FITS files or configuration files). The code is derived from the Source Extractor code base (written in C) and aims to produce results compatible with Source Extractor whenever possible.

  • Versions: 7
  • Dependent Packages: 8
  • Dependent Repositories: 1
Rankings
Dependent packages count: 7.1%
Average: 21.5%
Dependent repos count: 24.3%
Forks count: 25.2%
Stargazers count: 29.4%
Last synced: 6 months ago

Dependencies

setup.py pypi
  • numpy *
.github/workflows/build-wheels-upload-pypi.yml actions
  • actions/checkout v2 composite
  • actions/checkout v3 composite
  • actions/download-artifact v2 composite
  • actions/setup-python v2 composite
  • actions/setup-python v3 composite
  • actions/upload-artifact v2 composite
  • docker/setup-qemu-action v1 composite
  • pypa/gh-action-pypi-publish v1.4.1 composite
.github/workflows/python-package-tox.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite