Skip to content

Commit 4953eee

Browse files
authored
Update docs homepage (#44)
* Simplify docs homepage and relocate some information.
1 parent b0f8f6c commit 4953eee

9 files changed

Lines changed: 116 additions & 65 deletions

File tree

README.rst

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,20 @@ SWIFTGalaxy
3030
3131
SWIFTGalaxy is a module that extends SWIFTSimIO_ tailored to analyses of particles belonging to individual simulated galaxies. 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.
3232

33-
Installation is as simple as ``pip install swiftgalaxy``. Once installed, creating a ``SWIFTGalaxy`` object to get started with analysis is simple! For example, for a SWIFT simulation with a SOAP-format halo catalogue (an example - 300 MB - will be automatically downloaded):
33+
.. _SWIFTSimIO: http://swiftsimio.readthedocs.org
34+
.. _Velociraptor: https://ui.adsabs.harvard.edu/abs/2019PASA...36...21E/abstract
35+
.. _Caesar: https://caesar.readthedocs.io/en/latest/
36+
.. _SOAP: https://github.com/SWIFTSIM/SOAP
37+
38+
.. INTRO_END_LABEL
39+
40+
Installation_ is as simple as ``pip install swiftgalaxy``. Dependencies for using SOAP, Caesar and Velociraptor catalogues can be installed with ``pip install swiftgalaxy[soap,caesar,velociraptor]``.
41+
42+
.. _Installation: https://swiftgalaxy.readthedocs.io/en/latest/getting_started/index.html#installing
43+
44+
.. EXAMPLE_START_LABEL
45+
46+
Once installed, creating a ``SWIFTGalaxy`` object to get started with analysis is simple! For example, for a SWIFT simulation with a SOAP-format halo catalogue (an example - 300 MB - will be automatically downloaded):
3447

3548
.. code-block:: python
3649
@@ -45,6 +58,9 @@ Installation is as simple as ``pip install swiftgalaxy``. Once installed, creati
4558
# access data for particles belonging to the galaxy:
4659
sg.gas.temperatures
4760
61+
# access integrated properties from the halo catalogue
62+
sg.halo_catalogue.spherical_overdensity_200_crit.soradius
63+
4864
# automatically generated spherical/cylindrical coordinates:
4965
sg.gas.spherical_coordinates.r
5066
@@ -74,13 +90,7 @@ Installation is as simple as ``pip install swiftgalaxy``. Once installed, creati
7490
7591
.. image:: eagle6_galaxy.png
7692

77-
.. _SWIFTSimIO: http://swiftsimio.readthedocs.org
78-
.. _Velociraptor: https://ui.adsabs.harvard.edu/abs/2019PASA...36...21E/abstract
79-
.. _Caesar: https://caesar.readthedocs.io/en/latest/
80-
.. _SOAP: https://github.com/SWIFTSIM/SOAP
81-
.. _PyPI: https://pypi.org
82-
83-
.. INTRO_END_LABEL
93+
.. EXAMPLE_END_LABEL
8494
8595
Examples
8696
--------
@@ -140,6 +150,8 @@ Please also consider the `citations requested for SWIFTSimIO <citeSWIFTSimIO>`_.
140150
Community
141151
---------
142152

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

145157
SWIFTGalaxy is licensed under `GPL-3.0`_ and community members are expected to abide by the `code of conduct`_.
@@ -148,3 +160,5 @@ SWIFTGalaxy is licensed under `GPL-3.0`_ and community members are expected to a
148160
.. _development environment: https://swiftgalaxy.readthedocs.io/en/latest/getting_started/index.html#installing
149161
.. _GPL-3.0: https://github.com/SWIFTSIM/swiftgalaxy/tree/main?tab=GPL-3.0-1-ov-file
150162
.. _code of conduct: https://github.com/SWIFTSIM/swiftgalaxy/tree/main?tab=coc-ov-file
163+
164+
.. COMMUNITY_END_LABEL

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
sphinx
22
sphinx-rtd-theme
3+
sphinx-design
34
recommonmark
45
numpy
56
numba

docs/source/citing/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Citing SWIFTGalaxy
2+
==================
3+
4+
.. include:: ../../../README.rst
5+
:start-after: CITING_START_LABEL
6+
:end-before: CITING_END_LABEL

docs/source/community/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Developer guide
2+
===============
3+
4+
.. include:: ../../../README.rst
5+
:start-after: COMMUNITY_START_LABEL
6+
:end-before: COMMUNITY_END_LABEL

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"sphinx.ext.mathjax",
4242
"sphinx.ext.autosummary",
4343
"sphinx.ext.intersphinx",
44+
"sphinx_design",
4445
]
4546

