swiftgalaxy

Load in particles of a simulated galaxy, rotate coordinates, easy spherical/cylindrical coordinates, access integrated properties, and more.

https://github.com/swiftsim/swiftgalaxy

Science Score: 49.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 2 DOI reference(s) in README
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.9%) to scientific vocabulary

Keywords

astrophysics galaxies swift
Last synced: 6 months ago · JSON representation

Repository

Load in particles of a simulated galaxy, rotate coordinates, easy spherical/cylindrical coordinates, access integrated properties, and more.

Basic Info
Statistics
  • Stars: 7
  • Watchers: 4
  • Forks: 2
  • Open Issues: 5
  • Releases: 21
Topics
astrophysics galaxies swift
Created almost 4 years ago · Last pushed 7 months ago
Metadata Files
Readme Contributing License Code of conduct Codemeta

README.rst

.. image:: https://github.com/SWIFTSIM/swiftgalaxy/raw/main/swiftgalaxy_banner.png
   :width: 100%
   :alt: Banner with logo showing a swift in a spiral and the text SWIFTGalaxy.

.. raw:: html

    Python Version from PEP 621 TOML
    PyPI - Version
    Astrophysics Source Code Library - 2505.002
    Project Status: Active – The project has reached a stable, usable state and is being actively developed.
    Code archiving - Zenodo
    Build Status
    Documentation Status
    Test coverage - Codecov
    Code style - Black

.. INTRO_START_LABEL

SWIFTGalaxy is an open-source astrophysics module that extends SWIFTSimIO_ tailored to analyses of particles belonging to individual galaxies simulated with SWIFT_. It inherits from and extends the functionality of the ``SWIFTDataset``. It understands the content of halo catalogues (supported: `Velociraptor`_, `Caesar`_, `SOAP`_) and therefore which particles belong to a galaxy or other group of particles, and its integrated properties. The particles occupy a coordinate frame that is enforced to be consistent, such that particles loaded on-the-fly will match e.g. rotations and translations of particles already in memory. Intuitive masking of particle datasets is also enabled. Utilities to make working in cylindrical and spherical coordinate systems more convenient are also provided. Finally, tools to iterate efficiently over multiple galaxies are also provided.

.. _SWIFTSimIO: http://swiftsimio.readthedocs.org
.. _SWIFT: https://swift.strw.leidenuniv.nl/
.. _Velociraptor: https://ui.adsabs.harvard.edu/abs/2019PASA...36...21E/abstract
.. _Caesar: https://caesar.readthedocs.io/en/latest/
.. _SOAP: https://github.com/SWIFTSIM/SOAP

.. INTRO_END_LABEL

Installation_ is as simple as ``pip install swiftgalaxy``. Dependencies for using Velociraptor catalogues can be installed with ``pip install swiftgalaxy[velociraptor]``. For SOAP and Caesar support use:

.. code-block::

   pip install git+https://github.com/SWIFTSIM/soap.git@soap_runtime
   pip install git+https://github.com/dnarayanan/caesar.git

.. _Installation: https://swiftgalaxy.readthedocs.io/en/latest/getting_started/index.html#installing

.. EXAMPLE_START_LABEL

Once installed, creating a ``SWIFTGalaxy`` object to get started with analysis is simple! For instance, for a SWIFT simulation with a SOAP-format halo catalogue (an example - 300 MB - will be automatically downloaded):

.. code-block:: python

   from swiftgalaxy import SWIFTGalaxy, SOAP
   from swiftgalaxy.demo_data import web_examples

   sg = SWIFTGalaxy(
       web_examples.virtual_snapshot,
       SOAP(web_examples.soap, soap_index=0)
   )

   # access data for particles belonging to the galaxy:
   sg.gas.temperatures

   # access integrated properties from the halo catalogue
   sg.halo_catalogue.spherical_overdensity_200_crit.soradius

   # automatically generated spherical/cylindrical coordinates:
   sg.gas.spherical_coordinates.r

   # consistent coordinate transformations of all particles, even those not loaded yet:
   from scipy.spatial.transform import Rotation
   sg.rotate(Rotation.from_euler("x", 90, degrees=True))

   # compatible with swiftsimio visualisation:
   import numpy as np
   import unyt as u
   from swiftsimio import cosmo_array
   from swiftsimio.visualisation import project_gas
   import matplotlib.pyplot as plt
   img = project_gas(
       sg,
       periodic=False,
       resolution=256,
       region=cosmo_array(
           [-30, 30, -30, 30],
	   u.kpc,
	   comoving=True,
	   scale_factor=sg.metadata.a,
	   scale_exponent=1
       ),
   )
   plt.imsave("eagle6_galaxy.png", np.log10(img.T), origin="lower", cmap="inferno")

.. image:: eagle6_galaxy.png

.. EXAMPLE_END_LABEL

Examples
--------

.. EXAMPLES_START_LABEL

More usage examples can be found in the `examples folder on github`_.

.. _examples folder on github: https://github.com/SWIFTSIM/swiftgalaxy/tree/main/examples

.. EXAMPLES_END_LABEL

+ `Quick start guide`_
+ `Full documentation`_

.. _Quick start guide: https://swiftgalaxy.readthedocs.io/en/latest/getting_started
.. _Full documentation: https://swiftgalaxy.readthedocs.io/en/latest
   
Citing SWIFTGalaxy
------------------

.. CITING_START_LABEL

