Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: check-added-large-files # Prevent large files from being added to the repository.
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.11.0
rev: 25.12.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
Expand Down
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ Key features include:

## Installation

The Python package `rubix` can be downloades from git and can be installed:
The Python package `rubix` is published on GitHub and can be installed alongside its runtime dependencies (including JAX) by choosing the relevant extras. For a CPU-only environment, install with:

```
git clone https://github.com/AstroAI-Lab/rubix.git
cd rubix
pip install .
pip install .[cpu]
```

If you need GPU acceleration, replace `[cpu]` with `[cuda]` (or install `jax[cuda]` following the [JAX instructions](https://github.com/google/jax#installation) before installing Rubix). The plain `pip install .` command installs the minimal package without JAX and will raise `ImportError` if you try to import `rubix` before adding `jax` manually.

## Development installation

If you want to contribute to the development of `rubix`, we recommend
Expand All @@ -41,7 +43,7 @@ the following editable installation from this repository:
```
git clone https://github.com/AstroAI-Lab/rubix.git
cd rubix
python -m pip install --editable .[tests]
python -m pip install --editable .[cpu,tests,dev]
```

Having done so, the test suite can be run using `pytest`:
Expand All @@ -50,9 +52,21 @@ Having done so, the test suite can be run using `pytest`:
python -m pytest
```

This project depends on [jax](https://github.com/google/jax). It only installed for cpu computations with the testing dependencies. For installation instructions with gpu support,
please refer to [here](https://github.com/google/jax?tab=readme-ov-file#installation).
This project depends on [jax](https://github.com/google/jax). For the pytests we only test the `cpu` version.
For installation instructions with gpu support,
please refer to [here](https://github.com/google/jax?tab=readme-ov-file#installation) or simply use the `cuda` option when pip installing.

## Configuration overview

Rubix ships with two YAML files in `rubix/config/`: `rubix_config.yml` (constants, SSP templates, dust recipes, handler mappings, etc.) and `pipeline_config.yml` (pipeline graphs such as `calc_ifu` and `calc_dusty_ifu`). There is no configuration wizard — your runtime settings must supply a dictionary with the following blocks:

- `pipeline.name`: Identifies the pipeline from `pipeline_config.yml` (e.g., `calc_ifu`, `calc_dusty_ifu`, or `calc_gradient`).
- `galaxy`: Must provide `dist_z` and a `rotation` section (`type` or explicit `alpha`, `beta`, `gamma`).
- `telescope`: Requires `name`, `psf` (currently only the `gaussian` kernel with `size` and `sigma`), `lsf` (`sigma`), and `noise` (`signal_to_noise` plus `noise_distribution`, choose from `normal` or `uniform`).
- `ssp.dust`: Must declare `extinction_model` and `Rv` before calling the dusty pipeline (see `rubix/spectra/dust/extinction_models.py` for the supported models such as `Cardelli89`).
- `data.args.particle_type`: Should include `"stars"` (and `"gas"` if you want the gas branch) so the filters and rotation functions know which components exist.

The tutorials and notebooks assume square spaxels, so the default telescope factory currently only supports `pixel_type: square`. For a working example, inspect `notebooks/rubix_pipeline_single_function_shard_map.ipynb`, which runs the exact pipeline used in the tests.

## Documentation
Sphinx Documentation of all the functions is currently available under [this link](https://astro-rubix.web.app/).
Expand Down
23 changes: 18 additions & 5 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,37 @@ Installation
Clone the repository and navigate to the root directory of the repository. Then run

```
pip install .
pip install .[cpu]
```

If you want to contribute to the development of `RUBIX`, we recommend the following editable installation from this repository:

```
git clone https://github.com/AstroAI-Lab/rubix
cd rubix
pip install -e .
pip install -e .[cpu,tests,dev]
```
Having done so, the test suit can be run unsing `pytest`:

```
python -m pytest
```

Note that if `JAX` is not yet installed, only the CPU version of `JAX` will be installed
Note that if `JAX` is not yet installed, with the `cpu` option only the CPU version of `JAX` will be installed
as a dependency. For a GPU-compatible installation of `JAX`, please refer to the
[JAX installation guide](https://jax.readthedocs.io/en/latest/installation.html).
[JAX installation guide](https://jax.readthedocs.io/en/latest/installation.html) or use the option `cuda`.

Get started with this simple example notebooks/rubix_pipeline_single_function.ipynb.
Get started with this simple example notebooks/rubix_pipeline_single_function_shard_map.ipynb.

Configuration
=============

When you run the pipeline you provide a configuration dict that references the files in `rubix/config/`. The following sections are required for the default pipelines:

- `pipeline.name`: Choose one of `calc_ifu`, `calc_dusty_ifu`, or another entry from `pipeline_config.yml`.
- `galaxy`: Must include `dist_z` and a `rotation` block (`type` or explicit `alpha`, `beta`, `gamma`).
- `telescope`: Needs `name`, a `psf` block (Gaussian kernel with both `size` and `sigma`), an `lsf` block with `sigma`, and `noise` containing `signal_to_noise` plus a `noise_distribution` (`normal` or `uniform`).
- `ssp.dust`: Declares `extinction_model` and `Rv` before the dusty pipeline can produce an extincted datacube.
- `data.args.particle_type`: Must include `"stars"` (add `"gas"` if you rely on the optional gas branch) so the filtering/rotation steps know which components to process.

The telescopes in `rubix/telescope` currently only support square pixels, so every config should set `pixel_type: square` in the relevant telescope definition.
8 changes: 4 additions & 4 deletions notebooks/cosmology.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
"from rubix.cosmology.utils import trapz\n",
"import jax.numpy as jnp\n",
"\n",
"x = jnp.array([0, 1, 2, 3])\n",
"y = jnp.array([0, 1, 4, 9])\n",
"x = jnp.array([0.0, 1.0, 2.0, 3.0])\n",
"y = jnp.array([0.0, 1.0, 4.0, 9.0])\n",
"print(trapz(x, y))"
]
},
Expand All @@ -102,7 +102,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "rubix",
"display_name": "publishrubix",
"language": "python",
"name": "python3"
},
Expand All @@ -116,7 +116,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.12.12"
}
},
"nbformat": 4,
Expand Down
Loading