4647
# Add any paths that contain templates here, relative to this directory.
File renamed without changes.

docs/source/getting_started/index.rst

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -113,33 +113,18 @@ and `pre-push hook`_:
113113
.. _pre-commit hook: https://git-scm.com/book/ms/v2/Customizing-Git-Git-Hooks
114114
.. _pre-push hook: https://git-scm.com/book/ms/v2/Customizing-Git-Git-Hooks
115115

116+
.. _quick-start:
116117

117118
Quick start
118119
-----------
119120

120-
:mod:`swiftgalaxy` comes with some tools to procedurally generate very simple example data, and to download more realistic example data (~300 MB). Using the genrated example snapshot :file:`toysnap_virtual.hdf5` and SOAP catalogue :file:`toysoap.hdf5`, initializing a :class:`SWIFTGalaxy` for the galaxy in the first row (indexed from 0) in the SOAP catalogue is as easy as:
121+
.. include:: ../../../README.rst
122+
:start-after: EXAMPLE_START_LABEL
123+
:end-before: EXAMPLE_END_LABEL
121124

122-
.. code-block:: python
123-
124-
from swiftgalaxy import SWIFTGalaxy, SOAP
125-
from swiftgalaxy.demo_data import generated_examples
126-
127-
sg = SWIFTGalaxy(
128-
generated_examples.virtual_snapshot, # autofills the name of the snapshot "toysnap.hdf5"
129-
SOAP(
130-
generated_examples.soap, # autofills the name of the catalogue "toysoap.hdf5"
131-
soap_index=0
132-
)
133-
)
134-
135-
Like a :class:`~swiftsimio.reader.SWIFTDataset`, the particle datasets are accessed as below, and all data are loaded 'lazily', on demand.
136-
137-
.. code-block:: python
138-
139-
sg.gas.particle_ids
140-
sg.dark_matter.coordinates
125+
Like a :class:`~swiftsimio.reader.SWIFTDataset`, all data are loaded 'lazily' on demand.
141126

142-
However, information from the halo catalogue is used to select only the particles identified as bound to this galaxy. The coordinate system is centred in both position and velocity on the centre and peculiar velocity of the galaxy, as determined by the halo finder. The coordinate system can be further manipulated, and all particle arrays will stay in a consistent reference frame at all times.
127+
However, information from the halo catalogue is used to select only the particles identified as bound to this galaxy. The coordinate system is centred in both position and velocity on the centre and peculiar velocity of the galaxy, as determined by the halo catalogue. The coordinate system can be further manipulated, and all particle arrays will stay in a consistent reference frame at all times.
143128

144129
Again like for a :class:`~swiftsimio.reader.SWIFTDataset`, the units and metadata information are available:
145130