If your use of SWIFTGalaxy leads to a publication, please cite the `swiftgalaxy entry`_ in the ASCL_ (`indexed on ADS`_). Ideally specify the version used (`Zenodo DOI`_, git commit ID and/or version number) and link to the github repository. A PyOpenSci_ review leading to a JOSS_ submission is `in progress`_, please check back for updated citation information.

.. code-block:: bibtex

    @MISC{
        2025ascl.soft05002O,
     	author = {{Oman}, Kyle A.},
        title = "{swiftgalaxy}",
        keywords = {Software},
        howpublished = {Astrophysics Source Code Library, record ascl:2505.002},
        year = 2025,
        month = may,
        eid = {ascl:2505.002},
        pages = {ascl:2505.002},
        archivePrefix = {ascl},
        eprint = {2505.002},
        adsurl = {https://ui.adsabs.harvard.edu/abs/2025ascl.soft05002O},
        adsnote = {Provided by the SAO/NASA Astrophysics Data System}
    }

Please also consider the `citations requested for SWIFTSimIO `_.

.. _swiftgalaxy entry: https://ascl.net/2505.002
.. _ASCL: https://ascl.net
.. _JOSS: https://joss.theoj.org/
.. _PyOpenSci: https://www.pyopensci.org/
.. _in progress: https://github.com/pyOpenSci/software-submission/issues/244#issuecomment-2912506097
.. _indexed on ADS: https://ui.adsabs.harvard.edu/abs/2025ascl.soft05002O
.. _Zenodo DOI: https://zenodo.org/records/15502385
.. _citeSWIFTSimIO: https://swiftsimio.readthedocs.io/en/latest/index.html#citing-swiftsimio

.. CITING_END_LABEL

Community
---------

.. COMMUNITY_START_LABEL

Code contributions are very welcome! A good place to start is the `contributing guide`_ and how to set up a `development environment`_.

SWIFTGalaxy is licensed under `GPL-3.0`_ and community members are expected to abide by the `code of conduct`_.

.. _contributing guide: https://github.com/SWIFTSIM/swiftgalaxy/blob/main/CONTRIBUTING.md
.. _development environment: https://swiftgalaxy.readthedocs.io/en/latest/getting_started/index.html#installing
.. _GPL-3.0: https://github.com/SWIFTSIM/swiftgalaxy/tree/main?tab=GPL-3.0-1-ov-file
.. _code of conduct: https://github.com/SWIFTSIM/swiftgalaxy/tree/main?tab=coc-ov-file

.. COMMUNITY_END_LABEL

Owner

  • Name: SWIFT astrophysics simulation code and ecosystem of tools
  • Login: SWIFTSIM
  • Kind: organization
  • Location: Netherlands

SWIFT: SPH With Inter-dependent Fine-grained Tasking

JOSS Publication

SWIFTGalaxy: a Python package to work with particle groups from SWIFT simulations
Published
October 22, 2025
Volume 10, Issue 114, Page 9278
Authors
Kyle A. Oman ORCID
Institute for Computational Cosmology, Physics Department, Durham University, United Kingdom, Centre for Extragalactic Astronomy, Physics Department, Durham University, United Kingdom
Editor
Warrick Ball ORCID
Tags
astronomy simulations

GitHub Events

Total
  • Create event: 40
  • Release event: 17
  • Issues event: 24
  • Watch event: 5
  • Delete event: 28
  • Issue comment event: 32
  • Push event: 121
  • Pull request review event: 1
  • Pull request event: 40
  • Fork event: 2
Last Year
  • Create event: 40
  • Release event: 17
  • Issues event: 24
  • Watch event: 5
  • Delete event: 28
  • Issue comment event: 32
  • Push event: 121
  • Pull request review event: 1
  • Pull request event: 40
  • Fork event: 2

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 14
  • Total pull requests: 22
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 29 days
  • Total issue authors: 4
  • Total pull request authors: 3
  • Average comments per issue: 0.29
  • Average comments per pull request: 0.32
  • Merged pull requests: 17
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 14
  • Pull requests: 22
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 29 days
  • Issue authors: 4
  • Pull request authors: 3
  • Average comments per issue: 0.29
  • Average comments per pull request: 0.32
  • Merged pull requests: 17
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • kyleaoman (9)
  • blakeaw (6)
  • woodruffw (1)
  • andreagebek (1)
Pull Request Authors
  • kyleaoman (23)
  • AleKit (1)
  • robjmcgibbon (1)
Top Labels
Issue Labels
bug (3) enhancement (2)
Pull Request Labels
enhancement (8) bug (8) documentation (2)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 310 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 0
  • Total versions: 20
  • Total maintainers: 1
pypi.org: swiftgalaxy

Code abstraction of objects (galaxies) in simulations.

  • Versions: 20
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 310 Last month
Rankings
Dependent packages count: 6.6%
Average: 18.6%
Dependent repos count: 30.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/python-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
docs/requirements.txt pypi
  • h5py *
  • numba *
  • numpy *
  • recommonmark *
  • scipy *
  • sphinx *
  • sphinx-rtd-theme *
  • swiftsimio *
  • unyt *
  • velociraptor *
optional_requirements.txt pypi
  • black *
  • pytest *
  • velociraptor *
  • wily *
pyproject.toml pypi
  • h5py *
  • numpy *
  • scipy *
  • swiftsimio *
  • unyt *
requirements.txt pypi
  • h5py *
  • numpy *
  • scipy *
  • swiftsimio *
  • unyt *
.github/workflows/lint_and_test.yml actions
  • actions/cache v3 composite
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • psf/black stable composite
  • py-actions/flake8 v2 composite