swiftgalaxy.demo_data module

Functions and definitions to retrieve, generate and use illustrative example data.

class swiftgalaxy.demo_data.GeneratedExamples[source]

Bases: object

Helper class to generate example data on demand.

An instantiated helper is available using from swiftgalaxy.demo_data import generated_examples. The available examples are then:

generated_examples.snapshot
generated_examples.velociraptor
generated_examples.caesar
generated_examples.soap
generated_examples.virtual_snapshot

Examples

For usage examples see Example data.

remove() None[source]

Remove all generated example files.

Also removes the example data directory, if it is empty after the files have been removed.

class swiftgalaxy.demo_data.ToyHF(snapfile: str | Path = PosixPath('demo_data/toysnap.hdf5'), index: int | List[int] = 0, extra_mask: str | None = 'bound_only')[source]

Bases: _HaloCatalogue

Minimalist halo catalogue class for use with SWIFTGalaxy.

Parameters:
  • snapfile (str or Path, default: "demo_data/toysnap.hdf5") – The snapshot filename.

  • index (int or list, default: 0) – The index (position in the catalogue) of the target galaxy.

  • extra_mask (str or MaskCollection (optional), default: "bound_only") – The “extra” mask to apply to data when it is read (extra in the sense of in addition to the spatial mask applied by the SWIFTGalaxy).

property centre: cosmo_array

Get the coordinate centre of the target galaxy.

Returns:

The coordinate centre of the target galaxy.

Return type:

cosmo_array

property index: int | list[int] | None

Get the position in the catalogue of the target galaxy.

Returns:

The position in the catalogue of the target galaxy.

Return type:

int

property velocity_centre: cosmo_array

Get the velocity centre of the target galaxy.

Returns:

The velocity centre of the target galaxy.

Return type:

cosmo_array

class swiftgalaxy.demo_data.WebExamples[source]

Bases: object

Fetch example data from the web storage on demand.

An instantiated helper is available using from swiftgalaxy.demo_data import web_examples. The available examples are then:

web_examples.snapshot
web_examples.velociraptor
web_examples.caesar
web_examples.soap
web_examples.virtual_snapshot

Examples

For usage examples see Example data.

remove() None[source]

Remove all downloaded example files.

Also removes the example data directory, if it is empty after the files have been removed.