@@ -148,33 +133,6 @@ Again like for a :class:`~swiftsimio.reader.SWIFTDataset`, the units and metadat
148133
sg.units
149134
sg.metadata
150135
151-
The halo catalogue interface is accessible as shown below. What this interface looks like depends on the halo finder being used, but will provide values for the individual galaxy of interest.
152-
153-
.. code-block:: python
154-
155-
sg.halo_catalogue
156-
157-
In this case with :class:`~swiftgalaxy.halo_catalogues.SOAP`, we can get the centre of mass of the bound particles like this:
158-
159-
.. code-block:: python
160-
161-
sg.halo_catalogue.bound_subhalo.centre_of_mass
162-
163-
The procedurally generated example conforms to the data format of a real data set, but quantitatively speaking the contents are mostly nonsensical, and the halo catalogue has many fewer fields than a "real" one. A more interesting example data set, a :math:`(6\,\mathrm{Mpc})^3` EAGLE simulation at z=?? (about 300 MB to download) can be initialized with:
164-
165-
.. code-block:: python
166-
167-
from swiftgalaxy import SWIFTGalaxy, SOAP
168-
from swiftgalaxy.demo_data import web_examples
169-
170-
sg = SWIFTGalaxy(
171-
web_examples.virtual_snapshot, # autofills the name of the snapshot "EagleSingleVirtual.hdf5"
172-
SOAP(
173-
web_examples.soap, # autofills the name of the catalogue "SOAPEagleSingle.hdf5"
174-
soap_index=0
175-
)
176-
)
177-
178136
:mod:`swiftgalaxy` supports Python's tab completion features. This means that you can browse the available attributes of objects in an interactive interpreter by starting to type an attribute (or just a trailing dot) and pressing tab twice. A few examples to help start exploring:
179137

180138
- ``sg.<tab><tab>``

docs/source/index.rst

Lines changed: 73 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,81 @@
11
SWIFTGalaxy
22
===========
33

4-
In a hurry? :doc:`Quick-start <getting_started/index>`.
5-
64
.. include:: ../../README.rst
75
:start-after: INTRO_START_LABEL
86
:end-before: INTRO_END_LABEL
97

8+
.. grid:: 1 2 1 2
9+
:margin: 5 5 0 0
10+
:padding: 0 0 0 0
11+
:gutter: 4
12+
13+
.. grid-item-card:: :octicon:`info` Getting started
14+
:text-align: center
15+
:class-title: sd-fs-5
16+
:class-card: sd-p-3
17+
18+
.. button-ref:: getting_started/index
19+
:color: primary
20+
:outline:
21+
:expand:
22+
23+
installation
24+
25+
.. button-ref:: quick-start
26+
:color: primary
27+
:outline:
28+
:expand:
29+
30+
quick start guide
31+
32+
.. grid-item-card:: :octicon:`code-square` Contributing
33+
:text-align: center
34+
:class-title: sd-fs-5
35+
:class-card: sd-p-3
36+
37+
.. button-ref:: community/index
38+
:click-parent:
39+
:color: primary
40+
:outline:
41+
:expand:
42+
43+
information for developers
44+
45+
.. button-link:: https://github.com/SWIFTSIM/swiftgalaxy
46+
:click-parent:
47+
:color: primary
48+
:outline:
49+
:expand:
50+
51+
:octicon:`mark-github` source code :octicon:`link-external`
52+
53+
.. grid-item-card:: :octicon:`file-badge` Reference documentation
54+
:text-align: center
55+
:class-title: sd-fs-5
56+
:class-card: sd-p-3
57+
58+
.. button-ref:: modules/index
59+
:click-parent:
60+
:color: primary
61+
:outline:
62+
:expand:
63+
64+
lists of modules and functions
65+
66+
.. grid-item-card:: :octicon:`bookmark` Publishing?
67+
:text-align: center
68+
:class-title: sd-fs-5
69+
:class-card: sd-p-3
70+
71+
.. button-ref:: citing/index
72+
:click-parent:
73+
:color: primary
74+
:outline:
75+
:expand:
76+
77+
citation information
78+
1079
Documentation contents
1180
----------------------
1281

@@ -22,14 +91,10 @@ Documentation contents
2291
masking/index
2392
iterating/index
2493
visualisation/index
94+
community/index
95+
citing/index
2596
modules/index
2697

27-
Citing SWIFTGalaxy
28-
------------------
29-
30-
.. include:: ../../README.rst
31-
:start-after: CITING_START_LABEL
32-
:end-before: CITING_END_LABEL
3398

3499
Indices and tables
35100
------------------

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "swiftgalaxy"
7-
version="2.0.3"
7+
version="2.1.0"
88
authors = [
99
{ name="Kyle Oman", email="kyle.a.oman@durham.ac.uk" },
1010
]

0 commit comments

Comments
 (0)