elliprof
ELLIPROF is an astronomical isophote-fitting tool for measuring the radial surface-brightness and shape profiles of galaxies. Given a FITS image and an initial galaxy centre, it fits a sequence of elliptical isophotes and measures, for each one, its intensity, centre, ellipticity, position angle, radial intensity slope, and the 3rd- and 4th-order harmonic deviations from a pure ellipse. It can also build a smooth model image of the galaxy from the fitted isophotes.
elliprof packages the original ELLIPROF Fortran, compiled unchanged, as a command-line program and a Python library.
Source code and issue tracker: https://github.com/ekourkchi/elliprof
What it is for
ELLIPROF is intended primarily for galaxy images. It is particularly useful for:
- elliptical galaxies, smooth spheroidal systems and galaxy bulges, and other smooth light distributions;
- surface-brightness profiles, and how ellipticity and position angle change with radius (isophote twists);
- departures from pure elliptical isophotes, in particular the 4th-order term that characterizes boxy or disky isophotes.
It describes a galaxy as a set of nested ellipses, so it is not necessarily the best tool for irregular galaxies or strongly structured light (spiral arms, bars, dust lanes, bright clumps). Stars and other contaminants should be masked.
You supply the initial galaxy centre (X0, Y0). elliprof does not find the galaxy centre for you. Starting from your centre, ELLIPROF refines the centre of every isophote as part of its normal fit.
Installation
python -m pip install elliprof
- Prebuilt wheels are provided for Linux, macOS and Windows (see Platforms).
- No Fortran compiler and no separate CFITSIO installation are needed.
- Python 3.6 to 3.14 are supported.
If pip says "No matching distribution found"
University and observatory computers often have an old Python or an old pip. First check which ones you are using:
python --version
python -m pip --version
If Python is 3.6–3.14, upgrade pip and try again:
python -m pip install --upgrade pip
python -m pip install elliprof
On Python 3.6, the newest pip is 21.3.1:
python -m pip install "pip==21.3.1"
python -m pip install elliprof
Very old pip versions do not recognize the platform tags of current wheels (pip 20.3 or newer is needed), and then report "No matching distribution found" even though a wheel exists.
If Python is older than 3.6, do not replace your system Python. Create a separate environment instead; this does not modify your existing astronomy environment. With conda:
conda create -n elliprof python=3.12 pip -y
conda activate elliprof
python -m pip install --upgrade pip
python -m pip install elliprof
Or, if a newer Python is already installed, with venv:
python3.12 -m venv elliprof-env
source elliprof-env/bin/activate
python -m pip install --upgrade pip
python -m pip install elliprof
(Python 3.12 is only an example; any version from 3.6 to 3.14 works.)
Several Pythons on one machine: prefer python -m pip install elliprof to pip install elliprof. On shared systems the pip command may belong to a different Python than the one you run. Naming the interpreter makes sure the package is installed for it:
python3.9 -m pip install elliprof
python3.12 -m pip install elliprof
Quick start
elliprof galaxy.fits \
X0=500 Y0=500 \
R0=5 R1=200 NR=30 \
--csv profile.csv \
--reg profile.reg
X0,Y0: initial galaxy centre, in pixels (see Coordinates).R0,R1: the range of semi-major axes to fit, in pixels (0 < R0 < R1).NR: number of isophotes (2–100), spaced evenly in r^¼ by default.profile.csv: the radial profile, one row per isophote.profile.reg: the fitted ellipses as a DS9 region file. View them withds9 galaxy.fits -regions profile.reg.
Sky and masks
Subtract a constant sky level:
elliprof galaxy.fits \
--sky 1234.5 \
X0=500 Y0=500 \
R0=5 R1=200 NR=30
Subtract a 2-D sky (background) image:
elliprof galaxy.fits \
--sky-image background.fits \
X0=500 Y0=500 \
R0=5 R1=200 NR=30
Mask stars and defects (and subtract a sky image):
elliprof galaxy.fits \
--mask mask.fits \
--sky-image background.fits \
X0=500 Y0=500 \
R0=5 R1=200 NR=30
- Mask values: 0 = bad / ignored, 1 = good. Legacy
.dmaskbitmaps (BITPIX = 1) are also read. - The mask and the sky image must have exactly the same dimensions as the science image; nothing is resized.
- The image is prepared as
(science − sky) × mask, and ELLIPROF ignores pixels that are exactly 0.
Harmonic terms: boxy and disky isophotes
Along each fitted ellipse, ELLIPROF fits the intensity with a constant plus cos/sin terms of 1, 2, 3 and 4 times the angle around the ellipse. The 1st- and 2nd-order terms move the centre and change the ellipticity and position angle until the ellipse follows the isophote. The 3rd- and 4th-order terms are always fitted and reported (I3, A3, I4, A4). They measure how the isophote departs from a pure ellipse, but they never change the ellipse itself.
The 4th-order term is the familiar measure of boxy or disky isophotes:
A4near 0° (or 90°, which is the same phase): extra light along the major and minor axes, so the isophote is pointed along its axes: disky.A4near 45°: extra light along the diagonals: boxy.I4is the size of the deviation.
I4 is an intensity amplitude, not the conventional radial a4/a (and not B4). To first order, the conventional radial coefficient is
a4/a ≈ I4 × cos(4 × A4) / (−slope)
This is positive for disky and negative for boxy isophotes. On synthetic galaxies with a4/a = ±0.030 it gives ±0.030.
Choosing which harmonic terms go into the model image
The original ELLIPROF controls the harmonics through COS3X and COS4X. These choose which measured terms are included when ELLIPROF builds a model image (MODEL, -m model.fits). They do not change the fitted profile. elliprof exposes them as options:
| Option | Model image contains | ELLIPROF setting |
|---|---|---|
| (default) | 3rd- and 4th-order terms, each isophote's own values | COS3X=2 COS4X=2 |
--model-harmonics none |
pure ellipses, no harmonic terms | COS3X=0 COS4X=0 |
--model-harmonics 3 |
3rd-order term only | COS3X=2 COS4X=0 |
--model-harmonics 4 |
4th-order term only (boxy/disky shape) | COS3X=0 COS4X=2 |
--model-harmonics 3,4 |
both (same as the default) | COS3X=2 COS4X=2 |
add --harmonic-mode median |
the median of each term over all isophotes, instead of each isophote's own | 1 instead of 2 |
Examples:
# model of pure ellipses
elliprof galaxy.fits X0=500 Y0=500 R0=5 R1=200 NR=30 \
MODEL -m model.fits --model-harmonics none
# model with the boxy/disky (4th-order) structure only
elliprof galaxy.fits X0=500 Y0=500 R0=5 R1=200 NR=30 \
MODEL -m model.fits --model-harmonics 4
Subtracting such a model from the image shows the structure that the chosen terms do not describe. For example, a residual made with the pure-ellipse model reveals boxy or disky light directly.
6th order instead of 3rd. --sixth-order (ELLIPROF's COS3X < 0) fits and models the 6th-order term in place of the 3rd. This is the only harmonic setting that changes the fit. The I3 and A3 columns then hold the 6th-order amplitude, and a phase equal to twice the 6th-order phase (0–120°).
elliprof galaxy.fits X0=500 Y0=500 R0=5 R1=200 NR=30 --sixth-order
The original keywords work too, for those who know them from the original program: COS3X= (−2 to 2) and COS4X= (0 to 2). Use either the keywords or the options, not both.
Python
from elliprof import run_elliprof
result = run_elliprof(
image="galaxy.fits",
x0=500,
y0=500,
r0=5,
r1=200,
nr=30,
)
print(result.profile) # pandas DataFrame, one row per isophote
With a sky, a mask, and a model image that contains only the 4th-order harmonic term:
result = run_elliprof(
image="galaxy.fits", x0=500, y0=500, r0=5, r1=200, nr=30,
sky_image="background.fits", mask="mask.fits",
model=True, model_harmonics=(4,), # (), (3,), (4,) or (3, 4)
)
print(result.model_path)
harmonic_mode="median" and sixth_order=True correspond to the command-line options. cos3x= and cos4x= set the original ELLIPROF values directly. The command line and the Python API run exactly the same backend with the same settings.
python -m elliprof is the same as the elliprof command. A worked example on a real HST image is in examples/u12517 and notebooks/elliprof_example.ipynb.
The profile
One row per isophote (result.profile, the CSV file, and the .prf file):
| Column | Meaning |
|---|---|
Rmaj |
semi-major axis a of the isophote (pixels) |
x0, y0 |
fitted centre of the isophote (ELLIPROF coordinates, see below) |
I0 |
intensity of the isophote, in image units after sky subtraction |
alpha |
position angle of the major axis in degrees (0–180), counter-clockwise from the +y axis; the major axis lies at alpha + 90° counter-clockwise from +x |
ellip |
ellipticity, 1 − b/a |
I3, I4 |
amplitude of the 3rd- and 4th-order intensity variation along the isophote, as a fraction of I0 |
A3, A4 |
their phases in degrees: the intensity varies as cos(3(θ − A3)) and cos(4(θ − A4)), where θ is the angle around the ellipse (the eccentric angle), measured from the major axis. A3 is 0–120°, A4 is 0–90°. These are not the position angle. |
slope |
logarithmic slope d ln I / d ln r, from neighbouring isophotes (set to −2 where it would be positive) |
Coordinates
X0, Y0 and the fitted x0, y0 are in ELLIPROF image coordinates: the centre of the pixel in FITS column i is at x = i − 0.5. This is half a pixel less than FITS or DS9 pixel numbering. The DS9 region files are already converted.
Command-line reference
| Keyword or option | Python | Meaning |
|---|---|---|
X0= Y0= |
x0 y0 |
initial centre (required) |
R0= R1= NR= |
r0 r1 nr |
radius range and number of isophotes (required) |
--sky V |
sky |
subtract a constant |
--sky-image F |
sky_image |
subtract an image |
--mask F |
mask |
0 = ignored, 1 = good |
NITER= |
niter |
iterations (default 5, at most 1000) |
RLAW= |
rlaw |
radius spacing: 0 linear, 1 logarithmic, 2 r^¼ (default) |
LINEAR |
linear |
fit intensities instead of log intensities |
FIXCTR= |
fixctr |
0 free centres (default), 1 fixed at X0/Y0, 2 median centre |
ELLIP= |
ellip |
force this ellipticity |
RMSTAR |
rmstar |
reject star-like outliers along each isophote |
MODEL, -m F |
model, model_path |
build a model image |
--model-harmonics |
model_harmonics |
harmonic terms in the model (above) |
--harmonic-mode |
harmonic_mode |
each (default) or median |
--sixth-order |
sixth_order |
6th- instead of 3rd-order term |
COS3X= COS4X= |
cos3x cos4x |
the original harmonic settings |
TIE= |
tie |
smooth the parameters with radius |
AVG= |
avg |
average a (2n+1)² box when sampling |
GAIN= |
gain |
iteration gain (default 1) |
SCALE= |
scale |
arcsec/pixel, recorded in the profile |
SKY= |
elliprof_sky |
sky used only in ELLIPROF's de Vaucouleurs fit (it does not change the image) |
GC |
gc |
globular-cluster mode: circular annuli |
-o F --csv F --reg F |
prf_path csv_path reg_path |
output files |
--timeout S |
timeout |
stop a run after S seconds (default 1800) |
OLD, EDIT and TV (interactive options) are not supported. Invalid input fails immediately with a clear message, and the program never waits for keyboard input. elliprof --version and elliprof --diagnostics print version and platform information for bug reports.
Platforms
| Platform | Status |
|---|---|
| Linux x86_64, aarch64 (manylinux_2_28) | Supported |
| Linux ppc64le, s390x (manylinux_2_28) | Supported (wheels tested under QEMU emulation) |
| Linux x86_64, aarch64 (musllinux_1_2, e.g. Alpine) | Supported |
| macOS 11+ arm64, x86_64 | Supported |
| Windows x86_64 | Supported |
| Linux riscv64 (manylinux_2_39) | Experimental: the wheel builds, but its tests have not completed |
| Windows ARM64 | Experimental: no wheel (no GNU Fortran toolchain yet) |
Python 3.6 to 3.14. Supported means the wheel was installed and passed the installed-wheel and regression tests in a clean environment without a compiler or CFITSIO. On ppc64le and s390x, PyPI has no numpy or pandas wheels, so install those from your Linux distribution or conda. 32-bit systems and macOS older than 11 are not supported.
Development
brew install gcc cfitsio # or: apt install gfortran libcfitsio-dev
python -m pip install -e ".[test]"
make check # build and run all tests
The original numerical sources in src/original/ and include/ are never modified, and their SHA-256 hashes are checked on every test run. The test plan is in tests/TEST_PLAN.md.
Known limitations:
- NR ≤ 100.
- Isophotes smaller than about 3 pixels have too few samples.
GCmode assumes images at most 2048 pixels on a side.- The model image is written relative to the subtracted sky.
- With
--sixth-orderin the defaulteachmode, the original code can leave a few NaN pixels at the very centre of the model image, inside the innermost isophote.
Historical note: ELLIPROF was originally developed by John Tonry as part of MONSTA.
Maintained by Ehsan Kourkchi (Edwin Kay) Email: ekourkchi@gmail.com
License: MIT for the elliprof package code (see LICENSE). The original ELLIPROF sources and bundled libraries keep their own terms (see THIRD_PARTY_NOTICES.md).
Disclaimer. This software is provided as-is, without warranty of any kind. The maintainer is not responsible for software errors, incorrect scientific results, data loss, or decisions made using results produced by this software. Users are responsible for independently validating results for their scientific application.
Release files for elliprof 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 16.1 MB
Release files / elliprof-0.1.1-py3-none-win_amd64.whl
| Download URL | elliprof-0.1.1-py3-none-win_amd64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f88079643540f01b07d673e79e455d450b1dd157822e282c526d52bf1071dcd9
|
|
BLAKE2b-256 checksum How to use checksums |
aef6074905c31062ff0d29cfbb32429da063f2c59bf877f7b53e41997b655e01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / elliprof-0.1.1-py3-none-musllinux_1_2_x86_64.whl
| Download URL | elliprof-0.1.1-py3-none-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | Linux musl 1.2+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
b5140766c2719789c09bf1a40e60e3be88be22e2215b64670c3a213cc3d61f86
|
|
BLAKE2b-256 checksum How to use checksums |
067a0715e257a36fc7b2ae79ffea576fcfb139221623ac0be880f1ec80fcfd35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / elliprof-0.1.1-py3-none-musllinux_1_2_aarch64.whl
| Download URL | elliprof-0.1.1-py3-none-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | Linux musl 1.2+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
523a579c160271328af4676519e7386a98dc316ce59cc3871e8b3389e4ce72ff
|
|
BLAKE2b-256 checksum How to use checksums |
e57d4cebabd76573bdff545d8314ce6f699a17f437eb10d53c25b4c02fcad7a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / elliprof-0.1.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | elliprof-0.1.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
143c76130c354b1c6f2cf2200e10f79cb99769a5386e0c332a67421842f5d369
|
|
BLAKE2b-256 checksum How to use checksums |
0874a2600930c340e2b62b00f061f8969a52ba957c9b7ee9cb563214d6de88f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / elliprof-0.1.1-py3-none-manylinux_2_27_s390x.manylinux_2_28_s390x.whl
| Download URL | elliprof-0.1.1-py3-none-manylinux_2_27_s390x.manylinux_2_28_s390x.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Linux glibc 2.27+ IBM System/390x Linux glibc 2.28+ IBM System/390x Python 3 |
|
SHA-256 checksum How to use checksums |
ae1752a758c304db9742051e803077a798e4af88b190c58a8e2bab7cdc51e7d8
|
|
BLAKE2b-256 checksum How to use checksums |
15cf0563e6fb9a25193086789c0db8a9171d56b8670b0c9f18c5accd5506f481
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / elliprof-0.1.1-py3-none-manylinux_2_27_ppc64le.manylinux_2_28_ppc64le.whl
| Download URL | elliprof-0.1.1-py3-none-manylinux_2_27_ppc64le.manylinux_2_28_ppc64le.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Linux glibc 2.27+ PowerPC 64-le Linux glibc 2.28+ PowerPC 64-le Python 3 |
|
SHA-256 checksum How to use checksums |
b2f4e831ddb9037202fa2c32fafe077c68de3a02e3fe8525e1a2c7d9d62d5c1f
|
|
BLAKE2b-256 checksum How to use checksums |
51d31f8a9dd534c18421fdf84097f20c4fa241fa13221fd34e92d21696fc7041
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / elliprof-0.1.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | elliprof-0.1.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
c08ba55e0d16a9ef9c74eaa76d2987ef8a846215a044f3275fe405650b55d8df
|
|
BLAKE2b-256 checksum How to use checksums |
0313f03846fe019ce9159cdc740c75695c4d2ae680d224494745b74168bc604c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / elliprof-0.1.1-py3-none-macosx_11_0_arm64.whl
| Download URL | elliprof-0.1.1-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a2c16382a21d85e38b0c310c4f4c25bb7eff0e07b9923af807f6d001a157eacc
|
|
BLAKE2b-256 checksum How to use checksums |
acff072f2d70df260b076e2e6c88727009acc3d9ee34fd458f1c66ff49ce8850
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / elliprof-0.1.1-py3-none-macosx_10_16_x86_64.macosx_11_0_x86_64.whl
| Download URL | elliprof-0.1.1-py3-none-macosx_10_16_x86_64.macosx_11_0_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | Python 3 macOS 10.16+ x86-64 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
d45fa6d28588502f69482c16938c40b9be32dedcff96184168daf02063320d48
|
|
BLAKE2b-256 checksum How to use checksums |
b2b2bcab8cce58b7728af5ee59cb416e572be6f7e953cf6818cc21c3d3172177
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log