You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+22-8Lines changed: 22 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,20 @@ SWIFTGalaxy
30
30
31
31
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.
32
32
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):
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]``.
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):
34
47
35
48
.. code-block:: python
36
49
@@ -45,6 +58,9 @@ Installation is as simple as ``pip install swiftgalaxy``. Once installed, creati
45
58
# access data for particles belonging to the galaxy:
46
59
sg.gas.temperatures
47
60
61
+
# access integrated properties from the halo catalogue
: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
121
124
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.
141
126
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.
143
128
144
129
Again like for a :class:`~swiftsimio.reader.SWIFTDataset`, the units and metadata information are available:
145
130
@@ -148,33 +133,6 @@ Again like for a :class:`~swiftsimio.reader.SWIFTDataset`, the units and metadat
148
133
sg.units
149
134
sg.metadata
150
135
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
-
178
136
: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:
0 commit comments